fr.gouv.culture.sdx.oai
Class AbstractDocumentBaseOAIRepository

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

public abstract class AbstractDocumentBaseOAIRepository
extends AbstractOAIRepository
implements DocumentBaseOAIRepository

Abstract oai repository for DocumentBases providing common behaviors

TODORefactor: bring appropriate methods up from sub-classes


Nested Class Summary
 
Nested classes inherited from class fr.gouv.culture.sdx.oai.DocumentBaseOAIRepository
DocumentBaseOAIRepository.ConfigurationNode
 
Nested classes inherited from class fr.gouv.culture.oai.OAIObject
OAIObject.Node
 
Field Summary
protected  Database _database
          The database for this object
protected  org.apache.avalon.framework.context.DefaultContext context
          The framework's context.
protected  DocumentBase documentBase
          The underlying document base
protected  java.lang.String documentBaseId
          The document base's id
protected  org.apache.avalon.framework.service.ServiceManager manager
          The framework's service manager.
protected  int numRecordsPerResponse
          The number of records for before issuing a resumption tokent
static java.lang.String PARAMETER_NAME_SDX_FIELD
           
static java.lang.String PARAMETER_NAME_SET_NAME
           
static java.lang.String PARAMETER_NAME_SET_SPEC
           
protected  IDGenerator resumptionTokenIdGen
           
 
Fields inherited from class fr.gouv.culture.oai.AbstractOAIRepository
adminEmails, baseURL, compression, deletedRecord, description, earliestDatestamp, granularity, metadataFormats, protocolVersion, repositoryName
 
Fields inherited from class fr.gouv.culture.oai.OAIObjectImpl
_context, logger
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, 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
AbstractDocumentBaseOAIRepository()
           
 
Method Summary
protected  java.lang.String buildExternalOaiId(OAIRequest request, java.lang.String docId)
          Builds an sdx/oai identifier for a document
protected  java.lang.String buildUrlLocator(OAIRequest request, java.lang.String docId)
          Builds a url locator for the document with the provided id
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Basic configuration
protected  void configureAdminEmails(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures (sets) the adminEmails class-field from a configuration object
protected  void configureBaseURL(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures (sets) the baseURL class-field from a configuration object
protected  void configureDatabase(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures (sets) the database class-field from a configuration object
protected  void configureDescription(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures (sets) the description class-field from a configuration object
protected  void configureResumptionTokenIDGenerator(org.apache.avalon.framework.configuration.Configuration configuration)
           
protected  java.lang.String createResumptionToken(OAIRequest request)
          Builds a resumption token for a request and the database entity to store needed informations.
protected  java.lang.String deriveInternalSdxId(OAIRequest request, java.lang.String fullOaiId)
          Retrieves an internal sdx identifier from a full oai identifier
protected  java.lang.String getRepositoryId()
          Returns an id for this harvester based upon the underlying document base id
protected  java.lang.String getResumptionTokenCursor(java.lang.String resumptionToken)
          Returns the cursor index of the provided resumption token
protected  java.lang.String getResumptionTokenProperty(java.lang.String resumptionToken, java.lang.String propertyName)
          Returns a property value for provided resumption token
 void service(org.apache.avalon.framework.service.ServiceManager serviceManager)
           
 
Methods inherited from class fr.gouv.culture.oai.AbstractOAIRepository
endVerbEvent, getAdminEmails, getBaseURL, getCompression, getDeletedRecord, getDescription, getEarliestDatestamp, getGranularity, getGranularity, getProtocolVersion, getRepositoryName, identify, sendNoSetHierarchyError, sendResumptionToken, sendResumptionToken, sendResumptionToken, sendResumptionTokensNotSupportedError, startVerbEvent, toSAX, verifyGranularity, verifyParameters
 
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, getAdminEmails, getBaseURL, getCompression, getDeletedRecord, getDescription, getEarliestDatestamp, getGranularity, getProtocolVersion, getRecord, getRepositoryName, getResumptionToken, identify, listIdentifiers, listMetadataFormats, listRecords, listSets, purgeDeletedRecords, removeDeletedRecord, verifyParameters
 
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.apache.excalibur.xml.sax.XMLizable
toSAX
 
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
 

Field Detail

manager

protected org.apache.avalon.framework.service.ServiceManager manager
The framework's service manager.


context

protected org.apache.avalon.framework.context.DefaultContext context
The framework's context.


documentBase

protected DocumentBase documentBase
The underlying document base


_database

protected Database _database
The database for this object


documentBaseId

protected java.lang.String documentBaseId
The document base's id


numRecordsPerResponse

protected int numRecordsPerResponse
The number of records for before issuing a resumption tokent


resumptionTokenIdGen

protected IDGenerator resumptionTokenIdGen

PARAMETER_NAME_SDX_FIELD

public static final java.lang.String PARAMETER_NAME_SDX_FIELD
See Also:
Constant Field Values

PARAMETER_NAME_SET_NAME

public static final java.lang.String PARAMETER_NAME_SET_NAME
See Also:
Constant Field Values

PARAMETER_NAME_SET_SPEC

public static final java.lang.String PARAMETER_NAME_SET_SPEC
See Also:
Constant Field Values
Constructor Detail

AbstractDocumentBaseOAIRepository

public AbstractDocumentBaseOAIRepository()
Method Detail

service

public void service(org.apache.avalon.framework.service.ServiceManager serviceManager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Basic configuration

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

configureResumptionTokenIDGenerator

protected void configureResumptionTokenIDGenerator(org.apache.avalon.framework.configuration.Configuration configuration)
                                            throws org.apache.avalon.framework.configuration.ConfigurationException
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

configureBaseURL

protected void configureBaseURL(org.apache.avalon.framework.configuration.Configuration configuration)
                         throws org.apache.avalon.framework.configuration.ConfigurationException
Configures (sets) the baseURL class-field from a configuration object

Throws:
org.apache.avalon.framework.configuration.ConfigurationException

configureDescription

protected void configureDescription(org.apache.avalon.framework.configuration.Configuration configuration)
                             throws org.apache.avalon.framework.configuration.ConfigurationException
Configures (sets) the description class-field from a configuration object

Throws:
org.apache.avalon.framework.configuration.ConfigurationException

configureAdminEmails

protected void configureAdminEmails(org.apache.avalon.framework.configuration.Configuration configuration)
                             throws org.apache.avalon.framework.configuration.ConfigurationException
Configures (sets) the adminEmails class-field from a configuration object

Throws:
org.apache.avalon.framework.configuration.ConfigurationException

configureDatabase

protected void configureDatabase(org.apache.avalon.framework.configuration.Configuration configuration)
                          throws org.apache.avalon.framework.configuration.ConfigurationException
Configures (sets) the database class-field from a configuration object

Throws:
org.apache.avalon.framework.configuration.ConfigurationException

getRepositoryId

protected java.lang.String getRepositoryId()
Returns an id for this harvester based upon the underlying document base id


buildExternalOaiId

protected java.lang.String buildExternalOaiId(OAIRequest request,
                                              java.lang.String docId)
Builds an sdx/oai identifier for a document

Parameters:
request - The request from which the url will be used for id construction
docId - The sdx document identifier
See Also:
deconstruction of id's built with this method

deriveInternalSdxId

protected java.lang.String deriveInternalSdxId(OAIRequest request,
                                               java.lang.String fullOaiId)
Retrieves an internal sdx identifier from a full oai identifier

Parameters:
request - The request from which the url will be used for id construction
fullOaiId - The oai record identifier
See Also:
construction of id's passed as the fullOaiId argument

buildUrlLocator

protected java.lang.String buildUrlLocator(OAIRequest request,
                                           java.lang.String docId)
Builds a url locator for the document with the provided id

Parameters:
request - The request
docId - The id of the document for which to build the locator TODORemove: this is tightly coupled to the external sdx/sdx/sitemap.xmap

createResumptionToken

protected java.lang.String createResumptionToken(OAIRequest request)
                                          throws SDXException
Builds a resumption token for a request and the database entity to store needed informations.

Parameters:
request - The request
Returns:
newResumptionToken The next resumptionToken
Throws:
SDXException

getResumptionTokenCursor

protected java.lang.String getResumptionTokenCursor(java.lang.String resumptionToken)
Returns the cursor index of the provided resumption token

Parameters:
resumptionToken -

getResumptionTokenProperty

protected java.lang.String getResumptionTokenProperty(java.lang.String resumptionToken,
                                                      java.lang.String propertyName)
Returns a property value for provided resumption token

Parameters:
resumptionToken - The resumption token in question
propertyName - The property name for which a value is desired


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