org.jboss.soa.esb.common
Class TransactionStrategy

java.lang.Object
  extended by org.jboss.soa.esb.common.TransactionStrategy

public abstract class TransactionStrategy
extends java.lang.Object

This class represents the transaction strategy that is currently in force within the ESB. At present there are two strategies employed, a null strategy when running outside of an application server environment and a JTA strategy when running within.

Author:
Kevin Conner

Constructor Summary
TransactionStrategy()
           
 
Method Summary
abstract  void begin()
          Begin a transaction on the current thread.
abstract  void enlistResource(javax.transaction.xa.XAResource resource)
          Add a resource to the current transaction.
abstract  java.lang.Object getTransaction()
          Get a handle on the currently associated transaction (or null).
static TransactionStrategy getTransactionStrategy(boolean transacted)
          Get the active transaction strategy.
abstract  boolean isActive()
          Is the currently associated transaction active?
abstract  void registerSynchronization(javax.transaction.Synchronization sync)
          Add a synchronization to the current transaction.
abstract  void resume(java.lang.Object tx)
          Associated the transaction with the current thread.
abstract  void rollbackOnly()
          Mark the current transaction for rollback.
static void setTransactionStrategy(TransactionStrategy transactionStrategy)
          Set the active transaction strategy.
abstract  java.lang.Object suspend()
          Suspend the current thread-to-transaction association.
abstract  void terminate()
          Terminate the transaction on the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionStrategy

public TransactionStrategy()
Method Detail

getTransactionStrategy

public static TransactionStrategy getTransactionStrategy(boolean transacted)
Get the active transaction strategy.

Parameters:
transacted - True if the current transacted strategy is required, false for a null strategy.
Returns:
The transaction strategy.

setTransactionStrategy

public static void setTransactionStrategy(TransactionStrategy transactionStrategy)
Set the active transaction strategy.

Parameters:
transactionStrategy - The transaction strategy.

begin

public abstract void begin()
                    throws TransactionStrategyException
Begin a transaction on the current thread.

Throws:
TransactionStrategyException

terminate

public abstract void terminate()
                        throws TransactionStrategyException
Terminate the transaction on the current thread. If the transaction has been marked for rollback then it will be rolled back, otherwise it will be committed.

Throws:
TransactionStrategyException

rollbackOnly

public abstract void rollbackOnly()
                           throws TransactionStrategyException
Mark the current transaction for rollback.

Throws:
TransactionStrategyException

getTransaction

public abstract java.lang.Object getTransaction()
                                         throws TransactionStrategyException
Get a handle on the currently associated transaction (or null).

Throws:
TransactionStrategyException

suspend

public abstract java.lang.Object suspend()
                                  throws TransactionStrategyException
Suspend the current thread-to-transaction association.

Returns:
the associated transaction, or null.
Throws:
TransactionStrategyException

isActive

public abstract boolean isActive()
                          throws TransactionStrategyException
Is the currently associated transaction active?

Returns:
Throws:
TransactionStrategyException

resume

public abstract void resume(java.lang.Object tx)
                     throws TransactionStrategyException
Associated the transaction with the current thread.

Parameters:
tx -
Throws:
TransactionStrategyException

registerSynchronization

public abstract void registerSynchronization(javax.transaction.Synchronization sync)
                                      throws TransactionStrategyException
Add a synchronization to the current transaction.

Parameters:
sync -
Throws:
TransactionStrategyException

enlistResource

public abstract void enlistResource(javax.transaction.xa.XAResource resource)
                             throws TransactionStrategyException
Add a resource to the current transaction.

Parameters:
resource -
Throws:
TransactionStrategyException