Class ClientRuntime


  • public final class ClientRuntime
    extends DataClayRuntime
    This class contains functions for users to interact with DataClay.
    • Constructor Detail

      • ClientRuntime

        public ClientRuntime()
        Constructor for Mock tests.
    • Method Detail

      • initialize

        public void initialize​(String logicModuleHost,
                               int logicModulePort,
                               String originHostName)
                        throws Exception
        Initialize connections.
        Overrides:
        initialize in class DataClayRuntime
        Parameters:
        logicModuleHost - Name of the host of the logic module
        logicModulePort - Port of the logic module
        originHostName - Name of the host using the lib.
        Throws:
        Exception - if connection could not be done for some reason.
      • getOrNewPersistentInstance

        public DataClayObject getOrNewPersistentInstance​(MetaClassID classID,
                                                         ObjectID objectID,
                                                         BackendID hint)
        Description copied from class: DataClayRuntime
        Check if instance exists in Heap or create a new PERSISTENT instance if needed
        Specified by:
        getOrNewPersistentInstance in class DataClayRuntime
        Parameters:
        classID - ID of the class in case it is needed (not need to query) if null, look for class id in metadata.
        objectID - ID of object
        hint - Can be null. Hint in case object is a volatile in another DS and we need information.
        Returns:
        Instance
      • setLocalBackend

        public void setLocalBackend​(BackendID backendID)
        Sets ID of backend to be identified as LOCAL backend.
        Parameters:
        backendID - ID of LOCAL backend.
      • setSessionInfo

        public void setSessionInfo​(SessionInfo newSessionfo)
        Set sessionID for client
        Parameters:
        newSessionfo - Info of session
      • makePersistent

        public BackendID makePersistent​(DataClayObject dcObject,
                                        BackendID optionalDestBackendID,
                                        boolean recursive,
                                        String alias)
        Description copied from class: DataClayRuntime
        This method creates a new Persistent Object using the provided stub instance and, if indicated, all its associated objects also Logic module API used for communication
        Specified by:
        makePersistent in class DataClayRuntime
        Parameters:
        dcObject - Instance to make persistent
        optionalDestBackendID - Indicates which is the destination backend
        recursive - Indicates if make persistent is recursive
        alias - Alias for the object
        Returns:
        ID of the backend in which te object was persisted.
      • serializeMakePersistent

        public final List<ObjectWithDataParamOrReturn> serializeMakePersistent​(BackendID location,
                                                                               DataClayObject objectToPersist,
                                                                               Map<MetaClassID,​byte[]> ifaceBitMaps,
                                                                               boolean recursive)
        Serialize for make persistent.
        Parameters:
        location - Where objects will be stored
        objectToPersist - Object to persist
        ifaceBitMaps - Interface bitmaps
        recursive - Indicates if sub-objects must be serialized also.
        Returns:
        Serialized parameters
      • isDSLib

        public boolean isDSLib()
        Specified by:
        isDSLib in class DataClayRuntime
        Returns:
        TRUE if library is for DataClay, FALSE for clients.
      • closeSession

        public void closeSession()
        Close session.
      • detachObjectFromSession

        public void detachObjectFromSession​(ObjectID objectID,
                                            ExecutionEnvironmentID hint)
        Description copied from class: DataClayRuntime
        Detach object from current session in use, i.e. remove reference from current session provided to object, "dear garbage-collector, current session is not using the object anymore"
        Specified by:
        detachObjectFromSession in class DataClayRuntime
        Parameters:
        objectID - ID of the object to detach
        hint - Hint of the object to detach (can be null)
      • federateToBackend

        public void federateToBackend​(DataClayObject dcObject,
                                      ExecutionEnvironmentID externalExecutionEnvironmentID,
                                      boolean recursive)
        Description copied from class: DataClayRuntime
        Federate an object with an external dataClay
        Specified by:
        federateToBackend in class DataClayRuntime
        Parameters:
        dcObject - object to federate
        externalExecutionEnvironmentID - id of the external execution environment id
        recursive - Indicates if subobjects should be federated as well
      • unfederateFromBackend

        public void unfederateFromBackend​(DataClayObject dcObject,
                                          ExecutionEnvironmentID externalExecutionEnvironmentID,
                                          boolean recursive)
        Description copied from class: DataClayRuntime
        Unfederate an object with an external backend
        Specified by:
        unfederateFromBackend in class DataClayRuntime
        Parameters:
        dcObject - object to unfederate
        externalExecutionEnvironmentID - id of the external execution environment id
        recursive - Indicates if subobjects should be unfederated as well