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.
-
Field Summary
Fields inherited from class ORG.oclc.oai.server.catalog.RecordFactory
debug
-
Constructor Summary
ConstructorsConstructorDescriptionMetacatRecordFactory
(Properties properties) Construct a MetacatRecordFactory capable of producing the Crosswalk(s) specified in the properties file. -
Method Summary
Modifier and TypeMethodDescriptionString[]
createHeader
(Object nativeItem) Convert a native "item" to a "record" String.fromOAIIdentifier
(String oaiIdentifier) Utility method to parse the 'local identifier' from the OAI identifierGet the about elements from the itemgetDatestamp
(Object nativeItem) get the datestamp from the itemgetLocalIdentifier
(Object nativeItem) Extract the local identifier from the native itemgetOAIIdentifier
(Object nativeItem) Construct an OAI identifier from the native itemgetOAIIdentifierOld
(Object nativeItem) Construct an OAI identifier from the native itemgetSetSpecs
(Object nativeItem) get the setspec from the itemboolean
Is the record deleted?quickCreate
(Object nativeItem, String schemaLocation, 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
-
Constructor Details
-
MetacatRecordFactory
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
Utility method to parse the 'local identifier' from the OAI identifier- Specified by:
fromOAIIdentifier
in classORG.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
Construct an OAI identifier from the native item- Specified by:
getOAIIdentifier
in classORG.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
Construct an OAI identifier from the native item- Parameters:
nativeItem
- native Item object- Returns:
- OAI identifier
-
getLocalIdentifier
Extract the local identifier from the native item- Overrides:
getLocalIdentifier
in classORG.oclc.oai.server.catalog.RecordFactory
- Parameters:
nativeItem
- native Item object- Returns:
- local identifier
-
getDatestamp
get the datestamp from the item- Specified by:
getDatestamp
in classORG.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
get the setspec from the item- Specified by:
getSetSpecs
in classORG.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
Get the about elements from the item- Specified by:
getAbouts
in classORG.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
Is the record deleted?- Specified by:
isDeleted
in classORG.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
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 classORG.oclc.oai.server.catalog.RecordFactory
- Parameters:
nativeItem
- the native recordschemaURL
- the schemaURL desired for the responsethe
- metadataPrefix from the request- Returns:
- a String containing the OAI <record> or null if the default method should be used.
-
createHeader
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 classORG.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.
-