|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.gouv.culture.sdx.utils.SdxObjectImpl
fr.gouv.culture.sdx.utils.database.DatabaseBacked
fr.gouv.culture.sdx.documentbase.AbstractDocumentBase
fr.gouv.culture.sdx.documentbase.SDXDocumentBase
an abstract document base class handling SDX based configurations
Field Summary | |
protected static java.lang.String[] |
_documentAdditionStatus
|
protected static int |
DOC_ADD_STATUS_ADDED
|
protected static int |
DOC_ADD_STATUS_FAILURE
|
protected static int |
DOC_ADD_STATUS_IGNORED
|
protected static int |
DOC_ADD_STATUS_REFRESHED
|
protected static int |
DOC_ADD_STATUS_REPLACED
|
protected java.lang.String |
DOC_URL
|
static java.lang.String |
DOCUMENTBASE_DIR_PATH
String representation for a key in the Properties object : document base's directory location. |
protected boolean |
keepOriginalDocuments
Whether the original documents should be stored or not. |
protected static java.lang.String |
SDX_DATABASE_FORMAT
|
protected static java.lang.String |
SDX_DATABASE_VERSION
|
protected static java.lang.String |
SDX_DATABASE_VERSION_2_3
|
protected java.lang.String |
SDX_DATE
|
protected java.lang.String |
SDX_DATE_MILLISECONDS
|
protected java.lang.String |
SDX_ISO8601_DATE
|
protected java.lang.String |
SDX_USER
|
Fields inherited from class fr.gouv.culture.sdx.utils.database.DatabaseBacked |
_manager, ATTRIBUTE_ID, CLASS_NAME_SUFFIX, database, DATABASE_DIR_NAME, databaseConf, dbLocation, dbPath, DEFAULT_DATABASE_TYPE, ELEMENT_NAME_DATABASE, id, PACKAGE_QUALNAME, props |
Fields inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl |
encoding, logger |
Fields inherited from interface fr.gouv.culture.sdx.documentbase.DocumentBase |
ATTRIBUTE_ID, ATTRIBUTE_TYPE, CLASS_NAME_SUFFIX, ELEMENT_NAME_DOCUMENT_BASE, ELEMENT_NAME_DOCUMENT_BASES, PACKAGE_QUALNAME |
Constructor Summary | |
SDXDocumentBase()
|
Method Summary | |
protected void |
add(boolean batchIndex,
Document originalDoc,
Repository repository,
RepositoryConnection conn,
IndexParameters params,
boolean isIndexable,
boolean isPrimary,
java.lang.String relation,
java.lang.String parentId,
org.xml.sax.ContentHandler handler,
java.lang.String attachedDocId)
|
protected abstract void |
addToSearchIndex(java.lang.Object indexationDoc,
boolean batchIndex)
Add a document to the underlying search index |
protected abstract void |
compactSearchIndex()
|
void |
configure(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected abstract void |
configureDocumentBase(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected void |
configureIdGenerator(org.apache.avalon.framework.configuration.Configuration configuration)
|
void |
configureOAIComponents(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected abstract void |
configureOAIHarvester(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected abstract void |
configureOAIRepository(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected void |
configureRepositories(org.apache.avalon.framework.configuration.Configuration configuration)
|
void |
delete(Document[] docs,
org.xml.sax.ContentHandler handler)
Deletes an array of documents and any attached document(s) if not used by any other document(s). |
protected void |
delete(Document doc,
boolean isIndexable,
boolean isPrimary,
boolean isShared,
java.lang.String relation,
org.xml.sax.ContentHandler handler)
Deletes a document and any attached document(s) if not used by any other document(s). |
protected abstract void |
deleteFromSearchIndex(java.lang.String id)
|
protected void |
deleteIndexableDocumentComponents(IndexableDocument doc,
org.xml.sax.ContentHandler handler)
Deletes all secondary document and search index components |
protected void |
deleteRelationsToMastersFromDatabase(Document doc)
|
java.io.InputStream |
getDocument(Document doc)
Provides the requested SDX document as an InputStream |
void |
getDocument(Document doc,
java.io.OutputStream os)
Supplies the provided output stream with the requested document |
void |
getDocument(ParsableDocument doc,
org.apache.cocoon.xml.XMLConsumer consumer)
Gets a SDX document as SAX events. |
void |
getDocument(ParsableDocument doc,
org.apache.cocoon.xml.XMLConsumer consumer,
boolean docTypeKnown)
Gets a SDX document as SAX events. |
protected abstract java.lang.Object |
getIndexationDocument(IndexableDocument doc,
java.lang.String storeDocId,
java.lang.String repoId,
IndexParameters params)
|
java.lang.String[] |
getOwners(java.lang.String relationType,
java.lang.String docId,
org.xml.sax.ContentHandler handler)
Retrieves all parent documents containing the relationType/docId entry |
java.lang.String[] |
getRelated(java.lang.String docId,
java.lang.String relationType,
org.xml.sax.ContentHandler handler)
Retrieves the related documents (sub, attached, original) of the parent document for the relationType provided |
protected org.apache.avalon.framework.configuration.Configuration[] |
getRepositoryConfigurationList(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected Repository |
getRepositoryForDocument(Document doc)
Gets the repository object in which a document resides, document should not be null and have a valid id, use Utilities.checkDocument before calling this method |
protected Repository |
getRepositoryForStorage(Document doc,
Repository defaultRepo)
This method retrieves a repository id from a document object and then does a lookup for the corresponding repository object. |
protected int |
handleParameters(Document doc,
Repository repo,
IndexParameters params,
boolean isIndexable,
boolean isPrimary,
java.lang.String relation,
org.xml.sax.ContentHandler handler)
|
void |
index(IndexableDocument[] docs,
Repository repository,
IndexParameters params,
org.xml.sax.ContentHandler handler)
Adds some documents. |
void |
index(IndexableDocument doc,
Repository repository,
IndexParameters params,
org.xml.sax.ContentHandler handler)
Adds a document. |
protected void |
index(IndexableDocument doc,
Repository repository,
RepositoryConnection conn,
IndexParameters params,
org.xml.sax.ContentHandler handler,
boolean batchIndex)
Adds a document from an array of documents using the same connection. |
void |
init()
Initializes the document base. |
protected void |
loadBaseConfiguration(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected void |
rollbackIndexation(IndexableDocument doc,
org.xml.sax.ContentHandler handler)
|
protected IndexParameters |
setBaseParameters(IndexParameters params)
Set's the default pipeline parameters and ensures the params have a pipeline |
Methods inherited from class fr.gouv.culture.sdx.documentbase.AbstractDocumentBase |
addOaiDeletedRecord, configurePipeline, contextualize, createEntityForDocMetaData, delete, deletePhysicalDocument, getDefaultRepository, getId, getIndexationPipeline, getMimeType, getOAIHarvester, getOAIRepository, getPooledRepositoryConnection, getRepository, isDefault, optimizeDatabase, optimizeRepositories, releasePooledRepositoryConnections, removeOaiDeletedRecord, setId, toSAX |
Methods inherited from class fr.gouv.culture.sdx.utils.database.DatabaseBacked |
compose, getDatabase, setProperties |
Methods inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl |
enableLogging, getChildLogger, setEncoding |
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.sdx.documentbase.DocumentBase |
creationDate, lastModificationDate, setProperties |
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled |
enableLogging |
Methods inherited from interface org.apache.avalon.framework.component.Composable |
compose |
Methods inherited from interface fr.gouv.culture.sdx.search.Searchable |
getIndex |
Field Detail |
public static final java.lang.String DOCUMENTBASE_DIR_PATH
protected boolean keepOriginalDocuments
protected final java.lang.String DOC_URL
protected final java.lang.String SDX_USER
protected final java.lang.String SDX_DATE
protected final java.lang.String SDX_ISO8601_DATE
protected final java.lang.String SDX_DATE_MILLISECONDS
protected static final java.lang.String[] _documentAdditionStatus
protected static final int DOC_ADD_STATUS_FAILURE
protected static final int DOC_ADD_STATUS_IGNORED
protected static final int DOC_ADD_STATUS_ADDED
protected static final int DOC_ADD_STATUS_REFRESHED
protected static final int DOC_ADD_STATUS_REPLACED
protected static final java.lang.String SDX_DATABASE_FORMAT
protected static final java.lang.String SDX_DATABASE_VERSION
protected static final java.lang.String SDX_DATABASE_VERSION_2_3
Constructor Detail |
public SDXDocumentBase()
Method Detail |
public void configure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
configure
in class DatabaseBacked
org.apache.avalon.framework.configuration.ConfigurationException
protected void loadBaseConfiguration(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
protected org.apache.avalon.framework.configuration.Configuration[] getRepositoryConfigurationList(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
protected void configureRepositories(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
public void configureOAIComponents(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
protected void configureIdGenerator(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
protected abstract void configureDocumentBase(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
protected abstract void deleteFromSearchIndex(java.lang.String id) throws SDXException
SDXException
protected abstract void configureOAIRepository(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
protected abstract void configureOAIHarvester(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
protected abstract java.lang.Object getIndexationDocument(IndexableDocument doc, java.lang.String storeDocId, java.lang.String repoId, IndexParameters params) throws SDXException
SDXException
protected abstract void addToSearchIndex(java.lang.Object indexationDoc, boolean batchIndex) throws SDXException
indexationDoc
- The document object for the specific search implementation (lucene, or other)batchIndex
- parameter to indicate wheter a batch indexation pass is taking place so that optimization is done at the end of the batch
SDXException
protected abstract void compactSearchIndex() throws SDXException
SDXException
public void getDocument(ParsableDocument doc, org.apache.cocoon.xml.XMLConsumer consumer) throws SDXException
getDocument
in interface DocumentBase
getDocument
in class AbstractDocumentBase
doc
- A ParsableDocument, ie XMLDocument or HTMLDocument.consumer
- A SAX content handler to feed with events.
The wrapped contentHandler for including events within an XSP page contentHandler should be created using
IncludeXMLConsumer stripper = new IncludeXMLConsumer(xspContentHandler);
SDXException
public void getDocument(ParsableDocument doc, org.apache.cocoon.xml.XMLConsumer consumer, boolean docTypeKnown) throws SDXException
doc
- A Document, ie XMLDocument or HTMLDocument, we discern the type from the document lookup.consumer
- A SAX content handler to feed with events.docTypeKnown
- If the type of the ParsableDocument desired is unknown, ie. XML or HTML,
allows users to build one or the other type of document and still retrieve a document
The wrapped contentHandler for including events within an XSP page contentHandler should be created using
IncludeXMLConsumer stripper = new IncludeXMLConsumer(xspContentHandler);
SDXException
public void getDocument(Document doc, java.io.OutputStream os) throws SDXException
getDocument
in interface DocumentBase
getDocument
in class AbstractDocumentBase
doc
- The document.os
- The output stream.
SDXException
public java.io.InputStream getDocument(Document doc) throws SDXException
getDocument
in interface DocumentBase
getDocument
in class AbstractDocumentBase
doc
- The document.
SDXException
protected Repository getRepositoryForStorage(Document doc, Repository defaultRepo) throws SDXException
doc
- Document with desired repository storage iddefaultRepo
- Default repo to utilize if none found
SDXException
protected Repository getRepositoryForDocument(Document doc) throws SDXException
SDXException
protected void delete(Document doc, boolean isIndexable, boolean isPrimary, boolean isShared, java.lang.String relation, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
doc
- The document to delete.
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
protected void deleteIndexableDocumentComponents(IndexableDocument doc, org.xml.sax.ContentHandler handler) throws SDXException, org.apache.cocoon.ProcessingException, org.xml.sax.SAXException
doc
- The parent document
SDXException
org.apache.cocoon.ProcessingException
org.xml.sax.SAXException
public void delete(Document[] docs, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
docs
- The documents to delete.handler
- A content handler to feed with information.
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
public void index(IndexableDocument doc, Repository repository, IndexParameters params, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
doc
- The document to add.repository
- The repository where to store the document.params
- The parameters for this adding action.handler
- A content handler where to send information about the process (may be null), currently we don't use it, but maybe in the future.
TODO : what kind of "informations" ? -pb
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
protected void rollbackIndexation(IndexableDocument doc, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
public java.lang.String[] getOwners(java.lang.String relationType, java.lang.String docId, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException
relationType
- The relation type (sub, attached, original)docId
- The secondary document idhandler
- Then handler to feed with events
SDXException
org.xml.sax.SAXException
public java.lang.String[] getRelated(java.lang.String docId, java.lang.String relationType, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException
docId
- The parent document idrelationType
- The relation type (sub, attached, original)handler
- The handler to feed with events
SDXException
org.xml.sax.SAXException
protected void deleteRelationsToMastersFromDatabase(Document doc) throws SDXException
SDXException
protected int handleParameters(Document doc, Repository repo, IndexParameters params, boolean isIndexable, boolean isPrimary, java.lang.String relation, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
protected IndexParameters setBaseParameters(IndexParameters params)
params
- The params object provided by the user at indexation timepublic void index(IndexableDocument[] docs, Repository repository, IndexParameters params, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
docs
- The documents to add.repository
- The repository where to store the documents. If null is passed, the default repository will be used.params
- The parameters for this adding action.handler
- A content handler where to send information about the process (may be null)
TODO : what kind of "informations" ? -pb
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
protected void index(IndexableDocument doc, Repository repository, RepositoryConnection conn, IndexParameters params, org.xml.sax.ContentHandler handler, boolean batchIndex) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
doc
- The document to add.repository
- The repository where to store the document.conn
- The repository's connection, we want to use only one connection for all the documentsparams
- The parameters for this adding action.handler
- A content handler where to send information about the process (may be null), currently we don't use it, but maybe in the future.
TODO : what kind of "informations" ? -pb
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
protected void add(boolean batchIndex, Document originalDoc, Repository repository, RepositoryConnection conn, IndexParameters params, boolean isIndexable, boolean isPrimary, java.lang.String relation, java.lang.String parentId, org.xml.sax.ContentHandler handler, java.lang.String attachedDocId) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
originalDoc
- The document to addrepository
- The repository to useconn
- The repository connection to useparams
- The document addition parametershandler
- The content handler to feed with eventsisIndexable
- is the document indexableisPrimary
- is the document a primary or secondary documentbatchIndex
- is this a batch index
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
public void init() throws SDXException
DocumentBase
This method must be called after the logger has been set and the configuration done.
init
in interface DocumentBase
init
in class DatabaseBacked
SDXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |