Class IndexRebuildService
java.lang.Object
org.opencastproject.elasticsearch.index.rebuild.IndexRebuildService
- All Implemented Interfaces:
org.osgi.framework.BundleActivator
The bundle activator is defined in the pom.xml of this bundle.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumThe services whose data is indexed by ElasticSearch.static enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the service by its enum identifier.voidrebuildIndex(ElasticsearchIndex index) Clear and rebuild the index from all services.voidrebuildIndex(IndexProducer indexProducer, IndexRebuildService.DataType dataType) Partially rebuild the index from a specific service and maybe only a specific data type.voidresumeIndexRebuild(IndexRebuildService.Service startingService) Start Index Rebuild from the specified service and then do all that follow.voidstart(org.osgi.framework.BundleContext bundleContext) Called by OSGI when this bundle is started.voidstop(org.osgi.framework.BundleContext bundleContext) Called by OSGI when this bundle is stopped.
-
Constructor Details
-
IndexRebuildService
public IndexRebuildService()
-
-
Method Details
-
start
Called by OSGI when this bundle is started.- Specified by:
startin interfaceorg.osgi.framework.BundleActivator- Parameters:
bundleContext- The bundle context.- Throws:
Exception
-
stop
Called by OSGI when this bundle is stopped.- Specified by:
stopin interfaceorg.osgi.framework.BundleActivator- Parameters:
bundleContext- The bundle context.- Throws:
Exception
-
getIndexProducer
public IndexProducer getIndexProducer(IndexRebuildService.Service service) throws IllegalStateException Get the service by its enum identifier.- Parameters:
service- The enum identifying the service.- Returns:
- the service
- Throws:
IllegalStateException- If the service is not registered.
-
rebuildIndex
public void rebuildIndex(ElasticsearchIndex index) throws IOException, IndexRebuildException, IllegalArgumentException Clear and rebuild the index from all services.- Parameters:
index- The index to rebuild.- Throws:
IOException- Thrown if the index cannot be cleared.IndexRebuildException- Thrown if the index rebuild failed.IllegalArgumentException
-
rebuildIndex
public void rebuildIndex(IndexProducer indexProducer, IndexRebuildService.DataType dataType) throws IllegalArgumentException, IndexRebuildException Partially rebuild the index from a specific service and maybe only a specific data type.- Parameters:
indexProducer- The service to re-index from.dataType- The data type to re-index.- Throws:
IllegalArgumentException- Thrown if the service doesn't support the data type.IndexRebuildException- Thrown if the index rebuild failed.
-
resumeIndexRebuild
public void resumeIndexRebuild(IndexRebuildService.Service startingService) throws IllegalArgumentException, IndexRebuildException Start Index Rebuild from the specified service and then do all that follow. Can be used to resume a complete index rebuild that was interrupted.- Parameters:
startingService- TheIndexRebuildService.Serviceto start with.- Throws:
IllegalArgumentException- Thrown if the service doesn't exist.IndexRebuildException- Thrown if the index rebuild failed.
-
getRebuildStates
- Returns:
- All rebuild service repopulation states.
-