com.mockrunner.ejb
Class Configuration

java.lang.Object
  extended by com.mockrunner.ejb.Configuration

public class Configuration
extends java.lang.Object

Global configuration options regarding EJB and JNDI. Usually you do not have to change these options.


Constructor Summary
Configuration()
           
Configuration(java.lang.String userTransactionJNDIName)
           
Configuration(java.lang.String userTransactionJNDIName, boolean bindMockUserTransactionToJNDI)
           
 
Method Summary
 boolean getBindMockUserTransactionToJNDI()
          Get if the mock transaction should be bound to JNDI.
 javax.naming.Context getContext()
          Get the JNDI context.
 java.lang.String getUserTransactionJNDIName()
          Get the JNDI name for the user transaction.
 void setBindMockUserTransactionToJNDI(boolean bindMockUserTransactionToJNDI)
          Set if the mock transaction should be bound to JNDI.
 void setContext(javax.naming.Context context)
          Set the JNDI context used by EJBMockObjectFactory.
 void setUserTransactionJNDIName(java.lang.String userTransactionJNDIName)
          Set the JNDI name for the user transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration()

Configuration

public Configuration(java.lang.String userTransactionJNDIName)

Configuration

public Configuration(java.lang.String userTransactionJNDIName,
                     boolean bindMockUserTransactionToJNDI)
Method Detail

getContext

public javax.naming.Context getContext()
Get the JNDI context. This method returns null if no context is set. In this case the EJBMockObjectFactory uses the MockEJB JNDI implementation.

Returns:
the JNDI context

setContext

public void setContext(javax.naming.Context context)
Set the JNDI context used by EJBMockObjectFactory.

Parameters:
context - the JNDI context

getBindMockUserTransactionToJNDI

public boolean getBindMockUserTransactionToJNDI()
Get if the mock transaction should be bound to JNDI.

Returns:
if the mock transaction should be bound to JNDI

setBindMockUserTransactionToJNDI

public void setBindMockUserTransactionToJNDI(boolean bindMockUserTransactionToJNDI)
Set if the mock transaction should be bound to JNDI. When the EJBMockObjectFactory creates a MockUserTransaction, it tries to rebind the transaction to the JNDI tree with the specified name setUserTransactionJNDIName(java.lang.String), the name javax.transaction.UserTransaction (which is used by MockEJB and Weblogic) and the name java:comp/UserTransaction (which is the standard name), if this option is true. If this option is false, a mock transaction is created but not bound to JNDI. Default is true.

Parameters:
bindMockUserTransactionToJNDI - should the mock transaction be bound to JNDI

getUserTransactionJNDIName

public java.lang.String getUserTransactionJNDIName()
Get the JNDI name for the user transaction.

Returns:
the JNDI name for the user transaction

setUserTransactionJNDIName

public void setUserTransactionJNDIName(java.lang.String userTransactionJNDIName)
Set the JNDI name for the user transaction. The EJBMockObjectFactory tries to obtain a UserTransaction from JNDI using this name. If the lookup fails, a MockUserTransaction is created and bound to JNDI, if setBindMockUserTransactionToJNDI(boolean) is set to true. Default is javax.transaction.UserTransaction.

Parameters:
userTransactionJNDIName - the JNDI name for the user transaction