org.objectweb.perseus.persistence.lib
Class BasicWorkingSet

java.lang.Object
  extended byorg.objectweb.perseus.persistence.lib.BasicWorkingSet
All Implemented Interfaces:
TransactionalWorkingSet, WorkingSet

public class BasicWorkingSet
extends java.lang.Object
implements TransactionalWorkingSet

It is an implementation of the WorkingSet interface. This implementation is a Fractal component which needs a MonologFactory.

Author:
S.Chassande-Barrioz, Y.Bersihand

Field Summary
protected  ConnectionHolder connectionHolder
           
protected  Logger logger
           
protected  java.util.Map oid2state
           
protected  boolean restoreValues
           
protected  boolean retainValues
           
protected  boolean rollBackOnly
           
protected  byte status
           
protected  java.lang.Object userObject
           
 
Fields inherited from interface org.objectweb.perseus.persistence.api.TransactionalWorkingSet
CTX_ABORTED, CTX_ACTIVE_TRANSACTIONAL, CTX_COMMITTED, CTX_PREPARED, CTX_PREPARED_FAIL, CTX_PREPARED_OK
 
Fields inherited from interface org.objectweb.perseus.persistence.api.WorkingSet
CTX_ACTIVE, CTX_CLOSED, READ_INTENTION, UNKNOWN_INTENTION, WRITE_INTENTION
 
Constructor Summary
BasicWorkingSet()
           
 
Method Summary
 State bind(State state, java.lang.Object oid, byte mode)
          Attaches an entry to the transaction.
 void bindFc(java.lang.String c, java.lang.Object s)
           
 void clear()
          Removes all entries of the transaction.
 java.util.Set entries()
           
 ConnectionHolder getConnectionHolder()
           
 java.util.Map getOid2Entry()
          Get the map.
 byte getStatus()
          Returns the working set's status.
 java.lang.Object getUserObject()
           
 boolean getWSRestoreValues()
          Indicates if the dirty object must be reload at rollback time.
 boolean getWSRetainValues()
          Indicates if the state of persistent objects reached in the working set must be kept in the cache at the working set end.
 boolean getWSRollBackOnly()
          Indicates if the transactional working must rollback at the end.
 java.lang.String[] listFc()
           
 State lookup(java.lang.Object oid)
           
 java.lang.Object lookupFc(java.lang.String c)
           
 java.util.Set oids()
           
 void setStatus(byte status)
          Sets the working set's status.
 void setWSRestoreValues(boolean val)
          assignes a boolean value indicating if the dirty object must be reload at rollback time.
 void setWSRetainValues(boolean val)
          assing a boolean a value Indicating if the state of persistent objects reached in the working set must be kept in the cache at the working set end.
 void setWSRollBackOnly(boolean val)
          Permit to indicates if the transactional working must rollback at the end.
 boolean unbind(java.lang.Object oid)
          Dettaches an entry from the transaction.
 void unbindFc(java.lang.String c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Logger logger

oid2state

protected java.util.Map oid2state

status

protected byte status

userObject

protected java.lang.Object userObject

connectionHolder

protected ConnectionHolder connectionHolder

retainValues

protected boolean retainValues

restoreValues

protected boolean restoreValues

rollBackOnly

protected boolean rollBackOnly
Constructor Detail

BasicWorkingSet

public BasicWorkingSet()
Method Detail

listFc

public java.lang.String[] listFc()

lookupFc

public java.lang.Object lookupFc(java.lang.String c)

bindFc

public void bindFc(java.lang.String c,
                   java.lang.Object s)

unbindFc

public void unbindFc(java.lang.String c)

getStatus

public byte getStatus()
Description copied from interface: WorkingSet
Returns the working set's status.

Specified by:
getStatus in interface WorkingSet
Returns:
one of the constants of the TransactionalPersistenceManager interface.

setStatus

public void setStatus(byte status)
               throws PersistenceException
Description copied from interface: WorkingSet
Sets the working set's status. This setter permits also to intercept the working set life cycle.

Specified by:
setStatus in interface WorkingSet
Parameters:
status - one of the constants of the TransactionalPersistenceManager interface.
Throws:
PersistenceException - if this is a probleme in the interception of the working set life cycle.

lookup

public State lookup(java.lang.Object oid)
Specified by:
lookup in interface WorkingSet
Returns:
the entry attached to the transaction weither its identifier

bind

public State bind(State state,
                  java.lang.Object oid,
                  byte mode)
Attaches an entry to the transaction.

Specified by:
bind in interface WorkingSet
Parameters:
state - the state which must be attached to the transaction
mode - see WorkingSet.READ_INTENTION WorkingSet.WRITE_INTENTION WorkingSet.UNKNOWN_INTENTION
oid - is the id of the corresponding object
Returns:
the old state value in the cache
See Also:
READ_INTENTION.WRITE_INTENTION.UNKNOWN_INTENTION

unbind

public boolean unbind(java.lang.Object oid)
Dettaches an entry from the transaction.

Specified by:
unbind in interface WorkingSet
Parameters:
oid - is the identifier of entry which must be detattached from the transaction
Returns:
true if the entry was present in the working set

clear

public void clear()
Removes all entries of the transaction.

Specified by:
clear in interface WorkingSet

entries

public java.util.Set entries()
Specified by:
entries in interface WorkingSet
Returns:
the collection of entry attached to the transaction.

oids

public java.util.Set oids()
Specified by:
oids in interface WorkingSet
Returns:
the list of oids attached to the working set

getOid2Entry

public java.util.Map getOid2Entry()
Get the map.

Specified by:
getOid2Entry in interface WorkingSet
Returns:
the map of (oid,entry) couples attached to the working set

getUserObject

public java.lang.Object getUserObject()
Specified by:
getUserObject in interface WorkingSet
Returns:
the user object linked to the working set

getConnectionHolder

public ConnectionHolder getConnectionHolder()
Specified by:
getConnectionHolder in interface WorkingSet
Returns:
a ConnectionHolder instance permiting to acces the data support

getWSRetainValues

public boolean getWSRetainValues()
Description copied from interface: WorkingSet
Indicates if the state of persistent objects reached in the working set must be kept in the cache at the working set end.

Specified by:
getWSRetainValues in interface WorkingSet

setWSRetainValues

public void setWSRetainValues(boolean val)
Description copied from interface: WorkingSet
assing a boolean a value Indicating if the state of persistent objects reached in the working set must be kept in the cache at the working set end.

Specified by:
setWSRetainValues in interface WorkingSet

getWSRestoreValues

public boolean getWSRestoreValues()
Description copied from interface: WorkingSet
Indicates if the dirty object must be reload at rollback time.

Specified by:
getWSRestoreValues in interface WorkingSet

setWSRestoreValues

public void setWSRestoreValues(boolean val)
Description copied from interface: WorkingSet
assignes a boolean value indicating if the dirty object must be reload at rollback time.

Specified by:
setWSRestoreValues in interface WorkingSet

getWSRollBackOnly

public boolean getWSRollBackOnly()
Description copied from interface: TransactionalWorkingSet
Indicates if the transactional working must rollback at the end.

Specified by:
getWSRollBackOnly in interface TransactionalWorkingSet

setWSRollBackOnly

public void setWSRollBackOnly(boolean val)
Description copied from interface: TransactionalWorkingSet
Permit to indicates if the transactional working must rollback at the end.

Specified by:
setWSRollBackOnly in interface TransactionalWorkingSet


Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.