cuba.wired
Class WiredComponentContext

java.lang.Object
  extended by cuba.AbstractComponentContext
      extended by cuba.wired.WiredComponentContext
All Implemented Interfaces:
ComponentContextI, ContextI

public class WiredComponentContext
extends AbstractComponentContext

Author:
Jan Lessner

Nested Class Summary
 
Nested classes/interfaces inherited from interface cuba.ContextI
ContextI.Type
 
Method Summary
 void addToEnvironment(java.lang.String name, java.lang.Object value)
           
 java.lang.String getCallerName()
           
 ClientContextI getClientContext()
          Create a client context from a component context which provides external access to the same container which the current component resides in.
 java.lang.Object getComponent(java.lang.String localName)
          Looks up a component refered to by a symbolic name.
 javax.sql.DataSource getDataSource(java.lang.String localName)
          Looks up an SQL database refered to by a symbolic name.
 CubaEntityManager getEntityManager(java.lang.String name)
           
 java.lang.Object getEnvironment(java.lang.String name)
          Looks up an environment entry refered to by a symbolic name.
 boolean getRollbackOnly()
           
 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.
 boolean isCallerInRole(java.lang.String roleName)
           
 void popCall()
           
 void pushCall()
           
 void setRollbackOnly()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.


getTransaction

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


setRollbackOnly

public void setRollbackOnly()
                     throws javax.transaction.SystemException
Throws:
javax.transaction.SystemException

getRollbackOnly

public boolean getRollbackOnly()
                        throws javax.transaction.SystemException
Throws:
javax.transaction.SystemException

isCallerInRole

public boolean isCallerInRole(java.lang.String roleName)

getCallerName

public java.lang.String getCallerName()

getDataSource

public javax.sql.DataSource getDataSource(java.lang.String localName)
                                   throws ConstructionException,
                                          ReferenceException
Description copied from interface: ContextI
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:
localName - 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.

getComponent

public java.lang.Object getComponent(java.lang.String localName)
                              throws ConstructionException,
                                     ReferenceException
Description copied from interface: ContextI
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:
localName - 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.

getClientContext

public ClientContextI getClientContext()
Description copied from interface: ComponentContextI
Create a client context from a component context which provides external access to the same container which the current component resides in. This function is especially required to perform global lookups from inside the container, e.g. when integrating things like persistence management frameworks.

Returns:
The client context

getEnvironment

public java.lang.Object getEnvironment(java.lang.String name)
                                throws ReferenceException
Description copied from interface: ComponentContextI
Looks up an environment entry refered to by a symbolic name.

Parameters:
name - The symbolic name of the environment entry to look up
Returns:
The enrtie's value. The return value must be casted to the required type.
Throws:
ReferenceException - if the provided symbolic name cannot be resolved.

addToEnvironment

public void addToEnvironment(java.lang.String name,
                             java.lang.Object value)
                      throws ReferenceException
Throws:
ReferenceException

getEntityManager

public CubaEntityManager getEntityManager(java.lang.String name)
                                   throws ConstructionException,
                                          ReferenceException
Throws:
ConstructionException
ReferenceException

pushCall

public void pushCall()
              throws ComponentException
Specified by:
pushCall in class AbstractComponentContext
Throws:
ComponentException

popCall

public void popCall()
             throws ComponentException
Specified by:
popCall in class AbstractComponentContext
Throws:
ComponentException