org.fcrepo.server.storage
Class SimpleDOWriter

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

public class SimpleDOWriter
extends SimpleDOReader
implements Constants, 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.

Author:
Chris Wilper

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.fcrepo.common.Constants
Constants.FedoraHome
 
Field Summary
 
Fields inherited from interface org.fcrepo.common.Constants
ACCESS, ACTION, API, ATOM_APIM1_0, ATOM_ZIP1_1, ATOM1_1, AUDIT, AUDIT1_0, BATCH_MODIFY, BATCH_MODIFY1_1, BE_SECURITY, BE_SECURITY1_0, BINDING_SPEC, DATASTREAM, DC, DISSEMINATOR, DS_COMPOSITE_MODEL, DS_COMPOSITE_MODEL1_0, DS_INPUT_SPEC1_0, DS_INPUT_SPEC1_1, ENVIRONMENT, FCFG, FEDORA, FEDORA_APP_CONTEXT_NAME, FEDORA_DEFAULT_APP_CONTEXT, FEDORA_HOME, FOXML, FOXML1_0, FOXML1_0_LEGACY, FOXML1_1, HTTP_REQUEST, MANAGEMENT, METHOD_MAP, METS, METS_EXT, METS_EXT1_0, METS_EXT1_0_LEGACY, METS_EXT1_1, MODEL, MULGARA, OAI_DC, OAI_DC2_0, OAI_FRIENDS, OAI_FRIENDS2_0, OAI_IDENTIFIER, OAI_IDENTIFIER2_0, OAI_PMH, OAI_PMH2_0, OAI_PROV, OAI_PROV2_0, OBJ_DATASTREAMS1_0, OBJ_HISTORY1_0, OBJ_ITEMS1_0, OBJ_METHODS1_0, OBJ_PROFILE1_0, OBJ_VALIDATION1_0, OBJECT, OLD_XLINK, PID_LIST1_0, RDF, RDF_XSD, RECOVERY, RELS_EXT, RELS_EXT1_0, RELS_INT1_0, REPO_DESC1_0, RESOURCE, SDEF, SDEF_METHOD_MAP1_0, SDEP, SDEP_METHOD_MAP1_0, SDEP_METHOD_MAP1_1, SERVICE_PROFILE, SOAP, SOAP_ENC, SUBJECT, TYPES, VIEW, WSDL, WSDL_HTTP, WSDL_MIME, XACML_POLICY, XACML_POLICY1_0, XLINK, XML_XSD, XMLNS, XSI
 
Constructor Summary
SimpleDOWriter(Context context, DefaultDOManager mgr, DOTranslator translator, String exportFormat, String encoding, DigitalObject obj)
           
 
Method Summary
 void addDatastream(Datastream datastream, boolean addNewVersion)
          Adds a datastream to the object.
 boolean addRelationship(String subject, String relationship, String object, boolean isLiteral, String datatype)
          Adds a RDF triple to a reserved datastream (based on the subject)
 boolean addRelationship(String dsId, String subject, String relationship, String object, boolean isLiteral, String datatype)
          Adds a RDF triple to the specified (RDF) datastream
 void commit(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.
 String newAuditRecordID()
          Generate a unique id for an audit record.
 String newDatastreamID()
          Generate a unique id for a datastream.
 String newDatastreamID(String dsID)
          Generate a unique id for a datastream version.
 boolean purgeRelationship(String subject, String relationship, String object, boolean isLiteral, String datatype)
          Purges a RDF triple from a reserved datastream (based on the subject)
 boolean purgeRelationship(String dsId, String subject, String relationship, String object, boolean isLiteral, String datatype)
          Purges a RDF triple from the specified (RDF) datastream
 void remove()
          Removes the entire digital object.
 Date[] removeDatastream(String id, Date start, Date end)
          Removes a datastream from the object.
 void setDatastreamState(String datastreamID, String dsState)
          Sets the state for all versions of the specified datastream.
 void setDatastreamVersionable(String datastreamID, boolean versionable)
          Sets the indicator as to whether the datastream is subject to versioning.
 void setLabel(String label)
          Sets the label of the digital object.
 void setOwnerId(String ownerId)
          Sets the ownerId for the digital object.
 void setState(String state)
          Sets the state of the entire digital object.
 
Methods inherited from class org.fcrepo.server.storage.SimpleDOReader
Export, ExportObject, getAuditRecords, getContentModels, getCreateDate, GetDatastream, getDatastream, GetDatastreams, getDatastreamVersions, getLastModDate, getObject, getObjectHistory, GetObjectLabel, GetObjectPID, GetObjectState, GetObjectXML, getOwnerId, getRelationships, getRelationships, getRelationships, getWhenString, hasContentModel, hasRelationship, hasRelationship, ListDatastreamIDs, listMethods
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.fcrepo.server.storage.DOReader
Export, ExportObject, getAuditRecords, getContentModels, getCreateDate, GetDatastream, getDatastream, GetDatastreams, getDatastreamVersions, getLastModDate, getObject, getObjectHistory, GetObjectLabel, GetObjectPID, GetObjectState, GetObjectXML, getOwnerId, getRelationships, getRelationships, getRelationships, hasContentModel, hasRelationship, hasRelationship, ListDatastreamIDs, listMethods
 

Constructor Detail

SimpleDOWriter

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

setState

public void setState(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(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(String datastreamID,
                               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(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.

setLabel

public void setLabel(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.

removeDatastream

public Date[] removeDatastream(String id,
                               Date start,
                               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.

addRelationship

public boolean addRelationship(String subject,
                               String relationship,
                               String object,
                               boolean isLiteral,
                               String datatype)
                        throws ServerException
Description copied from interface: DOWriter
Adds a RDF triple to a reserved datastream (based on the subject)

Specified by:
addRelationship in interface DOWriter
Throws:
ServerException

addRelationship

public boolean addRelationship(String dsId,
                               String subject,
                               String relationship,
                               String object,
                               boolean isLiteral,
                               String datatype)
                        throws ServerException
Description copied from interface: DOWriter
Adds a RDF triple to the specified (RDF) datastream

Specified by:
addRelationship in interface DOWriter
Throws:
ServerException

purgeRelationship

public boolean purgeRelationship(String subject,
                                 String relationship,
                                 String object,
                                 boolean isLiteral,
                                 String datatype)
                          throws ServerException
Description copied from interface: DOWriter
Purges a RDF triple from a reserved datastream (based on the subject)

Specified by:
purgeRelationship in interface DOWriter
Throws:
ServerException

purgeRelationship

public boolean purgeRelationship(String dsId,
                                 String subject,
                                 String relationship,
                                 String object,
                                 boolean isLiteral,
                                 String datatype)
                          throws ServerException
Description copied from interface: DOWriter
Purges a RDF triple from the specified (RDF) datastream

Specified by:
purgeRelationship in interface DOWriter
Throws:
ServerException

commit

public void commit(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 String newDatastreamID()
Generate a unique id for a datastream.

Specified by:
newDatastreamID in interface DOWriter

newDatastreamID

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

Specified by:
newDatastreamID in interface DOWriter

newAuditRecordID

public 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


Copyright © 2011 DuraSpace. All Rights Reserved.