com.googlecode.fascinator.common.storage.impl
Class GenericDigitalObject

java.lang.Object
  extended by com.googlecode.fascinator.common.storage.impl.GenericDigitalObject
All Implemented Interfaces:
DigitalObject

public class GenericDigitalObject
extends java.lang.Object
implements DigitalObject

Generic DigitalObject implementation

Author:
Oliver Lucido

Constructor Summary
GenericDigitalObject(java.lang.String id)
          Creates a DigitalObject with the specified identifier and no metadata
 
Method Summary
 void close()
          Close the object
 Payload createLinkedPayload(java.lang.String pid, java.lang.String linkPath)
          Creates a new linked payload on the object
 Payload createStoredPayload(java.lang.String pid, java.io.InputStream in)
          Creates a new stored payload on the object
 java.lang.String getId()
          Gets the unique identifier for this object
 java.util.Map<java.lang.String,Payload> getManifest()
          Get the manifest of the DigitalObject
 java.util.Properties getMetadata()
          Instantiates a properties object from the object's metadata payload.
 Payload getPayload(java.lang.String pid)
          Gets the payload with the specified identifier
 java.util.Set<java.lang.String> getPayloadIdList()
          Gets the payloads related to this object
 java.lang.String getSourceId()
          Gets the Source related to this object
 void removePayload(java.lang.String pid)
          Remove a payload from the object
 void setId(java.lang.String oid)
          Sets the unique identifier for this object
 void setSourceId(java.lang.String pid)
          Sets the Source related to this object
 java.lang.String toString()
          Get the id of the DigitalObject
 Payload updatePayload(java.lang.String pid, java.io.InputStream in)
          Updates a payload's contents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericDigitalObject

public GenericDigitalObject(java.lang.String id)
Creates a DigitalObject with the specified identifier and no metadata

Parameters:
id - unique identifier
Method Detail

getManifest

public java.util.Map<java.lang.String,Payload> getManifest()
Get the manifest of the DigitalObject

Returns:
Manifest Map

getId

public java.lang.String getId()
Gets the unique identifier for this object

Specified by:
getId in interface DigitalObject
Returns:
an identifier

setId

public void setId(java.lang.String oid)
Sets the unique identifier for this object

Specified by:
setId in interface DigitalObject
Parameters:
a - String identifier

getSourceId

public java.lang.String getSourceId()
Gets the Source related to this object

Specified by:
getSourceId in interface DigitalObject
Returns:
a payload id

setSourceId

public void setSourceId(java.lang.String pid)
Sets the Source related to this object

Specified by:
setSourceId in interface DigitalObject
Parameters:
a - payload id

getMetadata

public java.util.Properties getMetadata()
                                 throws StorageException
Instantiates a properties object from the object's metadata payload.

Specified by:
getMetadata in interface DigitalObject
Returns:
A properties object
Throws:
StorageException

getPayloadIdList

public java.util.Set<java.lang.String> getPayloadIdList()
Gets the payloads related to this object

Specified by:
getPayloadIdList in interface DigitalObject
Returns:
list of payload ids

createStoredPayload

public Payload createStoredPayload(java.lang.String pid,
                                   java.io.InputStream in)
                            throws StorageException
Creates a new stored payload on the object

Specified by:
createStoredPayload in interface DigitalObject
Parameters:
pid - A string identifier
in - An inputStream to the new payload's contents
Returns:
a payload
Throws:
StorageException - if there was an error creating the payload or the ID already exists.

createLinkedPayload

public Payload createLinkedPayload(java.lang.String pid,
                                   java.lang.String linkPath)
                            throws StorageException
Creates a new linked payload on the object

Specified by:
createLinkedPayload in interface DigitalObject
Parameters:
pid - A string identifier
linkPath - A string showing the path to the linked file
Returns:
a payload
Throws:
StorageException - if there was an error creating the payload or the ID already exists.

getPayload

public Payload getPayload(java.lang.String pid)
                   throws StorageException
Gets the payload with the specified identifier

Specified by:
getPayload in interface DigitalObject
Parameters:
pid - payload identifier
Returns:
a payload
Throws:
StorageException - if there was an error instantiating the payload or the ID does not exist.

removePayload

public void removePayload(java.lang.String pid)
                   throws StorageException
Remove a payload from the object

Specified by:
removePayload in interface DigitalObject
Parameters:
a - payload identifier
Throws:
StorageException - if there was an error removing the payload

updatePayload

public Payload updatePayload(java.lang.String pid,
                             java.io.InputStream in)
                      throws StorageException
Updates a payload's contents

Specified by:
updatePayload in interface DigitalObject
Parameters:
pid - A string identifier
in - An InputStream to the new contetnts
Returns:
the updated payload
Throws:
StorageException - if there was an error updating the payload or the ID doesn't exist.

close

public void close()
           throws StorageException
Close the object

Specified by:
close in interface DigitalObject
Throws:
StorageException - if there was an error closing the object

toString

public java.lang.String toString()
Get the id of the DigitalObject

Overrides:
toString in class java.lang.Object
Returns:
id of the DigitalObject


Copyright © 2009-2013. All Rights Reserved.