org.objectweb.speedo.mim.api
Interface SpeedoAccessor

All Superinterfaces:
org.objectweb.jorm.api.PAccessor, java.io.Serializable, org.objectweb.perseus.persistence.api.State
All Known Implementing Classes:
BasicSpeedoAccessor

public interface SpeedoAccessor
extends org.objectweb.jorm.api.PAccessor, org.objectweb.perseus.persistence.api.State, java.io.Serializable

This interface a state of an user instance.

Author:
S.Chassande-Barrioz

Method Summary
 void attachCopy(ProxyManager pm, java.util.Map map, SpeedoAccessor detached, boolean makeTransactional)
          This method is used during the attach operation.
 void changeVersion()
          change the version of this only if needed The version is computed by this method A call to changeVersion can have no effect.
 boolean checkVersion(SpeedoAccessor sa)
          check the validity of the version of sa compared to the persistent object this.
 void deletePersistent(ProxyManager pm)
          Deletes persistent all inner elements of the persistent instance.
 void detachCopy(ProxyManager pm, java.util.Map map, SpeedoAccessor clone, java.util.Collection fgHints)
          This method is used during the detach operation.
 void forceDetachedDirty()
          Force the detached status to DETACHED_DIRTY and all the xxxLoaded to true
 byte getDetachedStatus()
          Gets the current status of this detached object
 SpeedoProxy getSpeedoProxy()
           
 long getVersion()
          Return the version of the object as a long
 boolean hasBeenFlush()
          indicates if the object has been flushed on the support in a writing before the end of the working set (commit | rollback | close).
 void indexFieldModified(int cacheId, boolean rebind)
          The field uses in user cache, has been modified.
 boolean isToMerge()
          indicates if the State has to be merge with the reference state at commit time.
 void jdoChangeStatus(byte action)
          Changes the status of this object
 byte jdoGetStatus()
          Gets the current status of this object
 void jdoSetStatus(byte newValue)
          Forces the new value of the status
 void loadFields(ProxyManager pm, long[] fields)
          Askes the loading of the some fields identified by the long array.
 void makePersistent(ProxyManager pm)
          Makes persistent all inner elements of the persistent instance.
 void makeToMerge(java.lang.Object thinLock)
          Mark the current state with the flag 'toMerge'.
 org.objectweb.perseus.persistence.api.State merge(org.objectweb.perseus.persistence.api.State oldState)
          This action updates the old state with the change (delta) done in the transaction on this state.
 void prepareWrite()
          Prepare to write (relations consistency management)
 void refresh(ProxyManager pm, java.util.Map map, java.util.Collection fgHints)
          This method is used during the refresh operation.
 void restoreDetachedNone()
          Restore the detached status to DETACHED_NONE and all the xxxLoaded to false
 void retrieve(ProxyManager pm, java.util.Map map, java.util.Collection fgHints)
          This method is used during the retrieve operation.
 void setDetachedStatus(byte newValue)
          Forces the new value of the detached status
 void setFlushed(boolean val)
          Assignates a boolean value to indicate if the object has been flushed on the support in a writing before the end of the working set (commit | rollback | close).
 void setSpeedoProxy(SpeedoProxy sp)
          Assignes the SpeedoProxy attached to this state representation.
 void unSwizzle()
           
 void workingSetClosed()
          The context has been closed (ex: transaction end).
 
Methods inherited from interface org.objectweb.jorm.api.PAccessor
getMemoryInstance
 
Methods inherited from interface org.objectweb.perseus.persistence.api.State
getCacheEntry
 

Method Detail

jdoChangeStatus

public void jdoChangeStatus(byte action)
Changes the status of this object

Parameters:
action - the action that may change the status
See Also:
LifeCycle

jdoGetStatus

public byte jdoGetStatus()
Gets the current status of this object

Returns:
the current state in the life cycle
See Also:
LifeCycle

jdoSetStatus

public void jdoSetStatus(byte newValue)
Forces the new value of the status

Parameters:
newValue - the new status of this object
See Also:
LifeCycle

changeVersion

public void changeVersion()
change the version of this only if needed The version is computed by this method A call to changeVersion can have no effect.


getVersion

public long getVersion()
Return the version of the object as a long


checkVersion

public boolean checkVersion(SpeedoAccessor sa)
check the validity of the version of sa compared to the persistent object this.


getDetachedStatus

public byte getDetachedStatus()
Gets the current status of this detached object

Returns:
the current state in the life cycle

setDetachedStatus

public void setDetachedStatus(byte newValue)
Forces the new value of the detached status

Parameters:
newValue - the new status of this object

getSpeedoProxy

public SpeedoProxy getSpeedoProxy()
Returns:
The SpeedoProxy attached to this state representation.

setSpeedoProxy

public void setSpeedoProxy(SpeedoProxy sp)
Assignes the SpeedoProxy attached to this state representation.


prepareWrite

public void prepareWrite()
Prepare to write (relations consistency management)


workingSetClosed

public void workingSetClosed()
The context has been closed (ex: transaction end).


hasBeenFlush

public boolean hasBeenFlush()
indicates if the object has been flushed on the support in a writing before the end of the working set (commit | rollback | close).


setFlushed

public void setFlushed(boolean val)
Assignates a boolean value to indicate if the object has been flushed on the support in a writing before the end of the working set (commit | rollback | close).

Parameters:
val - is the boolean which must be assigned.

makePersistent

public void makePersistent(ProxyManager pm)
Makes persistent all inner elements of the persistent instance. For a class, it means making persistent all objects referenced by a persistent field. For a genclass it means making persistent element of the genclass. This method is called when a makePersistent is called on the persistent class (Proxy) linked to this accessor.

Parameters:
pm - is the proxy manager for making persistent inner element.

deletePersistent

public void deletePersistent(ProxyManager pm)
Deletes persistent all inner elements of the persistent instance. For a class, it means deleting persistent all objects referenced by a persistent field. For a genclass it means deleting persistent element of the genclass. This method is called when a deletePersistent is called on the persistent class (Proxy) linked to this accessor.

Parameters:
pm - is the proxy manager for making persistent inner element.

loadFields

public void loadFields(ProxyManager pm,
                       long[] fields)
Askes the loading of the some fields identified by the long array.

Parameters:
pm - is the Proxy manager to use to load references
fields - is an array of long. Each long is a bit mask indicating fields to load. As a long is stored over 64 bits, each long of the array can represent only 64 persistent fields. If the class has 70 persistent field, the parameter could be a long array size is 2. This parameter can be null if no field loading is required.

detachCopy

public void detachCopy(ProxyManager pm,
                       java.util.Map map,
                       SpeedoAccessor clone,
                       java.util.Collection fgHints)
This method is used during the detach operation. A call to this method copy the field of the state into the the cloned state. When a field references a persistent object, according to the fetch plan, the referenced can be detached too.

Parameters:
pm - is the proxy manager used during the detach operation
map - is the map of the detached object. The use of this map permits to support cycle in the object graph.
clone - is a clone of the current state
fgHints - represents the fetch plan.

attachCopy

public void attachCopy(ProxyManager pm,
                       java.util.Map map,
                       SpeedoAccessor detached,
                       boolean makeTransactional)
This method is used during the attach operation. A call to this method copy the field of the cloned state into the the current state. When a field references a persistent object, according to the fetch plan, the referenced can be attached too.

Parameters:
pm - is the proxy manager used during the attach operation
map - is the map of the atttached object. The use of this map permits to support cycle in the object graph.
detached - is the detached state used to update the current state
makeTransactional - ??? TODO comment the parameter

refresh

public void refresh(ProxyManager pm,
                    java.util.Map map,
                    java.util.Collection fgHints)
This method is used during the refresh operation. A call to this method refreshes the fields of the current state. When a field references a persistent object, according to the fetch plan, the referenced can be refreshed too.

Parameters:
pm - is the proxy manager used during the refresh operation
map - is the map of the refreshed object. The use of this map permits to support cycle in the object graph.
fgHints - represents the fetch plan.

retrieve

public void retrieve(ProxyManager pm,
                     java.util.Map map,
                     java.util.Collection fgHints)
This method is used during the retrieve operation. A call to this method retrieves the fields of the current state. When a field references a persistent object, according to the fetch plan, the referenced can be retrieved too.

Parameters:
pm - is the proxy manager used during the retrieve operation
map - is the map of the retrieved object. The use of this map permits to support cycle in the object graph.
fgHints - represents the fetch plan.

forceDetachedDirty

public void forceDetachedDirty()
Force the detached status to DETACHED_DIRTY and all the xxxLoaded to true


restoreDetachedNone

public void restoreDetachedNone()
Restore the detached status to DETACHED_NONE and all the xxxLoaded to false


isToMerge

public boolean isToMerge()
indicates if the State has to be merge with the reference state at commit time.


makeToMerge

public void makeToMerge(java.lang.Object thinLock)
Mark the current state with the flag 'toMerge'. This status means at commit time this state has to be merge with the referenceState (cache). Since this method call and until the transaction end, the implementation could register the change for the merge.

Parameters:
thinLock - is an object representing the thin lock

merge

public org.objectweb.perseus.persistence.api.State merge(org.objectweb.perseus.persistence.api.State oldState)
This action updates the old state with the change (delta) done in the transaction on this state.

Parameters:
oldState - is the state which has to be updated
Returns:
the updated state.

unSwizzle

public void unSwizzle()

indexFieldModified

public void indexFieldModified(int cacheId,
                               boolean rebind)
The field uses in user cache, has been modified.

Parameters:
cacheId - is the cache identifier. The value Integer.MAX_VALUE means that all user cache must be updated.
rebind - if true, the speedoAcessor is rebound