Class MetacatCatalog
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
close the repositoryReturns a connection to the database.Get the most recent date that the xml_documents table was updatedRetrieve the specified metadata for the specified oaiIdentifiergetSchemaLocations
(String oaiIdentifier) Retrieve a list of schemaLocation values associated with the specified oaiIdentifier.protected boolean
isMetadataFile
(File child) Override this method if some files exist in the filesystem that aren't metadata records.listIdentifiers
(String resumptionToken) Retrieve the next set of Identifiers associated with the resumptionTokenlistIdentifiers
(String from, String until, String set, String metadataPrefix) Retrieve a list of Identifiers that satisfy the criteria parameterslistRecords
(String resumptionToken) Retrieve the next set of records associated with the resumptionTokenlistRecords
(String from, String until, String set, String metadataPrefix) Retrieve a list of records that satisfy the specified criterialistSets()
void
Run a query of the Metacat database to load the catalog of EML documents.Methods inherited from class ORG.oclc.oai.server.catalog.AbstractCatalog
factory, getCrosswalks, getDescriptions, getMetadata, getMillisecondsToLive, getRecordFactory, getResumptionMap, getResumptionMap, isHarvestable, setHarvestable, setRecordFactory, setSupportedGranularityOffset, toFinestFrom, toFinestUntil
-
Field Details
-
homeDir
-
-
Constructor Details
-
MetacatCatalog
-
-
Method Details
-
close
public void close()close the repository- Specified by:
close
in classORG.oclc.oai.server.catalog.AbstractCatalog
-
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
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 classORG.oclc.oai.server.catalog.AbstractCatalog
- Parameters:
oaiIdentifier
- the OAI identifiermetadataPrefix
- the OAI metadataPrefix- Returns:
- the Record object containing the result.
- Throws:
ORG.oclc.oai.server.verb.CannotDisseminateFormatException
- signals an http status code 400 problemORG.oclc.oai.server.verb.IdDoesNotExistException
- signals an http status code 404 problemORG.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 classORG.oclc.oai.server.catalog.AbstractCatalog
- Parameters:
oaiIdentifier
- the OAI identifier- Returns:
- a Vector containing schemaLocation Strings
- Throws:
OAIBadRequestException
- signals an http status code 400 problemOAINotFoundException
- signals an http status code 404 problemORG.oclc.oai.server.verb.OAIInternalServerError
- signals an http status code 500 problemORG.oclc.oai.server.verb.IdDoesNotExistException
ORG.oclc.oai.server.verb.NoMetadataFormatsException
-
isMetadataFile
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 classORG.oclc.oai.server.catalog.AbstractCatalog
- Parameters:
from
- beginning date in the form of YYYY-MM-DD or null if earliest date is desireduntil
- ending date in the form of YYYY-MM-DD or null if latest date is desiredset
- set name or null if no set is desiredmetadataPrefix
- 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 problemORG.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 classORG.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 problemORG.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 classORG.oclc.oai.server.catalog.AbstractCatalog
- Parameters:
from
- beginning date in the form of YYYY-MM-DD or null if earliest date is desireduntil
- ending date in the form of YYYY-MM-DD or null if latest date is desiredset
- set name or null if no set is desiredmetadataPrefix
- 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 problemORG.oclc.oai.server.verb.OAIInternalServerError
- signals an http status code 500 problemORG.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 classORG.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 problemORG.oclc.oai.server.verb.BadResumptionTokenException
-
listSets
- Specified by:
listSets
in classORG.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 classORG.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.
-