edu.ucsb.nceas.metacat.oaipmh.provider.server.catalog
Class MetacatRecordFactory

java.lang.Object
  extended by ORG.oclc.oai.server.catalog.RecordFactory
      extended by 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.


Field Summary
 
Fields inherited from class ORG.oclc.oai.server.catalog.RecordFactory
debug
 
Constructor Summary
MetacatRecordFactory(java.util.Properties properties)
          Construct a MetacatRecordFactory capable of producing the Crosswalk(s) specified in the properties file.
 
Method Summary
 java.lang.String[] createHeader(java.lang.Object nativeItem)
          Convert a native "item" to a "record" String.
 java.lang.String fromOAIIdentifier(java.lang.String oaiIdentifier)
          Utility method to parse the 'local identifier' from the OAI identifier
 java.util.Iterator getAbouts(java.lang.Object nativeItem)
          Get the about elements from the item
 java.lang.String getDatestamp(java.lang.Object nativeItem)
          get the datestamp from the item
 java.lang.String getLocalIdentifier(java.lang.Object nativeItem)
          Extract the local identifier from the native item
 java.lang.String getOAIIdentifier(java.lang.Object nativeItem)
          Construct an OAI identifier from the native item
 java.lang.String getOAIIdentifierOld(java.lang.Object nativeItem)
          Construct an OAI identifier from the native item
 java.util.Iterator getSetSpecs(java.lang.Object nativeItem)
          get the setspec from the item
 boolean isDeleted(java.lang.Object nativeItem)
          Is the record deleted?
 java.lang.String quickCreate(java.lang.Object nativeItem, java.lang.String schemaLocation, java.lang.String metadataPrefix)
          Allows classes that implement RecordFactory to override the default create() method.
 
Methods inherited from class ORG.oclc.oai.server.catalog.RecordFactory
create, create, create, create, createHeader, createHeader, createMetadata, createMetadata, createMetadata, getCrosswalks, getSchemaLocations, quickCreateMetadata
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetacatRecordFactory

public MetacatRecordFactory(java.util.Properties properties)
                     throws java.lang.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:
java.lang.IllegalArgumentException - Something is wrong with the argument.
Method Detail

fromOAIIdentifier

public java.lang.String fromOAIIdentifier(java.lang.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 java.lang.String getOAIIdentifier(java.lang.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 java.lang.String getOAIIdentifierOld(java.lang.Object nativeItem)
Construct an OAI identifier from the native item

Parameters:
nativeItem - native Item object
Returns:
OAI identifier

getLocalIdentifier

public java.lang.String getLocalIdentifier(java.lang.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 java.lang.String getDatestamp(java.lang.Object nativeItem)
                              throws java.lang.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:
java.lang.IllegalArgumentException - Something is wrong with the argument.

getSetSpecs

public java.util.Iterator getSetSpecs(java.lang.Object nativeItem)
                               throws java.lang.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:
java.lang.IllegalArgumentException - Something is wrong with the argument.

getAbouts

public java.util.Iterator getAbouts(java.lang.Object nativeItem)
                             throws java.lang.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:
java.lang.IllegalArgumentException - Something is wrong with the argument.

isDeleted

public boolean isDeleted(java.lang.Object nativeItem)
                  throws java.lang.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:
java.lang.IllegalArgumentException - Something is wrong with the argument.

quickCreate

public java.lang.String quickCreate(java.lang.Object nativeItem,
                                    java.lang.String schemaLocation,
                                    java.lang.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 java.lang.String[] createHeader(java.lang.Object nativeItem)
                                throws java.lang.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:
java.lang.IllegalArgumentException - One of the header components for this record is bad.


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.