|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Generic document storer.
Implementations of this interface provide the capability of storing documents within document storage systems. The term document is used in a very generic sense, referring to any object that contains data that can be read and/or written. The term document storage system (or document storer) is a generic term referring to any kind of system or device that is capable of storing and retrieving documents.
import tribble.search.*; public class MyDocStorer implements tribble.search.DocumentStorerI { ... }
A document storer allows client classes to create and store documents. Information (a.k.a. attributes) about each new document can be established, as well as it data contents.
Examples of the kinds of entities handled by document storer implementations
include:
The store()
method of a document storer object writes and
commits the document data and its associated attributes to the storage system.
MyDocStorer stor; Hashtable props; WritableDocumentI doc; OutputStream docData; // Create and initialize a new document storer object stor = new MyDocStorer(...); props = new Hashtable(); props.put(..., ...); stor.initialize(props); stor.open("foo"); // Create a new document doc = stor.create("bar", false); docData = doc.getOutputStream(); docData.write(...); docData.close(); doc.setAttribute(..., ...); // Store the new document stor.storestore(doc); // Finish stor.close();
The remove()
method deletes a named document from the storage
system.
DocumentI
,
DocumentFilterI
,
DocumentSearcherI
Field Summary | |
static java.lang.String |
REV
Revision information. |
static int |
SERIES
Series number. |
Method Summary | |
void |
close()
Close this document storer. |
WritableDocumentI |
create(java.lang.String name,
boolean append)
Create a new document in the document storage system. |
void |
createDirectory(java.lang.String name)
Create a new directory in the document storage system. |
void |
initialize(java.util.Hashtable parms)
Initialize this document storer. |
void |
open(java.lang.String path)
Open a given storage path for this document storer. |
void |
remove(java.lang.String name)
Remove a document from the document storage system. |
void |
removeDirectory(java.lang.String name)
Remove a directory from the document storage system. |
void |
store(DocumentI doc)
Store a document into the document storage system. |
Field Detail |
public static final java.lang.String REV
public static final int SERIES
Method Detail |
public void initialize(java.util.Hashtable parms) throws java.lang.Exception
This must be the first method to be called on this document storer object,
prior to calling the open()
method.
The implementation of this interface may allow this method to be called more than once.
parms
- A hash table containing name/value pairs with which to initialize this
document storer. This argument may be allowed to be null, depending on
the implementation of this interface.
java.lang.Exception
- Thrown if the specified hash table entries are malformed, or if some other
error occurs.open(java.lang.String)
public void open(java.lang.String path) throws java.lang.Exception
path
- The name of a path (which can be anything meaningfully interpreted as a
path or device, such as a filename or URL) specifying the
location that this document storer is to write new documents to.
java.lang.Exception
- Thrown if the specified path does not exist or is not accessible, or if it
is malformed, or if some other error occurs.close()
,
initialize(java.util.Hashtable)
public void close() throws java.lang.Exception
This must be the last method to be called on this document storer object.
java.lang.Exception
- Thrown if an error occurs.open(java.lang.String)
public WritableDocumentI create(java.lang.String name, boolean append) throws java.lang.Exception, java.lang.UnsupportedOperationException
It is up to the implementation of this interface how it creates a new
document. In particular, space for the new document may or may not
actually be allocated in the storage system until the
store()
method is called.
name
- The name of the new document to create. Whether or not this name
constitutes a meaningful and valid document name is determined by the
implementation of this interface.append
- Specifies whether or not to append written data to the end of the new
document if it already exists. The interpretation of this flag is
determined by the implementation of this interface.
java.lang.Exception
- Thrown if the document name is malformed, or if the document already
exists and cannot be overwritten, or if some other error occurs.
java.lang.UnsupportedOperationException
- (unchecked)
Thrown if the append mode specified is not supported by this document
storer.store(tribble.search.DocumentI)
,
remove(java.lang.String)
,
createDirectory(java.lang.String)
public void createDirectory(java.lang.String name) throws java.lang.Exception, java.lang.UnsupportedOperationException
It is up to the implementation of this interface whether or not it supports directories and subdirectories and how it creates them if it does.
name
- The name of the new directory to create. Whether or not this name
constitutes a meaningful and valid directory name is determined by the
implementation of this interface.
java.lang.Exception
- Thrown if the directory name is malformed, or if the directory already
exists, or if the new directory cannot be creaed, or if some other error
occurs.
java.lang.UnsupportedOperationException
- (unchecked)
Thrown if this method is not supported by this document storer.create(java.lang.String, boolean)
,
removeDirectory(java.lang.String)
public void store(DocumentI doc) throws java.lang.Exception
It is up to the implementation of this interface how it stores a new document.
doc
- The document to store into the document storage system. This should be a
document object previously returned by create()
.
java.lang.Exception
- Thrown if the document is malformed, or if the document cannot be written
into the storage system, or if some other error occurs.create(java.lang.String, boolean)
public void remove(java.lang.String name) throws java.lang.Exception, java.lang.UnsupportedOperationException
It is up to the implementation of this interface how it removes a document.
name
- The name of the new document to remove. Whether or not this name
constitutes a meaningful and valid document name is determined by the
implementation of this interface.
java.lang.Exception
- Thrown if the document name is malformed, or if the document does not
exist, or if the document cannot be removed, or if some other error
occurs.
java.lang.UnsupportedOperationException
- (unchecked)
Thrown if this method is not supported by this document storer.create(java.lang.String, boolean)
,
removeDirectory(java.lang.String)
public void removeDirectory(java.lang.String name) throws java.lang.Exception, java.lang.UnsupportedOperationException
It is up to the implementation of this interface whether or not it supports directories and subdirectories and how it removes them if it does.
name
- The name of the existing directory to remove. Whether or not this name
constitutes a meaningful and valid directory name is determined by the
implementation of this interface.
java.lang.Exception
- Thrown if the directory name is malformed, or if the directory does not
exist, or if the new directory cannot be removed, or if some other error
occurs.
java.lang.UnsupportedOperationException
- (unchecked)
Thrown if this method is not supported by this document storer.createDirectory(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |