public class AkubraLowlevelStorage extends Object implements ILowlevelStorage, IListable, ISizable, ICheckable
This implementation uses two Akubra BlobStores; one for
objects and another for datastreams.
| Constructor and Description |
|---|
AkubraLowlevelStorage(org.akubraproject.BlobStore objectStore,
org.akubraproject.BlobStore datastreamStore,
boolean forceSafeObjectOverwrites,
boolean forceSafeDatastreamOverwrites)
Creates an instance using the given blob stores.
|
| Modifier and Type | Method and Description |
|---|---|
long |
addDatastream(String pid,
InputStream content) |
long |
addDatastream(String dsKey,
InputStream content,
Map<String,String> hints)
Sets the content of a new datastream version.
|
void |
addObject(String pid,
InputStream content) |
void |
addObject(String objectKey,
InputStream content,
Map<String,String> hints)
Adds a new object.
|
void |
auditDatastream()
Performs a consistency check against the datastream index if such an
index exists.
|
void |
auditObject()
Performs a consistency check against the object index if such an index
exists.
|
long |
getDatastreamSize(String dsKey)
Return the size of a datastream in bytes
|
Iterator<String> |
listDatastreams()
Lists all stored datastreams in no particular order.
|
Iterator<String> |
listObjects()
Lists all stored objects in no particular order.
|
boolean |
objectExists(String objectKey) |
void |
rebuildDatastream()
Reconstructs the datastream index if such an index exists.
|
void |
rebuildObject()
Reconstructs the object index if such an index exists.
|
void |
removeDatastream(String dsKey)
Removes the content of an existing datastream version.
|
void |
removeObject(String objectKey)
Removes an object.
|
long |
replaceDatastream(String pid,
InputStream content) |
long |
replaceDatastream(String dsKey,
InputStream content,
Map<String,String> hints)
Sets the content of an existing datastream version.
|
void |
replaceObject(String pid,
InputStream content) |
void |
replaceObject(String objectKey,
InputStream content,
Map<String,String> hints)
Replaces an existing object.
|
InputStream |
retrieveDatastream(String dsKey)
Gets the content of an existing datastream version.
|
InputStream |
retrieveObject(String objectKey)
Gets an existing object.
|
public AkubraLowlevelStorage(org.akubraproject.BlobStore objectStore,
org.akubraproject.BlobStore datastreamStore,
boolean forceSafeObjectOverwrites,
boolean forceSafeDatastreamOverwrites)
The blob stores MUST:
info:fedora/ URIs as blob ids.
The blob stores MAY:
forceSafe..Overwrites MUST be given as
true and the blob store MUST support
org.akubraproject.core.Blob#renameTo
objectStore - the store for serialized objects.datastreamStore - the store for datastream content.forceSafeObjectOverwrites - if true, replaceObject calls will
be done in a way that ensures the old content is not deleted
until the new content is safely written. If the objectStore
already does this, this should be given as false.forceSafeDatastreamOverwrites - same as above, but for
replaceDatastream calls.public long addDatastream(String dsKey, InputStream content, Map<String,String> hints) throws LowlevelStorageException
ILowlevelStorageaddDatastream in interface ILowlevelStoragedsKey - the $pid "+" $dsId "+" $dsVersionId string that uniquely
identifies the datastream version.content - the content.LowlevelStorageException - if the datastream version already
exists or cannot be added for any other reason.public long addDatastream(String pid, InputStream content) throws LowlevelStorageException
LowlevelStorageExceptionpublic void addObject(String objectKey, InputStream content, Map<String,String> hints) throws LowlevelStorageException
ILowlevelStorageaddObject in interface ILowlevelStorageobjectKey - the pid of the object.content - the serialized object.hints - a map of hints for object storageLowlevelStorageException - if the object already exists or
cannot be added for any other reason.public void addObject(String pid, InputStream content) throws LowlevelStorageException
LowlevelStorageExceptionpublic void auditDatastream()
throws LowlevelStorageException
ILowlevelStorageauditDatastream in interface ILowlevelStorageLowlevelStorageException - if an error occurs that prevents the
consistency check from taking place.public void auditObject()
throws LowlevelStorageException
ILowlevelStorageauditObject in interface ILowlevelStorageLowlevelStorageException - if an error occurs that prevents the
consistency check from taking place.public void rebuildDatastream()
throws LowlevelStorageException
ILowlevelStorage
rebuildDatastream in interface ILowlevelStorageLowlevelStorageException - if an error occurs that prevents thepublic void rebuildObject()
throws LowlevelStorageException
ILowlevelStorage
rebuildObject in interface ILowlevelStorageLowlevelStorageException - if an error occurs that prevents the
index from being rebuilt.public void removeDatastream(String dsKey) throws LowlevelStorageException
ILowlevelStorageremoveDatastream in interface ILowlevelStoragedsKey - the $pid "+" $dsId "+" $dsVersionId string that uniquely
identifies the datastream version.LowlevelStorageException - if the datastream version does not
exist or cannot be removed for any other reason.public void removeObject(String objectKey) throws LowlevelStorageException
ILowlevelStorageremoveObject in interface ILowlevelStorageobjectKey - the pid of the object.LowlevelStorageException - if the object does not exist or
cannot be removed for any other reason.public long replaceDatastream(String dsKey, InputStream content, Map<String,String> hints) throws LowlevelStorageException
ILowlevelStoragereplaceDatastream in interface ILowlevelStoragedsKey - the $pid "+" $dsId "+" $dsVersionId string that uniquely
identifies the datastream version.content - the content.LowlevelStorageException - if the datastream version does not
already exist or cannot be replaced for any other reason.public long replaceDatastream(String pid, InputStream content) throws LowlevelStorageException
LowlevelStorageExceptionpublic void replaceObject(String objectKey, InputStream content, Map<String,String> hints) throws LowlevelStorageException
ILowlevelStoragereplaceObject in interface ILowlevelStorageobjectKey - the pid of the object.content - the serialized object.LowlevelStorageException - if the object does not already exist
or cannot be replaced for any other reason.public void replaceObject(String pid, InputStream content) throws LowlevelStorageException
LowlevelStorageExceptionpublic InputStream retrieveDatastream(String dsKey) throws LowlevelStorageException
ILowlevelStorageretrieveDatastream in interface ILowlevelStoragedsKey - the $pid "+" $dsId "+" $dsVersionId string that uniquely
identifies the datastream version.LowlevelStorageException - if the datastream version does not
exist or cannot be read for any other reason.public InputStream retrieveObject(String objectKey) throws LowlevelStorageException
ILowlevelStorageretrieveObject in interface ILowlevelStorageobjectKey - the pid of the object.LowlevelStorageException - if the object does not exist or
cannot be read for any other reason.public Iterator<String> listDatastreams()
IListablelistDatastreams in interface IListablepublic Iterator<String> listObjects()
IListablelistObjects in interface IListablepublic long getDatastreamSize(String dsKey) throws LowlevelStorageException
ISizablegetDatastreamSize in interface ISizableLowlevelStorageExceptionpublic boolean objectExists(String objectKey)
objectExists in interface ICheckableCopyright © 2013 DuraSpace. All Rights Reserved.