org.xiruss.repository.api
Interface StorageObject

All Superinterfaces:
RepositoryObject, Version
All Known Subinterfaces:
FileStorageObject, TextStorageObject, XmlStorageObject
All Known Implementing Classes:
CompoundDocumentStorageObject, CompoundDocumentStorageObjectProxy, StorageObjectBase, StorageObjectProxy, TextStorageObjectBase, TextStorageObjectProxy, XmlStorageObjectBase, XmlStorageObjectProxy

public interface StorageObject
extends Version

A storage object is a Version that has the priveledged property "content" that contains an arbitrarily large byte stream. The StorageObject interface provides access to those bytes. Importers should set the property: XirussRepositoryConst.ObjPropNames.MIME_TYPE When characters are written to the storage object.


Method Summary
 boolean canWrite()
          Checks if the storage object can be written to (because it is not fixed and is not already open).
 void close()
          Closes the storage object if it has been opened for writing via getWriter();
 byte[] getBytes()
          Gets the bytes of the storage object's content (as distinct from its other properties).
 java.lang.String getMimeType()
          Returns the MIME type of the storage object.
 java.lang.String getOriginalSystemId()
          Gets the value of the original system ID property, if any.
 long length()
          Returns the length, in bytes, of the storage object content
 java.io.InputStream openInputStream()
           
 java.io.OutputStream openOutputStream()
          Opens an output stream for writing to the storage object.
 void setStorageObjectData(StorageObjectData data)
          Sets the storage object data object that provides access to the data as managed by the repository's storage manager.
 
Methods inherited from interface org.xiruss.snapcm.api.Version
addDependency, addNextVersion, addPreviousVersion, checkIsNotFixed, collectTargetVersions, dependsOn, dependsOn, getDependencies, getDependenciesByType, getNext, getPrevious, getResource, initialize, initialize, isFixed, setAsFixed, setPrevious
 
Methods inherited from interface org.xiruss.snapcm.api.RepositoryObject
accept, compareTo, getId, getName, getProperties, getProperty, getPropertyNames, getRepository, getType, hasProperty, initialize, isNull, setId, setName, setProperty, toString
 

Method Detail

getBytes

byte[] getBytes()
                throws java.io.IOException
Gets the bytes of the storage object's content (as distinct from its other properties).

Returns:
Byte array
Throws:
java.io.IOException

getOriginalSystemId

java.lang.String getOriginalSystemId()
Gets the value of the original system ID property, if any. For storage objects created via import from some other storage system, captures the original storage location of the storage object.

Returns:
String representing the system ID. The syntax of the system ID will reflect the details of the original storage system (i.e., Windows filename, URL, Unix path, etc.).

length

long length()
Returns the length, in bytes, of the storage object content

Returns:

getMimeType

java.lang.String getMimeType()
Returns the MIME type of the storage object. The default is "unknown/unknown".

Returns:
MIME type string.

openOutputStream

java.io.OutputStream openOutputStream()
                                      throws VersionMutationException,
                                             java.io.IOException
Opens an output stream for writing to the storage object. Writing will replace any existing content.

Returns:
Output stream to which bytes can be written.
Throws:
VersionMutationException - if version is fixed.
java.io.IOException - if storage object is already open.

close

void close()
           throws java.io.IOException
Closes the storage object if it has been opened for writing via getWriter();

Throws:
java.io.IOException

canWrite

boolean canWrite()
Checks if the storage object can be written to (because it is not fixed and is not already open).

Returns:
true if storage object can be written to.

setStorageObjectData

void setStorageObjectData(StorageObjectData data)
Sets the storage object data object that provides access to the data as managed by the repository's storage manager.

Parameters:
data - StorageObjectData instance

openInputStream

java.io.InputStream openInputStream()
                                    throws java.io.IOException
Throws:
java.io.IOException