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 DataClayRuntime
clientRuntime
Client runtime.protected DataSetID
dataSetID
ID of dataset of object.protected static boolean
DEBUG_ENABLED
Indicates if debug is enabled.protected AtomicBoolean
isLoaded
Indicates if the object was filled with data.protected AtomicBoolean
isPersistent
Indicates if the object is registered or not.static BackendID
LOCAL
'LOCAL' locationstatic org.apache.logging.log4j.Logger
logger
Logger.protected ObjectID
objectID
ObjectID 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 void
addReplicaLocations(ExecutionEnvironmentID replicaLocation)
Add replica locationstatic void
clearExecStubInfosCache()
Clear exec stub infos cache for enrichments.void
clearReplicaLocations()
Clear replica locationsstatic void
clearStubInfosCache()
Clear stub infos cache for enrichments.DataClayObject
dcClone()
Retrieves a copy of this objectDataClayObject
dcClone(boolean recursive)
Retrieves a copy of this objectstatic DataClayObject
dcCloneByAlias(String alias)
Retrieves a copy of this object (but not the subobjects)static DataClayObject
dcCloneByAlias(String alias, boolean recursive)
Retrieves a copy of this objectvoid
dcPut(String alias)
Equivalent tomakePersistent
void
dcPut(String alias, boolean recursive)
Equivalent tomakePersistent
void
dcPut(String alias, BackendID optBackendID)
Equivalent tomakePersistent
void
dcPut(String alias, BackendID optBackendID, boolean recursive)
Equivalent tomakePersistent
void
dcUpdate(DataClayObject fromObject)
Updates this object alias with the values in argument objectstatic void
dcUpdateByAlias(String alias, DataClayObject fromObject)
Updates the object identified by the given alias with the values in argument objectvoid
debugEnd(String opNameAndDesc)
Debug end of running methodvoid
debugStart(String opNameAndDesc)
Debug start of running methodvoid
deleteAlias()
Delete object's aliasstatic void
deleteAlias(String alias)
Method to be specializedstatic void
deleteAlias(String className, String alias)
Deletes an alias of an object of a specific classvoid
deserialize(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.boolean
equals(Object obj)
Object
executeRemoteImplementation(String methodSignature, String implIDAsStr, Object[] params)
Execute remote methodvoid
federate(DataClayInstanceID extDataClayID)
Federates this object with an external dataClay instancevoid
federate(DataClayInstanceID extDataClayID, boolean recursive)
Federates this object with an external dataClay instancevoid
federateToBackend(BackendID extBackendID)
Federates this object with an external backend instancevoid
federateToBackend(BackendID extBackendID, boolean recursive)
Federates this object with an external backend instancestatic long
getAccessCount()
String
getAlias()
Get aliasSet<BackendID>
getAllLocations()
Gets the location of this persistent object and its replicas.protected static DataClayObject
getByAlias(MetaClassID classID, String alias, boolean safe)
Generic static method to instantiate a DataClayObject by its aliasstatic <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).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).DataSetID
getDataSetID()
Get DataSetIDDataClayInstanceID
getExternalDataClayID()
DataClayInstanceID
getExternalDataClayID(String hostname, int port)
Retrieve dataClay IDBackendID
getHint()
Get the DataClayObject::hintstatic long
getHitCount()
String
getID()
static DataClayRuntime
getLib()
Get DataService client libraryBackendID
getLocation()
Gets the location of this persistent object.BackendID
getMasterLocation()
MetaClassID
getMetaClassID()
Get metaclass IDstatic MetaClassID
getMetaClassID(String className)
Get metaclass ID of the specified class nameObjectID
getObjectID()
Get the ObjectID of the instanceObjectID
getOriginalObjectID()
ExecutionEnvironmentID
getOriginLocation()
Set<ExecutionEnvironmentID>
getReplicaLocations()
Get all replica locationsExecutionEnvironmentID
getRootLocation()
StubInfo
getStubInfo()
Get stub information of classstatic StubInfo
getStubInfoFromClass(String className)
Get stubinfo for class with name providedint
hashCode()
protected void
incrementAccessCount()
protected void
incrementHitCount()
void
initializeObjectAsPersistent()
Initialize object with state 'persistent' with proper flags.void
initializeObjectAsVolatile()
Initialize object with state 'volatile' with proper flags.boolean
isMasterLocation()
boolean
isPersistent()
Indicates the object is persistent.boolean
isPrefetchingAccess()
RT PREFETCHING FIELDSboolean
isReadOnly()
Get if object is read onlystatic boolean
isStub(Class<?> clazz)
Checks if class provided is stub or not.void
makePersistent()
void
makePersistent(boolean recursive)
Store this object into DataClay.void
makePersistent(boolean recursive, BackendID optionalBackendID)
Store this object into DataClay.void
makePersistent(BackendID optBackendID)
void
makePersistent(String alias)
void
makePersistent(String alias, boolean recursive)
Store this object into DataClay.void
makePersistent(String alias, BackendID destBackendID)
Store this object into DataClay.void
makePersistent(String alias, BackendID destBackendID, boolean recursive)
Store this object into DataClay.void
moveObject(BackendID srcLocID, BackendID destLocID)
Moves a persistent object and referenced objects from the source location to the destination location specified.void
moveObject(BackendID srcLocID, BackendID destLocID, boolean recursive)
Moves a persistent object from the source location to the destination location specified.BackendID
newReplica()
Creates a new replica of this persistent object and its subobjects in a certain backend.BackendID
newReplica(boolean recursive)
Creates a new replica of this persistent object in a certain backend.BackendID
newReplica(BackendID optionalBackendID)
Creates a new replica of this persistent object.BackendID
newReplica(BackendID optionalBackendID, boolean recursive)
Create a new replica of this persistent object.static void
printObjectAccessStats()
void
removeReplicaLocation(ExecutionEnvironmentID replicaLocation)
Remove replica locationstatic void
resetObjectAccessStats()
Object
run(ImplementationID implID, Object[] params)
Runs the method with ID provided and params specifiedvoid
serialize(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.void
sessionDetach()
Detach object from session, i.e.void
setAlias(String alias)
Set the alias of the objectvoid
setAll(DataClayObject otherObject)
This method set all fields with values of fields of provided object.void
setDataSetID(DataSetID newDataSetID)
Set object DataSetIDvoid
setExternalDataClayID(DataClayInstanceID newID)
void
setFieldsDeserialization(Queue<Object> fieldsToSet)
Set fieldsvoid
setHint(BackendID newhint)
Set the DataClayObject::hintvoid
setIsPersistent(boolean newisPersistent)
Set the DataClayObject:newisPersistentstatic void
setLib(DataClayRuntime theruntime)
Set runtimevoid
setLoaded(boolean newisLoaded)
Set the DataClayObject::isLoadedvoid
setMasterLocation(BackendID newMasterLocation)
If called from client side will not have any effect.void
setNewObjectID()
Set a new object ID (used for remove objects)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.void
setObjectReadOnly()
Sets this persistent object to be read only.void
setObjectReadWrite()
Sets this persistent object to be read write.void
setOriginalObjectID(ObjectID newOriginalObjectID)
void
setOriginLocation(ExecutionEnvironmentID originLocation)
Set origin location of the objectstatic void
setPrefetchingAccess(boolean value)
void
setReadOnly(boolean readOnly)
Set if object is read onlyvoid
setReplicaLocations(Set<ExecutionEnvironmentID> replicaLocations)
Set replica locationsvoid
setRootLocation(ExecutionEnvironmentID rootLocation)
Set root location of the objectvoid
setWrappersParams(ImplementationID implID, SerializedParametersOrReturn wrapParams)
Unwraps parameters for deserializationvoid
setWrappersReturn(ImplementationID implID, SerializedParametersOrReturn wrapReturn)
Unwraps return for deserializationvoid
synchronize(ImplementationID implID, Object[] params)
Synchronizevoid
unfederate(boolean recursive)
Unfederate this object with all external dataClays is registered withvoid
unfederate(DataClayInstanceID extDataClayID)
Unfederate this object with the provided external dataClayvoid
unfederate(DataClayInstanceID extDataClayID, boolean recursive)
Unfederate this object with the provided external dataClayvoid
unfederateFromBackend(BackendID extBackendID)
Unfederates this object with an external backend instancevoid
unfederateFromBackend(BackendID extBackendID, boolean recursive)
Unfederates this object with an external backend instancevoid
whenFederated()
Override this function with code to be executed when a federated object arrives into a destination dataClay.void
whenUnfederated()
Override this function with code to be executed when a federate object is unfederated in destination dataClay.void
wrapFieldsDeserialization(List<DataClaySerializable> wrapFields)
Wraps fields for deserializationvoid
wrapFieldsSerialization(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:
getObjectID
in 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:
getMetaClassID
in 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:
getID
in interfaceStubItf
- Overrides:
getID
in classStorageObject
- Returns:
- ID of the persistent object in string format
-
makePersistent
public final void makePersistent()
- Specified by:
makePersistent
in interfaceStubItf
- Overrides:
makePersistent
in classStorageObject
-
makePersistent
public final void makePersistent(BackendID optBackendID)
- Overrides:
makePersistent
in classStorageObject
- Parameters:
optBackendID
- optional backend where the object must be stored
-
makePersistent
public final void makePersistent(String alias)
- Specified by:
makePersistent
in interfaceStubItf
- Overrides:
makePersistent
in classStorageObject
- Parameters:
alias
- the alias associated to this object
-
makePersistent
public final void makePersistent(boolean recursive)
Store this object into DataClay.- Overrides:
makePersistent
in 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:
makePersistent
in 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:
makePersistent
in 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:
makePersistent
in 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:
makePersistent
in 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:
newReplica
in 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:
newReplica
in 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:
newReplica
in 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:
newReplica
in 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:
moveObject
in 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:
moveObject
in 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:
setObjectReadOnly
in 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:
setObjectReadWrite
in classStorageObject
-
getLocation
public final BackendID getLocation()
Gets the location of this persistent object.- Overrides:
getLocation
in 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:
getAllLocations
in 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:DataClaySerializable
Serializes the object into the buffer provided using the interface represented in the bitmap specified.- Specified by:
serialize
in 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:DataClaySerializable
Deserializes the object from the buffer provided using the interface represented in the bitmap specified.- Specified by:
deserialize
in 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:
executeRemoteImplementation
in 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()
-
-