Package org.dspace.ctask.replicate.store
Class DuraCloudObjectStore
- java.lang.Object
-
- org.dspace.ctask.replicate.store.DuraCloudObjectStore
-
- All Implemented Interfaces:
ObjectStore
public class DuraCloudObjectStore extends Object implements ObjectStore
DuraCloudReplicaStore invokes the DuraCloud RESTful web service API, (using a java client library) rather than using the rsync tool.- Author:
- richardrodgers
-
-
Constructor Summary
Constructors Constructor Description DuraCloudObjectStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longfetchObject(String group, String id, File file)Fetches a copy of the object with passed ID, and places it in passed file.voidinit()Initializes the storage service for use.longmoveObject(String srcGroup, String destGroup, String id)Moves the passed object from one storage group to another.StringobjectAttribute(String group, String id, String attrName)Obtains attributes of the representation of the object with passed ID.booleanobjectExists(String group, String id)Returns whether an object with the passed id exists in the store.longremoveObject(String group, String id)Removes the passed object from the store.protected voidsetContentStore(org.duracloud.client.ContentStore contentStore)longtransferObject(String group, File file)Transfers a copy of this file to the object store
-
-
-
Method Detail
-
setContentStore
protected void setContentStore(org.duracloud.client.ContentStore contentStore)
-
init
public void init() throws IOExceptionDescription copied from interface:ObjectStoreInitializes the storage service for use.- Specified by:
initin interfaceObjectStore- Throws:
IOException- if I/O error
-
fetchObject
public long fetchObject(String group, String id, File file) throws IOException
Description copied from interface:ObjectStoreFetches a copy of the object with passed ID, and places it in passed file.- Specified by:
fetchObjectin interfaceObjectStore- Parameters:
group- Groupid- IDfile- File- Returns:
- number of bytes the replica used
- Throws:
IOException- if I/O error
-
objectExists
public boolean objectExists(String group, String id) throws IOException
Description copied from interface:ObjectStoreReturns whether an object with the passed id exists in the store.- Specified by:
objectExistsin interfaceObjectStore- Parameters:
group- Groupid- ID- Returns:
- true if a representation of the object named by ID exists
- Throws:
IOException- if I/O error
-
removeObject
public long removeObject(String group, String id) throws IOException
Description copied from interface:ObjectStoreRemoves the passed object from the store.- Specified by:
removeObjectin interfaceObjectStore- Parameters:
group- Groupid- the id of the object to remove- Returns:
- number of bytes the object was using, or 0 if object did not exist.
- Throws:
IOException- if I/O error
-
transferObject
public long transferObject(String group, File file) throws IOException
Description copied from interface:ObjectStoreTransfers a copy of this file to the object store- Specified by:
transferObjectin interfaceObjectStore- Parameters:
group- Groupfile- the file to transfer to store- Returns:
- number of bytes transferred to store or 0 if transfer failed.
- Throws:
IOException- if I/O error
-
moveObject
public long moveObject(String srcGroup, String destGroup, String id) throws IOException
Description copied from interface:ObjectStoreMoves the passed object from one storage group to another.- Specified by:
moveObjectin interfaceObjectStore- Parameters:
srcGroup- source groupdestGroup- destination groupid- the id of the object to move between groups- Returns:
- number of bytes moved or 0 if move failed.
- Throws:
IOException- if I/O error
-
objectAttribute
public String objectAttribute(String group, String id, String attrName) throws IOException
Description copied from interface:ObjectStoreObtains attributes of the representation of the object with passed ID.- Specified by:
objectAttributein interfaceObjectStore- Parameters:
group- Groupid- IDattrName- - name of the attribute- Returns:
- value of the attribute if it exists, else null
- Throws:
IOException- if I/O error
-
-