Harvester Class Descriptions Revision 1.1 12/12/03 Class Description Harvester The main controller class. Reads the harvest registry from the database, creating a HarvestInformation object for each entry in the harvest registry. Manages a list of HarvestLog entries to keep a permanent record of harvest operations. Provides operations to read the harvest log from the database, add new harvest log entries, and write the harvest log to the database. HarvestInformation Represents information for a single harvest site in the harvest registry. For a given site, stores its ldapDN, its harvestConfigurationURL, the date of its last harvest, the date of its next harvest (if stored explicitly), and the harvest frequency. If the date of the next harvest has not been stored explicitly, it can be derived from the date of the last harvest and the harvest frequency. Provides operations to get and parse the site’s harvest configuration document. For each document listed in the harvest configuration document, creates a HarvestDocument object. Manages harvest scheduling for a site. Provides operations to interact with the HARVEST_INFORMATION database table. HarvestDocument Represents a single document to be harvested. Stores data about the document (documentURL, documentType, docid, etc.). Provides operations to get the document from the site and put (insert or update) the document to Metacat. Provides operations to interact with the HARVEST_DOCUMENT database table. HarvestLog Represents a single harvest log entry. For a given Harvest operation, records the date, type of operation, message string, status, and docid (if this operation pertains to a HarvestDocument). Provides operations to interact with the HARVEST_LOG database table. Sequence of Events for Pull Operation 1. Harvester starts up. (Add log entry to record startup operation.) 2. Harvester reads the Harvest registry from the database, creating a HarvestInformation object for every record in the HARVEST_INFORMATION table. 3. For each HarvestInformation object: 4. If this site is due to be harvested today: 5. Get the harvest configuration from the harvestConfigurationURL. 6. Parse the harvest configuration file, creating a HarvestDocument object for each document element in the file. (If file is not a valid harvest configuration file, log an exception, send email report, and exit.) 7. For each document element in the harvest configuration file: 8. Get the document from the site, using the document URL. 9. Parse the document to check that it is valid EML. (If not valid, log an exception and continue.) 10. Query Metacat as to whether it already has this document 11. If Metacat does not already have the document: 12. Insert or update the document to Metacat. 13. Log the result of inserting or updating the document to Metacat (including any exceptions). 14. Generate and send an email report to the site contact. The report will contain results of this harvest, and the (tentatively) scheduled date of the next harvest. 15. Generate and send an email report to the harvester administrator. The report is a composite of all the individual site reports. (Alternatively, this could be written to a log file instead of emailed. An email message could simply contain the location of the log file and a brief summary.) 16. Harvester shuts down. (Add log entry for shutdown.)