|
|||||||||
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.repository.AbstractRepository
public abstract class AbstractRepository
A basic implementation of a repository.
This abstract implementation handles the super.getLog(), the id and null operations for connections.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.repository.Repository |
---|
Repository.ConfigurationNode |
Field Summary | |
---|---|
protected boolean |
isDefault
True if this is a default repository for an application. |
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.repository.Repository |
---|
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 | |
---|---|
AbstractRepository()
|
Method Summary | |
---|---|
void |
add(Document doc,
RepositoryConnection c)
Does param checks for subclasses |
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 |
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 |
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 |
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 |
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
---|
configure, configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, initToSax, initVolatileObjectsToSax, 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.repository.Repository |
---|
empty, exists, getConnection, init, lists, size |
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.utils.save.Saveable |
---|
backup, restore |
Field Detail |
---|
protected boolean isDefault
Constructor Detail |
---|
public AbstractRepository()
Method Detail |
---|
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.ConfigurationException
we should link to this in the future when we have better documentation capabilities
public void releaseConnection(RepositoryConnection c) throws SDXException
releaseConnection
in interface Repository
c
- The connection to release.
SDXException
public boolean isDefault()
Repository
isDefault
in interface Repository
public void delete(Document doc, RepositoryConnection c) throws SDXException
delete
in interface Repository
doc
- The document to delete.
SDXException
public void add(Document doc, RepositoryConnection c) throws SDXException
add
in interface Repository
doc
- The document to add.c
- A connection to the repository.
SDXException
public java.io.InputStream openStream(Document doc, java.lang.String encoding, RepositoryConnection c) throws SDXException
openStream
in interface Repository
doc
- The document to read.encoding
- Should be null
as not verified here, but in subClasses with checkEncoding() method.c
- A connection to the repository.
SDXException
public void get(Document doc, java.io.OutputStream os, RepositoryConnection c) throws SDXException
get
in interface Repository
doc
- The document to read.os
- The output stream where to write.c
- A connection to the repository.
SDXException
public void toSAX(ParsableDocument doc, org.apache.cocoon.xml.XMLConsumer consumer, RepositoryConnection c) throws SDXException
toSAX
in interface Repository
doc
- 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.
SDXException
public void setIsDefault(boolean b)
setIsDefault
in interface Repository
protected java.lang.String checkEncoding(java.lang.String encoding) throws SDXException
encoding
-
SDXException
public void checkConnection(RepositoryConnection c) throws SDXException
SDXException
public void optimize() throws SDXException
Repository
optimize
in interface Repository
SDXException
protected java.lang.String getClassNameSuffix()
AbstractSdxObject
getClassNameSuffix
in class AbstractSdxObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |