DLESE Tools
v1.6.0

org.dlese.dpc.oai.harvester
Class SimpleHarvestMessageHandler

java.lang.Object
  extended by org.dlese.dpc.oai.harvester.SimpleHarvestMessageHandler
All Implemented Interfaces:
Serializable, HarvestMessageHandler

public class SimpleHarvestMessageHandler
extends Object
implements HarvestMessageHandler, Serializable

Outputs harvest status messages to standard output.

Author:
John Weatherley
See Also:
Harvester, Serialized Form

Constructor Summary
SimpleHarvestMessageHandler()
           
 
Method Summary
 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.
 void errorMessage(String errorMessage)
          A serios error that occured during the harvest, preventing it from completing.
 int getNumRecordsForStatusNotification()
          Gets the number of records the Harveser should harvest between sending statusMessage notifications to this HarvestMessageHandler.
 void oaiErrorMessage(String oaiError, String errorMessage, String supportedGranularity, String deletedRecordSupport)
          A message generated by the harvester when an OAI protocol error has occured.
 void setHarvestAttributes(Date from, Date until)
          Sets the harvest attributes for this harvest.
 void statusMessage(int recordCount, int resumptionCount)
          A status message indicating the number of records currenlty harvested and the number of resumption tokens issued.
 void statusMessage(String msg)
          A status message indicating an event that took place during the harvest, such as a request made to the data provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleHarvestMessageHandler

public SimpleHarvestMessageHandler()
Method Detail

statusMessage

public void statusMessage(String msg)
A status message indicating an event that took place during the harvest, such as a request made to the data provider.

Specified by:
statusMessage in interface HarvestMessageHandler
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:
statusMessage in interface HarvestMessageHandler
Parameters:
recordCount - Number of recrods currently harvested.
resumptionCount - Number of resumption tokens currently issued.
See Also:
getNumRecordsForStatusNotification()

getNumRecordsForStatusNotification

public int getNumRecordsForStatusNotification()
Gets the number of records the Harveser should harvest between sending statusMessage notifications to this HarvestMessageHandler.

Specified by:
getNumRecordsForStatusNotification in interface HarvestMessageHandler
Returns:
The numRecordsForStatusNotification value.
See Also:
statusMessage(String msg)

oaiErrorMessage

public void oaiErrorMessage(String oaiError,
                            String errorMessage,
                            String supportedGranularity,
                            String deletedRecordSupport)
A message generated by the harvester when an OAI protocol error has occured.

Specified by:
oaiErrorMessage in interface HarvestMessageHandler
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 null
deletedRecordSupport - Deleted record support [no, transient, persistent] or null

errorMessage

public void errorMessage(String errorMessage)
A serios error that occured during the harvest, preventing it from completing. For example an http 500 error or a parsing error.

Specified by:
errorMessage in interface HarvestMessageHandler
Parameters:
errorMessage - Description of the error.

setHarvestAttributes

public void setHarvestAttributes(Date from,
                                 Date until)
Sets the harvest attributes for this harvest.

Specified by:
setHarvestAttributes in interface HarvestMessageHandler
Parameters:
from - The from date or null if none used
until - The until date or null if none used

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. This method is only called if the harvest completes successfully with no errors.

Specified by:
completedHarvestMessage in interface HarvestMessageHandler
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]

DLESE Tools
v1.6.0