Package storage
Class StorageItf
- java.lang.Object
-
- storage.StorageItf
-
public final class StorageItf extends Object
This class intends to offer a basic API based on Severo Ochoa project needs.- Author:
- jmarti
-
-
Field Summary
Fields Modifier and Type Field Description protected static booleanDEBUG_ENABLEDIndicates if debug is enabled.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidconsolidateVersion(String finalVersionIDstr)static StringexecuteTask(String objectIDstr, Method method, Object[] params, CallbackHandler callback)static StringexecuteTask(String objectIDstr, String operationSignature, Object[] params, String destHost, CallbackHandler callback)static voidfinish()static ObjectgetByID(String objectIDstr)static StringgetLocation(String objectIDstr)static List<String>getLocations(String objectIDstr)static ObjectgetResult(CallbackEvent callbackEvent)Processes and retrieves the callback event produced by a task execution.static SessionIDgetSessionID()static voidinit(String configFilePath)static voidnewReplica(String objectIDstr, String destHost)static StringnewVersion(String objectIDstr, boolean preserveSource, String optDestHost)
-
-
-
Method Detail
-
init
public static void init(String configFilePath) throws StorageException
- Throws:
StorageException
-
newReplica
public static void newReplica(String objectIDstr, String destHost) throws StorageException
- Parameters:
objectIDstr- objectID to be replicated.destHost- target location of the object replica.- Throws:
StorageException- if an exception occurs
-
newVersion
public static String newVersion(String objectIDstr, boolean preserveSource, String optDestHost) throws StorageException
- Parameters:
objectIDstr- object id to be versionedpreserveSource- whether the source object is preserved or otherwise can be deleted.optDestHost- target location for the version of the object (if null, a random location will be chosen).- Returns:
- the object id of the corresponding to the new version of the object.
- Throws:
StorageException- if an exception occurs
-
consolidateVersion
public static void consolidateVersion(String finalVersionIDstr) throws StorageException
- Parameters:
finalVersionIDstr- the final version to be consolidated with the original object.- Throws:
StorageException- if an exception occurs
-
getByID
public static Object getByID(String objectIDstr) throws StorageException
- Parameters:
objectIDstr- ID of the object- Returns:
- An instance of the stub representing the given objectID
- Throws:
StorageException- if an exception occurs
-
getLocation
public static String getLocation(String objectIDstr) throws StorageException
- Parameters:
objectIDstr- object to retrieve its location- Returns:
- a location of the object.
- Throws:
StorageException- if an exception occurs
-
getLocations
public static List<String> getLocations(String objectIDstr) throws StorageException
- Parameters:
objectIDstr- object to retrieve its locations.- Returns:
- locations of an object.
- Throws:
StorageException- if an exception occurs
-
getSessionID
public static SessionID getSessionID()
- Returns:
- sessionID
-
executeTask
public static String executeTask(String objectIDstr, Method method, Object[] params, CallbackHandler callback) throws StorageException
- Parameters:
objectIDstr- ID of the target object.method- method to be executedparams- parameters for the operation.callback- callback handler to communicate the result when the execution finishes.- Returns:
- an id of the executed request that will receive the callback handler with the corresponding response
- Throws:
StorageException- if an exception occurs.
-
executeTask
public static String executeTask(String objectIDstr, String operationSignature, Object[] params, String destHost, CallbackHandler callback) throws StorageException
- Parameters:
objectIDstr- ID of the target object.operationSignature- signature of the method to be executed.params- parameters for the operation.destHost- destination host where the method has to be executed.callback- callback handler to communicate the result when the execution finishes.- Returns:
- an id of the executed request that will receive the callback handler with the corresponding response
- Throws:
StorageException- if an exception occurs.
-
getResult
public static Object getResult(CallbackEvent callbackEvent) throws StorageException
Processes and retrieves the callback event produced by a task execution.- Parameters:
callbackEvent- the event to be processed- Returns:
- The task result.
- Throws:
StorageException- if any exception occurs
-
finish
public static void finish() throws StorageException- Throws:
StorageException- if an exception occurs
-
-