org.objectweb.perseus.persistence.api
Interface WorkingSet

All Known Subinterfaces:
TransactionalWorkingSet
All Known Implementing Classes:
BasicWorkingSet

public interface WorkingSet

It defines a context used in by the PersistenceManager. A context contains a collection of CacheEntry instances and has a status.

Author:
S.Chassande-Barrioz, Y.Bersihand

Field Summary
static byte CTX_ACTIVE
          The status of a non transactional context which is not already closed.
static byte CTX_CLOSED
          The status of a cloased context (transactional or not)
static byte READ_INTENTION
          The origin of the binding action.
static byte UNKNOWN_INTENTION
           
static byte WRITE_INTENTION
           
 
Method Summary
 State bind(State state, java.lang.Object oid, byte mode)
          Attaches an entry to the working set.
 void clear()
          Removes all entries of the working set.
 java.util.Set entries()
           
 ConnectionHolder getConnectionHolder()
           
 java.util.Map getOid2Entry()
           
 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.
 State lookup(java.lang.Object oid)
           
 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.
 boolean unbind(java.lang.Object oid)
          Dettaches an entry from the working set.
 

Field Detail

CTX_ACTIVE

public static final byte CTX_ACTIVE
The status of a non transactional context which is not already closed.

See Also:
Constant Field Values

CTX_CLOSED

public static final byte CTX_CLOSED
The status of a cloased context (transactional or not)

See Also:
Constant Field Values

READ_INTENTION

public static final byte READ_INTENTION
The origin of the binding action.

See Also:
Constant Field Values

WRITE_INTENTION

public static final byte WRITE_INTENTION
See Also:
Constant Field Values

UNKNOWN_INTENTION

public static final byte UNKNOWN_INTENTION
See Also:
Constant Field Values
Method Detail

getStatus

public byte getStatus()
Returns the working set's status.

Returns:
one of the constants of the TransactionalPersistenceManager interface.

setStatus

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

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)
Returns:
the entry attached to the working set weither its identifier

bind

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

Parameters:
state - is the state which must be attached to the working set
oid - is the id of the corresponding object
mode - is the origin of the binding action: read/write intention
Returns:
the value of the old state in the cache, can be null if the state was not already in the cache
See Also:
READ_INTENTION.WRITE_INTENTION.UNKNOWN_INTENTION

unbind

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

Parameters:
oid - is the identifier of entry which must be detattached from the working set
Returns:
true if the entry was present in the working set

clear

public void clear()
Removes all entries of the working set.


entries

public java.util.Set entries()
Returns:
the list of entries attached to the working set.

oids

public java.util.Set oids()
Returns:
the list of oids attached to the working set

getOid2Entry

public java.util.Map getOid2Entry()
Returns:
the map of (oid,entry) couples attached to the working set

getUserObject

public java.lang.Object getUserObject()
Returns:
the user object linked to the working set

getConnectionHolder

public ConnectionHolder getConnectionHolder()
Returns:
a ConnectionHolder instance permiting to acces the data support

getWSRetainValues

public 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.


setWSRetainValues

public 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.


getWSRestoreValues

public boolean getWSRestoreValues()
Indicates if the dirty object must be reload at rollback time.


setWSRestoreValues

public void setWSRestoreValues(boolean val)
assignes a boolean value indicating if the dirty object must be reload at rollback time.



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