Class Rebuilder
- java.lang.Object
-
- de.pangaea.metadataportal.harvester.Harvester
-
- de.pangaea.metadataportal.harvester.Rebuilder
-
public final class Rebuilder extends Harvester
Index rebuilder implemented as harvester that reads all documents from an index and pushes them back into the index. Only the XML blobs and control fields are read, all other info is rebuild like in the normal harvester. This helps during restructuring the index fields. This can be done without re-harvesting from the original metadata providers. This class is called from command line or usingHarvester.runHarvester(de.pangaea.metadataportal.config.Config, java.lang.String)with this class as harvester class parameter.- Author:
- Uwe Schindler
-
-
Field Summary
-
Fields inherited from class de.pangaea.metadataportal.harvester.Harvester
fromDateReference, harvestCount, HARVESTER_METADATA_FIELD_LAST_HARVESTED, harvestMessageStep, iconfig, log, processor
-
-
Constructor Summary
Constructors Constructor Description Rebuilder(HarvesterConfig iconfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose(boolean cleanShutdown)Closes harvester.MetadataDocumentcreateMetadataDocumentInstance()Creates an instance of MetadataDocument and initializes it with the harvester config.protected voidenumerateValidHarvesterPropertyNames(Set<String> props)This method is used by subclasses to enumerate all available harvester properties that are implemented by them.voidfinishReindex(boolean cleanShutdown)Does cleanup work after rebuilding the index byRebuilder.voidharvest()This method is called by the harvester afterHarvester.open(de.pangaea.metadataportal.processor.ElasticsearchConnection, java.lang.String)'ing it.static voidmain(String[] args)voidopen(ElasticsearchConnection es, String targetIndex)Opens harvester for harvesting documents described by the givenHarvesterConfig.voidprepareReindex(ElasticsearchConnection es, String targetIndex)Prepares harvester for rebuilding the index byRebuilder.static booleanrunRebuilder(Config conf, String id)-
Methods inherited from class de.pangaea.metadataportal.harvester.Harvester
addDocument, deleteDocument, getValidHarvesterPropertyNames, isAllIndexes, isClosed, isDocumentOutdated, runHarvester, runHarvester, setHarvestingDateReference, setValidIdentifiers
-
-
-
-
Constructor Detail
-
Rebuilder
public Rebuilder(HarvesterConfig iconfig) throws Exception
- Throws:
Exception
-
-
Method Detail
-
main
public static void main(String[] args)
-
open
public void open(ElasticsearchConnection es, String targetIndex) throws Exception
Description copied from class:HarvesterOpens harvester for harvesting documents described by the givenHarvesterConfig. OpensHarvester.processorfor usage inHarvester.harvest()method.
-
close
public void close(boolean cleanShutdown) throws ExceptionDescription copied from class:HarvesterCloses harvester. All resources are freed and theHarvester.processoris closed.- Overrides:
closein classHarvester- Parameters:
cleanShutdown- enables writing of status information to the Elasticsearch instance for the next harvesting. If an error occurred during harvesting this should not be done.- Throws:
Exception- if an exception occurs during closing (various types of exceptions can be thrown). Exceptions can be thrown asynchronous and may not affect the correct document.
-
prepareReindex
public void prepareReindex(ElasticsearchConnection es, String targetIndex) throws Exception
Description copied from class:HarvesterPrepares harvester for rebuilding the index byRebuilder. By default this method does nothing, but can be overridden by subclasses that need to setup additional things.- Overrides:
prepareReindexin classHarvester- Throws:
Exception- if an exception occurs during opening (various types of exceptions can be thrown).
-
finishReindex
public void finishReindex(boolean cleanShutdown) throws ExceptionDescription copied from class:HarvesterDoes cleanup work after rebuilding the index byRebuilder. By default this method does nothing, but can be overridden by subclasses that need to shutdown additional things.- Overrides:
finishReindexin classHarvester- Throws:
Exception- if an exception occurs during closing (various types of exceptions can be thrown). Exceptions can be thrown asynchronous and may not affect the correct document.
-
createMetadataDocumentInstance
public MetadataDocument createMetadataDocumentInstance()
Description copied from class:HarvesterCreates an instance of MetadataDocument and initializes it with the harvester config. This method should be overwritten, if a harvester uses another class.- Overrides:
createMetadataDocumentInstancein classHarvester
-
enumerateValidHarvesterPropertyNames
protected void enumerateValidHarvesterPropertyNames(Set<String> props)
Description copied from class:HarvesterThis method is used by subclasses to enumerate all available harvester properties that are implemented by them. Overwrite this method in your own implementation and append all harvester names to the suppliedSet. The public API for client code requesting property names isHarvester.getValidHarvesterPropertyNames().- Overrides:
enumerateValidHarvesterPropertyNamesin classHarvester- See Also:
Harvester.getValidHarvesterPropertyNames()
-
harvest
public void harvest() throws ExceptionDescription copied from class:HarvesterThis method is called by the harvester afterHarvester.open(de.pangaea.metadataportal.processor.ElasticsearchConnection, java.lang.String)'ing it. Overwrite this method in your harvester class. This method should harvest files from somewhere, generateMetadataDocuments and add them withHarvester.addDocument(de.pangaea.metadataportal.processor.MetadataDocument).
-
-