org.objectweb.speedo.mim.lib
Class BasicSpeedoAccessor

java.lang.Object
  extended byorg.objectweb.speedo.mim.lib.BasicSpeedoAccessor
All Implemented Interfaces:
org.objectweb.jorm.api.PAccessor, java.io.Serializable, SpeedoAccessor, org.objectweb.perseus.persistence.api.State
Direct Known Subclasses:
GenClassAccessor

public abstract class BasicSpeedoAccessor
extends java.lang.Object
implements SpeedoAccessor

This class is the basic implementation of the SpeedoAccessor interface. It is used at the top of the XXXFields class inheritance.

Author:
S.Chassande-Barrioz
See Also:
Serialized Form

Field Summary
 byte detachedStatus
           
 boolean hasBeenFlush
           
protected  boolean isToMerge
           
protected  byte jdoStatus
          This version is allocated: - before attach - before detach - before commit
 SpeedoProxy proxy
           
 
Constructor Summary
BasicSpeedoAccessor()
           
BasicSpeedoAccessor(SpeedoProxy _proxy)
           
 
Method Summary
 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.
 org.objectweb.perseus.cache.api.CacheEntry getCacheEntry()
           
 byte getDetachedStatus()
          Gets the current status of this detached object
 java.lang.Object getMemoryInstance()
           
 SpeedoProxy getSpeedoProxy()
           
 java.lang.Object getUserKey(int cacheId)
           
 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 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 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)
          It assignes the SpeedoProxy attached to this state representation.
 void workingSetClosed()
          The context has been closed (ex: transaction end).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.speedo.mim.api.SpeedoAccessor
attachCopy, deletePersistent, detachCopy, forceDetachedDirty, loadFields, makePersistent, refresh, restoreDetachedNone, retrieve, unSwizzle
 

Field Detail

jdoStatus

protected byte jdoStatus
This version is allocated: - before attach - before detach - before commit


detachedStatus

public byte detachedStatus

isToMerge

protected boolean isToMerge

proxy

public SpeedoProxy proxy

hasBeenFlush

public boolean hasBeenFlush
Constructor Detail

BasicSpeedoAccessor

public BasicSpeedoAccessor()

BasicSpeedoAccessor

public BasicSpeedoAccessor(SpeedoProxy _proxy)
Method Detail

getCacheEntry

public org.objectweb.perseus.cache.api.CacheEntry getCacheEntry()
Specified by:
getCacheEntry in interface org.objectweb.perseus.persistence.api.State

getMemoryInstance

public java.lang.Object getMemoryInstance()
Specified by:
getMemoryInstance in interface org.objectweb.jorm.api.PAccessor

jdoChangeStatus

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

Specified by:
jdoChangeStatus in interface SpeedoAccessor
Parameters:
action - the action that may change the status
See Also:
LifeCycle

jdoGetStatus

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

Specified by:
jdoGetStatus in interface SpeedoAccessor
Returns:
the current state in the life cycle
See Also:
LifeCycle

jdoSetStatus

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

Specified by:
jdoSetStatus in interface SpeedoAccessor
Parameters:
newValue - the new status of this object
See Also:
LifeCycle

getDetachedStatus

public byte getDetachedStatus()
Description copied from interface: SpeedoAccessor
Gets the current status of this detached object

Specified by:
getDetachedStatus in interface SpeedoAccessor
Returns:
the current state in the life cycle

setDetachedStatus

public void setDetachedStatus(byte newValue)
Description copied from interface: SpeedoAccessor
Forces the new value of the detached status

Specified by:
setDetachedStatus in interface SpeedoAccessor
Parameters:
newValue - the new status of this object

getSpeedoProxy

public SpeedoProxy getSpeedoProxy()
Specified by:
getSpeedoProxy in interface SpeedoAccessor
Returns:
The SpeedoProxy attached to this state representation.

setSpeedoProxy

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

Specified by:
setSpeedoProxy in interface SpeedoAccessor

prepareWrite

public void prepareWrite()
Description copied from interface: SpeedoAccessor
Prepare to write (relations consistency management)

Specified by:
prepareWrite in interface SpeedoAccessor

workingSetClosed

public void workingSetClosed()
Description copied from interface: SpeedoAccessor
The context has been closed (ex: transaction end).

Specified by:
workingSetClosed in interface SpeedoAccessor

hasBeenFlush

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

Specified by:
hasBeenFlush in interface SpeedoAccessor

setFlushed

public void setFlushed(boolean val)
Description copied from interface: SpeedoAccessor
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).

Specified by:
setFlushed in interface SpeedoAccessor
Parameters:
val - is the boolean which must be assigned.

changeVersion

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

Specified by:
changeVersion in interface SpeedoAccessor

checkVersion

public boolean checkVersion(SpeedoAccessor sa)
Description copied from interface: SpeedoAccessor
check the validity of the version of sa compared to the persistent object this.

Specified by:
checkVersion in interface SpeedoAccessor

getVersion

public long getVersion()
Description copied from interface: SpeedoAccessor
Return the version of the object as a long

Specified by:
getVersion in interface SpeedoAccessor

isToMerge

public boolean isToMerge()
Description copied from interface: SpeedoAccessor
indicates if the State has to be merge with the reference state at commit time.

Specified by:
isToMerge in interface SpeedoAccessor

makeToMerge

public void makeToMerge(java.lang.Object thinLock)
Description copied from interface: SpeedoAccessor
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.

Specified by:
makeToMerge in interface SpeedoAccessor
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)
Description copied from interface: SpeedoAccessor
This action updates the old state with the change (delta) done in the transaction on this state.

Specified by:
merge in interface SpeedoAccessor
Parameters:
oldState - is the state which has to be updated
Returns:
the updated state.

getUserKey

public java.lang.Object getUserKey(int cacheId)

indexFieldModified

public void indexFieldModified(int cacheId,
                               boolean rebind)
Description copied from interface: SpeedoAccessor
The field uses in user cache, has been modified.

Specified by:
indexFieldModified in interface SpeedoAccessor
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