fr.gouv.culture.sdx.documentbase
Class SDXDocumentBase

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.AbstractSdxObject
      extended by fr.gouv.culture.sdx.utils.database.DatabaseBacked
          extended by fr.gouv.culture.sdx.documentbase.AbstractDocumentBase
              extended by fr.gouv.culture.sdx.documentbase.SDXDocumentBase
All Implemented Interfaces:
DocumentBase, SDXDocumentBaseTarget, Searchable, Describable, Encodable, Identifiable, Localizable, Saveable, SdxObject, Target, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.excalibur.xml.sax.XMLizable
Direct Known Subclasses:
AbstractThesaurus, LuceneDocumentBase

public abstract class SDXDocumentBase
extends AbstractDocumentBase
implements SDXDocumentBaseTarget

an abstract document base class handling SDX based configurations


Nested Class Summary
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.documentbase.SDXDocumentBaseTarget
SDXDocumentBaseTarget.ConfigurationNode
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.documentbase.DocumentBase
DocumentBase.ConfigurationNode
 
Field Summary
protected  org.apache.avalon.framework.configuration.Configuration _configuration
           
protected static java.lang.String[] _documentAdditionStatus
           
protected  int _ilevel
           
protected  LoggingIndexation _ilogger
           
protected  boolean _isIndexOptimized
          A flag to know if the index is optimized or not
protected  boolean autoOptimize
          Auto-optimization when uploading / deleting documents.
protected  java.lang.String baseIndexDir
          The base index directory path
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
           
protected static java.lang.String ELEMENT_NAME_DEFAULT_HPP
           
protected static java.lang.String ELEMENT_NAME_DEFAULT_MAXSORT
           
protected  boolean isDatadirShared
           
protected  boolean keepOriginalDocuments
          Whether the original documents should be stored or not.
protected  TimeScheduler scheduler
          Time scheduler for stored requests
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
           
protected  boolean splitActive
          Whether the index may be split or not
protected  long splitDoc
          Document limit for index splitting
protected  long splitSize
          Size limit for index splitting.
protected  java.lang.String splitUnit
          Size unit for index splitting.
protected  boolean useCompoundFiles
          Compound File format usage defaulted to true
 
Fields inherited from class fr.gouv.culture.sdx.documentbase.AbstractDocumentBase
_indexationPipeline, _oaiHarv, ATTRIBUTE_AUTO_OPTIMIZE, ATTRIBUTE_COMPOUND_FILES, ATTRIBUTE_SPLIT_DOC, ATTRIBUTE_SPLIT_SIZE, ATTRIBUTE_SPLIT_UNIT, DBELEM_ATTRIBUTE_DEFAULT, DBELEM_ATTRIBUTE_HPP, DBELEM_ATTRIBUTE_KEEP_ORIGINAL, DBELEM_ATTRIBUTE_MAXSORT, defaultHitsPerPage, defaultMaxSort, defaultRepository, ELEMENT_NAME_INDEX_SPLIT, ELEMENT_NAME_OPTIMIZE, INTERNAL_FIELD_NAME_SDX_OAI_DELETED_RECORD, INTERNAL_FIELD_NAME_SDXALL, INTERNAL_FIELD_NAME_SDXAPPID, INTERNAL_FIELD_NAME_SDXCONTENTLENGTH, INTERNAL_FIELD_NAME_SDXDBID, INTERNAL_FIELD_NAME_SDXDOCID, INTERNAL_FIELD_NAME_SDXDOCTYPE, INTERNAL_FIELD_NAME_SDXMODDATE, INTERNAL_FIELD_NAME_SDXREPOID, INTERNAL_SDXALL_FIELD_VALUE, isDefault, locale, oaiRepo, oaiRepositories, PROPERTY_NAME_ATTACHED, PROPERTY_NAME_CONTENT_LENGTH, PROPERTY_NAME_DOCTYPE, PROPERTY_NAME_MIMETYPE, PROPERTY_NAME_ORIGINAL, PROPERTY_NAME_PARENT, PROPERTY_NAME_REPO, PROPERTY_NAME_SUB, repoConnectionPool, repositories, useMetadata
 
Fields inherited from class fr.gouv.culture.sdx.utils.database.DatabaseBacked
_database, CLASS_NAME_SUFFIX, DATABASE_DIR_NAME, databaseConf, dbLocation, dbPath, DEFAULT_DATABASE_TYPE
 
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
_context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized
 
Fields inherited from interface fr.gouv.culture.sdx.documentbase.DocumentBase
CLASS_NAME_SUFFIX, PACKAGE_QUALNAME
 
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable
DEFAULT_ENCODING
 
Fields inherited from interface fr.gouv.culture.sdx.utils.save.Saveable
ALL_SAVE_ATTRIB, PATH_ATTRIB, SAVE_DIRECTORY_PARAM
 
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)
          Adds a document to the search index of Lucene
protected abstract  void addToSearchIndex(java.lang.Object indexationDoc, boolean batchIndex)
          Add a document to the underlying search index
 void backup(SaveParameters save_config)
          Save the DocumentBase data objects
protected abstract  void backupIndexes(SaveParameters save_config)
           
protected abstract  void backupTimeStamp(SaveParameters save_config)
           
 void checkIntegrity()
          Check the integrity of the documentBase
protected abstract  void compactSearchIndex()
           
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures SDX document base
protected  void configureBase(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)
          Configures OAI components if relevant: repository and harvester
protected abstract  void configureOAIHarvester(org.apache.avalon.framework.configuration.Configuration configuration)
           
protected abstract  void configureOAIRepositories(org.apache.avalon.framework.configuration.Configuration configuration)
           
protected abstract  void configureOAIRepository(org.apache.avalon.framework.configuration.Configuration configuration)
           
protected  void configureOptimizeTriggers(org.apache.avalon.framework.configuration.Configuration optimizeConf)
          Configures time triggers for optimizations
protected  void configureRepositories(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures repositories
protected  void configureSplit(org.apache.avalon.framework.configuration.Configuration configuration)
          Index splitter 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(java.lang.String relation, Document doc)
           
protected  long getByteSplitSize()
          Get the split size for indexes, in byte
protected  org.apache.avalon.framework.configuration.Configuration getConfiguration()
           
 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)
           
 void getIndexationInformations()
           
 LoggingIndexation getIndexationLogger()
           
 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)
          Configures repositories
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.
 long getSplitDoc()
          Get the document number condition for index splitting
 long getSplitSize()
          Get the split size for indexes, depending on unit
 java.lang.String getSplitUnit()
          Get split size unit
 boolean getUseCompoundFiles()
          Get the specified file format for indexation
abstract  java.util.HashMap getXMLFieldList()
          Returns the list of XML type fields
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.
abstract  void indexModified()
           
 void init()
          Initializes the document base.
protected  boolean initToSax()
          Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML
protected  void initVolatileObjectsToSax()
          Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML Some objects need to be refresh each time a toSAX is called
 boolean isAutoOptimized()
          Get information about optimization method
 boolean isIndexOptimized()
           
abstract  void mergeBatch()
          Deprecated. This method is deprecated since SDX v. 2.3. Use mergeCurrentBatch() instead.
abstract  void mergeCurrentBatch()
          Merges a batch of documents (in memory) into the physical index on the file system and optimize this one if necessary (depends of the autoOptimize attribute for the current Document Base)
abstract  void optimize()
          Process an optimization of the Documentbase
 void restore(SaveParameters save_config)
          Restore the DocumentBase data objects
protected abstract  void restoreIndexes(SaveParameters save_config)
           
protected abstract  void restoreTimeStamp(SaveParameters save_config)
           
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
protected  void setConfiguration(org.apache.avalon.framework.configuration.Configuration configuration)
           
abstract  boolean splitCheck(boolean currentIndex)
          Return true when splitting condition are reached if true, should be followed by a splitIndex() call
abstract  void splitIndex(boolean currentIndex)
          Split the current big index into 2 smaller one
 void targetTriggered(java.lang.String triggeredString)
          Optimization by the cron
 
Methods inherited from class fr.gouv.culture.sdx.documentbase.AbstractDocumentBase
addOaiDeletedRecord, addOAIRepository, configurePipeline, createEntityForDocMetaData, createOAIRepository, createOAIRepository, delete, deletePhysicalDocument, getDefaultHitsPerPage, getDefaultMaxSort, getDefaultOAIRepository, getDefaultRepository, getIdGenerator, getIndexationPipeline, getMimeType, getOAIHarvester, getOAIRepositoriesSize, getOAIRepository, getOAIRepository, getPooledRepositoryConnection, getRepository, getSourceValidity, isDefault, isUseMetadata, managedOaiDeletedRecord, optimizeDatabase, optimizeRepositories, releasePooledRepositoryConnections, removeOaiDeletedRecord
 
Methods inherited from class fr.gouv.culture.sdx.utils.database.DatabaseBacked
configure, getClassNameSuffix, getDatabase
 
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
configureDescription, contextualize, enableLogging, getBaseAttributes, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResources
 
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
 
Methods inherited from interface fr.gouv.culture.sdx.utils.SdxObject
getLog
 
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.avalon.framework.service.Serviceable
service
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Identifiable
getId, setId
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Describable
getDescription, setDescription
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Encodable
getEncoding, setEncoding
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Localizable
getLocale, getXmlLang, setLocale, setXmlLang
 
Methods inherited from interface org.apache.excalibur.xml.sax.XMLizable
toSAX
 
Methods inherited from interface fr.gouv.culture.sdx.search.Searchable
getId, getIndex
 

Field Detail

scheduler

protected TimeScheduler scheduler
Time scheduler for stored requests


keepOriginalDocuments

protected boolean keepOriginalDocuments
Whether the original documents should be stored or not.


baseIndexDir

protected java.lang.String baseIndexDir
The base index directory path


splitActive

protected boolean splitActive
Whether the index may be split or not


splitSize

protected long splitSize
Size limit for index splitting. (byte unit)


splitUnit

protected java.lang.String splitUnit
Size unit for index splitting.


splitDoc

protected long splitDoc
Document limit for index splitting


useCompoundFiles

protected boolean useCompoundFiles
Compound File format usage defaulted to true


autoOptimize

protected boolean autoOptimize
Auto-optimization when uploading / deleting documents. Defaulted to true (as in SDX 2.2)


isDatadirShared

protected boolean isDatadirShared

_isIndexOptimized

protected boolean _isIndexOptimized
A flag to know if the index is optimized or not


DOC_URL

protected final java.lang.String DOC_URL
See Also:
Constant Field Values

SDX_USER

protected final java.lang.String SDX_USER
See Also:
Constant Field Values

SDX_DATE

protected final java.lang.String SDX_DATE
See Also:
Constant Field Values

SDX_ISO8601_DATE

protected final java.lang.String SDX_ISO8601_DATE
See Also:
Constant Field Values

SDX_DATE_MILLISECONDS

protected final java.lang.String SDX_DATE_MILLISECONDS
See Also:
Constant Field Values

_documentAdditionStatus

protected static final java.lang.String[] _documentAdditionStatus

DOC_ADD_STATUS_FAILURE

protected static final int DOC_ADD_STATUS_FAILURE
See Also:
Constant Field Values

DOC_ADD_STATUS_IGNORED

protected static final int DOC_ADD_STATUS_IGNORED
See Also:
Constant Field Values

DOC_ADD_STATUS_ADDED

protected static final int DOC_ADD_STATUS_ADDED
See Also:
Constant Field Values

DOC_ADD_STATUS_REFRESHED

protected static final int DOC_ADD_STATUS_REFRESHED
See Also:
Constant Field Values

DOC_ADD_STATUS_REPLACED

protected static final int DOC_ADD_STATUS_REPLACED
See Also:
Constant Field Values

SDX_DATABASE_FORMAT

protected static final java.lang.String SDX_DATABASE_FORMAT
See Also:
Constant Field Values

SDX_DATABASE_VERSION

protected static final java.lang.String SDX_DATABASE_VERSION
See Also:
Constant Field Values

SDX_DATABASE_VERSION_2_3

protected static final java.lang.String SDX_DATABASE_VERSION_2_3
See Also:
Constant Field Values

ELEMENT_NAME_DEFAULT_HPP

protected static final java.lang.String ELEMENT_NAME_DEFAULT_HPP
See Also:
Constant Field Values

ELEMENT_NAME_DEFAULT_MAXSORT

protected static final java.lang.String ELEMENT_NAME_DEFAULT_MAXSORT
See Also:
Constant Field Values

_configuration

protected org.apache.avalon.framework.configuration.Configuration _configuration

_ilogger

protected LoggingIndexation _ilogger

_ilevel

protected int _ilevel
Constructor Detail

SDXDocumentBase

public SDXDocumentBase()
Method Detail

setConfiguration

protected void setConfiguration(org.apache.avalon.framework.configuration.Configuration configuration)

getConfiguration

protected org.apache.avalon.framework.configuration.Configuration getConfiguration()
Overrides:
getConfiguration in class AbstractSdxObject

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configures SDX document base

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

configureBase

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

configureSplit

protected void configureSplit(org.apache.avalon.framework.configuration.Configuration configuration)
                       throws org.apache.avalon.framework.configuration.ConfigurationException
Index splitter configuration

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

getRepositoryConfigurationList

protected org.apache.avalon.framework.configuration.Configuration[] getRepositoryConfigurationList(org.apache.avalon.framework.configuration.Configuration configuration)
                                                                                            throws org.apache.avalon.framework.configuration.ConfigurationException
Configures repositories

Parameters:
configuration -
Returns:
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

configureRepositories

protected void configureRepositories(org.apache.avalon.framework.configuration.Configuration configuration)
                              throws org.apache.avalon.framework.configuration.ConfigurationException
Configures repositories

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

configureOAIComponents

public void configureOAIComponents(org.apache.avalon.framework.configuration.Configuration configuration)
                            throws org.apache.avalon.framework.configuration.ConfigurationException
Configures OAI components if relevant: repository and harvester

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

configureIdGenerator

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

configureDocumentBase

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

deleteFromSearchIndex

protected abstract void deleteFromSearchIndex(java.lang.String id)
                                       throws SDXException
Throws:
SDXException

configureOAIRepositories

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

configureOAIRepository

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

configureOAIHarvester

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

getIndexationDocument

protected abstract java.lang.Object getIndexationDocument(IndexableDocument doc,
                                                          java.lang.String storeDocId,
                                                          java.lang.String repoId,
                                                          IndexParameters params)
                                                   throws SDXException
Throws:
SDXException

addToSearchIndex

protected abstract void addToSearchIndex(java.lang.Object indexationDoc,
                                         boolean batchIndex)
                                  throws SDXException
Add a document to the underlying search index

Parameters:
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
Throws:
SDXException

compactSearchIndex

protected abstract void compactSearchIndex()
                                    throws SDXException
Throws:
SDXException

getUseCompoundFiles

public boolean getUseCompoundFiles()
Get the specified file format for indexation


isAutoOptimized

public boolean isAutoOptimized()
Get information about optimization method


getByteSplitSize

protected long getByteSplitSize()
Get the split size for indexes, in byte


getSplitSize

public long getSplitSize()
Get the split size for indexes, depending on unit


getSplitUnit

public java.lang.String getSplitUnit()
Get split size unit


getSplitDoc

public long getSplitDoc()
Get the document number condition for index splitting


getDocument

public void getDocument(ParsableDocument doc,
                        org.apache.cocoon.xml.XMLConsumer consumer)
                 throws SDXException
Gets a SDX document as SAX events.

Specified by:
getDocument in interface DocumentBase
Overrides:
getDocument in class AbstractDocumentBase
Parameters:
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);

Throws:
SDXException

getDocument

public void getDocument(ParsableDocument doc,
                        org.apache.cocoon.xml.XMLConsumer consumer,
                        boolean docTypeKnown)
                 throws SDXException
Gets a SDX document as SAX events.

Specified by:
getDocument in interface DocumentBase
Parameters:
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);

Throws:
SDXException

getDocument

public void getDocument(Document doc,
                        java.io.OutputStream os)
                 throws SDXException
Supplies the provided output stream with the requested document

Specified by:
getDocument in interface DocumentBase
Overrides:
getDocument in class AbstractDocumentBase
Parameters:
doc - The document.
os - The output stream.
Throws:
SDXException

getDocument

public java.io.InputStream getDocument(Document doc)
                                throws SDXException
Provides the requested SDX document as an InputStream

Specified by:
getDocument in interface DocumentBase
Overrides:
getDocument in class AbstractDocumentBase
Parameters:
doc - The document.
Returns:
An input stream.
Throws:
SDXException

getRepositoryForStorage

protected Repository getRepositoryForStorage(Document doc,
                                             Repository defaultRepo)
                                      throws SDXException
This method retrieves a repository id from a document object and then does a lookup for the corresponding repository object.

Parameters:
doc - Document with desired repository storage id
defaultRepo - Default repo to utilize if none found
Returns:
Repository
Throws:
SDXException

getRepositoryForDocument

protected Repository getRepositoryForDocument(Document doc)
                                       throws SDXException
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

Throws:
SDXException

delete

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
Deletes a document and any attached document(s) if not used by any other document(s).

Parameters:
doc - The document to delete.
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

deleteIndexableDocumentComponents

protected void deleteIndexableDocumentComponents(IndexableDocument doc,
                                                 org.xml.sax.ContentHandler handler)
                                          throws SDXException,
                                                 org.apache.cocoon.ProcessingException,
                                                 org.xml.sax.SAXException
Deletes all secondary document and search index components

Parameters:
doc - The parent document
Throws:
SDXException
org.apache.cocoon.ProcessingException
org.xml.sax.SAXException

delete

public void delete(Document[] docs,
                   org.xml.sax.ContentHandler handler)
            throws SDXException,
                   org.xml.sax.SAXException,
                   org.apache.cocoon.ProcessingException
Deletes an array of documents and any attached document(s) if not used by any other document(s).

Specified by:
delete in interface DocumentBase
Parameters:
docs - The documents to delete.
handler - A content handler to feed with information.
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

index

public void index(IndexableDocument doc,
                  Repository repository,
                  IndexParameters params,
                  org.xml.sax.ContentHandler handler)
           throws SDXException,
                  org.xml.sax.SAXException,
                  org.apache.cocoon.ProcessingException
Adds a document.

Specified by:
index in interface DocumentBase
Parameters:
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
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

rollbackIndexation

protected void rollbackIndexation(IndexableDocument doc,
                                  org.xml.sax.ContentHandler handler)
                           throws SDXException,
                                  org.xml.sax.SAXException,
                                  org.apache.cocoon.ProcessingException
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

getOwners

public java.lang.String[] getOwners(java.lang.String relationType,
                                    java.lang.String docId,
                                    org.xml.sax.ContentHandler handler)
                             throws SDXException,
                                    org.xml.sax.SAXException
Retrieves all parent documents containing the relationType/docId entry

Parameters:
relationType - The relation type (sub, attached, original)
docId - The secondary document id
handler - Then handler to feed with events
Returns:
String[]
Throws:
SDXException
org.xml.sax.SAXException

getRelated

public java.lang.String[] getRelated(java.lang.String docId,
                                     java.lang.String relationType,
                                     org.xml.sax.ContentHandler handler)
                              throws SDXException,
                                     org.xml.sax.SAXException
Retrieves the related documents (sub, attached, original) of the parent document for the relationType provided

Parameters:
docId - The parent document id
relationType - The relation type (sub, attached, original)
handler - The handler to feed with events
Returns:
String[]
Throws:
SDXException
org.xml.sax.SAXException

deleteRelationsToMastersFromDatabase

protected void deleteRelationsToMastersFromDatabase(java.lang.String relation,
                                                    Document doc)
                                             throws SDXException
Throws:
SDXException

handleParameters

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
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

setBaseParameters

protected IndexParameters setBaseParameters(IndexParameters params)
Set's the default pipeline parameters and ensures the params have a pipeline

Parameters:
params - The params object provided by the user at indexation time

index

public void index(IndexableDocument[] docs,
                  Repository repository,
                  IndexParameters params,
                  org.xml.sax.ContentHandler handler)
           throws SDXException,
                  org.xml.sax.SAXException,
                  org.apache.cocoon.ProcessingException
Adds some documents.

Specified by:
index in interface DocumentBase
Parameters:
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
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

index

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
Adds a document from an array of documents using the same connection.

Parameters:
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 documents
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
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

add

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
Adds a document to the search index of Lucene

Parameters:
originalDoc - The document to add
repository - The repository to use
conn - The repository connection to use
params - The document addition parameters
handler - The content handler to feed with events
isIndexable - is the document indexable
isPrimary - is the document a primary or secondary document
batchIndex - is this a batch index
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

init

public void init()
          throws SDXException
Description copied from interface: DocumentBase
Initializes the document base.

This method must be called after the super.getLog() has been set and the configuration done.

Specified by:
init in interface DocumentBase
Overrides:
init in class DatabaseBacked
Throws:
SDXException

getXMLFieldList

public abstract java.util.HashMap getXMLFieldList()
Returns the list of XML type fields


initToSax

protected boolean initToSax()
Description copied from class: AbstractSdxObject
Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML

Overrides:
initToSax in class AbstractDocumentBase

initVolatileObjectsToSax

protected void initVolatileObjectsToSax()
Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML Some objects need to be refresh each time a toSAX is called

Overrides:
initVolatileObjectsToSax in class AbstractDocumentBase

optimize

public abstract void optimize()
Process an optimization of the Documentbase

Specified by:
optimize in interface DocumentBase

mergeBatch

public abstract void mergeBatch()
                         throws SDXException
Deprecated. This method is deprecated since SDX v. 2.3. Use mergeCurrentBatch() instead.

Merges a batch of documents (in memory) into the physical index on the file system.

Throws:
SDXException

mergeCurrentBatch

public abstract void mergeCurrentBatch()
Merges a batch of documents (in memory) into the physical index on the file system and optimize this one if necessary (depends of the autoOptimize attribute for the current Document Base)


indexModified

public abstract void indexModified()

splitCheck

public abstract boolean splitCheck(boolean currentIndex)
                            throws SDXException
Return true when splitting condition are reached if true, should be followed by a splitIndex() call

Throws:
SDXException

splitIndex

public abstract void splitIndex(boolean currentIndex)
                         throws java.io.IOException,
                                SDXException
Split the current big index into 2 smaller one

Throws:
java.io.IOException
SDXException

isIndexOptimized

public final boolean isIndexOptimized()
Returns:
boolean tell us if the documentBase index is optimized or not

configureOptimizeTriggers

protected void configureOptimizeTriggers(org.apache.avalon.framework.configuration.Configuration optimizeConf)
                                  throws org.apache.avalon.framework.configuration.ConfigurationException
Configures time triggers for optimizations

Parameters:
optimizeConf - The configuration for optimizations
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

targetTriggered

public void targetTriggered(java.lang.String triggeredString)
Optimization by the cron

Specified by:
targetTriggered in interface Target
Parameters:
triggeredString - the name of trigger

checkIntegrity

public void checkIntegrity()
Check the integrity of the documentBase

Specified by:
checkIntegrity in interface DocumentBase

backup

public void backup(SaveParameters save_config)
            throws SDXException
Save the DocumentBase data objects

Specified by:
backup in interface Saveable
Overrides:
backup in class AbstractDocumentBase
Throws:
SDXException
See Also:
Saveable.backup(fr.gouv.culture.sdx.utils.save.SaveParameters)

backupIndexes

protected abstract void backupIndexes(SaveParameters save_config)
                               throws SDXException
Throws:
SDXException

backupTimeStamp

protected abstract void backupTimeStamp(SaveParameters save_config)
                                 throws SDXException
Throws:
SDXException

restore

public void restore(SaveParameters save_config)
             throws SDXException
Restore the DocumentBase data objects

Specified by:
restore in interface Saveable
Overrides:
restore in class AbstractDocumentBase
Throws:
SDXException
See Also:
Saveable.restore(fr.gouv.culture.sdx.utils.save.SaveParameters)

getIndexationLogger

public LoggingIndexation getIndexationLogger()

getIndexationInformations

public void getIndexationInformations()

restoreIndexes

protected abstract void restoreIndexes(SaveParameters save_config)
                                throws SDXException
Throws:
SDXException

restoreTimeStamp

protected abstract void restoreTimeStamp(SaveParameters save_config)
                                  throws SDXException
Throws:
SDXException


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