public abstract class AbstractDatabaseBackedRepository extends DatabaseBacked implements Repository
This abstract implementation handles the super.getLog(), the id and null operations for connections.
Repository.ConfigurationNode| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isDefault
True if this is a default repository for an application.
|
_database, CLASS_NAME_SUFFIX, DATABASE_DIR_NAME, databaseConf, dbLocation, dbPath, DEFAULT_DATABASE_TYPE_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitializedCLASS_NAME_SUFFIX, PACKAGE_QUALNAMEDEFAULT_ENCODINGALL_SAVE_ATTRIB, PATH_ATTRIB, SAVE_DIRECTORY_PARAM| Constructor and Description |
|---|
AbstractDatabaseBackedRepository() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Document doc,
RepositoryConnection c)
Does param checks for subclasses
|
void |
backup(SaveParameters save_config)
Save the repository
|
void |
checkConnection(RepositoryConnection c) |
protected java.lang.String |
checkEncoding(java.lang.String encoding)
Verifies an encoding string,
if not supported by JVM default is used, UTF-8.
|
void |
delete(Document doc,
RepositoryConnection c)
Does param checks for subclasses
|
boolean |
exists(java.lang.String id,
RepositoryConnection conn) |
void |
get(Document doc,
java.io.OutputStream os,
RepositoryConnection c)
Does param checks for subclasses
|
protected java.lang.String |
getClassNameSuffix()
Sub classes should element this method to return their class name suffix for SAX output
|
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 whether it is a default repository for an application.
|
protected void |
loadBaseConfiguration(org.apache.avalon.framework.configuration.Configuration configuration)
Loads base configuration common to all repositories.
|
java.io.InputStream |
openStream(Document doc,
java.lang.String encoding,
RepositoryConnection c)
Does param checks for subclasses
|
void |
optimize()
Utility method for repository maintenance,
normally used to optimize indices of Lucene based repositories
It is the responsibility of the Repository to ensure that
unnecessary optimizations are not performed when this method
is called.
|
void |
releaseConnection(RepositoryConnection c)
Releases a previously opened connection.
|
void |
restore(SaveParameters save_config)
Restore the repository
|
void |
setIsDefault(boolean b)
Sets the isDefault flag for the repository
|
void |
toSAX(ParsableDocument doc,
org.apache.cocoon.xml.XMLConsumer consumer,
RepositoryConnection c)
Does param checks for subclasses
|
configure, configure, getDatabase, initconfigureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResourcesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitempty, getConnection, init, lists, sizegetId, setIdgetDescription, setDescriptiongetEncoding, setEncodinggetLocale, getXmlLang, setLocale, setXmlLangprotected boolean isDefault
protected void loadBaseConfiguration(org.apache.avalon.framework.configuration.Configuration configuration)
throws org.apache.avalon.framework.configuration.ConfigurationException
configuration - The configuration object
The parameter required are an id for the repository, an optional attribute
indicating if the repository is the default within a document base is also handled
but the default if not specified will be false.configuration - The configuration for this repository (based on a xml file).
Sample configuration entry:
<sdx:repository sdx:type = "FS" sdx:id = "myRepoId" baseDirectory = "baseDirName" depth = "2" extent = "50"/>
org.apache.avalon.framework.configuration.ConfigurationExceptionwe should link to this in the future when we have better documentation capabilitiespublic void releaseConnection(RepositoryConnection c) throws SDXException
releaseConnection in interface Repositoryc - The connection to release.SDXExceptionpublic boolean isDefault()
RepositoryisDefault in interface Repositorypublic void delete(Document doc, RepositoryConnection c) throws SDXException
delete in interface Repositorydoc - The document to delete.SDXExceptionpublic void add(Document doc, RepositoryConnection c) throws SDXException
add in interface Repositorydoc - The document to add.c - A connection to the repository.SDXExceptionpublic java.io.InputStream openStream(Document doc, java.lang.String encoding, RepositoryConnection c) throws SDXException
openStream in interface Repositorydoc - The document to read.encoding - Should be null as not verified here, but in subClasses with checkEncoding() method.c - A connection to the repository.SDXExceptionpublic void get(Document doc, java.io.OutputStream os, RepositoryConnection c) throws SDXException
get in interface Repositorydoc - The document to read.os - The output stream where to write.c - A connection to the repository.SDXExceptionpublic void toSAX(ParsableDocument doc, org.apache.cocoon.xml.XMLConsumer consumer, RepositoryConnection c) throws SDXException
toSAX in interface Repositorydoc - The document.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);
c - A connection to the repository.SDXExceptionpublic void setIsDefault(boolean b)
setIsDefault in interface Repositoryprotected java.lang.String checkEncoding(java.lang.String encoding)
throws SDXException
encoding - SDXExceptionpublic void checkConnection(RepositoryConnection c) throws SDXException
SDXExceptionpublic void optimize()
throws SDXException
Repositoryoptimize in interface RepositorySDXExceptionpublic boolean exists(java.lang.String id,
RepositoryConnection conn)
exists in interface Repositoryprotected java.lang.String getClassNameSuffix()
AbstractSdxObjectgetClassNameSuffix in class DatabaseBackedprotected boolean initToSax()
AbstractSdxObjectinitToSax in class DatabaseBackedprotected void initVolatileObjectsToSax()
initVolatileObjectsToSax in class DatabaseBackedpublic void backup(SaveParameters save_config) throws SDXException
backup in interface SaveableSDXExceptionSaveable.backup(fr.gouv.culture.sdx.utils.save.SaveParameters)public void restore(SaveParameters save_config) throws SDXException
restore in interface SaveableSDXExceptionSaveable.restore(fr.gouv.culture.sdx.utils.save.SaveParameters)Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.