org.objectweb.speedo.mim.api
Interface StateItf

All Superinterfaces:
org.objectweb.jorm.api.PAccessor, java.io.Serializable, State
All Known Implementing Classes:
AbstractStateImpl, CollectionAccessor, GenClassAccessor, ListAccessor, MapAccessor, SetAccessor

public interface StateItf
extends org.objectweb.jorm.api.PAccessor, State, java.io.Serializable

This interface a state of an user instance.

Author:
S.Chassande-Barrioz

Method Summary
 void attachCopy(POManagerItf pm, java.util.Map map, StateItf detached)
          This method is used during the attach operation.
 boolean checkVersion(StateItf sa)
          check the validity of the version of sa compared to the persistent object this.
 void deletePersistent(POManagerItf pm)
          Deletes persistent all inner elements of the persistent instance.
 void detachCopy(POManagerItf pm, java.util.Map map, StateItf 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
 PersistentObjectItf getSpeedoPO()
           
 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 StateItf has to be merge with the reference state at commit time.
 void loadFields(POManagerItf pm, long[] fields)
          Askes the loading of the some fields identified by the long array.
 void makePersistent(POManagerItf pm)
          Makes persistent all inner elements of the persistent instance.
 void makePersistentOnAttach(POManagerItf pm, java.util.Map map)
          makes persistent on attach, taking into account the map representing the attch context.
 void makeToMerge(java.lang.Object thinLock)
          Mark the current state with the flag 'toMerge'.
 State merge(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(POManagerItf 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(POManagerItf 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 setSpeedoPO(PersistentObjectItf sp)
          Assignes the PersistentObjectItf attached to this state representation.
 void speedoChangeStatus(byte action)
          Changes the status of this object
 void speedoChangeVersion()
          change the version of this only if needed The version is computed by this method A call to changeVersion can have no effect.
 byte speedoGetStatus()
          Gets the current status of this object
 void speedoSetStatus(byte newValue)
          Forces the new value of the status
 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, setCacheEntry
 

Method Detail

speedoChangeStatus

void speedoChangeStatus(byte action)
Changes the status of this object

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

speedoGetStatus

byte speedoGetStatus()
Gets the current status of this object

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

speedoSetStatus

void speedoSetStatus(byte newValue)
Forces the new value of the status

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

speedoChangeVersion

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


getVersion

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


checkVersion

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


getDetachedStatus

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

Returns:
the current state in the life cycle

setDetachedStatus

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

Parameters:
newValue - the new status of this object

getSpeedoPO

PersistentObjectItf getSpeedoPO()
Returns:
The PersistentObjectItf attached to this state representation.

setSpeedoPO

void setSpeedoPO(PersistentObjectItf sp)
Assignes the PersistentObjectItf attached to this state representation.


prepareWrite

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


workingSetClosed

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


hasBeenFlush

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

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

void makePersistent(POManagerItf 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 (PO) linked to this accessor.

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

makePersistentOnAttach

void makePersistentOnAttach(POManagerItf pm,
                            java.util.Map map)
makes persistent on attach, taking into account the map representing the attch context. It enables to avoid cycles.

Parameters:
pm - is the po manager for making persistent inner element.
map - is the context of the attachment process.

deletePersistent

void deletePersistent(POManagerItf 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 (po) linked to this accessor.

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

loadFields

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

Parameters:
pm - is the po 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

void detachCopy(POManagerItf pm,
                java.util.Map map,
                StateItf 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 po 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

void attachCopy(POManagerItf pm,
                java.util.Map map,
                StateItf detached)
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 po 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

refresh

void refresh(POManagerItf 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 po 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

void retrieve(POManagerItf 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 po 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

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


restoreDetachedNone

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


isToMerge

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


makeToMerge

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

State merge(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

void unSwizzle()

indexFieldModified

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