Class MetacatRecordFactory

java.lang.Object
ORG.oclc.oai.server.catalog.RecordFactory
edu.ucsb.nceas.metacat.oaipmh.provider.server.catalog.MetacatRecordFactory

public class MetacatRecordFactory extends ORG.oclc.oai.server.catalog.RecordFactory
MetacatRecordFactory converts native Metacat documents to OAI-PMH records.
  • Constructor Details

    • MetacatRecordFactory

      public MetacatRecordFactory(Properties properties) throws IllegalArgumentException
      Construct a MetacatRecordFactory capable of producing the Crosswalk(s) specified in the properties file.
      Parameters:
      properties - Contains information to configure the factory: specifically, the names of the crosswalk(s) supported
      Throws:
      IllegalArgumentException - Something is wrong with the argument.
  • Method Details

    • fromOAIIdentifier

      public String fromOAIIdentifier(String oaiIdentifier)
      Utility method to parse the 'local identifier' from the OAI identifier
      Specified by:
      fromOAIIdentifier in class ORG.oclc.oai.server.catalog.RecordFactory
      Parameters:
      oaiIdentifier - OAI identifier e.g. "urn:lsid:knb.ecoinformatics.org:knb-lter-gce:169"
      Returns:
      local identifier, e.g. "knb-lter-gce.169"
    • getOAIIdentifier

      public String getOAIIdentifier(Object nativeItem)
      Construct an OAI identifier from the native item
      Specified by:
      getOAIIdentifier in class ORG.oclc.oai.server.catalog.RecordFactory
      Parameters:
      nativeItem - native Item object
      Returns:
      OAI identifier, e.g. urn:lsid:knb.ecoinformatics.org:knb-lter-gce:169
    • getOAIIdentifierOld

      public String getOAIIdentifierOld(Object nativeItem)
      Construct an OAI identifier from the native item
      Parameters:
      nativeItem - native Item object
      Returns:
      OAI identifier
    • getLocalIdentifier

      public String getLocalIdentifier(Object nativeItem)
      Extract the local identifier from the native item
      Overrides:
      getLocalIdentifier in class ORG.oclc.oai.server.catalog.RecordFactory
      Parameters:
      nativeItem - native Item object
      Returns:
      local identifier
    • getDatestamp

      public String getDatestamp(Object nativeItem) throws IllegalArgumentException
      get the datestamp from the item
      Specified by:
      getDatestamp in class ORG.oclc.oai.server.catalog.RecordFactory
      Parameters:
      nativeItem - a native item presumably containing a datestamp somewhere
      Returns:
      a String containing the datestamp for the item
      Throws:
      IllegalArgumentException - Something is wrong with the argument.
    • getSetSpecs

      public Iterator getSetSpecs(Object nativeItem) throws IllegalArgumentException
      get the setspec from the item
      Specified by:
      getSetSpecs in class ORG.oclc.oai.server.catalog.RecordFactory
      Parameters:
      nativeItem - a native item presumably containing a setspec somewhere
      Returns:
      a String containing the setspec for the item
      Throws:
      IllegalArgumentException - Something is wrong with the argument.
    • getAbouts

      public Iterator getAbouts(Object nativeItem) throws IllegalArgumentException
      Get the about elements from the item
      Specified by:
      getAbouts in class ORG.oclc.oai.server.catalog.RecordFactory
      Parameters:
      nativeItem - a native item presumably containing about information somewhere
      Returns:
      a Iterator of Strings containing <about>s for the item
      Throws:
      IllegalArgumentException - Something is wrong with the argument.
    • isDeleted

      public boolean isDeleted(Object nativeItem) throws IllegalArgumentException
      Is the record deleted?
      Specified by:
      isDeleted in class ORG.oclc.oai.server.catalog.RecordFactory
      Parameters:
      nativeItem - a native item presumably containing a possible delete indicator
      Returns:
      true if record is deleted, false if not
      Throws:
      IllegalArgumentException - Something is wrong with the argument.
    • quickCreate

      public String quickCreate(Object nativeItem, String schemaLocation, String metadataPrefix)
      Allows classes that implement RecordFactory to override the default create() method. This is useful, for example, if the entire <record> is already packaged as the native record. Return null if you want the default handler to create it by calling the methods above individually.
      Specified by:
      quickCreate in class ORG.oclc.oai.server.catalog.RecordFactory
      Parameters:
      nativeItem - the native record
      schemaURL - the schemaURL desired for the response
      the - metadataPrefix from the request
      Returns:
      a String containing the OAI <record> or null if the default method should be used.
    • createHeader

      public String[] createHeader(Object nativeItem) throws IllegalArgumentException
      Convert a native "item" to a "record" String. Use this version of createHeader if the setSpecs are derived from the nativeItem itself.
      Overrides:
      createHeader in class ORG.oclc.oai.server.catalog.RecordFactory
      Parameters:
      nativeItem - the native record.
      Returns:
      String[0] = "header" XML string String[1] = oai-identifier.
      Throws:
      IllegalArgumentException - One of the header components for this record is bad.