cuba
Interface ContextI

All Known Subinterfaces:
ClientContextI, ComponentContextI
All Known Implementing Classes:
AbstractComponentContext, AbstractEJBClientContext, AbstractEJBComponentContext, EJB2ClientContext, EJB2ComponentContext, EJB3ClientContext, EJB3ComponentContext, WebserviceClientContext, WiredClientContext, WiredComponentContext

public interface ContextI

General interface type used to lookup the components and resources provided by an application. See the derived interfaces and implementation classes for details.

Author:
Jan Lessner

Nested Class Summary
static interface ContextI.Type
           
 
Method Summary
 java.lang.Object getComponent(java.lang.String name)
          Looks up a component refered to by a symbolic name.
 javax.sql.DataSource getDataSource(java.lang.String name)
          Looks up an SQL database refered to by a symbolic 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.
 

Method Detail

getType

int getType()
Returns the type of context, to let the context holder perform operations depending on the environment it is working in.


getComponent

java.lang.Object getComponent(java.lang.String name)
                              throws ConstructionException,
                                     ReferenceException
Looks up a component refered to by a symbolic name. The lookup is performed either in a global name space or in a local one depending on the type of context used.

Parameters:
name - The symbolic 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

javax.transaction.UserTransaction getTransaction()
                                                 throws javax.transaction.SystemException
Provide access to a user transaction

Throws:
javax.transaction.SystemException

getDataSource

javax.sql.DataSource getDataSource(java.lang.String name)
                                   throws ConstructionException,
                                          ReferenceException
Looks up an SQL database refered to by a symbolic name. The lookup is performed either in a global name space or in a local one depending on the type of context used.

Parameters:
name - The symbolic 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.