net.cnri.dobj
Interface StorageProxy


public interface StorageProxy

StorageProxy objects provide an interface to the storage layer of a registry for a single object.


Method Summary
 void appendDataElement(java.lang.String elementID, java.io.InputStream input)
          Appends data from the given InputStream to the data element for the given object ID.
 java.lang.String createObject(java.lang.String newObjectID)
          Creates a new digital object with the given ID, if one does not already exist.
 java.lang.String createObject(java.lang.String newObjectID, java.lang.String newObjectName)
          Creates a new digital object with the given ID, if one does not already exist.
 void deleteAttributes(java.lang.String[] attributeKeys)
          Remove the attributes with the given keys from the object.
 boolean deleteDataElement(java.lang.String elementID)
          Deletes the specified data element from the current object.
 void deleteElementAttributes(java.lang.String elementID, java.lang.String[] attributeKeys)
          Remove the attributes with the given keys from the element.
 void deleteObject()
          Deletes the current object object along with all data elements or files that are associated with it.
 void deserializeObject(java.lang.String format, java.io.InputStream in)
          Reset the object's state and re-initialize the object with the data in the given InputStream in the given format.
 boolean doesDataElementExist(java.lang.String elementID)
          Returns true if the given data element exists
 boolean doesObjectExist()
          Returns true if the given digital object exists.
 HeaderSet getAttributes(HeaderSet container)
          Get all of the key-value attributes that are associated with the object.
 java.io.InputStream getDataElement(java.lang.String elementID)
          Returns a stream for reading the identified data element for this object.
 HeaderSet getElementAttributes(java.lang.String elementID, HeaderSet container)
          Get all of the key-value attributes that are associated with the given element in the object.
 java.io.File getFileForDataElement(java.lang.String elementID)
          Returns the File in which the given data element is stored, if any.
 StorageProxy getObjectAccessor(java.lang.String objectID)
          Returns a StorageProxy for a different object in this Repository.
 java.lang.String getObjectID()
          Get the object identifier of the given object.
 java.lang.String getRepoID()
          Get the repository identifier of the repository for the given object.
 java.util.Enumeration listDataElements()
          Returns a list of the data elements associated with the current object.
 java.util.Enumeration listObjects()
          Returns an Enumeration of all of the objects in the repository.
 void serializeObject(java.lang.String format, java.io.OutputStream out)
          Serialize the entire object using the given format to the given stream
 void setAttributes(HeaderSet attributes)
          Set the given key-value attributes in the object, replacing any existing attributes that have the same keys.
 void setElementAttributes(java.lang.String elementID, HeaderSet attributes)
          Set the given key-value attributes for the given element in the object, replacing any existing attributes that have the same keys.
 void storeDataElement(java.lang.String elementID, java.io.InputStream input)
          Writes data from the given InputStream as the data element for the given object ID.
 

Method Detail

getObjectID

java.lang.String getObjectID()
Get the object identifier of the given object.


getRepoID

java.lang.String getRepoID()
Get the repository identifier of the repository for the given object.


getObjectAccessor

StorageProxy getObjectAccessor(java.lang.String objectID)
Returns a StorageProxy for a different object in this Repository.


doesObjectExist

boolean doesObjectExist()
                        throws DOException
Returns true if the given digital object exists.

Throws:
DOException

doesDataElementExist

boolean doesDataElementExist(java.lang.String elementID)
                             throws DOException
Returns true if the given data element exists

Throws:
DOException

getFileForDataElement

java.io.File getFileForDataElement(java.lang.String elementID)
                                   throws DOException
Returns the File in which the given data element is stored, if any. This can return null on servers where data elements are not stored in files. This is used where operators need to do more with a data element than simple read and write operations. Examples inlude indexes, databases, etc.

Throws:
DOException

createObject

java.lang.String createObject(java.lang.String newObjectID)
                              throws DOException
Creates a new digital object with the given ID, if one does not already exist. The caller must have permission to create a digital object, and this can only be called on the StorageProxy for the repository object itself. This returns the ID of the newly created object.

Throws:
DOException

createObject

java.lang.String createObject(java.lang.String newObjectID,
                              java.lang.String newObjectName)
                              throws DOException
Creates a new digital object with the given ID, if one does not already exist. This can only be ccalled on the StorageProxy for the repository object itself. This returns the ID of the newly created object.

Throws:
DOException

deleteObject

void deleteObject()
                  throws DOException
Deletes the current object object along with all data elements or files that are associated with it.

Throws:
DOException

listObjects

java.util.Enumeration listObjects()
                                  throws DOException
Returns an Enumeration of all of the objects in the repository.

Throws:
DOException

listDataElements

java.util.Enumeration listDataElements()
                                       throws DOException
Returns a list of the data elements associated with the current object.

Throws:
DOException

getDataElement

java.io.InputStream getDataElement(java.lang.String elementID)
                                   throws DOException
Returns a stream for reading the identified data element for this object.

Throws:
DOException

storeDataElement

void storeDataElement(java.lang.String elementID,
                      java.io.InputStream input)
                      throws java.lang.Exception
Writes data from the given InputStream as the data element for the given object ID.

Throws:
java.lang.Exception

appendDataElement

void appendDataElement(java.lang.String elementID,
                       java.io.InputStream input)
                       throws java.lang.Exception
Appends data from the given InputStream to the data element for the given object ID.

Throws:
java.lang.Exception

deleteDataElement

boolean deleteDataElement(java.lang.String elementID)
                          throws DOException
Deletes the specified data element from the current object. Returns true if the specified data element ever existed in the first place.

Throws:
DOException

getAttributes

HeaderSet getAttributes(HeaderSet container)
                        throws DOException
Get all of the key-value attributes that are associated with the object. If the given container is non-null then the attributes are put into it in order to avoid instantiating a new HeaderSet.

Returns:
a HeaderSet containing all of the attributes that are associated with the object
Throws:
DOException

getElementAttributes

HeaderSet getElementAttributes(java.lang.String elementID,
                               HeaderSet container)
                               throws DOException
Get all of the key-value attributes that are associated with the given element in the object. If the given container is non-null then the attributes are put into it in order to avoid instantiating a new HeaderSet.

Returns:
a HeaderSet containing all of the attributes that are associated with the element
Throws:
DOException

setAttributes

void setAttributes(HeaderSet attributes)
                   throws DOException
Set the given key-value attributes in the object, replacing any existing attributes that have the same keys. This will not remove any attributes from the object.

Throws:
DOException

setElementAttributes

void setElementAttributes(java.lang.String elementID,
                          HeaderSet attributes)
                          throws DOException
Set the given key-value attributes for the given element in the object, replacing any existing attributes that have the same keys. This will not remove any attributes from the element

Throws:
DOException

deleteAttributes

void deleteAttributes(java.lang.String[] attributeKeys)
                      throws DOException
Remove the attributes with the given keys from the object.

Throws:
DOException

deleteElementAttributes

void deleteElementAttributes(java.lang.String elementID,
                             java.lang.String[] attributeKeys)
                             throws DOException
Remove the attributes with the given keys from the element.

Throws:
DOException

serializeObject

void serializeObject(java.lang.String format,
                     java.io.OutputStream out)
                     throws DOException
Serialize the entire object using the given format to the given stream

Throws:
DOException

deserializeObject

void deserializeObject(java.lang.String format,
                       java.io.InputStream in)
                       throws DOException
Reset the object's state and re-initialize the object with the data in the given InputStream in the given format.

Throws:
DOException