|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tribble.repository.AbstractDocument tribble.repository.AbstractStorableDocument
public abstract class AbstractStorableDocument
Generic storable repository document.
A repository document is composed of content data (such as an image, text, or other kind of user data) and zero or more properties.
Most of the methods in this base class that implement the
Document
interface do not throw any checked exceptions.
Field Summary | |
---|---|
protected java.io.InputStream |
m_in
Input stream containing the contents of this document. |
Fields inherited from class tribble.repository.AbstractDocument |
---|
m_id, m_props, m_propVals, m_size |
Constructor Summary | |
---|---|
protected |
AbstractStorableDocument(DocumentProperty[] props)
Constructor. |
Method Summary | |
---|---|
void |
addProperty(DocumentProperty prop)
Add a property to this repository document. |
void |
close()
Close this repository document. |
protected void |
closeDataStream()
Close the input syteam for this repository document. |
void |
doneReading()
Indicate that reading of the input data stream for this repository document is complete. |
void |
setDataStream(java.io.InputStream in)
Establish the input data stream containing the contents of this repository document. |
void |
setID(java.lang.String id)
Establish the ID of this repository document. |
void |
setProperty(java.lang.String prop,
java.lang.Object val)
Set the value of a property in this repository document. |
void |
setSize(long len)
Establish the data size for this repository document. |
Methods inherited from class tribble.repository.AbstractDocument |
---|
checkOpen, finalize, getID, getProperties, getProperty, getSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface tribble.repository.Document |
---|
getDataStream, getID, getProperties, getProperty, getSize |
Field Detail |
---|
protected java.io.InputStream m_in
Constructor Detail |
---|
protected AbstractStorableDocument(DocumentProperty[] props)
props
- The properties which define the documents in the repository.Method Detail |
---|
protected void closeDataStream()
Note that this method can be called multiple times with no ill effects.
Note that this method does not throw any exceptions.
public void close()
Note that this method can be called multiple times with no ill effects.
Note that this method does not throw any exceptions.
close
in interface java.io.Closeable
close
in interface Document
close
in class AbstractDocument
public void setID(java.lang.String id) throws java.io.IOException, java.lang.UnsupportedOperationException
setID
in interface StorableDocument
id
- A name that identifies the document within the repository.
Whether or not this name is unique depends on the implementation.
This cannot be null.
java.io.IOException
- Thrown if an error occurred while accessing the document.
java.lang.UnsupportedOperationException
- (unchecked)
Thrown if this operation is not allowed by the implementation, i.e.,
if IDs are assigned to repository documents by some other means.
java.lang.NullPointerException
- (unchecked)
Thrown if id is null.
java.lang.IllegalStateException
- (unchecked)
Thrown if close()
has been called for this object.public void setSize(long len)
setSize
in interface StorableDocument
len
- The size (typically in bytes) of the document data, or -1 if the size is
not known.
java.lang.IllegalStateException
- (unchecked)
Thrown if close()
has been called for this object.public void setProperty(java.lang.String prop, java.lang.Object val) throws java.io.IOException
setProperty
in interface StorableDocument
prop
- The name of the document property to set.val
- The new property value.
java.io.IOException
- Thrown if an error occurred while modifying the document.
java.lang.IllegalStateException
- (unchecked)
Thrown if close()
has been called for this object.public void addProperty(DocumentProperty prop) throws java.lang.UnsupportedOperationException, java.io.IOException
addProperty
in interface StorableDocument
prop
- A property to add to this document.
java.io.IOException
- Thrown if the property already exists in this document, or if an error
occurred while modifying the document.
java.lang.UnsupportedOperationException
- (unchecked)
Thrown if this method is not supported by the implementation of this
interface.
java.lang.IllegalStateException
- (unchecked)
Thrown if close()
has been called for this object.public void setDataStream(java.io.InputStream in) throws java.io.IOException
setDataStream
in interface StorableDocument
in
- A binary data stream from which the contents of the document are to be
read. The reading occurs when the
RepositoryWriter.storeDocument()
method is called and passed this document object. The stream will be
closed (by calling its close() method) after the data is
completely read from the stream (i.e., its read() method returns
-1). The stream will also be closed (if it is still open) when this
document object's close()
method is called.
java.io.IOException
- Thrown if an error occurred while accessing the document.
java.lang.NullPointerException
- (unchecked)
Thrown if in is null.public void doneReading()
This method is called when the
RepositoryWriter.storeDocument()
method is called and passed this document object, once all of the content
data for the document has been read. The input stream is closed (by
calling its close()
method), and then this method is
called. Any other resources associated with this document should then be
deallocated.
doneReading
in interface StorableDocument
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |