|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fr.gouv.culture.sdx.utils.AbstractSdxObject fr.gouv.culture.sdx.utils.database.DatabaseBacked fr.gouv.culture.sdx.documentbase.AbstractDocumentBase
public abstract class AbstractDocumentBase
an abstract document base class handling most common behaviors
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.documentbase.DocumentBase |
---|
DocumentBase.ConfigurationNode |
Field Summary | |
---|---|
protected Pipeline |
_indexationPipeline
The default indexation pipeline |
protected OAIHarvester |
_oaiHarv
The oai harvester wrapper for this document base |
protected java.lang.String |
ATTRIBUTE_AUTO_OPTIMIZE
Attribute needed to make a choice of optimization method |
protected java.lang.String |
ATTRIBUTE_COMPOUND_FILES
Attribute required to specify the compound files format for indexation |
protected java.lang.String |
ATTRIBUTE_SPLIT_DOC
Attribute used to fix the document limit per index before splitting it |
protected java.lang.String |
ATTRIBUTE_SPLIT_SIZE
Attribute used to fix the size limit per index before splitting it |
protected java.lang.String |
ATTRIBUTE_SPLIT_UNIT
Very optionnal attribute used to tell wich unit must be use with the size one to determine max index size |
protected java.lang.String |
DBELEM_ATTRIBUTE_DEFAULT
The implied attribute stating whether the document base is to be used by default or not. |
protected static java.lang.String |
DBELEM_ATTRIBUTE_HPP
The implied attribute stating whether the document base is to be used by default or not. |
protected java.lang.String |
DBELEM_ATTRIBUTE_KEEP_ORIGINAL
The implied attribute stating whether original documents should be stored or not. |
protected static java.lang.String |
DBELEM_ATTRIBUTE_MAXSORT
The implied attribute stating whether the document base is to be used by default or not. |
protected int |
defaultHitsPerPage
Number of results per page. |
protected int |
defaultMaxSort
Maximum number of results to sort. |
protected Repository |
defaultRepository
The default repository for this document base. |
protected static java.lang.String |
ELEMENT_NAME_INDEX_SPLIT
Index splitting condition meta name |
protected static java.lang.String |
ELEMENT_NAME_OPTIMIZE
Element for cron configuration (optimization) |
static java.lang.String |
INTERNAL_FIELD_NAME_SDX_OAI_DELETED_RECORD
|
static java.lang.String |
INTERNAL_FIELD_NAME_SDXALL
Internal field name for a *fixed* value field. |
static java.lang.String |
INTERNAL_FIELD_NAME_SDXAPPID
Internal field name for application id. |
static java.lang.String |
INTERNAL_FIELD_NAME_SDXCONTENTLENGTH
Internal field name for document length in bytes. |
static java.lang.String |
INTERNAL_FIELD_NAME_SDXDBID
Internal field name for document base id. |
static java.lang.String |
INTERNAL_FIELD_NAME_SDXDOCID
Internal field name for document ids |
static java.lang.String |
INTERNAL_FIELD_NAME_SDXDOCTYPE
Internal field name for document type. |
static java.lang.String |
INTERNAL_FIELD_NAME_SDXMODDATE
Internal field name for modification date. |
static java.lang.String |
INTERNAL_FIELD_NAME_SDXREPOID
Internal field name for repository id. |
static java.lang.String |
INTERNAL_SDXALL_FIELD_VALUE
Internal value for this field. |
protected boolean |
isDefault
True if this document base is the default one in the application. |
protected java.util.Locale |
locale
The locale for this document base (found either in the configuration file or by using Locale.getDefault() ). |
protected OAIRepository |
oaiRepo
The oai repository wrapper for this document base |
protected java.util.Hashtable |
oaiRepositories
The OAI repositories for this document base |
protected java.lang.String |
PROPERTY_NAME_ATTACHED
Internal fields for relationships between documents (kind of metadata required/proposed by SDX) //TODO : move them to a framework/application/relationship class ? |
protected static java.lang.String |
PROPERTY_NAME_CONTENT_LENGTH
|
protected java.lang.String |
PROPERTY_NAME_DOCTYPE
A constant for the path property for the type of document, Binary, HTML, or XML. |
protected static java.lang.String |
PROPERTY_NAME_MIMETYPE
A constant for the path property for attached documents. |
protected java.lang.String |
PROPERTY_NAME_ORIGINAL
Internal value for this field : an original document relationship. |
protected java.lang.String |
PROPERTY_NAME_PARENT
|
protected static java.lang.String |
PROPERTY_NAME_REPO
A constant for the repository property in the database entities. |
protected java.lang.String |
PROPERTY_NAME_SUB
Internal value for this field : a sub-document document relationship. |
protected java.util.Hashtable |
repoConnectionPool
A pool of connections to the repositories. |
protected java.util.Hashtable |
repositories
The repositories that are owned by this document base. |
boolean |
useMetadata
Metadata usage defaulted to true |
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 |
---|
_configuration, _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 | |
---|---|
AbstractDocumentBase()
|
Method Summary | |
---|---|
protected void |
addOaiDeletedRecord(IndexableDocument doc)
Adds an indexable document to the list of the OAI deleted records. |
protected void |
addOAIRepository(OAIRepository _repo,
org.apache.avalon.framework.configuration.Configuration _conf,
java.lang.String _repoid)
Adds an OAI repository to the repositories list. |
void |
backup(SaveParameters save_config)
Save the DocumentBase data objects |
protected void |
configurePipeline(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected DatabaseEntity |
createEntityForDocMetaData(Document doc,
Repository repository,
java.lang.String[] parentDocId)
|
OAIRepository |
createOAIRepository()
Creates an OAIRepository for the documentbase |
OAIRepository |
createOAIRepository(java.lang.String repo)
Creates an OAIRepository for the documentbase |
void |
delete(Document doc,
org.xml.sax.ContentHandler handler)
Deletes a document and any attached document(s) if not used by any other document(s). |
protected void |
deletePhysicalDocument(Document doc,
Repository repo,
org.xml.sax.ContentHandler handler)
This method does a special delete. |
int |
getDefaultHitsPerPage()
Returns the default number of results on page for this DocumentBase. |
int |
getDefaultMaxSort()
Returns the default maximum number of results to sort for this DocumentBase. |
OAIRepository |
getDefaultOAIRepository()
Returns the default OAI repository |
Repository |
getDefaultRepository()
Returns the default repository for this document base. |
java.io.InputStream |
getDocument(Document doc)
Does param checks for subclasses |
void |
getDocument(Document doc,
java.io.OutputStream os)
Does param checks for subclasses |
void |
getDocument(ParsableDocument doc,
org.apache.cocoon.xml.XMLConsumer consumer)
Does param checks for subclasses |
IDGenerator |
getIdGenerator()
Providing access to the id generator as this maybe be useful when building documents externally |
Pipeline |
getIndexationPipeline()
Returns the default indexation pipeline used for indexation in this document base. |
java.lang.String |
getMimeType(Document doc)
Supplies the mimeType for the the document if it exists otherwise the binary document default mimetype is returned |
OAIHarvester |
getOAIHarvester()
Returns the OAI harvester |
int |
getOAIRepositoriesSize()
Return the number (int) of OAI repositories managed by the document base. |
OAIRepository |
getOAIRepository()
Gets the default OAIRepository for the documentbase if one exists |
OAIRepository |
getOAIRepository(java.lang.String repo)
Returns the specified OAI repository |
protected RepositoryConnection |
getPooledRepositoryConnection(java.lang.String repoId)
|
Repository |
getRepository(java.lang.String id)
Gets a repository in this document base. |
org.apache.excalibur.source.SourceValidity |
getSourceValidity()
Returns the source validity of 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 |
isDefault()
Returns true if this document base is the default in the application. |
boolean |
isUseMetadata()
Return true or false if this document base should use metadata or not |
protected void |
managedOaiDeletedRecord(IndexableDocument doc,
java.lang.String action)
Manages the list of OAI deleted documents |
protected void |
optimizeDatabase()
Optimizes the database of the document base. |
protected void |
optimizeRepositories()
Optimizes the repositories of the document base. |
protected void |
releasePooledRepositoryConnections()
|
protected void |
removeOaiDeletedRecord(IndexableDocument doc)
Remove an indexable document to the list of the OAI deleted records. |
void |
restore(SaveParameters save_config)
restore the DocumentBase data objects |
Methods inherited from class fr.gouv.culture.sdx.utils.database.DatabaseBacked |
---|
configure, configure, getClassNameSuffix, getDatabase, init |
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
---|
configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, 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 |
---|
checkIntegrity, creationDate, delete, getDocument, index, index, init, lastModificationDate, optimize |
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 org.apache.avalon.framework.configuration.Configurable |
---|
configure |
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 |
---|
protected boolean isDefault
protected int defaultHitsPerPage
protected int defaultMaxSort
protected Pipeline _indexationPipeline
protected java.util.Hashtable repositories
protected Repository defaultRepository
protected OAIRepository oaiRepo
protected java.util.Hashtable oaiRepositories
protected OAIHarvester _oaiHarv
protected java.util.Locale locale
Locale.getDefault()
).
protected java.util.Hashtable repoConnectionPool
protected final java.lang.String PROPERTY_NAME_ATTACHED
protected final java.lang.String PROPERTY_NAME_ORIGINAL
protected final java.lang.String PROPERTY_NAME_SUB
protected final java.lang.String PROPERTY_NAME_PARENT
protected final java.lang.String DBELEM_ATTRIBUTE_DEFAULT
protected static final java.lang.String DBELEM_ATTRIBUTE_MAXSORT
protected static final java.lang.String DBELEM_ATTRIBUTE_HPP
protected final java.lang.String DBELEM_ATTRIBUTE_KEEP_ORIGINAL
protected final java.lang.String ATTRIBUTE_COMPOUND_FILES
protected final java.lang.String ATTRIBUTE_AUTO_OPTIMIZE
protected static final java.lang.String ELEMENT_NAME_OPTIMIZE
protected static final java.lang.String ELEMENT_NAME_INDEX_SPLIT
protected final java.lang.String ATTRIBUTE_SPLIT_SIZE
protected final java.lang.String ATTRIBUTE_SPLIT_UNIT
protected final java.lang.String ATTRIBUTE_SPLIT_DOC
public boolean useMetadata
protected static final java.lang.String PROPERTY_NAME_REPO
protected static final java.lang.String PROPERTY_NAME_MIMETYPE
protected static final java.lang.String PROPERTY_NAME_CONTENT_LENGTH
protected final java.lang.String PROPERTY_NAME_DOCTYPE
public static final java.lang.String INTERNAL_FIELD_NAME_SDXDOCID
public static final java.lang.String INTERNAL_FIELD_NAME_SDXALL
public static final java.lang.String INTERNAL_SDXALL_FIELD_VALUE
public static final java.lang.String INTERNAL_FIELD_NAME_SDXAPPID
public static final java.lang.String INTERNAL_FIELD_NAME_SDXDBID
public static final java.lang.String INTERNAL_FIELD_NAME_SDXREPOID
public static final java.lang.String INTERNAL_FIELD_NAME_SDXDOCTYPE
public static final java.lang.String INTERNAL_FIELD_NAME_SDXMODDATE
public static final java.lang.String INTERNAL_FIELD_NAME_SDXCONTENTLENGTH
public static final java.lang.String INTERNAL_FIELD_NAME_SDX_OAI_DELETED_RECORD
Constructor Detail |
---|
public AbstractDocumentBase()
Method Detail |
---|
public boolean isDefault()
true
if this document base is the default in the application.
isDefault
in interface DocumentBase
public int getOAIRepositoriesSize()
getOAIRepositoriesSize
in interface DocumentBase
public final boolean isUseMetadata()
true
or false
if this document base should use metadata or not
public int getDefaultHitsPerPage()
DocumentBase
getDefaultHitsPerPage
in interface DocumentBase
public int getDefaultMaxSort()
DocumentBase
getDefaultMaxSort
in interface DocumentBase
public Pipeline getIndexationPipeline()
getIndexationPipeline
in interface DocumentBase
public java.lang.String getMimeType(Document doc) throws SDXException
getMimeType
in interface DocumentBase
doc
- The document.
SDXException
protected void configurePipeline(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
public void getDocument(ParsableDocument doc, org.apache.cocoon.xml.XMLConsumer consumer) throws SDXException
getDocument
in interface DocumentBase
doc
- consumer
-
SDXException
public void getDocument(Document doc, java.io.OutputStream os) throws SDXException
getDocument
in interface DocumentBase
doc
- os
-
SDXException
public java.io.InputStream getDocument(Document doc) throws SDXException
getDocument
in interface DocumentBase
doc
-
SDXException
public Repository getDefaultRepository()
getDefaultRepository
in interface DocumentBase
public Repository getRepository(java.lang.String id) throws SDXException
getRepository
in interface DocumentBase
id
- The repository's id, if null
for the default repository is returned
SDXException
public OAIRepository createOAIRepository(java.lang.String repo) throws org.apache.avalon.framework.configuration.ConfigurationException
repo
- String The id of the repository to create
org.apache.avalon.framework.configuration.ConfigurationException
public OAIRepository createOAIRepository() throws org.apache.avalon.framework.configuration.ConfigurationException
createOAIRepository
in interface DocumentBase
org.apache.avalon.framework.configuration.ConfigurationException
public OAIRepository getOAIRepository(java.lang.String repo)
getOAIRepository
in interface DocumentBase
repo
- String The repository id
public OAIRepository getOAIRepository()
DocumentBase
getOAIRepository
in interface DocumentBase
getDefaultOAIRepository()
public OAIRepository getDefaultOAIRepository()
public OAIHarvester getOAIHarvester()
getOAIHarvester
in interface DocumentBase
protected void addOAIRepository(OAIRepository _repo, org.apache.avalon.framework.configuration.Configuration _conf, java.lang.String _repoid)
_repo
- _conf
- _repoid
- protected void addOaiDeletedRecord(IndexableDocument doc) throws SDXException
doc
- The indexable document to add to the list
SDXException
managedOaiDeletedRecord(IndexableDocument, String)
protected void removeOaiDeletedRecord(IndexableDocument doc) throws SDXException
doc
- The indexable document to remove from the list
SDXException
managedOaiDeletedRecord(IndexableDocument, String)
protected void managedOaiDeletedRecord(IndexableDocument doc, java.lang.String action) throws SDXException
action
- Actions are: add
or remove
SDXException
protected void optimizeDatabase() throws SDXException
SDXException
protected void optimizeRepositories() throws SDXException
SDXException
protected void releasePooledRepositoryConnections() throws SDXException
SDXException
protected RepositoryConnection getPooledRepositoryConnection(java.lang.String repoId) throws SDXException
SDXException
protected DatabaseEntity createEntityForDocMetaData(Document doc, Repository repository, java.lang.String[] parentDocId) throws SDXException
SDXException
public void delete(Document doc, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
delete
in interface DocumentBase
doc
- The document to delete.handler
- A content handler to feed with information.
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
protected void deletePhysicalDocument(Document doc, Repository repo, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
doc
- handler
-
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
public IDGenerator getIdGenerator()
protected boolean initToSax()
AbstractSdxObject
initToSax
in class DatabaseBacked
protected void initVolatileObjectsToSax()
initVolatileObjectsToSax
in class DatabaseBacked
public void backup(SaveParameters save_config) throws SDXException
backup
in interface Saveable
SDXException
Saveable.backup(fr.gouv.culture.sdx.utils.save.SaveParameters)
public void restore(SaveParameters save_config) throws SDXException
restore
in interface Saveable
SDXException
Saveable.restore(fr.gouv.culture.sdx.utils.save.SaveParameters)
public org.apache.excalibur.source.SourceValidity getSourceValidity()
getSourceValidity
in interface DocumentBase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |