com.groiss.component
Class BeanManager

java.lang.Object
  extended by com.groiss.component.BeanManager

public class BeanManager
extends java.lang.Object

Manages transaction aware components (="beans"). The beans should implement javax.ejb.SessionSynchronization.


Constructor Summary
BeanManager()
           
 
Method Summary
static void addBean(java.lang.String key, java.lang.Class<?> service)
          Add a bean to the list of known user bean classes.
static void addBean(java.lang.String key, java.lang.Class<?> service, boolean isSystemBean)
          Add a bean to the list of known bean classes.
static void bindThreadToTransaction(javax.transaction.UserTransaction ut)
           
static void commit()
          Commits the transaction and releases all beans.
static java.lang.Object getBean(java.lang.String key)
          Gets a bean instance for a bean class registered with a key.
static javax.transaction.UserTransaction getUserTransaction()
          The client or the bean manager itself gets a UserTransaction.
static javax.transaction.UserTransaction getUserTransaction(java.lang.String name)
          The client or the bean manager itself gets a UserTransaction.
static boolean hasActiveUserTransaction()
           
static void rollback()
          Rolls back the transaction and releases all beans.
static void rollbackTransaction(javax.transaction.UserTransaction ut)
           
static void setExplicitTransactionMode(boolean value)
          If set to true, a thread will not get a usertransaction when calling method getUserTransaction() or method getUserTransaction(String) with null as parameter.
static void unbindThreadFromTransaction()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanManager

public BeanManager()
Method Detail

getBean

public static java.lang.Object getBean(java.lang.String key)
Gets a bean instance for a bean class registered with a key.

Parameters:
key - the key which was used to register a bean class
Returns:
a bean instance

addBean

public static void addBean(java.lang.String key,
                           java.lang.Class<?> service,
                           boolean isSystemBean)
Add a bean to the list of known bean classes.

Parameters:
key - a unique key for the bean
service - the beans class
isSystemBean - true, if the bean is an internal @enterprise bean. Do not use this call in application code.

addBean

public static void addBean(java.lang.String key,
                           java.lang.Class<?> service)
Add a bean to the list of known user bean classes.

Parameters:
key - a unique key for the bean
service - the beans class

commit

public static void commit()
Commits the transaction and releases all beans.


rollback

public static void rollback()
Rolls back the transaction and releases all beans.


rollbackTransaction

public static void rollbackTransaction(javax.transaction.UserTransaction ut)

hasActiveUserTransaction

public static boolean hasActiveUserTransaction()

getUserTransaction

public static javax.transaction.UserTransaction getUserTransaction()
The client or the bean manager itself gets a UserTransaction.


getUserTransaction

public static javax.transaction.UserTransaction getUserTransaction(java.lang.String name)
The client or the bean manager itself gets a UserTransaction.


bindThreadToTransaction

public static void bindThreadToTransaction(javax.transaction.UserTransaction ut)

unbindThreadFromTransaction

public static void unbindThreadFromTransaction()

setExplicitTransactionMode

public static void setExplicitTransactionMode(boolean value)
If set to true, a thread will not get a usertransaction when calling method getUserTransaction() or method getUserTransaction(String) with null as parameter. Instead an exception will be thrown.



@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.