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

java.lang.Object
  extended by ORG.oclc.oai.server.catalog.AbstractCatalog
      extended by 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
protected  java.lang.String homeDir
           
 
Constructor Summary
MetacatCatalog(java.util.Properties properties)
           
 
Method Summary
 void close()
          close the repository
 java.sql.Connection getConnection()
          Returns a connection to the database.
 java.lang.String getMaxDateUpdated()
          Get the most recent date that the xml_documents table was updated
 java.lang.String getRecord(java.lang.String oaiIdentifier, java.lang.String metadataPrefix)
          Retrieve the specified metadata for the specified oaiIdentifier
 java.util.Vector getSchemaLocations(java.lang.String oaiIdentifier)
          Retrieve a list of schemaLocation values associated with the specified oaiIdentifier.
protected  boolean isMetadataFile(java.io.File child)
          Override this method if some files exist in the filesystem that aren't metadata records.
 java.util.Map listIdentifiers(java.lang.String resumptionToken)
          Retrieve the next set of Identifiers associated with the resumptionToken
 java.util.Map listIdentifiers(java.lang.String from, java.lang.String until, java.lang.String set, java.lang.String metadataPrefix)
          Retrieve a list of Identifiers that satisfy the criteria parameters
 java.util.Map listRecords(java.lang.String resumptionToken)
          Retrieve the next set of records associated with the resumptionToken
 java.util.Map listRecords(java.lang.String from, java.lang.String until, java.lang.String set, java.lang.String metadataPrefix)
          Retrieve a list of records that satisfy the specified criteria
 java.util.Map listSets()
           
 java.util.Map listSets(java.lang.String resumptionToken)
           
 void loadCatalog()
          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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

homeDir

protected java.lang.String homeDir
Constructor Detail

MetacatCatalog

public MetacatCatalog(java.util.Properties properties)
Method Detail

close

public void close()
close the repository

Specified by:
close in class ORG.oclc.oai.server.catalog.AbstractCatalog

getConnection

public java.sql.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 java.lang.String getMaxDateUpdated()
Get the most recent date that the xml_documents table was updated

Returns:

getRecord

public java.lang.String getRecord(java.lang.String oaiIdentifier,
                                  java.lang.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 java.util.Vector getSchemaLocations(java.lang.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(java.io.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 java.util.Map listIdentifiers(java.lang.String from,
                                     java.lang.String until,
                                     java.lang.String set,
                                     java.lang.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 java.util.Map listIdentifiers(java.lang.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 java.util.Map listRecords(java.lang.String from,
                                 java.lang.String until,
                                 java.lang.String set,
                                 java.lang.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 java.util.Map listRecords(java.lang.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 java.util.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 java.util.Map listSets(java.lang.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.



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