Package org.dlese.dpc.oai.harvester
Class IndexingHarvestMsgHandler
java.lang.Object
org.dlese.dpc.oai.harvester.IndexingHarvestMsgHandler
- All Implemented Interfaces:
HarvestMessageHandler
A HarvestMessageHandler that writes harvest status messages to a SimpleLuceneIndex.
- Author:
- John Weatherley
-
Constructor Summary
ConstructorsConstructorDescriptionIndexingHarvestMsgHandler(SimpleLuceneIndex harvestLogIndex, String repositoryName, String baseURL, String set, String shUid, int numRecordsForNotification, File hd) Constructor for the HarvestMsgHandler object -
Method Summary
Modifier and TypeMethodDescriptionvoidcompletedHarvestMessage(int recordCount, int resumptionCount, String baseURL, String set, long startTime, long endTime, String zipFilePathName, String supportedGranularity, String deletedRecordSupport) A final report detailing the result of a successful harvest, which only occurs if no errors have occured.voiderrorMessage(String msg) A serios error that occured during the harvest, preventing it from completing.protected static final StringReturn a string for the current time and date, sutiable for display in log files and output to standout:intGets the number of records the Harveser should harvest between sending statusMessage notifications to this HarvestMessageHandler.voidoaiErrorMessage(String oaiError, String errorMessage, String supportedGranularity, String deletedRecordSupport) A message generated by the harvester when a standard OAI error has occured.static voidsetDebug(boolean db) Sets the debug attribute of the objectvoidsetHarvestAttributes(Date from, Date until) Sets the harvest attributes for this harvest.voidsetHarvester(Harvester harvester) Sets the harvester attribute of the IndexingHarvestMsgHandler objectvoidstatusMessage(int recordCount, int resumptionCount) A status message indicating the number of records currenlty harvested and the number of resumption tokens issued.voidstatusMessage(String msg) A status message indicating an event that took place during the harvest, such as a request made to the data provider.
-
Constructor Details
-
IndexingHarvestMsgHandler
public IndexingHarvestMsgHandler(SimpleLuceneIndex harvestLogIndex, String repositoryName, String baseURL, String set, String shUid, int numRecordsForNotification, File hd) Constructor for the HarvestMsgHandler object- Parameters:
harvestLogIndex- The index.repositoryName- The name of the repository, for indexing.baseURL- Base URL to the harvested provider.set- Set being harvested.shUid- UID of the scheduled Harvest.numRecordsForNotification- Number of records the harvester should recieve between logging progress entries.hd- Description of the Parameter
-
-
Method Details
-
setHarvester
Sets the harvester attribute of the IndexingHarvestMsgHandler object- Parameters:
harvester- The new harvester value
-
setHarvestAttributes
Sets the harvest attributes for this harvest.- Specified by:
setHarvestAttributesin interfaceHarvestMessageHandler- Parameters:
from- The from date or null if none useduntil- The until date or null if none used
-
statusMessage
A status message indicating an event that took place during the harvest, such as a request made to the data provider.- Specified by:
statusMessagein interfaceHarvestMessageHandler- Parameters:
msg- A harvest status message generated by the harvester.
-
statusMessage
public void statusMessage(int recordCount, int resumptionCount) A status message indicating the number of records currenlty harvested and the number of resumption tokens issued.- Specified by:
statusMessagein interfaceHarvestMessageHandler- Parameters:
recordCount- Number of recrods currently harvested.resumptionCount- Number of resumption tokens currently issued.- See Also:
-
oaiErrorMessage
public void oaiErrorMessage(String oaiError, String errorMessage, String supportedGranularity, String deletedRecordSupport) A message generated by the harvester when a standard OAI error has occured.- Specified by:
oaiErrorMessagein interfaceHarvestMessageHandler- Parameters:
oaiError- The OAI error code, for example "noRecordsMatch".errorMessage- The accompanying message returned by the data provider, if any.supportedGranularity- Supported granularity [days, seconds] or nulldeletedRecordSupport- Deleted record support [no, transient, persistent] or null
-
errorMessage
A serios error that occured during the harvest, preventing it from completing. For example an http 500 error.- Specified by:
errorMessagein interfaceHarvestMessageHandler- Parameters:
msg- Description of the error.
-
completedHarvestMessage
public void completedHarvestMessage(int recordCount, int resumptionCount, String baseURL, String set, long startTime, long endTime, String zipFilePathName, String supportedGranularity, String deletedRecordSupport) A final report detailing the result of a successful harvest, which only occurs if no errors have occured.- Specified by:
completedHarvestMessagein interfaceHarvestMessageHandler- Parameters:
recordCount- The total number of records harvested.resumptionCount- Number of resumption tokens issued.baseURL- The baseURL that was harvested.set- The set that was harvested, or an empty string if none.startTime- The time the harvest began.endTime- The time the harvest was completed.zipFilePathName- The full path to the harvest zip file, or null if none.supportedGranularity- Supported granularity [days, seconds]deletedRecordSupport- Deleted record support [no, transient, persistent]
-
getNumRecordsForStatusNotification
public int getNumRecordsForStatusNotification()Gets the number of records the Harveser should harvest between sending statusMessage notifications to this HarvestMessageHandler.- Specified by:
getNumRecordsForStatusNotificationin interfaceHarvestMessageHandler- Returns:
- The numRecordsForStatusNotification value.
- See Also:
-
getDateStamp
Return a string for the current time and date, sutiable for display in log files and output to standout:- Returns:
- The dateStamp value
-
setDebug
public static void setDebug(boolean db) Sets the debug attribute of the object- Parameters:
db- The new debug value
-