fr.gouv.culture.oai
Class AbstractOAIRepository

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by fr.gouv.culture.oai.OAIObjectImpl
                  extended by fr.gouv.culture.oai.AbstractOAIRepository
All Implemented Interfaces:
OAIObject, OAIRepository, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer, org.apache.excalibur.xml.sax.XMLConsumer, org.apache.excalibur.xml.sax.XMLizable, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler
Direct Known Subclasses:
AbstractDocumentBaseOAIRepository

public abstract class AbstractOAIRepository
extends OAIObjectImpl
implements OAIRepository

This class represents an OAI repository.


Nested Class Summary
 
Nested classes/interfaces inherited from interface fr.gouv.culture.oai.OAIObject
OAIObject.Node
 
Field Summary
protected  java.lang.String[] adminEmails
          Email address of the administrator of this OAI Repository
protected  java.lang.String baseURL
          The base url of this repository
protected  java.lang.String compression
          Compression supported by this OAI repository - optional as per OAI spec
protected  java.lang.String deletedRecord
          String value of yes/no indicating if deleted records are supported deletedRecord : the manner in which the repository supports the notion of deleted records .
protected  org.apache.excalibur.source.impl.FileSource description
          Description of this repository - optional as per OAI spec
protected  java.lang.String earliestDatestamp
          String value indicating the earliest _datestamp of this repository
protected  java.lang.String granularity
          The granularity of datestamps supported by this repository
protected  java.util.Hashtable metadataFormats
          Hashtable containing supported OAIMetadataFormat objects
protected  java.lang.String protocolVersion
          String value of the version number of the oai protocol supported in this
protected  java.lang.String repositoryName
          A human readable name for this repository
 
Fields inherited from class fr.gouv.culture.oai.OAIObjectImpl
_context, logger
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface fr.gouv.culture.oai.OAIObject
HTTP_HEADER_NAME_FROM, HTTP_HEADER_NAME_USER_AGENT, NUMBER_RECORDS_PER_RESPONSE, STRING_DATEFORMAT_GRANULARITY_DAY, STRING_DATEFORMAT_GRANULARITY_SECOND
 
Constructor Summary
AbstractOAIRepository()
           
 
Method Summary
protected  void endVerbEvent(OAIRequest request)
          Sends the end event corresponding to the verb of the request
 java.lang.String[] getAdminEmails()
          Required element within a response from a repository queried with the "Identify" verb
 java.lang.String getBaseURL()
           
 java.lang.String getCompression()
           
 java.lang.String getDeletedRecord()
           
 void getDescription(org.xml.sax.ContentHandler handler)
          Send's the description file to the current consumer
 java.lang.String getEarliestDatestamp()
           
 java.lang.String getGranularity()
           
static java.lang.String getGranularity(java.lang.String paramVal)
          Return the granularity of a date in a OAI request.
 java.lang.String getProtocolVersion()
           
 java.lang.String getRepositoryName()
           
 void identify(OAIRequest request)
          Sends SAX events for the OAI-PMH "identify" request
protected  void sendNoSetHierarchyError()
          Sends the oai error specifying that a set hierarchy is NOT supported by this oai repository
 void sendResumptionToken(java.lang.String resumptionToken)
          Sends the resumption token element to the consumer
 void sendResumptionToken(java.lang.String resumptionToken, java.lang.String cursor)
          Sends the resumption token element to the consumer
 void sendResumptionToken(java.lang.String resumptionToken, java.lang.String cursor, java.lang.String completeListSize)
          Sends the resumption token element to the consumer
protected  void sendResumptionTokensNotSupportedError()
          Sends the oai error specifying that resumptionTokens are NOT supported by this oai repository
protected  void startVerbEvent(OAIRequest request)
          Sends the start event corresponding to the verb of the request
 void toSAX(org.xml.sax.ContentHandler contentHandler)
          Calls the identify method and sends the SAX flow to the provided content handler
 boolean verifyGranularity(java.lang.String paramVal)
          Verifies the granularity of a date in a OAI request.
 boolean verifyParameters(OAIRequest request)
          Verifies the request parameters.
 
Methods inherited from class fr.gouv.culture.oai.OAIObjectImpl
contextualize, enableLogging, endElement, getContext, sendElement, sendElementContent, startElement
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
recycle, setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.gouv.culture.oai.OAIRepository
addDeletedRecord, getRecord, getResumptionToken, listIdentifiers, listMetadataFormats, listRecords, listSets, purgeDeletedRecords, removeDeletedRecord
 
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled
enableLogging
 
Methods inherited from interface org.apache.avalon.framework.context.Contextualizable
contextualize
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 
Methods inherited from interface org.apache.avalon.framework.configuration.Configurable
configure
 

Field Detail

adminEmails

protected java.lang.String[] adminEmails
Email address of the administrator of this OAI Repository


protocolVersion

protected java.lang.String protocolVersion
String value of the version number of the oai protocol supported in this


repositoryName

protected java.lang.String repositoryName
A human readable name for this repository


baseURL

protected java.lang.String baseURL
The base url of this repository


granularity

protected java.lang.String granularity
The granularity of datestamps supported by this repository


deletedRecord

protected java.lang.String deletedRecord
String value of yes/no indicating if deleted records are supported deletedRecord : the manner in which the repository supports the notion of deleted records . Legitimate values are no ; transient ; persistent with meanings defined in the section on deletion (from oai spec) .


earliestDatestamp

protected java.lang.String earliestDatestamp
String value indicating the earliest _datestamp of this repository


compression

protected java.lang.String compression
Compression supported by this OAI repository - optional as per OAI spec


description

protected org.apache.excalibur.source.impl.FileSource description
Description of this repository - optional as per OAI spec


metadataFormats

protected java.util.Hashtable metadataFormats
Hashtable containing supported OAIMetadataFormat objects

Constructor Detail

AbstractOAIRepository

public AbstractOAIRepository()
Method Detail

identify

public void identify(OAIRequest request)
              throws org.xml.sax.SAXException
Sends SAX events for the OAI-PMH "identify" request

Specified by:
identify in interface OAIRepository
Parameters:
request - The request
Throws:
org.xml.sax.SAXException

getDeletedRecord

public java.lang.String getDeletedRecord()
Specified by:
getDeletedRecord in interface OAIRepository

getGranularity

public java.lang.String getGranularity()
Specified by:
getGranularity in interface OAIRepository

getRepositoryName

public java.lang.String getRepositoryName()
Specified by:
getRepositoryName in interface OAIRepository

getEarliestDatestamp

public java.lang.String getEarliestDatestamp()
Specified by:
getEarliestDatestamp in interface OAIRepository

getProtocolVersion

public java.lang.String getProtocolVersion()
Specified by:
getProtocolVersion in interface OAIRepository

getBaseURL

public java.lang.String getBaseURL()
Specified by:
getBaseURL in interface OAIRepository

getAdminEmails

public java.lang.String[] getAdminEmails()
Description copied from interface: OAIRepository
Required element within a response from a repository queried with the "Identify" verb

Specified by:
getAdminEmails in interface OAIRepository

getCompression

public java.lang.String getCompression()
Specified by:
getCompression in interface OAIRepository

getDescription

public void getDescription(org.xml.sax.ContentHandler handler)
                    throws org.xml.sax.SAXException
Send's the description file to the current consumer

Specified by:
getDescription in interface OAIRepository
Parameters:
handler -
Throws:
org.xml.sax.SAXException

verifyParameters

public boolean verifyParameters(OAIRequest request)
                         throws org.xml.sax.SAXException
Verifies the request parameters.

Verifies the request parameters respective of the verb provided in the request and the repository's level of support for certain optional features like "resumptionToken"s and "set"s.

Note this method should return SAX events to any XMLConsumer set if errors exist within the request parameters.

Specified by:
verifyParameters in interface OAIRepository
Parameters:
request - The request object
Returns:
Return true or false.
Throws:
org.xml.sax.SAXException

verifyGranularity

public boolean verifyGranularity(java.lang.String paramVal)
Verifies the granularity of a date in a OAI request.

The date must be formated according the ISO-8601 format : YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DD.

Parameters:
paramVal - The date as a String.
Returns:
Return true if the date is well formated as a complete date or complete date plus hours, minutes and seconds.
See Also:
getGranularity(java.lang.String)

getGranularity

public static java.lang.String getGranularity(java.lang.String paramVal)
Return the granularity of a date in a OAI request.

The date must be formated according the ISO-8601 format : YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DD.

Parameters:
paramVal - The date as a String
Returns:
Return YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ if the date is well formated as a complete date or complete date plus hours, minutes and seconds.
See Also:
OAIObject.Node.Value.STRING_GRANULARITY_DAY, OAIObject.Node.Value.STRING_GRANULARITY_SECOND

sendNoSetHierarchyError

protected void sendNoSetHierarchyError()
                                throws org.xml.sax.SAXException
Sends the oai error specifying that a set hierarchy is NOT supported by this oai repository

Throws:
org.xml.sax.SAXException

sendResumptionTokensNotSupportedError

protected void sendResumptionTokensNotSupportedError()
                                              throws org.xml.sax.SAXException
Sends the oai error specifying that resumptionTokens are NOT supported by this oai repository

Throws:
org.xml.sax.SAXException

startVerbEvent

protected void startVerbEvent(OAIRequest request)
                       throws org.xml.sax.SAXException
Sends the start event corresponding to the verb of the request

Throws:
org.xml.sax.SAXException

endVerbEvent

protected void endVerbEvent(OAIRequest request)
                     throws org.xml.sax.SAXException
Sends the end event corresponding to the verb of the request

Throws:
org.xml.sax.SAXException

toSAX

public void toSAX(org.xml.sax.ContentHandler contentHandler)
           throws org.xml.sax.SAXException
Calls the identify method and sends the SAX flow to the provided content handler

Specified by:
toSAX in interface org.apache.excalibur.xml.sax.XMLizable
Parameters:
contentHandler - The event receiver
Throws:
org.xml.sax.SAXException
See Also:
identify(fr.gouv.culture.oai.OAIRequest)

sendResumptionToken

public void sendResumptionToken(java.lang.String resumptionToken)
                         throws org.xml.sax.SAXException
Sends the resumption token element to the consumer

Parameters:
resumptionToken - The resumption token
Throws:
org.xml.sax.SAXException

sendResumptionToken

public void sendResumptionToken(java.lang.String resumptionToken,
                                java.lang.String cursor)
                         throws org.xml.sax.SAXException
Sends the resumption token element to the consumer

Parameters:
resumptionToken - The resumption token
cursor - The cursor position
Throws:
org.xml.sax.SAXException

sendResumptionToken

public void sendResumptionToken(java.lang.String resumptionToken,
                                java.lang.String cursor,
                                java.lang.String completeListSize)
                         throws org.xml.sax.SAXException
Sends the resumption token element to the consumer

Parameters:
resumptionToken - The resumption token
cursor - The cursor position
completeListSize - The size of the complete list
Throws:
org.xml.sax.SAXException


Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.