Class DataClay


  • public final class DataClay
    extends Object
    This class contains the dataClay public API.
    • Field Detail

      • CONFIGFILEPATH_ENV

        public static final String CONFIGFILEPATH_ENV
        Environment variable where configuration file can be specified.
        See Also:
        Constant Field Values
      • DEBUG_ENABLED

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

        public static final String DATASET_SEPARATOR_TOKEN
        Separator token for datasets.
        See Also:
        Constant Field Values
      • commonLib

        public static ClientRuntime commonLib
        UserClientLib for the session. WARNING: CURRENTLY IS PUBLIC IN ORDER TO ALLOW THREADS CREATED IN CLIENT TO USE THE COMMONLIB. Check design.
      • jLOCAL

        public static BackendID jLOCAL
        LOCAL BackendID
    • Method Detail

      • init

        public static void init​(int numBackends,
                                CommonMessages.Langs language)
                         throws DataClayException
        Initialize dataClay waiting for the following number of backends of language provided.
        Parameters:
        numBackends - Number of backends to wait for
        language - language of backend to wait for
        Throws:
        DataClayException - if an exception occurs
      • getByID

        public static Object getByID​(String objectIDstr)
                              throws DataClayException
        If the object is accessible, initializes an instance of a stub with the given objectID.
        Parameters:
        objectIDstr - ID of the object
        Returns:
        An instance of the stub representing the given objectID
        Throws:
        DataClayException - if an exception occurs
      • getLocation

        public static String getLocation​(String objectIDstr)
                                  throws DataClayException
        Gets any location of an object.
        Parameters:
        objectIDstr - object to retrieve its location
        Returns:
        a location of the object.
        Throws:
        DataClayException - if an exception occurs
      • getLocations

        public static List<String> getLocations​(String objectIDstr)
                                         throws DataClayException
        Gets all the locations of an object.
        Parameters:
        objectIDstr - object to retrieve its locations.
        Returns:
        locations of an object.
        Throws:
        DataClayException - if an exception occurs
      • moveReplica

        public static void moveReplica​(String objectIDstr,
                                       String srcHost,
                                       String destHost)
                                throws DataClayException
        Move a replica from source host to dest host.
        Parameters:
        objectIDstr - object which replica must be moved.
        srcHost - source location of the object replica.
        destHost - target location of the object replica.
        Throws:
        DataClayException - if an exception occurs. E.g. if source or dest hosts have no backend registered.
      • newReplica

        public static void newReplica​(String objectIDstr,
                                      String destHost)
                               throws DataClayException
        Create a new replica of the given object.
        Parameters:
        objectIDstr - objectID to be replicated.
        destHost - target location of the object replica.
        Throws:
        DataClayException - if an exception occurs
      • executeTask

        public static String executeTask​(String objectIDstr,
                                         Method method,
                                         Object[] params,
                                         CallbackHandler callback)
                                  throws DataClayException
        Executes a method on a specific target assynchronously.
        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:
        DataClayException - if an exception occurs.
      • executeTask

        public static String executeTask​(String objectIDstr,
                                         String operationSignature,
                                         Object[] params,
                                         CallbackHandler callback)
                                  throws DataClayException
        Executes a method on a specific target assynchronously.
        Parameters:
        objectIDstr - ID of the target object.
        operationSignature - signature of the 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:
        DataClayException - if an exception occurs.
      • getResult

        public static Object getResult​(CallbackEvent callbackEvent)
                                throws DataClayException
        Processes and retrieves the callback event produced by a task execution.
        Parameters:
        callbackEvent - the event to be processed
        Returns:
        The task result.
        Throws:
        DataClayException - if any exception occurs
      • ids2String

        public static String ids2String​(ObjectID objectID,
                                        BackendID hint,
                                        MetaClassID classID)
        Translates from ObjectID to string representation.
        Parameters:
        objectID - ID of the object.
        hint - hint where the object should be
        classID - class id of the object
        Returns:
        string representation of the giving object.
      • getJavaBackends

        public static Set<BackendID> getJavaBackends()
        Retrieves all Java backends
        Returns:
        info of the backends
      • getBackendInfo

        public static Backend getBackendInfo​(BackendID backendID)
        Retrieves the info of a backend
        Parameters:
        backendID - id of the backend
        Returns:
        info of the backend
      • getCommonLib

        public static ClientRuntime getCommonLib()
        Getter for commonLib property.
        Returns:
        common lib reference
      • getSessionID

        public static SessionID getSessionID()
        Getter for sessionID property.
        Returns:
        sessionID
      • getMDmisses

        public static int getMDmisses()
      • getMDhits

        public static int getMDhits()
      • getDataClayID

        public static DataClayInstanceID getDataClayID()
        Retrieves current dataClay instance ID
        Returns:
        id of current dataClay instance
      • getJavaBackend

        public static BackendID getJavaBackend​(String dsName)
        Retrieves the id of ANY java backend with name provided
        Parameters:
        dsName - DS name
        Returns:
        id of ANY java backend with name provided
      • getExternalJavaBackend

        public static BackendID getExternalJavaBackend​(String dsName,
                                                       DataClayInstanceID externalDcID)
        Retrieves the id of external java backend with name provided in external dataClay specified
        Parameters:
        dsName - DS name
        externalDcID - External dataClay instance ID
        Returns:
        id of external java backend with name provided in external dataClay specified
      • getDataClayID

        public static DataClayInstanceID getDataClayID​(String dcHost,
                                                       int dcPort)
        Retrieves the id of the external dataClay which Logic Module is located at provided host and listening on specified port.
        Parameters:
        dcHost - host where the external dataClay is located.
        dcPort - port where the external dataClay is listening.
        Returns:
        id of the external dataClay
      • registerDataClay

        public static DataClayInstanceID registerDataClay​(String dcHost,
                                                          int dcPort)
        Registers an external dataClay to enable future object federation with it. Also returns its dataClay instance id.
        Parameters:
        dcHost - host where the external dataClay is located.
        dcPort - port where the external dataClay is listening.
        Returns:
        id of the external dataClay
      • activateTracingInDataClayServices

        public static void activateTracingInDataClayServices()
        Activate tracing in dataClay services
      • deactivateTracingInDataClayServices

        public static void deactivateTracingInDataClayServices()
        Dectivate tracing
      • activateTracing

        public static void activateTracing​(boolean initializeWrapper)
        Activate tracing
      • deactivateTracing

        public static void deactivateTracing​(boolean finalizeWrapper)
        Dectivate tracing
      • getTracesInDataClayServices

        public static final void getTracesInDataClayServices()
        Get traces in dataClay services and store it in current workspace
      • unfederateAllObjects

        public static void unfederateAllObjects​(DataClayInstanceID extDataClayID)
        Unfederate all objects belonging/federated with external dataClay with id provided
        Parameters:
        extDataClayID - External dataClay ID
      • unfederateAllObjects

        public static void unfederateAllObjects()
        Unfederate all objects belonging/federated with ANY external dataClay
      • getNumObjects

        public static int getNumObjects()
        Get number of objects in dataClay
      • migrateFederatedObjects

        public static void migrateFederatedObjects​(DataClayInstanceID originDataClayID,
                                                   DataClayInstanceID destinationDataClayID)
        Migrate (unfederate and federate) all current dataClay objects from specified external dataclay di to destination dataclay.
        Parameters:
        originDataClayID - Origin dataclay id
        destinationDataClayID - Destination dataclay id
      • federateAllObjects

        public static void federateAllObjects​(DataClayInstanceID destinationDataClayID)
        Federate all dataClay objects from specified current dataClay destination dataclay.
        Parameters:
        destinationDataClayID - Destination dataclay id
      • importModelsFromExternalDataClay

        public static void importModelsFromExternalDataClay​(String externalNamespace,
                                                            DataClayInstanceID extDataClayID)
        Import classes in namespace specified from an external dataClay
        Parameters:
        externalNamespace - External namespace to get
        extDataClayID - External dataClay ID