Package es.bsc.dataclay
Class DataClayObject
- java.lang.Object
-
- storage.StorageObject
-
- es.bsc.dataclay.DataClayObject
-
- All Implemented Interfaces:
DataClaySerializable,Serializable,StubItf
- Direct Known Subclasses:
DataClayExecutionObject
public class DataClayObject extends StorageObject implements DataClaySerializable, Serializable, StubItf
This class represents a Object in DataClay.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static DataClayRuntimeclientRuntimeClient runtime.protected DataSetIDdataSetIDID of dataset of object.protected static booleanDEBUG_ENABLEDIndicates if debug is enabled.protected AtomicBooleanisLoadedIndicates if the object was filled with data.protected AtomicBooleanisPersistentIndicates if the object is registered or not.static BackendIDLOCAL'LOCAL' locationstatic org.apache.logging.log4j.LoggerloggerLogger.protected ObjectIDobjectIDObjectID of the stub instance.
-
Constructor Summary
Constructors Constructor Description DataClayObject()ConstructorDataClayObject(ObjectID theobjectID)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddReplicaLocations(ExecutionEnvironmentID replicaLocation)Add replica locationstatic voidclearExecStubInfosCache()Clear exec stub infos cache for enrichments.voidclearReplicaLocations()Clear replica locationsstatic voidclearStubInfosCache()Clear stub infos cache for enrichments.DataClayObjectdcClone()Retrieves a copy of this objectDataClayObjectdcClone(boolean recursive)Retrieves a copy of this objectstatic DataClayObjectdcCloneByAlias(String alias)Retrieves a copy of this object (but not the subobjects)static DataClayObjectdcCloneByAlias(String alias, boolean recursive)Retrieves a copy of this objectvoiddcPut(String alias)Equivalent tomakePersistentvoiddcPut(String alias, boolean recursive)Equivalent tomakePersistentvoiddcPut(String alias, BackendID optBackendID)Equivalent tomakePersistentvoiddcPut(String alias, BackendID optBackendID, boolean recursive)Equivalent tomakePersistentvoiddcUpdate(DataClayObject fromObject)Updates this object alias with the values in argument objectstatic voiddcUpdateByAlias(String alias, DataClayObject fromObject)Updates the object identified by the given alias with the values in argument objectvoiddebugEnd(String opNameAndDesc)Debug end of running methodvoiddebugStart(String opNameAndDesc)Debug start of running methodvoiddeleteAlias()Delete object's aliasstatic voiddeleteAlias(String alias)Method to be specializedstatic voiddeleteAlias(String className, String alias)Deletes an alias of an object of a specific classvoiddeserialize(DataClayByteBuffer dcBuffer, Map<MetaClassID,byte[]> ifaceBitMaps, DataClayObjectMetaData metadata, Map<Integer,Object> curDeserializedJavaObjs)Deserializes the object from the buffer provided using the interface represented in the bitmap specified.booleanequals(Object obj)ObjectexecuteRemoteImplementation(String methodSignature, String implIDAsStr, Object[] params)Execute remote methodvoidfederate(DataClayInstanceID extDataClayID)Federates this object with an external dataClay instancevoidfederate(DataClayInstanceID extDataClayID, boolean recursive)Federates this object with an external dataClay instancevoidfederateToBackend(BackendID extBackendID)Federates this object with an external backend instancevoidfederateToBackend(BackendID extBackendID, boolean recursive)Federates this object with an external backend instancestatic longgetAccessCount()StringgetAlias()Get aliasSet<BackendID>getAllLocations()Gets the location of this persistent object and its replicas.protected static DataClayObjectgetByAlias(MetaClassID classID, String alias, boolean safe)Generic static method to instantiate a DataClayObject by its aliasstatic <E> EgetByAliasExt(String alias)This method can be used from registered methods to access objects by alias, this method is parameterized in order to provide to the users a way to implement and compile an application using a model to be registered (extending DataClayObject).static <E> EgetByAliasExt(String alias, boolean safe)This method can be used from registered methods to access objects by alias, this method is parameterized in order to provide to the users a way to implement and compile an application using a model to be registered (extending DataClayObject).DataSetIDgetDataSetID()Get DataSetIDDataClayInstanceIDgetExternalDataClayID()DataClayInstanceIDgetExternalDataClayID(String hostname, int port)Retrieve dataClay IDBackendIDgetHint()Get the DataClayObject::hintstatic longgetHitCount()StringgetID()static DataClayRuntimegetLib()Get DataService client libraryBackendIDgetLocation()Gets the location of this persistent object.BackendIDgetMasterLocation()MetaClassIDgetMetaClassID()Get metaclass IDstatic MetaClassIDgetMetaClassID(String className)Get metaclass ID of the specified class nameObjectIDgetObjectID()Get the ObjectID of the instanceObjectIDgetOriginalObjectID()ExecutionEnvironmentIDgetOriginLocation()Set<ExecutionEnvironmentID>getReplicaLocations()Get all replica locationsExecutionEnvironmentIDgetRootLocation()StubInfogetStubInfo()Get stub information of classstatic StubInfogetStubInfoFromClass(String className)Get stubinfo for class with name providedinthashCode()protected voidincrementAccessCount()protected voidincrementHitCount()voidinitializeObjectAsPersistent()Initialize object with state 'persistent' with proper flags.voidinitializeObjectAsVolatile()Initialize object with state 'volatile' with proper flags.booleanisMasterLocation()booleanisPersistent()Indicates the object is persistent.booleanisPrefetchingAccess()RT PREFETCHING FIELDSbooleanisReadOnly()Get if object is read onlystatic booleanisStub(Class<?> clazz)Checks if class provided is stub or not.voidmakePersistent()voidmakePersistent(boolean recursive)Store this object into DataClay.voidmakePersistent(boolean recursive, BackendID optionalBackendID)Store this object into DataClay.voidmakePersistent(BackendID optBackendID)voidmakePersistent(String alias)voidmakePersistent(String alias, boolean recursive)Store this object into DataClay.voidmakePersistent(String alias, BackendID destBackendID)Store this object into DataClay.voidmakePersistent(String alias, BackendID destBackendID, boolean recursive)Store this object into DataClay.voidmoveObject(BackendID srcLocID, BackendID destLocID)Moves a persistent object and referenced objects from the source location to the destination location specified.voidmoveObject(BackendID srcLocID, BackendID destLocID, boolean recursive)Moves a persistent object from the source location to the destination location specified.BackendIDnewReplica()Creates a new replica of this persistent object and its subobjects in a certain backend.BackendIDnewReplica(boolean recursive)Creates a new replica of this persistent object in a certain backend.BackendIDnewReplica(BackendID optionalBackendID)Creates a new replica of this persistent object.BackendIDnewReplica(BackendID optionalBackendID, boolean recursive)Create a new replica of this persistent object.static voidprintObjectAccessStats()voidremoveReplicaLocation(ExecutionEnvironmentID replicaLocation)Remove replica locationstatic voidresetObjectAccessStats()Objectrun(ImplementationID implID, Object[] params)Runs the method with ID provided and params specifiedvoidserialize(DataClayByteBuffer dcBuffer, boolean ignoreUserTypes, Map<MetaClassID,byte[]> ifaceBitMaps, IdentityHashMap<Object,Integer> curSerializedObjs, ListIterator<DataClayObject> pendingObjs, ReferenceCounting referenceCounting)Serializes the object into the buffer provided using the interface represented in the bitmap specified.voidsessionDetach()Detach object from session, i.e.voidsetAlias(String alias)Set the alias of the objectvoidsetAll(DataClayObject otherObject)This method set all fields with values of fields of provided object.voidsetDataSetID(DataSetID newDataSetID)Set object DataSetIDvoidsetExternalDataClayID(DataClayInstanceID newID)voidsetFieldsDeserialization(Queue<Object> fieldsToSet)Set fieldsvoidsetHint(BackendID newhint)Set the DataClayObject::hintvoidsetIsPersistent(boolean newisPersistent)Set the DataClayObject:newisPersistentstatic voidsetLib(DataClayRuntime theruntime)Set runtimevoidsetLoaded(boolean newisLoaded)Set the DataClayObject::isLoadedvoidsetMasterLocation(BackendID newMasterLocation)If called from client side will not have any effect.voidsetNewObjectID()Set a new object ID (used for remove objects)voidsetObjectIDUnsafe(ObjectID newObjectID)Set the object's id This method is labeled as unsafe as the user should be aware it is just possible to change ids of non-persistent objects.voidsetObjectReadOnly()Sets this persistent object to be read only.voidsetObjectReadWrite()Sets this persistent object to be read write.voidsetOriginalObjectID(ObjectID newOriginalObjectID)voidsetOriginLocation(ExecutionEnvironmentID originLocation)Set origin location of the objectstatic voidsetPrefetchingAccess(boolean value)voidsetReadOnly(boolean readOnly)Set if object is read onlyvoidsetReplicaLocations(Set<ExecutionEnvironmentID> replicaLocations)Set replica locationsvoidsetRootLocation(ExecutionEnvironmentID rootLocation)Set root location of the objectvoidsetWrappersParams(ImplementationID implID, SerializedParametersOrReturn wrapParams)Unwraps parameters for deserializationvoidsetWrappersReturn(ImplementationID implID, SerializedParametersOrReturn wrapReturn)Unwraps return for deserializationvoidsynchronize(ImplementationID implID, Object[] params)Synchronizevoidunfederate(boolean recursive)Unfederate this object with all external dataClays is registered withvoidunfederate(DataClayInstanceID extDataClayID)Unfederate this object with the provided external dataClayvoidunfederate(DataClayInstanceID extDataClayID, boolean recursive)Unfederate this object with the provided external dataClayvoidunfederateFromBackend(BackendID extBackendID)Unfederates this object with an external backend instancevoidunfederateFromBackend(BackendID extBackendID, boolean recursive)Unfederates this object with an external backend instancevoidwhenFederated()Override this function with code to be executed when a federated object arrives into a destination dataClay.voidwhenUnfederated()Override this function with code to be executed when a federate object is unfederated in destination dataClay.voidwrapFieldsDeserialization(List<DataClaySerializable> wrapFields)Wraps fields for deserializationvoidwrapFieldsSerialization(List<DataClaySerializable> wrapFields)Wraps fields for serializationList<DataClaySerializable>wrapParameters(ImplementationID implID, Object[] params)Wraps parameters for serializationList<DataClaySerializable>wrapReturn(ImplementationID implID, Object ret)Wraps return for serialization-
Methods inherited from class storage.StorageObject
deletePersistent, deletePersistent
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface storage.StubItf
deletePersistent
-
-
-
-
Field Detail
-
DEBUG_ENABLED
protected static final boolean DEBUG_ENABLED
Indicates if debug is enabled.
-
logger
public static final org.apache.logging.log4j.Logger logger
Logger.
-
clientRuntime
public static DataClayRuntime clientRuntime
Client runtime.
-
objectID
protected ObjectID objectID
ObjectID of the stub instance.
-
isPersistent
protected AtomicBoolean isPersistent
Indicates if the object is registered or not.
-
isLoaded
protected AtomicBoolean isLoaded
Indicates if the object was filled with data.
-
dataSetID
protected DataSetID dataSetID
ID of dataset of object. Used for user to specify which DataSet to use in store.
-
LOCAL
public static BackendID LOCAL
'LOCAL' location
-
-
Constructor Detail
-
DataClayObject
public DataClayObject()
Constructor
-
DataClayObject
public DataClayObject(ObjectID theobjectID)
Constructor- Parameters:
theobjectID- ID of the object
-
-
Method Detail
-
initializeObjectAsPersistent
public void initializeObjectAsPersistent()
Initialize object with state 'persistent' with proper flags. See same function in DataClayExecutionObject for a different initialization. This design is intended to be clear with object state. Usually, since constructors are calling initializeObjectAsVolatile, this function 'overrides' flags set
-
initializeObjectAsVolatile
public void initializeObjectAsVolatile()
Initialize object with state 'volatile' with proper flags. Usually, volatile state is created by a stub, app, exec class,.. See same function in DataClayExecutionObject for a different initialization. This design is intended to be clear with object state.
-
setLoaded
public final void setLoaded(boolean newisLoaded)
Set the DataClayObject::isLoaded- Parameters:
newisLoaded- the isLoaded to set
-
getByAlias
protected static DataClayObject getByAlias(MetaClassID classID, String alias, boolean safe)
Generic static method to instantiate a DataClayObject by its alias- Parameters:
classID- id of real class of the instancealias- alias of the instancesafe- if true, checks that an object with the provided alias exists- Returns:
- the reference to persistent object of given class with given alias
-
getByAliasExt
public static <E> E getByAliasExt(String alias)
This method can be used from registered methods to access objects by alias, this method is parameterized in order to provide to the users a way to implement and compile an application using a model to be registered (extending DataClayObject).- Type Parameters:
E- type of the object requested- Parameters:
alias- alias of object to be requested- Returns:
- The object identified by the provided alias
-
getByAliasExt
public static <E> E getByAliasExt(String alias, boolean safe)
This method can be used from registered methods to access objects by alias, this method is parameterized in order to provide to the users a way to implement and compile an application using a model to be registered (extending DataClayObject).- Type Parameters:
E- type of the object requested- Parameters:
alias- alias of object to be requestedsafe- if true, checks that an object with the provided alias exists- Returns:
- The object identified by the provided alias
-
deleteAlias
public static void deleteAlias(String className, String alias)
Deletes an alias of an object of a specific class- Parameters:
className- class name of the objectalias- alias of the object
-
deleteAlias
public static void deleteAlias(String alias)
Method to be specialized- Parameters:
alias- alias to be removed from this object
-
deleteAlias
public void deleteAlias()
Delete object's alias
-
setObjectIDUnsafe
public void setObjectIDUnsafe(ObjectID newObjectID)
Set the object's id This method is labeled as unsafe as the user should be aware it is just possible to change ids of non-persistent objects. There no warranty that, once persisted, an object will keep the same id.- Parameters:
newObjectID- The ObjectID to set
-
debugStart
public final void debugStart(String opNameAndDesc)
Debug start of running method- Parameters:
opNameAndDesc- Operation name and descriptor
-
debugEnd
public final void debugEnd(String opNameAndDesc)
Debug end of running method- Parameters:
opNameAndDesc- Operation name and descriptor
-
setNewObjectID
public final void setNewObjectID()
Set a new object ID (used for remove objects)
-
getLib
public static final DataClayRuntime getLib()
Get DataService client library- Returns:
- DataService client library
-
setLib
public static void setLib(DataClayRuntime theruntime)
Set runtime- Parameters:
theruntime- the runtime to set
-
getObjectID
public final ObjectID getObjectID()
Get the ObjectID of the instance- Overrides:
getObjectIDin classStorageObject- Returns:
- The ObjectID
-
isPersistent
public final boolean isPersistent()
Indicates the object is persistent.- Returns:
- TRUE if it is persistent. FALSE otherwise.
-
setIsPersistent
public final void setIsPersistent(boolean newisPersistent)
Set the DataClayObject:newisPersistent- Parameters:
newisPersistent- the isPersistent to set
-
getMetaClassID
public MetaClassID getMetaClassID()
Get metaclass ID- Overrides:
getMetaClassIDin classStorageObject- Returns:
- Class ID
-
getMetaClassID
public static MetaClassID getMetaClassID(String className)
Get metaclass ID of the specified class name- Parameters:
className- name of the class- Returns:
- ID of the class
-
run
public Object run(ImplementationID implID, Object[] params)
Runs the method with ID provided and params specified- Parameters:
implID- ID of the method to invokeparams- Parameters of the method- Returns:
- Result of the method
-
synchronize
public void synchronize(ImplementationID implID, Object[] params)
Synchronize- Parameters:
implID- implementation ID to be invoked on federated objectparams- Parameters of the method
-
wrapFieldsSerialization
public void wrapFieldsSerialization(List<DataClaySerializable> wrapFields)
Wraps fields for serialization- Parameters:
wrapFields- [out] Wrapped fields
-
wrapFieldsDeserialization
public void wrapFieldsDeserialization(List<DataClaySerializable> wrapFields)
Wraps fields for deserialization- Parameters:
wrapFields- [out] Wrapped fields
-
setFieldsDeserialization
public void setFieldsDeserialization(Queue<Object> fieldsToSet)
Set fields- Parameters:
fieldsToSet- Fields to set, in order.
-
wrapParameters
public List<DataClaySerializable> wrapParameters(ImplementationID implID, Object[] params)
Wraps parameters for serialization- Parameters:
implID- ID of the method to invokeparams- Parameters of the method- Returns:
- Wrapped parameters
-
wrapReturn
public List<DataClaySerializable> wrapReturn(ImplementationID implID, Object ret)
Wraps return for serialization- Parameters:
implID- ID of the method to invokeret- Return of the method- Returns:
- Wrapped return
-
setWrappersParams
public void setWrappersParams(ImplementationID implID, SerializedParametersOrReturn wrapParams)
Unwraps parameters for deserialization- Parameters:
implID- ID of the method to invokewrapParams- Wrapped Parameters of the method
-
setWrappersReturn
public void setWrappersReturn(ImplementationID implID, SerializedParametersOrReturn wrapReturn)
Unwraps return for deserialization- Parameters:
implID- ID of the method to invokewrapReturn- Wrapped return of the method
-
setAll
public void setAll(DataClayObject otherObject)
This method set all fields with values of fields of provided object.- Parameters:
otherObject- object with values of fields to set.
-
dcClone
public DataClayObject dcClone()
Retrieves a copy of this object- Returns:
- a non-persistent copy of this object
-
dcClone
public DataClayObject dcClone(boolean recursive)
Retrieves a copy of this object- Parameters:
recursive- whether to also copy its subobjects or not- Returns:
- a non-persistent copy of this object
-
dcCloneByAlias
public static DataClayObject dcCloneByAlias(String alias)
Retrieves a copy of this object (but not the subobjects)- Parameters:
alias- alias of the object to be retrieved- Returns:
- a non-persistent copy of this object
-
dcCloneByAlias
public static DataClayObject dcCloneByAlias(String alias, boolean recursive)
Retrieves a copy of this object- Parameters:
alias- alias of the object to be retrievedrecursive- whether to also copy its subobjects or not- Returns:
- a non-persistent copy of this object
-
dcUpdate
public final void dcUpdate(DataClayObject fromObject)
Updates this object alias with the values in argument object- Parameters:
fromObject- object to be copied to this object
-
dcUpdateByAlias
public static final void dcUpdateByAlias(String alias, DataClayObject fromObject)
Updates the object identified by the given alias with the values in argument object- Parameters:
alias- alias of the object to be updatedfromObject- object to be copied to this object
-
dcPut
public final void dcPut(String alias)
Equivalent tomakePersistent- Parameters:
alias- alias for the object
-
dcPut
public final void dcPut(String alias, BackendID optBackendID)
Equivalent tomakePersistent- Parameters:
alias- alias for the objectoptBackendID- optional backend where to persist this object
-
dcPut
public final void dcPut(String alias, boolean recursive)
Equivalent tomakePersistent- Parameters:
alias- alias for the objectrecursive- whether subobjects are also persisted or not
-
dcPut
public final void dcPut(String alias, BackendID optBackendID, boolean recursive)
Equivalent tomakePersistent- Parameters:
alias- alias for the objectoptBackendID- optional backend where to persist this objectrecursive- whether subobjects are also persisted or not
-
getID
public String getID()
- Specified by:
getIDin interfaceStubItf- Overrides:
getIDin classStorageObject- Returns:
- ID of the persistent object in string format
-
makePersistent
public final void makePersistent()
- Specified by:
makePersistentin interfaceStubItf- Overrides:
makePersistentin classStorageObject
-
makePersistent
public final void makePersistent(BackendID optBackendID)
- Overrides:
makePersistentin classStorageObject- Parameters:
optBackendID- optional backend where the object must be stored
-
makePersistent
public final void makePersistent(String alias)
- Specified by:
makePersistentin interfaceStubItf- Overrides:
makePersistentin classStorageObject- Parameters:
alias- the alias associated to this object
-
makePersistent
public final void makePersistent(boolean recursive)
Store this object into DataClay.- Overrides:
makePersistentin classStorageObject- Parameters:
recursive- Indicates if all referenced objects from this objects that are not already persistent must also be stored. If true, all referenced objects are also stored. If the object is already persistent i.e. contains a DataClay objectID this function will fail.
-
makePersistent
public final void makePersistent(boolean recursive, BackendID optionalBackendID)Store this object into DataClay.- Overrides:
makePersistentin classStorageObject- Parameters:
recursive- Indicates if all referenced objects from this objects that are not already persistent must also be stored. If true, all referenced objects are also stored. If the object is already persistent i.e. contains a DataClay objectID this function will fail.optionalBackendID- ID of the backend in which the object must be stored. If null, any backend is accepted.
-
makePersistent
public final void makePersistent(String alias, BackendID destBackendID)
Store this object into DataClay.- Overrides:
makePersistentin classStorageObject- Parameters:
alias- alias for the objectdestBackendID- ID of the backend in which the object must be stored. If null, any backend is accepted.
-
makePersistent
public final void makePersistent(String alias, boolean recursive)
Store this object into DataClay.- Overrides:
makePersistentin classStorageObject- Parameters:
alias- alias for the objectrecursive- Indicates if all referenced objects from this objects that are not already persistent must also be stored. If true, all referenced objects are also stored. If the object is already persistent i.e. contains a DataClay objectID this function will fail.
-
makePersistent
public final void makePersistent(String alias, BackendID destBackendID, boolean recursive)
Store this object into DataClay.- Overrides:
makePersistentin classStorageObject- Parameters:
alias- alias for the objectdestBackendID- ID of the backend in which the object must be stored. If null, any backend is accepted.recursive- Indicates if all referenced objects from this objects that are not already persistent must also be stored. If true, all referenced objects are also stored. If the object is already persistent i.e. contains a DataClay objectID this function will fail.
-
newReplica
public final BackendID newReplica()
Creates a new replica of this persistent object and its subobjects in a certain backend.- Overrides:
newReplicain classStorageObject- Returns:
- The ID of the backend in which the replica was created.
-
newReplica
public final BackendID newReplica(boolean recursive)
Creates a new replica of this persistent object in a certain backend.- Overrides:
newReplicain classStorageObject- Parameters:
recursive- Indicates if all sub-objects must be replicated as well.- Returns:
- The ID of the backend in which the replica was created.
-
newReplica
public final BackendID newReplica(BackendID optionalBackendID)
Creates a new replica of this persistent object.- Overrides:
newReplicain classStorageObject- Parameters:
optionalBackendID- ID of the backend in which to create the replica. If null, any backend is accepted. If the object is not persistent i.e. does not contain a DataClay objectID this function will fail.- Returns:
- The ID of the backend in which the replica was created.
-
newReplica
public final BackendID newReplica(BackendID optionalBackendID, boolean recursive)
Create a new replica of this persistent object.- Overrides:
newReplicain classStorageObject- Parameters:
optionalBackendID- ID of the backend in which to create the replica. If null, any backend is accepted. If the object is not persistent i.e. does not contain a DataClay objectID this function will fail.recursive- Indicates if all sub-objects must be replicated as well.- Returns:
- The ID of the backend in which the replica was created.
-
moveObject
public final void moveObject(BackendID srcLocID, BackendID destLocID)
Moves a persistent object and referenced objects from the source location to the destination location specified. If the object is not persistent i.e. does not contain a DataClay objectID this function will fail.- Overrides:
moveObjectin classStorageObject- Parameters:
srcLocID- of the source location in which the object is stored.destLocID- of the destination location in which the object should be moved.
-
moveObject
public final void moveObject(BackendID srcLocID, BackendID destLocID, boolean recursive)
Moves a persistent object from the source location to the destination location specified. If the object is not persistent i.e. does not contain a DataClay objectID this function will fail.- Overrides:
moveObjectin classStorageObject- Parameters:
srcLocID- of the source location in which the object is stored.destLocID- of the destination location in which the object should be moved.recursive- Indicates if all sub-objects must be moved as well.
-
setObjectReadOnly
public final void setObjectReadOnly()
Sets this persistent object to be read only. If the object is not persistent i.e. does not contain a DataClay objectID this function will fail.- Overrides:
setObjectReadOnlyin classStorageObject
-
setObjectReadWrite
public final void setObjectReadWrite()
Sets this persistent object to be read write. If the object is not persistent i.e. does not contain a DataClay objectID this function will fail.- Overrides:
setObjectReadWritein classStorageObject
-
getLocation
public final BackendID getLocation()
Gets the location of this persistent object.- Overrides:
getLocationin classStorageObject- Returns:
- ID of the backend in which the object is stored. If the object is not persistent i.e. does not contain a DataClay objectID this function will fail.
-
getAllLocations
public final Set<BackendID> getAllLocations()
Gets the location of this persistent object and its replicas.- Overrides:
getAllLocationsin classStorageObject- Returns:
- A set of IDs of the backend in which this object or its replicas are stored. If the object is not persistent i.e. does not contain a DataClay objectID this function will fail.
-
federate
public void federate(DataClayInstanceID extDataClayID, boolean recursive)
Federates this object with an external dataClay instance- Parameters:
extDataClayID- id of the external dataClay instancerecursive- whether to federate recursively or not
-
unfederate
public void unfederate(DataClayInstanceID extDataClayID, boolean recursive)
Unfederate this object with the provided external dataClay- Parameters:
extDataClayID- id of the external dataClay instancerecursive- whether to unfederate recursively or not
-
unfederate
public void unfederate(boolean recursive)
Unfederate this object with all external dataClays is registered with- Parameters:
recursive- whether to unfederate recursively or not
-
federate
public void federate(DataClayInstanceID extDataClayID)
Federates this object with an external dataClay instance- Parameters:
extDataClayID- id of the external dataClay instance
-
unfederate
public void unfederate(DataClayInstanceID extDataClayID)
Unfederate this object with the provided external dataClay- Parameters:
extDataClayID- id of the external dataClay instance
-
federateToBackend
public void federateToBackend(BackendID extBackendID)
Federates this object with an external backend instance- Parameters:
extBackendID- id of the external backend to federate
-
federateToBackend
public void federateToBackend(BackendID extBackendID, boolean recursive)
Federates this object with an external backend instance- Parameters:
extBackendID- id of the external backend to federaterecursive- Indicates if federation is recursive or not
-
unfederateFromBackend
public void unfederateFromBackend(BackendID extBackendID)
Unfederates this object with an external backend instance- Parameters:
extBackendID- id of the external backend to federate
-
unfederateFromBackend
public void unfederateFromBackend(BackendID extBackendID, boolean recursive)
Unfederates this object with an external backend instance- Parameters:
extBackendID- id of the external backend to federaterecursive- Indicates if unfederation is recursive or not
-
getExternalDataClayID
public final DataClayInstanceID getExternalDataClayID(String hostname, int port)
Retrieve dataClay ID- Parameters:
hostname- Name of external dataclayport- Port of external dataclay- Returns:
- ID of external dataclay
-
sessionDetach
public final void sessionDetach()
Detach object from session, i.e. remove reference from current session provided to current object, "dear garbage-collector, the current session is not using this object anymore"
-
whenFederated
public void whenFederated()
Override this function with code to be executed when a federated object arrives into a destination dataClay.
-
whenUnfederated
public void whenUnfederated()
Override this function with code to be executed when a federate object is unfederated in destination dataClay.
-
serialize
public void serialize(DataClayByteBuffer dcBuffer, boolean ignoreUserTypes, Map<MetaClassID,byte[]> ifaceBitMaps, IdentityHashMap<Object,Integer> curSerializedObjs, ListIterator<DataClayObject> pendingObjs, ReferenceCounting referenceCounting)
Description copied from interface:DataClaySerializableSerializes the object into the buffer provided using the interface represented in the bitmap specified.- Specified by:
serializein interfaceDataClaySerializable- Parameters:
dcBuffer- Buffer in which to serialize the objectignoreUserTypes- Indicates if user types found during serialization must be ignored or not (for instance, non recursive make persistent)ifaceBitMaps- Map of bitmaps representing the interfaces to usecurSerializedObjs- Current serialized objects Object -> OID tag. This structure must be different during each serialization since OID tags are not shared.pendingObjs- Pending objs.referenceCounting- Reference counting from this object.
-
deserialize
public void deserialize(DataClayByteBuffer dcBuffer, Map<MetaClassID,byte[]> ifaceBitMaps, DataClayObjectMetaData metadata, Map<Integer,Object> curDeserializedJavaObjs)
Description copied from interface:DataClaySerializableDeserializes the object from the buffer provided using the interface represented in the bitmap specified.- Specified by:
deserializein interfaceDataClaySerializable- Parameters:
dcBuffer- Buffer from which to deserialize the objectifaceBitMaps- Map of bitmaps representing the interfaces to usemetadata- Useful metadata of the object for executioncurDeserializedJavaObjs- Currently deserialized Java objects
-
getHint
public BackendID getHint()
Get the DataClayObject::hint- Returns:
- the hint
-
setHint
public void setHint(BackendID newhint)
Set the DataClayObject::hint- Parameters:
newhint- the hint to set
-
clearExecStubInfosCache
public static final void clearExecStubInfosCache()
Clear exec stub infos cache for enrichments.
-
clearStubInfosCache
public static final void clearStubInfosCache()
Clear stub infos cache for enrichments.
-
getStubInfo
public final StubInfo getStubInfo()
Get stub information of class- Returns:
- Stub information
-
isStub
public static final boolean isStub(Class<?> clazz)
Checks if class provided is stub or not.- Parameters:
clazz- Class to check.- Returns:
- True if it is an stub. False otherwise.
-
getStubInfoFromClass
public static final StubInfo getStubInfoFromClass(String className)
Get stubinfo for class with name provided- Parameters:
className- Name of the class- Returns:
- Stub information.
-
executeRemoteImplementation
public Object executeRemoteImplementation(String methodSignature, String implIDAsStr, Object[] params)
Execute remote method- Overrides:
executeRemoteImplementationin classStorageObject- Parameters:
methodSignature- Signature of the methodimplIDAsStr- ImplementationID as stringparams- Parameters to send- Returns:
- Return value.
-
getDataSetID
public DataSetID getDataSetID()
Get DataSetID- Returns:
- DataSetID
-
setDataSetID
public void setDataSetID(DataSetID newDataSetID)
Set object DataSetID- Parameters:
newDataSetID- ID of DataSet this object belongs to
-
getMasterLocation
public final BackendID getMasterLocation()
- Returns:
- the masterLocation
-
setMasterLocation
public void setMasterLocation(BackendID newMasterLocation)
If called from client side will not have any effect.- Parameters:
newMasterLocation- the masterLocation to set
-
getAlias
public String getAlias()
Get alias- Returns:
- the alias of the object
-
setAlias
public void setAlias(String alias)
Set the alias of the object- Parameters:
alias- the alias of the object
-
isReadOnly
public boolean isReadOnly()
Get if object is read only- Returns:
- boolean indicating if object is read only or not
-
setReadOnly
public void setReadOnly(boolean readOnly)
Set if object is read only- Parameters:
readOnly- boolean indicating if object is read only or not
-
getOriginalObjectID
public final ObjectID getOriginalObjectID()
- Returns:
- the original object id in case of new version
-
setOriginalObjectID
public void setOriginalObjectID(ObjectID newOriginalObjectID)
- Parameters:
newOriginalObjectID- the original object id to set
-
getRootLocation
public ExecutionEnvironmentID getRootLocation()
- Returns:
- root location of the object or null if current is original
-
setRootLocation
public void setRootLocation(ExecutionEnvironmentID rootLocation)
Set root location of the object- Parameters:
rootLocation- root location to set
-
getOriginLocation
public ExecutionEnvironmentID getOriginLocation()
- Returns:
- origin location of the object or null if current is original
-
setOriginLocation
public void setOriginLocation(ExecutionEnvironmentID originLocation)
Set origin location of the object- Parameters:
originLocation- origin location to set
-
getReplicaLocations
public Set<ExecutionEnvironmentID> getReplicaLocations()
Get all replica locations- Returns:
- Replica locations
-
setReplicaLocations
public void setReplicaLocations(Set<ExecutionEnvironmentID> replicaLocations)
Set replica locations- Parameters:
replicaLocations- replica locations to set
-
addReplicaLocations
public void addReplicaLocations(ExecutionEnvironmentID replicaLocation)
Add replica location- Parameters:
replicaLocation- replica location to add
-
removeReplicaLocation
public void removeReplicaLocation(ExecutionEnvironmentID replicaLocation)
Remove replica location- Parameters:
replicaLocation- replica location to add
-
clearReplicaLocations
public void clearReplicaLocations()
Clear replica locations
-
isMasterLocation
public final boolean isMasterLocation()
- Returns:
- true if masterlocation is the current backend, false otherwise
-
getExternalDataClayID
public DataClayInstanceID getExternalDataClayID()
- Returns:
- id of the external dataClay instance where the object resides. null if it is local.
-
setExternalDataClayID
public void setExternalDataClayID(DataClayInstanceID newID)
- Parameters:
newID- id of the external dataClay instance
-
isPrefetchingAccess
public boolean isPrefetchingAccess()
RT PREFETCHING FIELDS
-
setPrefetchingAccess
public static void setPrefetchingAccess(boolean value)
-
getAccessCount
public static long getAccessCount()
-
getHitCount
public static long getHitCount()
-
incrementAccessCount
protected void incrementAccessCount()
-
incrementHitCount
protected void incrementHitCount()
-
resetObjectAccessStats
public static void resetObjectAccessStats()
-
printObjectAccessStats
public static void printObjectAccessStats()
-
-