org.jboss.txbridge.ba.datamgmt
Class DataManagerProvider

java.lang.Object
  extended by org.jboss.txbridge.ba.datamgmt.DataManagerProvider

public class DataManagerProvider
extends java.lang.Object

This component is responsible for ensuring that a proper Data Manager is provided during execution of a service or a datamgmt action. It associates datamgmt managers with proper threads of execution.

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

Field Summary
private static java.util.concurrent.ConcurrentMap<java.lang.Long,DataManager> cmList
           
private static DataManagerProvider cmp
           
private static org.apache.log4j.Logger log
           
 
Constructor Summary
private DataManagerProvider()
           
 
Method Summary
 void associateCompensationManager(java.lang.Long thread, DataManager cmp)
          This method associates a datamgmt manager with a given thread of execution.
 DataManager getCompensationManager(java.lang.Long thread)
          This method returns the datamgmt manager object associated to a certain thread of execution.
static DataManagerProvider getSingletonInstance()
          Returns the instance fo a datamgmt manager provider.
 void removeCompensationManager(java.lang.Long thread)
          This method removes the association of a thread and a datamgmt manager.
 
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

cmp

private static volatile DataManagerProvider cmp

cmList

private static java.util.concurrent.ConcurrentMap<java.lang.Long,DataManager> cmList
Constructor Detail

DataManagerProvider

private DataManagerProvider()
Method Detail

getSingletonInstance

public static DataManagerProvider getSingletonInstance()
Returns the instance fo a datamgmt manager provider.

Returns:
the datamgmt manager.

associateCompensationManager

public void associateCompensationManager(java.lang.Long thread,
                                         DataManager cmp)
This method associates a datamgmt manager with a given thread of execution.

Parameters:
thread - is the thread for which the datamgmt manager should be associated.
cmp - is the datamgmt manager, which should be associated.

getCompensationManager

public DataManager getCompensationManager(java.lang.Long thread)
This method returns the datamgmt manager object associated to a certain thread of execution. If there is no datamgmt manager associated to a certain thread of execution then it means the service is being executed outside the scope of the Business Activity and a dummy datamgmt manager is simply returned.

Parameters:
thread - thread ID for which the datamgmt manager should be returned.
Returns:
the DataManager object.

removeCompensationManager

public void removeCompensationManager(java.lang.Long thread)
This method removes the association of a thread and a datamgmt manager.

Parameters:
thread - is the thread for which the associaction should be removed.