java.lang.Object
ORG.oclc.oai.server.catalog.AbstractCatalog
edu.ucsb.nceas.metacat.oaipmh.provider.server.catalog.MetacatCatalog

public class MetacatCatalog extends ORG.oclc.oai.server.catalog.AbstractCatalog
MetacatCatalog is an implementation of AbstractCatalog interface.
Author:
Ralph LeVan, OCLC Online Computer Library Center
  • Field Details

    • homeDir

      protected String homeDir
  • Constructor Details

    • MetacatCatalog

      public MetacatCatalog(Properties properties)
  • Method Details

    • close

      public void close()
      close the repository
      Specified by:
      close in class ORG.oclc.oai.server.catalog.AbstractCatalog
    • getConnection

      public Connection getConnection()
      Returns a connection to the database. Opens the connection if a connection has not already been made previously.
      Returns:
      conn the database Connection object
    • getMaxDateUpdated

      public String getMaxDateUpdated()
      Get the most recent date that the xml_documents table was updated
      Returns:
    • getRecord

      public String getRecord(String oaiIdentifier, String metadataPrefix) throws ORG.oclc.oai.server.verb.IdDoesNotExistException, ORG.oclc.oai.server.verb.CannotDisseminateFormatException, ORG.oclc.oai.server.verb.OAIInternalServerError
      Retrieve the specified metadata for the specified oaiIdentifier
      Specified by:
      getRecord in class ORG.oclc.oai.server.catalog.AbstractCatalog
      Parameters:
      oaiIdentifier - the OAI identifier
      metadataPrefix - the OAI metadataPrefix
      Returns:
      the Record object containing the result.
      Throws:
      ORG.oclc.oai.server.verb.CannotDisseminateFormatException - signals an http status code 400 problem
      ORG.oclc.oai.server.verb.IdDoesNotExistException - signals an http status code 404 problem
      ORG.oclc.oai.server.verb.OAIInternalServerError - signals an http status code 500 problem
    • getSchemaLocations

      public Vector getSchemaLocations(String oaiIdentifier) throws ORG.oclc.oai.server.verb.IdDoesNotExistException, ORG.oclc.oai.server.verb.OAIInternalServerError, ORG.oclc.oai.server.verb.NoMetadataFormatsException
      Retrieve a list of schemaLocation values associated with the specified oaiIdentifier. We get passed the ID for a record and are supposed to return a list of the formats that we can deliver the record in. Since we are assuming that all the records in the directory have the same format, the response to this is static;
      Specified by:
      getSchemaLocations in class ORG.oclc.oai.server.catalog.AbstractCatalog
      Parameters:
      oaiIdentifier - the OAI identifier
      Returns:
      a Vector containing schemaLocation Strings
      Throws:
      OAIBadRequestException - signals an http status code 400 problem
      OAINotFoundException - signals an http status code 404 problem
      ORG.oclc.oai.server.verb.OAIInternalServerError - signals an http status code 500 problem
      ORG.oclc.oai.server.verb.IdDoesNotExistException
      ORG.oclc.oai.server.verb.NoMetadataFormatsException
    • isMetadataFile

      protected boolean isMetadataFile(File child)
      Override this method if some files exist in the filesystem that aren't metadata records.
      Parameters:
      child - the File to be investigated
      Returns:
      true if it contains metadata, false otherwise
    • listIdentifiers

      public Map listIdentifiers(String from, String until, String set, String metadataPrefix) throws ORG.oclc.oai.server.verb.NoItemsMatchException
      Retrieve a list of Identifiers that satisfy the criteria parameters
      Specified by:
      listIdentifiers in class ORG.oclc.oai.server.catalog.AbstractCatalog
      Parameters:
      from - beginning date in the form of YYYY-MM-DD or null if earliest date is desired
      until - ending date in the form of YYYY-MM-DD or null if latest date is desired
      set - set name or null if no set is desired
      metadataPrefix - e.g. "oai_dc", "eml-2.0.1", "eml-2.1.0"
      Returns:
      a Map object containing an optional "resumptionToken" key/value pair and an "identifiers" Map object. The "identifiers" Map contains OAI identifier keys with corresponding values of "true" or null depending on whether the identifier is deleted or not.
      Throws:
      OAIBadRequestException - signals an http status code 400 problem
      ORG.oclc.oai.server.verb.NoItemsMatchException
    • listIdentifiers

      public Map listIdentifiers(String resumptionToken) throws ORG.oclc.oai.server.verb.BadResumptionTokenException
      Retrieve the next set of Identifiers associated with the resumptionToken
      Specified by:
      listIdentifiers in class ORG.oclc.oai.server.catalog.AbstractCatalog
      Parameters:
      resumptionToken - implementation-dependent format taken from the previous listIdentifiers() Map result.
      Returns:
      a Map object containing an optional "resumptionToken" key/value pair and an "identifiers" Map object. The "identifiers" Map contains OAI identifier keys with corresponding values of "true" or null depending on whether the identifier is deleted or not.
      Throws:
      OAIBadRequestException - signals an http status code 400 problem
      ORG.oclc.oai.server.verb.BadResumptionTokenException
    • listRecords

      public Map listRecords(String from, String until, String set, String metadataPrefix) throws ORG.oclc.oai.server.verb.CannotDisseminateFormatException, ORG.oclc.oai.server.verb.OAIInternalServerError, ORG.oclc.oai.server.verb.NoItemsMatchException
      Retrieve a list of records that satisfy the specified criteria
      Overrides:
      listRecords in class ORG.oclc.oai.server.catalog.AbstractCatalog
      Parameters:
      from - beginning date in the form of YYYY-MM-DD or null if earliest date is desired
      until - ending date in the form of YYYY-MM-DD or null if latest date is desired
      set - set name or null if no set is desired
      metadataPrefix - e.g. "oai_dc", "eml-2.0.1", "eml-2.1.0"
      Returns:
      a Map object containing an optional "resumptionToken" key/value pair and a "records" Iterator object. The "records" Iterator contains a set of Records objects.
      Throws:
      OAIBadRequestException - signals an http status code 400 problem
      ORG.oclc.oai.server.verb.OAIInternalServerError - signals an http status code 500 problem
      ORG.oclc.oai.server.verb.CannotDisseminateFormatException
      ORG.oclc.oai.server.verb.NoItemsMatchException
    • listRecords

      public Map listRecords(String resumptionToken) throws ORG.oclc.oai.server.verb.BadResumptionTokenException
      Retrieve the next set of records associated with the resumptionToken
      Overrides:
      listRecords in class ORG.oclc.oai.server.catalog.AbstractCatalog
      Parameters:
      resumptionToken - implementation-dependent format taken from the previous listRecords() Map result.
      Returns:
      a Map object containing an optional "resumptionToken" key/value pair and a "records" Iterator object. The "records" Iterator contains a set of Records objects.
      Throws:
      OAIBadRequestException - signals an http status code 400 problem
      ORG.oclc.oai.server.verb.BadResumptionTokenException
    • listSets

      public Map listSets() throws ORG.oclc.oai.server.verb.NoSetHierarchyException
      Specified by:
      listSets in class ORG.oclc.oai.server.catalog.AbstractCatalog
      Throws:
      ORG.oclc.oai.server.verb.NoSetHierarchyException
    • listSets

      public Map listSets(String resumptionToken) throws ORG.oclc.oai.server.verb.BadResumptionTokenException
      Specified by:
      listSets in class ORG.oclc.oai.server.catalog.AbstractCatalog
      Throws:
      ORG.oclc.oai.server.verb.BadResumptionTokenException
    • loadCatalog

      public void loadCatalog()
      Run a query of the Metacat database to load the catalog of EML documents. For each EML document, we store its 'docid', 'doctype', and 'date_updated' values.