|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Repository<DocType extends Document>
Generic document repository (base class).
This interface contains the basic methods for implementing a document repository application. Such an application is responsible for managing a document storage system (or repository) that allows clients to store or retrieve documents from it. How the repository system is implemented and what exactly constitutes a document is determined by each particular subclass that implements this interface.
A document consists of content data (such as an image, text, or other kind of user data) and zero or more properties. Typically, the properties comprise the keys used to store the document in the repository system.
Implementations of a repository system must subclass either the
RepositoryReader
or RepositoryWriter
class, or both.
Repository reader implementations must also subclass the Document
class, while repository writer implementations must subclass the
StorableDocument
class.
Configuration properties specific to the repository implementation are passed
to the initialize()
method in order to initialize the
repository reader or writer appropriately. Once the repository reader or
writer has been properly initialized, calling its open()
method
establishes a connection to the repository system. Documents can then be
retrieved from or stored into the repository. After all repository operations
have been completed, the close()
method must be called, which
closes the connection to the repository system and deallocates any resources
used by the reader/writer object.
Most of the methods in these classes throw an IOException if an error occurs.
Note: This requires Java 1.5 or later.
Document
,
RepositoryReader
,
RepositoryWriter
Field Summary | |
---|---|
static java.lang.String |
REV
|
Method Summary | |
---|---|
void |
close()
Close the connection and detach the repository system from this repository handler. |
DocumentProperty[] |
getDefaultProperties()
Retrieve the default properties for documents managed by this repository handler. |
void |
initialize(java.util.Hashtable props)
Load the application configuration properties for this repository handler. |
void |
open(java.lang.String name)
Establish a connection and attach a repository system to this repository handler. |
Field Detail |
---|
static final java.lang.String REV
Method Detail |
---|
void initialize(java.util.Hashtable props) throws java.io.IOException
open()
or any other method.
The name and format of the properties is determined by the actual
implementation of the repository system. Typically, properties specify
the details required to establish a connection to the repository system,
e.g., host or path names, user-ID and password credentials, database
names, and other similar information. The properties passed to this
method thus establish a specific context in which access to the repository
system takes place. This context exists for all of the operations
occurring between the calls to open()
and
close()
.
Certain implementations might not require any context information at all
prior to calling open()
, in which case this method may
accept an empty or null Hashtable object.
Implementations may allow this method to be called more than once. This could be useful in cases where configuration information is taken from multiple sources.
props
- Configuration properties (hash table) to initialize the repository reader.
Typically this is a Properties
object.
Some implementations may allow this to be empty or null.
java.io.IOException
- Thrown if a required property is missing or malformed.void open(java.lang.String name) throws java.io.IOException
name
- Name of the document collection within the repository to be opened.
The format and meaning of this name is determined by the implementation.
Some implementations may allow this to be empty ("") or null.
java.io.IOException
- Thrown if an error occurs while opening the repository system.
java.lang.IllegalStateException
- (unchecked)
Thrown if initialize()
has not been called yet.void close()
Any subsequent attempts to use this repository handler without calling
open()
again will result in exceptions.
Note that this method does not throw any exceptions.
close
in interface java.io.Closeable
DocumentProperty[] getDefaultProperties() throws java.io.IOException
Note that implementations are not required to support default document properties, in which case this method can throw an UnsupportedOperationException or simply return null.
java.lang.IllegalStateException
- (unchecked)
Thrown if initialize()
has not been called yet.
java.lang.UnsupportedOperationException
- (unchecked)
This operation is not supported, i.e., the implementation does not support
default document properties.
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |