Package storage

Class StorageItf


  • public final class StorageItf
    extends Object
    This class intends to offer a basic API based on Severo Ochoa project needs.
    Author:
    jmarti
    • Field Detail

      • DEBUG_ENABLED

        protected static final boolean DEBUG_ENABLED
        Indicates if debug is enabled.
    • Method Detail

      • 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 versioned
        preserveSource - 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 executed
        params - 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