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 completion or compensation action. It associates data 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 associateManager(java.lang.Long thread, DataManager cmp)
          This method associates a data manager with a given thread of execution.
 DataManager getManager(java.lang.Long thread)
          This method returns the data manager object associated to a certain thread of execution.
static DataManagerProvider getSingletonInstance()
          Returns the instance of a data manager provider.
 void removeManager(java.lang.Long thread)
          This method removes the association of a thread and a data 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 of a data manager provider.

Returns:
the data manager provider.

associateManager

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

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

getManager

public DataManager getManager(java.lang.Long thread)
This method returns the data manager object associated to a certain thread of execution. If there is no data 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 data manager is simply returned.

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

removeManager

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

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