com.xerox.bantam
Interface ContentDocument

All Superinterfaces:
javax.activation.DataSource, Document

public interface ContentDocument
extends Document, javax.activation.DataSource

An interface for a Document with associated content. In addition to properties, a ContentDocument contains a byte stream which may be stored in some private way by the Storage implementation or may be mapped to some object in an externally-visible repository. For example the content might be managed in a database along with the properties. Alternatively, the content might come from a resource managed by an HTTP server. A ContentDocument can function directly as a DataSource.

Version:
$Revision: 1.8 $, $Date: 2000/10/10 00:43:28 $
Author:
Keith Edwards

Method Summary
 boolean getCanRead()
          Return true if the content can be read.
 boolean getCanWrite()
          Return true if the content can be written.
 String getContentProvider()
          Returns the name of the content provider for this specific document.
 String getContentType()
          Return the MIME type of the content, in a string like text/plain or image/jpeg.
 InputStream getInputStream()
          Return an InputStream to read the content.
 Date getLastModified()
          Return last modification date for the content.
 long getLength()
          Return the length of the content in bytes.
 OutputStream getOutputStream()
          Return an OutputStream to write the content.
 Reader getReader()
          Return a Reader for the content.
 Writer getWriter()
          Return a Writer for the content.
 void setContentProvider(String name)
          Sets the content provider of this specific document.
 void setContentType(String mimeType)
          Set the MIME type of the content
 
Methods inherited from interface com.xerox.bantam.Document
addMultiValue, addMultiValue, clearProperty, clearProperty, conformsTo, containsValue, containsValue, delete, enforceSchema, enforceSchema, flush, get_all_property_names, getDescriptors, getEnforcedSchemas, getID, getMultiValues, getMultiValues, getName, getPropertyNames, getPropertyNames, getPropertyValue, getPropertyValue, getStorage, getUnenforcedPropertyNames, isEnforced, propertyExists, propertyExists, removeValue, removeValue, setMultiValues, setMultiValues, setName, setPropertyValue, setPropertyValue, unenforceSchema
 
Methods inherited from interface javax.activation.DataSource
getName
 

Method Detail

getContentProvider

public String getContentProvider()
                          throws StorageException
Returns the name of the content provider for this specific document.
Returns:
The name of the content provider (see Storage for a list of valid names).

setContentProvider

public void setContentProvider(String name)
                        throws StorageException
Sets the content provider of this specific document. The content provider defaults to the internal (database) repository. Once a given document's content has been set up on a given repository (e.g., by calling createContent or by calling getOutputStream or getWriter) then the repository cannot be reset.
Parameters:
name - The name of the content provider (see Storage for a list of valid names).

getContentType

public String getContentType()
Return the MIME type of the content, in a string like text/plain or image/jpeg. This cannot throw StorageException because it's really just a restatement of DataSource.getContentType().
Specified by:
getContentType in interface javax.activation.DataSource
Returns:
String the content type as a mime string

setContentType

public void setContentType(String mimeType)
                    throws StorageException
Set the MIME type of the content

getInputStream

public InputStream getInputStream()
                           throws IOException
Return an InputStream to read the content. This cannot throw StorageException because it's really just a restatement of DataSource.getInputStream().
Specified by:
getInputStream in interface javax.activation.DataSource
Returns:
InputStream on the content if readable, null otherwise

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Return an OutputStream to write the content. Any existing content is discarded by this operation. This cannot throw StorageException because it's really just a restatement of DataSource.getOutputStream().
Specified by:
getOutputStream in interface javax.activation.DataSource
Returns:
OutputStream on the content if writable, null otherwise

getReader

public Reader getReader()
                 throws StorageException
Return a Reader for the content.

getWriter

public Writer getWriter()
                 throws StorageException
Return a Writer for the content.

getLength

public long getLength()
               throws StorageException
Return the length of the content in bytes.

getCanRead

public boolean getCanRead()
                   throws StorageException
Return true if the content can be read.

getCanWrite

public boolean getCanWrite()
                    throws StorageException
Return true if the content can be written.

getLastModified

public Date getLastModified()
                     throws StorageException
Return last modification date for the content.

Project Harland