org.objectweb.speedo.workingset.lib
Class AbstractTransaction

java.lang.Object
  extended by org.objectweb.perseus.persistence.lib.BasicWorkingSet
      extended by org.objectweb.speedo.workingset.lib.AbstractTransaction
All Implemented Interfaces:
BindingController, LifeCycleController, TransactionalWorkingSet, WorkingSet, TransactionItf
Direct Known Subclasses:
EJBTransactionImpl, JDOTransactionImpl

public abstract class AbstractTransaction
extends BasicWorkingSet
implements TransactionItf, LifeCycleController

Author:
S.Chassande-Barrioz

Field Summary
static java.lang.String COMPONENT_BINDING
           
protected  boolean managedEnv
          indicates if the transaction is managed by a J2EE environnement.
protected  org.objectweb.jorm.api.PMapper mapper
          is the mapper permitting to reach the prefetch cache and to invalidate prefetched buffer at working set closing time.
static java.lang.String MAPPER_BINDING
           
protected  boolean nontransactionalRead
           
protected  boolean nontransactionalWrite
           
protected  boolean optimistic
          Indicates if the transaction is optimistic.
protected  POManagerItf pm
          Is the linked po manager.
static java.lang.String PO_MANAGER_BINDING
           
protected  boolean rollbackOnly
          Indicates if the jdo transaction must be rolledback.
protected  javax.transaction.Synchronization synchronization
          The JDO user synchronization registered (can be null if none has been registered).
protected  TransactionItf thisT
          the reference to this component in Speedo
protected  TransactionalPersistenceManager tpm
          Is used to delegates working set/transaction demercation
static java.lang.String TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING
           
static TransactionListener txListener
           
 
Fields inherited from class org.objectweb.perseus.persistence.lib.BasicWorkingSet
connectionHolder, logger, objectSharing, oid2state, restoreValues, retainValues, rollBackOnly, status, 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
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
AbstractTransaction()
           
 
Method Summary
 void activate()
          It activates the working set.
 void beforeWSPrepare()
          Invalidates the prefetch buffer associated to this working set.
 void begin()
          Starts the transaction.
 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 commit()
          Commits the transaction.
 java.lang.String getFcState()
           
 POManagerItf getPOManager()
           
 boolean getRollbackOnly()
           
 boolean isActive()
           
 boolean isManagedEnv()
          Indicates if the transaction environnement is managed.
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String c)
           
 void onWSEnd()
          Signal to the persistent instances reached in the working set that the current working set is closed.
 void rollback()
          Rolles back the transaction.
 void setConnectionHolder(ConnectionHolder ch)
          Assignes the connection holder.
 void setRollbackOnly()
          Marks the current transaction as rollback only.
 void setStatus(byte status)
           
 void startFc()
           
 void stopFc()
           
 void unbindFc(java.lang.String c)
           
 
Methods inherited from class org.objectweb.perseus.persistence.lib.BasicWorkingSet
clear, entries, getConnectionHolder, getOid2Entry, getStatus, getUserObject, getWSObjectSharing, getWSRestoreValues, getWSRetainValues, getWSRollBackOnly, lookup, oids, setWSObjectSharing, setWSRestoreValues, setWSRetainValues, setWSRollBackOnly, unbind
 
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.workingset.api.TransactionItf
rollBackOnInternalError
 
Methods inherited from interface org.objectweb.perseus.persistence.api.TransactionalWorkingSet
getWSRollBackOnly, setWSRollBackOnly
 
Methods inherited from interface org.objectweb.perseus.persistence.api.WorkingSet
clear, entries, getConnectionHolder, getOid2Entry, getStatus, getUserObject, getWSObjectSharing, getWSRestoreValues, getWSRetainValues, lookup, oids, setWSObjectSharing, setWSRestoreValues, setWSRetainValues, unbind
 

Field Detail

PO_MANAGER_BINDING

public static final java.lang.String PO_MANAGER_BINDING
See Also:
Constant Field Values

MAPPER_BINDING

public static final java.lang.String MAPPER_BINDING
See Also:
Constant Field Values

TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING

public static final java.lang.String TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING
See Also:
Constant Field Values

COMPONENT_BINDING

public static final java.lang.String COMPONENT_BINDING
See Also:
Constant Field Values

txListener

public static TransactionListener txListener

mapper

protected org.objectweb.jorm.api.PMapper mapper
is the mapper permitting to reach the prefetch cache and to invalidate prefetched buffer at working set closing time.


tpm

protected TransactionalPersistenceManager tpm
Is used to delegates working set/transaction demercation


nontransactionalRead

protected boolean nontransactionalRead

nontransactionalWrite

protected boolean nontransactionalWrite

optimistic

protected boolean optimistic
Indicates if the transaction is optimistic.


synchronization

protected javax.transaction.Synchronization synchronization
The JDO user synchronization registered (can be null if none has been registered).


managedEnv

protected boolean managedEnv
indicates if the transaction is managed by a J2EE environnement.


rollbackOnly

protected boolean rollbackOnly
Indicates if the jdo transaction must be rolledback.


thisT

protected TransactionItf thisT
the reference to this component in Speedo


pm

protected POManagerItf pm
Is the linked po manager.

Constructor Detail

AbstractTransaction

public AbstractTransaction()
Method Detail

bind

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

Specified by:
bind in interface WorkingSet
Overrides:
bind in class BasicWorkingSet
Parameters:
state - the state which must be attached to the transaction
mode - the action that stared the binding: either read or write intention

beforeWSPrepare

public void beforeWSPrepare()
                     throws PersistenceException
Invalidates the prefetch buffer associated to this working set.

Throws:
PersistenceException

onWSEnd

public void onWSEnd()
Signal to the persistent instances reached in the working set that the current working set is closed. Some actions on persistent instances at this time can be done, such as reference unswizlling


getFcState

public java.lang.String getFcState()
Specified by:
getFcState in interface LifeCycleController

startFc

public void startFc()
Specified by:
startFc in interface LifeCycleController

stopFc

public void stopFc()
Specified by:
stopFc in interface LifeCycleController

listFc

public java.lang.String[] listFc()
Specified by:
listFc in interface BindingController
Overrides:
listFc in class BasicWorkingSet

lookupFc

public java.lang.Object lookupFc(java.lang.String c)
Specified by:
lookupFc in interface BindingController
Overrides:
lookupFc in class BasicWorkingSet

bindFc

public void bindFc(java.lang.String c,
                   java.lang.Object s)
Specified by:
bindFc in interface BindingController
Overrides:
bindFc in class BasicWorkingSet

unbindFc

public void unbindFc(java.lang.String c)
Specified by:
unbindFc in interface BindingController
Overrides:
unbindFc in class BasicWorkingSet

setStatus

public void setStatus(byte status)
               throws PersistenceException
Specified by:
setStatus in interface WorkingSet
Overrides:
setStatus in class BasicWorkingSet
Throws:
PersistenceException

isActive

public boolean isActive()
Specified by:
isActive in interface TransactionItf
Returns:
boolean value indicating if the transaction is active or not.

begin

public void begin()
Description copied from interface: TransactionItf
Starts the transaction.

Specified by:
begin in interface TransactionItf
See Also:
TransactionItf.begin()

commit

public void commit()
Description copied from interface: TransactionItf
Commits the transaction.

Specified by:
commit in interface TransactionItf
See Also:
TransactionItf.commit()

rollback

public void rollback()
Description copied from interface: TransactionItf
Rolles back the transaction.

Specified by:
rollback in interface TransactionItf
See Also:
TransactionItf.rollback()

activate

public void activate()
              throws PersistenceException
It activates the working set. This is used to delimit the begining of the working set.

Specified by:
activate in interface TransactionItf
Throws:
PersistenceException

isManagedEnv

public boolean isManagedEnv()
Description copied from interface: TransactionItf
Indicates if the transaction environnement is managed. If the 'false' value is returned then that means that a user transaction matches to a local transaction managed by speedo.

Specified by:
isManagedEnv in interface TransactionItf

setConnectionHolder

public void setConnectionHolder(ConnectionHolder ch)
Description copied from interface: TransactionItf
Assignes the connection holder. The connection holder is able to allocate a connection to the underlying data support and to kept it until the working set / transaction end.

Specified by:
setConnectionHolder in interface TransactionItf

getRollbackOnly

public boolean getRollbackOnly()
Specified by:
getRollbackOnly in interface TransactionItf
Returns:
the rollback only flag.

setRollbackOnly

public void setRollbackOnly()
Description copied from interface: TransactionItf
Marks the current transaction as rollback only. this means that the transaction cannot be committed

Specified by:
setRollbackOnly in interface TransactionItf

getPOManager

public POManagerItf getPOManager()
Specified by:
getPOManager in interface TransactionItf