org.jboss.txbridge.ba
Class BATransactionManager

java.lang.Object
  extended by org.jboss.txbridge.ba.BATransactionManager

public class BATransactionManager
extends java.lang.Object

This is the main component - the Business Activity Transaction Manager. It is responsible for associating fully unique task identifiers to different invocations. It also knows about all existing components responsible for single transactions.

Version:
0.1
Author:
Maciej P. Machulak (mmachulak@redhat.com)

Field Summary
private static BATransactionManager baTransactionManager
           
private  com.arjuna.mw.wst.BusinessActivityManager businessActivityManager
           
private static org.apache.log4j.Logger log
           
private  ServiceInformationManager serviceManager
           
private  java.util.concurrent.ConcurrentMap<java.lang.String,SingleTransactionManager> singleTransactionManagers
           
 
Constructor Summary
private BATransactionManager()
           
 
Method Summary
 void cleanInvocation(TaskDescription taskDesc)
          This method is invoked if the business logic could not completeTask and the fault is to be propagated to the client.
 void closeTransaction(java.lang.String txId)
          This method cleans data associated with a given transaction.
 void compensateTransaction(java.lang.String txId)
          This method compensates a transaction with a given ID.
 void completeInvocation(TaskDescription taskDesc, java.lang.Object[] arguments, java.lang.Object returnObject)
          This method completes the invocation of a service within a scope of a transaction.
static BATransactionManager getSingletonInstance()
          Returns the instance of the BATRansactionManager object.
 TaskDescription handleInvocation(java.lang.reflect.Method method)
          This method handles a transaction for this invocation of a method.
 boolean isBAPresent()
          This method returns true if there is currently a Business Activity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.log4j.Logger log

baTransactionManager

private static volatile BATransactionManager baTransactionManager

businessActivityManager

private com.arjuna.mw.wst.BusinessActivityManager businessActivityManager

serviceManager

private ServiceInformationManager serviceManager

singleTransactionManagers

private java.util.concurrent.ConcurrentMap<java.lang.String,SingleTransactionManager> singleTransactionManagers
Constructor Detail

BATransactionManager

private BATransactionManager()
Method Detail

getSingletonInstance

public static BATransactionManager getSingletonInstance()
Returns the instance of the BATRansactionManager object.

Returns:
the instance of the BATransactionManager.

isBAPresent

public boolean isBAPresent()
                    throws com.arjuna.wst.SystemException
This method returns true if there is currently a Business Activity.

Returns:
the boolean value.
Throws:
com.arjuna.wst.SystemException - if it is not possible to get current transaction.

handleInvocation

public TaskDescription handleInvocation(java.lang.reflect.Method method)
                                 throws TransactionProcessingException
This method handles a transaction for this invocation of a method.

Parameters:
method - is the method which is being invoked.
Returns:
the task identifier for this method.
Throws:
TransactionProcessingException - if there is a problem with processing a transaction

compensateTransaction

public void compensateTransaction(java.lang.String txId)
This method compensates a transaction with a given ID. It delegates the datamgmt management to an appropriate single transaction manager.

Parameters:
txId - is the ID of the transaction which should be compensated.

closeTransaction

public void closeTransaction(java.lang.String txId)
This method cleans data associated with a given transaction. It removes a single transaction manager from the list.

Parameters:
txId - is the ID of the transaction which should be finished.

completeInvocation

public void completeInvocation(TaskDescription taskDesc,
                               java.lang.Object[] arguments,
                               java.lang.Object returnObject)
                        throws TransactionProcessingException
This method completes the invocation of a service within a scope of a transaction. It is responsible for remembering necessary arguments that were passed to this service and a return object (those objects may be used later if datamgmt action is being invoked).

Parameters:
taskDesc - describes the task.
arguments - is the list of the arguments for this service.
returnObject - is the return object of this service.
Throws:
TransactionProcessingException - if it was impossible to completeTask invocation.

cleanInvocation

public void cleanInvocation(TaskDescription taskDesc)
                     throws TransactionProcessingException
This method is invoked if the business logic could not completeTask and the fault is to be propagated to the client. It removes information about this task.

Parameters:
taskDesc - is the description of the task.
Throws:
TransactionProcessingException - if cleaning the invocation was not successful.