Class OAIStaticRepositoryHarvester
- java.lang.Object
-
- de.pangaea.metadataportal.harvester.Harvester
-
- de.pangaea.metadataportal.harvester.OAIHarvesterBase
-
- de.pangaea.metadataportal.harvester.OAIStaticRepositoryHarvester
-
public class OAIStaticRepositoryHarvester extends OAIHarvesterBase
Harvester for OAI static repositories.This harvester supports the following additional harvester properties (please look into
OAIHarvesterBase
for further OAI-specific properties):url
: URL of static repository
- Author:
- Uwe Schindler
-
-
Field Summary
-
Fields inherited from class de.pangaea.metadataportal.harvester.OAIHarvesterBase
authorizationHeader, DEFAULT_RETRY_COUNT, DEFAULT_RETRY_TIME, DEFAULT_TIMEOUT, deleteMissingDocuments, filterIncomingSets, httpClient, identifierPrefix, ignoreDatestamps, metadataPrefix, OAI_NS, OAI_STATICREPOSITORY_NS, retryCount, retryTime, sets, timeout, USER_AGENT
-
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 OAIStaticRepositoryHarvester(HarvesterConfig iconfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDocument(MetadataDocument mdoc)
Adds a document to theHarvester.processor
working in the background.void
close(boolean cleanShutdown)
Closes harvester.protected void
enumerateValidHarvesterPropertyNames(Set<String> props)
This method is used by subclasses to enumerate all available harvester properties that are implemented by them.void
harvest()
This method is called by the harvester afterHarvester.open(de.pangaea.metadataportal.processor.ElasticsearchConnection, java.lang.String)
'ing it.void
open(ElasticsearchConnection es, String targetIndex)
Opens harvester for harvesting documents described by the givenHarvesterConfig
.protected void
recreateDigester()
Recreates all digesters that are used by parsing the OAI XML.-
Methods inherited from class de.pangaea.metadataportal.harvester.OAIHarvesterBase
cancelMissingDocumentDelete, createMetadataDocumentInstance, doParse, enableMissingDocumentDelete, getEntityResolver, getInputSource, getMetadataDocumentFactory, reset
-
Methods inherited from class de.pangaea.metadataportal.harvester.Harvester
deleteDocument, finishReindex, getValidHarvesterPropertyNames, isAllIndexes, isClosed, isDocumentOutdated, main, prepareReindex, runHarvester, runHarvester, setHarvestingDateReference, setValidIdentifiers
-
-
-
-
Constructor Detail
-
OAIStaticRepositoryHarvester
public OAIStaticRepositoryHarvester(HarvesterConfig iconfig)
-
-
Method Detail
-
open
public void open(ElasticsearchConnection es, String targetIndex) throws Exception
Description copied from class:Harvester
Opens harvester for harvesting documents described by the givenHarvesterConfig
. OpensHarvester.processor
for usage inHarvester.harvest()
method.- Overrides:
open
in classOAIHarvesterBase
- Throws:
Exception
- if an exception occurs during opening (various types of exceptions can be thrown).
-
recreateDigester
protected void recreateDigester()
Description copied from class:OAIHarvesterBase
Recreates all digesters that are used by parsing the OAI XML. This method is called initiall once and later on network errors before parsing same document again. This allows to recover from document parsing failing somewhere in the middle of a document.- Specified by:
recreateDigester
in classOAIHarvesterBase
-
addDocument
public void addDocument(MetadataDocument mdoc) throws Exception
Description copied from class:Harvester
Adds a document to theHarvester.processor
working in the background.- Overrides:
addDocument
in classOAIHarvesterBase
- Throws:
BackgroundFailure
- if an error occurred in background thread. Exceptions can be thrown asynchronous and may not affect the currect document. The real exception is thrown again inHarvester.close(boolean)
.Exception
-
close
public void close(boolean cleanShutdown) throws Exception
Description copied from class:Harvester
Closes harvester. All resources are freed and theHarvester.processor
is closed.- Overrides:
close
in classOAIHarvesterBase
- 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.
-
harvest
public void harvest() throws Exception
Description copied from class:Harvester
This 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, generateMetadataDocument
s and add them withHarvester.addDocument(de.pangaea.metadataportal.processor.MetadataDocument)
.
-
enumerateValidHarvesterPropertyNames
protected void enumerateValidHarvesterPropertyNames(Set<String> props)
Description copied from class:Harvester
This 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:
enumerateValidHarvesterPropertyNames
in classOAIHarvesterBase
- See Also:
Harvester.getValidHarvesterPropertyNames()
-
-