fedora.server.storage
Class SimpleDOWriter

java.lang.Object
  extended by fedora.server.storage.SimpleDOReader
      extended by fedora.server.storage.SimpleDOWriter
All Implemented Interfaces:
DOReader, DOWriter

public class SimpleDOWriter
extends SimpleDOReader
implements DOWriter

A DigitalObject-backed DOWriter.

This interface supports transaction behavior with the commit(String) and rollBack() methods. When a DOWriter is instantiated, there is an implicit transaction. Write methods may be called, but they won't affect the the underlying data store until commit(String) is invoked. This also has the effect of creating another implicit transaction. If temporary changes are no longer wanted, rollBack() may be called to return the object to it's original form. rollBack() is only valid for the current transaction.

The read methods of DOWriter reflect on the composition of the object in the context of the current transaction.

Version:
$Id: SimpleDOWriter.java 5351 2006-12-07 13:04:02Z rlw $
Author:
cwilper@cs.cornell.edu

Constructor Summary
SimpleDOWriter(Context context, DefaultDOManager mgr, DOTranslator translator, java.lang.String exportFormat, java.lang.String encoding, DigitalObject obj)
           
 
Method Summary
 void addDatastream(Datastream datastream, boolean addNewVersion)
          Adds a datastream to the object.
 void addDisseminator(Disseminator disseminator)
          Adds a disseminator to the object.
 void commit(java.lang.String logMessage)
          Saves the changes thus far to the permanent copy of the digital object.
 void invalidate()
          Marks this DOWriter handle invalid (unusable).
 boolean isCommitted()
          Marks whether the object has been successfully committed.
 boolean isNew()
          Marks whether the object is new.
 java.lang.String newAuditRecordID()
          Generate a unique id for an audit record.
 java.lang.String newDatastreamBindingMapID()
          Generate a unique id for a datastreamBindingMap.
 java.lang.String newDatastreamID()
          Generate a unique id for a datastream.
 java.lang.String newDatastreamID(java.lang.String dsID)
          Generate a unique id for a datastream version.
 java.lang.String newDisseminatorID()
          Generate a unique id for a disseminator.
 java.lang.String newDisseminatorID(java.lang.String dissID)
          Generate a unique id for a disseminator version.
 void remove()
          Removes the entire digital object.
 java.util.Date[] removeDatastream(java.lang.String id, java.util.Date start, java.util.Date end)
          Removes a datastream from the object.
 java.util.Date[] removeDisseminator(java.lang.String id, java.util.Date start, java.util.Date end)
          Removes a disseminator from the object.
 void setDatastreamState(java.lang.String datastreamID, java.lang.String dsState)
          Sets the state for all versions of the specified datastream.
 void setDatastreamVersionable(java.lang.String datastreamID, boolean versionable)
          Sets the indicator as to whether the datastream is subject to versioning.
 void setDisseminatorState(java.lang.String disseminatorID, java.lang.String dissState)
          Sets the state for all versions of the specified disseminator.
 void setLabel(java.lang.String label)
          Sets the label of the digital object.
 void setOwnerId(java.lang.String ownerId)
          Sets the ownerId for the digital object.
 void setState(java.lang.String state)
          Sets the state of the entire digital object.
 
Methods inherited from class fedora.server.storage.SimpleDOReader
ExportObject, getAuditRecords, GetBehaviorDefs, getContentModelId, getCreateDate, GetDatastream, getDatastream, GetDatastreams, getDatastreamVersions, getDisseminationBindingInfo, GetDisseminator, GetDisseminators, getDisseminatorVersions, GetDSBindingMaps, getFedoraObjectType, getLastModDate, getObjectHistory, GetObjectLabel, getObjectMethodParms, GetObjectPID, GetObjectState, GetObjectXML, getOwnerId, getWhenString, ListDatastreamIDs, ListDisseminatorIDs, listMethods, listMethods
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fedora.server.storage.DOReader
ExportObject, getAuditRecords, GetBehaviorDefs, getContentModelId, getCreateDate, GetDatastream, getDatastream, GetDatastreams, getDatastreamVersions, getDisseminationBindingInfo, GetDisseminator, GetDisseminators, getDisseminatorVersions, GetDSBindingMaps, getFedoraObjectType, getLastModDate, getObjectHistory, GetObjectLabel, getObjectMethodParms, GetObjectPID, GetObjectState, GetObjectXML, getOwnerId, ListDatastreamIDs, ListDisseminatorIDs, listMethods, listMethods
 

Constructor Detail

SimpleDOWriter

public SimpleDOWriter(Context context,
                      DefaultDOManager mgr,
                      DOTranslator translator,
                      java.lang.String exportFormat,
                      java.lang.String encoding,
                      DigitalObject obj)
Method Detail

setState

public void setState(java.lang.String state)
              throws ObjectIntegrityException
Description copied from interface: DOWriter
Sets the state of the entire digital object.

Specified by:
setState in interface DOWriter
Parameters:
state - The state.
Throws:
ObjectIntegrityException

setOwnerId

public void setOwnerId(java.lang.String ownerId)
                throws ObjectIntegrityException
Description copied from interface: DOWriter
Sets the ownerId for the digital object.

Specified by:
setOwnerId in interface DOWriter
Parameters:
ownerId - The ownerId.
Throws:
ObjectIntegrityException

setDatastreamState

public void setDatastreamState(java.lang.String datastreamID,
                               java.lang.String dsState)
                        throws ServerException
Description copied from interface: DOWriter
Sets the state for all versions of the specified datastream.

Specified by:
setDatastreamState in interface DOWriter
Parameters:
datastreamID - The datastream id.
dsState - The state.
Throws:
ServerException - If any type of error occurred fulfilling the request.

setDatastreamVersionable

public void setDatastreamVersionable(java.lang.String datastreamID,
                                     boolean versionable)
                              throws ServerException
Description copied from interface: DOWriter
Sets the indicator as to whether the datastream is subject to versioning. In Fedora 2.0, the system will not operate on this indicator and all datastreams will be versioned by default.

Specified by:
setDatastreamVersionable in interface DOWriter
Parameters:
datastreamID - The datastream id.
versionable - a boolean indicating if versionable
Throws:
ServerException - If any type of error occurred fulfilling the request.

setDisseminatorState

public void setDisseminatorState(java.lang.String disseminatorID,
                                 java.lang.String dissState)
                          throws ServerException
Description copied from interface: DOWriter
Sets the state for all versions of the specified disseminator.

Specified by:
setDisseminatorState in interface DOWriter
Parameters:
disseminatorID - The disseminator id.
dissState - The state.
Throws:
ServerException - If any type of error occurred fulfilling the request.

setLabel

public void setLabel(java.lang.String label)
              throws ObjectIntegrityException
Description copied from interface: DOWriter
Sets the label of the digital object.

Specified by:
setLabel in interface DOWriter
Parameters:
label - The label.
Throws:
ObjectIntegrityException

remove

public void remove()
            throws ObjectIntegrityException
Removes the entire digital object.

Specified by:
remove in interface DOWriter
Throws:
ServerException - If any type of error occurred fulfilling the request.
ObjectIntegrityException

addDatastream

public void addDatastream(Datastream datastream,
                          boolean addNewVersion)
                   throws ServerException
Adds a datastream to the object.

Specified by:
addDatastream in interface DOWriter
Parameters:
datastream - The datastream.
Throws:
ServerException - If any type of error occurred fulfilling the request.

addDisseminator

public void addDisseminator(Disseminator disseminator)
                     throws ServerException
Adds a disseminator to the object.

Specified by:
addDisseminator in interface DOWriter
Parameters:
disseminator - The disseminator.
Throws:
ServerException - If any type of error occurred fulfilling the request.

removeDatastream

public java.util.Date[] removeDatastream(java.lang.String id,
                                         java.util.Date start,
                                         java.util.Date end)
                                  throws ServerException
Removes a datastream from the object.

Specified by:
removeDatastream in interface DOWriter
Parameters:
id - The id of the datastream.
start - The start date (inclusive) of versions to remove. If null, this is taken to be the smallest possible value.
end - The end date (inclusive) of versions to remove. If null, this is taken to be the greatest possible value.
Throws:
ServerException - If any type of error occurred fulfilling the request.

removeDisseminator

public java.util.Date[] removeDisseminator(java.lang.String id,
                                           java.util.Date start,
                                           java.util.Date end)
                                    throws ServerException
Removes a disseminator from the object.

Specified by:
removeDisseminator in interface DOWriter
Parameters:
id - The id of the datastream.
start - The start date (inclusive) of versions to remove. If null, this is taken to be the smallest possible value.
end - The end date (inclusive) of versions to remove. If null, this is taken to be the greatest possible value.
Throws:
ServerException - If any type of error occurred fulfilling the request.

commit

public void commit(java.lang.String logMessage)
            throws ServerException
Saves the changes thus far to the permanent copy of the digital object.

Specified by:
commit in interface DOWriter
Parameters:
logMessage - An explanation of the change(s).
Throws:
ServerException - If any type of error occurred fulfilling the request.

invalidate

public void invalidate()
Description copied from interface: DOWriter
Marks this DOWriter handle invalid (unusable).

Specified by:
invalidate in interface DOWriter

newDatastreamID

public java.lang.String newDatastreamID()
Generate a unique id for a datastream.

Specified by:
newDatastreamID in interface DOWriter

newDatastreamID

public java.lang.String newDatastreamID(java.lang.String dsID)
Generate a unique id for a datastream version.

Specified by:
newDatastreamID in interface DOWriter

newDisseminatorID

public java.lang.String newDisseminatorID()
Generate a unique id for a disseminator.

Specified by:
newDisseminatorID in interface DOWriter

newDisseminatorID

public java.lang.String newDisseminatorID(java.lang.String dissID)
Generate a unique id for a disseminator version.

Specified by:
newDisseminatorID in interface DOWriter

newDatastreamBindingMapID

public java.lang.String newDatastreamBindingMapID()
Generate a unique id for a datastreamBindingMap.

Specified by:
newDatastreamBindingMapID in interface DOWriter

newAuditRecordID

public java.lang.String newAuditRecordID()
Generate a unique id for an audit record.

Specified by:
newAuditRecordID in interface DOWriter

isCommitted

public boolean isCommitted()
Description copied from interface: DOWriter
Marks whether the object has been successfully committed.

Specified by:
isCommitted in interface DOWriter

isNew

public boolean isNew()
Description copied from interface: DOWriter
Marks whether the object is new.

Specified by:
isNew in interface DOWriter