Class OAIHarvester


  • public class OAIHarvester
    extends Object
    This class handles OAI harvesting of externally located records into this repository.
    Author:
    Alexey Maslov
    • Method Detail

      • getORENamespace

        public static org.jdom2.Namespace getORENamespace()
        Search the configuration options and find the ORE serialization string
        Returns:
        Namespace of the supported ORE format. Returns null if not found.
      • getDMDNamespace

        public static org.jdom2.Namespace getDMDNamespace​(String metadataKey)
        Cycle through the options and find the metadata namespace matching the provided key.
        Parameters:
        metadataKey -
        Returns:
        Namespace of the designated metadata format. Returns null of not found.
      • runHarvest

        public void runHarvest()
                        throws SQLException,
                               IOException,
                               AuthorizeException
        Performs a harvest cycle on this collection. This will query the remote OAI-PMH provider, check for updates since last harvest, and ingest the returned items.
        Throws:
        IOException - A general class of exceptions produced by failed or interrupted I/O operations.
        SQLException - An exception that provides information on a database access error or other errors.
        AuthorizeException - Exception indicating the current user of the context does not have permission to perform a particular action.
      • extractHandle

        protected String extractHandle​(Item item)
        Scan an item's metadata, looking for the value "identifier.*". If it meets the parameters that identify it as valid handle as set in dspace.cfg (harvester.acceptedHandleServer and harvester.rejectedHandlePrefix), use that handle instead of minting a new one.
        Parameters:
        item - a newly created, but not yet installed, DSpace Item
        Returns:
        null or the handle to be used.
      • alertAdmin

        protected void alertAdmin​(int status,
                                  Exception ex)
        Generate and send an email to the administrator. Prompted by errors encountered during harvesting.
        Parameters:
        status - the current status of the collection, usually HarvestedCollection.STATUS_OAI_ERROR or HarvestedCollection.STATUS_UNKNOWN_ERROR
        ex - the Exception that prompted this action
      • verifyOAIharvester

        public List<String> verifyOAIharvester()
        Verify OAI settings for the current collection
        Returns:
        list of errors encountered during verification. Empty list indicates a "success" condition.
      • getAvailableMetadataFormats

        public static List<Map<String,​String>> getAvailableMetadataFormats()
        Return all available metadata formats
        Returns:
        a list containing a map for each supported metadata format