cuba.ejb
Class AbstractEJBClientContext

java.lang.Object
  extended by cuba.ejb.AbstractEJBClientContext
All Implemented Interfaces:
ClientContextI, ContextI
Direct Known Subclasses:
EJB2ClientContext, EJB3ClientContext

public class AbstractEJBClientContext
extends java.lang.Object
implements ClientContextI

Client interface to an EJB container used to get access to components and resources provided by that container.

Author:
Jan Lessner

Nested Class Summary
 
Nested classes/interfaces inherited from interface cuba.ContextI
ContextI.Type
 
Field Summary
 
Fields inherited from interface cuba.ClientContextI
CALLER_PROPERTY
 
Constructor Summary
AbstractEJBClientContext(AbstractEJBComponentFactory factory)
          Create a new EJBClientContext from default properties.
AbstractEJBClientContext(java.util.Properties props, AbstractEJBComponentFactory factory)
          Create a new EJBClientContext based on the passed properties.
 
Method Summary
 java.lang.Object getComponent(java.lang.String globalName)
          Looks up a component by its global JNDI name.
 javax.sql.DataSource getDataSource(java.lang.String globalName)
          Looks up a DataSource refered to by a global JNDI name.
 javax.transaction.UserTransaction getTransaction()
          Provide access to a user transaction
 int getType()
          Returns the type of context, to let the context holder perform operations depending on the environment it is working in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEJBClientContext

public AbstractEJBClientContext(java.util.Properties props,
                                AbstractEJBComponentFactory factory)
Create a new EJBClientContext based on the passed properties. The properties are passed to the constructor of an InitialContext and include details like server host, server port and communication protocol. The actual content is propriatary for the application server in use.


AbstractEJBClientContext

public AbstractEJBClientContext(AbstractEJBComponentFactory factory)
Create a new EJBClientContext from default properties. Depending on the application server vendor, there may by various different mechanisms available to provide contact details. The function is also used to obtain a client context from within the container (see ComponentContextI.getClientContext()).

Method Detail

getType

public int getType()
Description copied from interface: ContextI
Returns the type of context, to let the context holder perform operations depending on the environment it is working in.

Specified by:
getType in interface ContextI

getComponent

public java.lang.Object getComponent(java.lang.String globalName)
                              throws ConstructionException,
                                     ReferenceException
Looks up a component by its global JNDI name.

Specified by:
getComponent in interface ContextI
Parameters:
globalName - The global JNDI name of the component to look up
Returns:
A proxy object, implementing the component's interface. The return value must be casted to the required type.
Throws:
ConstructionException - if the container failed to provide the required component
ReferenceException - if the provided symbolic name cannot be resolved.

getTransaction

public javax.transaction.UserTransaction getTransaction()
                                                 throws javax.transaction.SystemException
Description copied from interface: ContextI
Provide access to a user transaction

Specified by:
getTransaction in interface ContextI
Throws:
javax.transaction.SystemException

getDataSource

public javax.sql.DataSource getDataSource(java.lang.String globalName)
                                   throws ConstructionException,
                                          ReferenceException
Looks up a DataSource refered to by a global JNDI name.

Specified by:
getDataSource in interface ContextI
Parameters:
globalName - The global JNDI name of the SQL source to look up
Returns:
A proxy object, providing access to the database.
Throws:
ConstructionException - if the container failed to provide the required SQL database
ReferenceException - if the provided symbolic name cannot be resolved.