org.xiruss.xirussrepository.client
Class StorageObjectProxy

java.lang.Object
  extended by org.xiruss.xirussrepository.client.RepositoryObjectProxy
      extended by org.xiruss.xirussrepository.client.VersionProxy
          extended by org.xiruss.xirussrepository.client.StorageObjectProxy
All Implemented Interfaces:
StorageObject, RepositoryObject, Version
Direct Known Subclasses:
CompoundDocumentStorageObjectProxy, TextStorageObjectProxy

public class StorageObjectProxy
extends VersionProxy
implements StorageObject


Field Summary
 
Fields inherited from class org.xiruss.xirussrepository.client.RepositoryObjectProxy
cHelper, logger, objectTypeCode, pathToMe
 
Constructor Summary
StorageObjectProxy()
           
StorageObjectProxy(XirussHttpApiClientHelper helper, org.w3c.dom.Element dataSource)
           
 
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.
 void initialize(XirussHttpApiClientHelper helper, org.w3c.dom.Element dataSource)
           
 long length()
          Returns the length, in bytes, of the storage object content
protected  void loadStorageObjectData(XirussHttpApiClientHelper helper, org.w3c.dom.Element dataSource)
           
 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 class org.xiruss.xirussrepository.client.VersionProxy
addDependency, addNextVersion, addPreviousVersion, checkIsNotFixed, collectTargetVersions, dependsOn, dependsOn, getDependencies, getDependenciesByType, getNext, getPathInSnapshotContext, getPrevious, getResource, getVersionMapValue, initialize, initialize, isFixed, loadVersionData, setAsFixed, setPrevious
 
Methods inherited from class org.xiruss.xirussrepository.client.RepositoryObjectProxy
accept, compareTo, doPost, doStringReturnPost, equals, getBooleanValue, getId, getName, getOriginalClassName, getPathToMe, getProperties, getProperty, getPropertyNames, getRepository, getStringReturnValue, getStringSetReturnValue, getType, hasProperty, initialize, isNull, loadRepositoryObjectData, setId, setName, setProperty, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
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
 

Constructor Detail

StorageObjectProxy

public StorageObjectProxy()

StorageObjectProxy

public StorageObjectProxy(XirussHttpApiClientHelper helper,
                          org.w3c.dom.Element dataSource)
                   throws XirussRepositoryException
Throws:
XirussRepositoryException
Method Detail

loadStorageObjectData

protected void loadStorageObjectData(XirussHttpApiClientHelper helper,
                                     org.w3c.dom.Element dataSource)
                              throws XirussRepositoryException
Throws:
XirussRepositoryException

initialize

public void initialize(XirussHttpApiClientHelper helper,
                       org.w3c.dom.Element dataSource)
                throws XirussRepositoryException
Overrides:
initialize in class VersionProxy
Throws:
XirussRepositoryException

getBytes

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

Specified by:
getBytes in interface StorageObject
Returns:
Byte array
Throws:
java.io.IOException

getOriginalSystemId

public java.lang.String getOriginalSystemId()
Description copied from interface: StorageObject
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.

Specified by:
getOriginalSystemId in interface StorageObject
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

public long length()
Description copied from interface: StorageObject
Returns the length, in bytes, of the storage object content

Specified by:
length in interface StorageObject
Returns:

getMimeType

public java.lang.String getMimeType()
Description copied from interface: StorageObject
Returns the MIME type of the storage object. The default is "unknown/unknown".

Specified by:
getMimeType in interface StorageObject
Returns:
MIME type string.

openOutputStream

public java.io.OutputStream openOutputStream()
                                      throws VersionMutationException,
                                             java.io.IOException
Description copied from interface: StorageObject
Opens an output stream for writing to the storage object. Writing will replace any existing content.

Specified by:
openOutputStream in interface StorageObject
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

public void close()
           throws java.io.IOException
Description copied from interface: StorageObject
Closes the storage object if it has been opened for writing via getWriter();

Specified by:
close in interface StorageObject
Throws:
java.io.IOException

canWrite

public boolean canWrite()
Description copied from interface: StorageObject
Checks if the storage object can be written to (because it is not fixed and is not already open).

Specified by:
canWrite in interface StorageObject
Returns:
true if storage object can be written to.

setStorageObjectData

public void setStorageObjectData(StorageObjectData data)
Description copied from interface: StorageObject
Sets the storage object data object that provides access to the data as managed by the repository's storage manager.

Specified by:
setStorageObjectData in interface StorageObject
Parameters:
data - StorageObjectData instance

openInputStream

public java.io.InputStream openInputStream()
                                    throws java.io.IOException
Specified by:
openInputStream in interface StorageObject
Throws:
java.io.IOException