|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Repository
A generic storage location for SDX documents.
When SDX indexes a document, it must make it available, for example send it as a stream or as SAX events. A repository is responsible for sending the document's contents and, possibly, to store it.
A repository can be read-only or not. TODO?: i think we have removed this option?-rbp If it is, documents can't be stored, they can only be retrieved. There are two main interests for read-only repositories : (1) to implement an SDX application on a read-only media such as a CD-ROM, the indexing may have been done before ; (2) for URL repositories, where the document can be distant and not writable.
A repository must be able to find a document only with the document's id. The manner in which it keeps track of these ids is implementation specific.
A repository must also manage a connection, even if it doesn't use it. A connection may be used to speed up batch operations.
To be usable, a repository object must created, a super.getLog() set, then configured and initialized.
Nested Class Summary | |
---|---|
static interface |
Repository.ConfigurationNode
|
Field Summary | |
---|---|
static java.lang.String |
CLASS_NAME_SUFFIX
String representation of the repository class name suffix. |
static java.lang.String |
PACKAGE_QUALNAME
String representation of the repository package name (including trailing separator "."). |
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 |
Method Summary | |
---|---|
void |
add(Document doc,
RepositoryConnection c)
Adds a document to the repository. |
void |
delete(Document doc,
RepositoryConnection c)
Deletes a document. |
void |
empty()
Deletes all documents from the repository. |
boolean |
exists(java.lang.String id,
RepositoryConnection conn)
|
void |
get(Document doc,
java.io.OutputStream os,
RepositoryConnection c)
Feeds a stream with a document. |
RepositoryConnection |
getConnection()
Returns a connection to the repository. |
void |
init()
Initializes the repository. |
boolean |
isDefault()
Returns whether it is a default repository for an application. |
void |
lists(org.xml.sax.ContentHandler hdl)
Lists the repository content as SAX events. |
java.io.InputStream |
openStream(Document doc,
java.lang.String encoding,
RepositoryConnection c)
Opens a stream to read a document. |
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 default flag for the repository |
long |
size()
Returns the number of documents within the repository. |
void |
toSAX(ParsableDocument doc,
org.apache.cocoon.xml.XMLConsumer consumer,
RepositoryConnection c)
Retrieves a SDX document as SAX events. |
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 |
---|
static final java.lang.String PACKAGE_QUALNAME
static final java.lang.String CLASS_NAME_SUFFIX
Method Detail |
---|
void init() throws SDXException
SDXException
RepositoryConnection getConnection() throws SDXException
SDXException
void releaseConnection(RepositoryConnection c) throws SDXException
c
- The connection to release.
SDXException
long size() throws SDXException
SDXException
void lists(org.xml.sax.ContentHandler hdl) throws SDXException
The exact structure is still to be defined, but it shoud be very simple, with only one element per document and a few properties as attributes.
hdl
- The SAX content handler to feed with events.
SDXException
void add(Document doc, RepositoryConnection c) throws SDXException
doc
- The document to add.c
- A connection to the repository.
SDXException
void empty() throws SDXException
SDXException
void delete(Document doc, RepositoryConnection c) throws SDXException
doc
- The document to delete.
SDXException
void toSAX(ParsableDocument doc, org.apache.cocoon.xml.XMLConsumer consumer, RepositoryConnection c) throws SDXException
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
java.io.InputStream openStream(Document doc, java.lang.String encoding, RepositoryConnection c) throws SDXException
doc
- The document to read.encoding
- The encoding to use for serialization of XML content (may be null).c
- A connection to the repository.
SDXException
void get(Document doc, java.io.OutputStream os, RepositoryConnection c) throws SDXException
doc
- The document to read.os
- The output stream where to write.c
- A connection to the repository.
SDXException
boolean isDefault()
void setIsDefault(boolean b)
void optimize() throws SDXException
SDXException
boolean exists(java.lang.String id, RepositoryConnection conn)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |