org.jboss.ejb
Class EnterpriseContext.EJBContextImpl

java.lang.Object
  extended byorg.jboss.ejb.EnterpriseContext.EJBContextImpl
All Implemented Interfaces:
EJBContext (src)
Direct Known Subclasses:
EntityEnterpriseContext.EntityContextImpl (src) , MessageDrivenEnterpriseContext.MessageDrivenContextImpl (src) , StatefulSessionEnterpriseContext.StatefulSessionContextImpl (src) , StatelessSessionEnterpriseContext.SessionContextImpl (src)
Enclosing class:
EnterpriseContext (src)

protected class EnterpriseContext.EJBContextImpl
extends java.lang.Object
implements EJBContext (src)


Constructor Summary
protected EnterpriseContext.EJBContextImpl()
           
 
Method Summary
 java.security.Identity getCallerIdentity()
          Deprecated. Use Principal getCallerPrincipal() instead.

 java.security.Principal getCallerPrincipal()
          Get the Principal for the current caller.
 EJBHome (src) getEJBHome()
          Obtain the enterprise bean's remote home interface.
 EJBLocalHome (src) getEJBLocalHome()
          Obtain the enterprise bean's local home interface.
 java.util.Properties getEnvironment()
          Deprecated. Use the JNDI naming context java:comp/env to access enterprise bean's environment.

 boolean getRollbackOnly()
          Test if the transaction has been marked for rollback only.
 TimerService (src) getTimerService()
          Get access to the EJB Timer Service.
 UserTransaction (src) getUserTransaction()
          Obtain the transaction demarcation interface.
 boolean isCallerInRole(java.security.Identity id)
          Deprecated. Use boolean isCallerInRole(String roleName) instead.

 boolean isCallerInRole(java.lang.String roleName)
          Checks if the current caller has a given role.
 java.lang.Object lookup(java.lang.String name)
          New from EJB 3.0.
 void setRollbackOnly()
          Mark the current transaction for rollback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnterpriseContext.EJBContextImpl

protected EnterpriseContext.EJBContextImpl()
Method Detail

lookup

public java.lang.Object lookup(java.lang.String name)
Description copied from interface: EJBContext (src)
New from EJB 3.0. A JNDI lookup method that doesn't throw exceptions

Specified by:
lookup in interface EJBContext (src)
Parameters:
name -
Returns:
returns null if JNDI lookup finds nothing

getCallerIdentity

public java.security.Identity getCallerIdentity()
Deprecated.  

Description copied from interface: EJBContext (src)
Deprecated. Use Principal getCallerPrincipal() instead.

Obtain the java.security.Identity of the caller. This method is deprecated in EJB 1.1. The Container is allowed to return alway null from this method. The enterprise bean should use the getCallerPrincipal method instead.

Specified by:
getCallerIdentity in interface EJBContext (src)
Returns:
The Identity object that identifies the caller.

getTimerService

public TimerService (src)  getTimerService()
                             throws java.lang.IllegalStateException
Description copied from interface: EJBContext (src)
Get access to the EJB Timer Service.

Specified by:
getTimerService in interface EJBContext (src)
Throws:
java.lang.IllegalStateException - The Container throws the exception if the instance is not allowed to use this method (e.g. if the bean is a stateful session bean)

getCallerPrincipal

public java.security.Principal getCallerPrincipal()
Get the Principal for the current caller. This method cannot return null according to the ejb-spec.

Specified by:
getCallerPrincipal in interface EJBContext (src)
Returns:
The Principal object that identifies the caller. This method never returns null.

getEJBHome

public EJBHome (src)  getEJBHome()
Description copied from interface: EJBContext (src)
Obtain the enterprise bean's remote home interface.

Specified by:
getEJBHome in interface EJBContext (src)
Returns:
The enterprise bean's remote home interface.

getEJBLocalHome

public EJBLocalHome (src)  getEJBLocalHome()
Description copied from interface: EJBContext (src)
Obtain the enterprise bean's local home interface.

Specified by:
getEJBLocalHome in interface EJBContext (src)
Returns:
The enterprise bean's local home interface.

getEnvironment

public java.util.Properties getEnvironment()
Deprecated.  

Description copied from interface: EJBContext (src)
Deprecated. Use the JNDI naming context java:comp/env to access enterprise bean's environment.

Obtain the enterprise bean's environment properties.

Note: If the enterprise bean has no environment properties this method returns an empty java.util.Properties object. This method never returns null.

Specified by:
getEnvironment in interface EJBContext (src)
Returns:
The environment properties for the enterprise bean.

getRollbackOnly

public boolean getRollbackOnly()
Description copied from interface: EJBContext (src)
Test if the transaction has been marked for rollback only. An enterprise bean instance can use this operation, for example, to test after an exception has been caught, whether it is fruitless to continue computation on behalf of the current transaction. Only enterprise beans with container-managed transactions are allowed to use this method.

Specified by:
getRollbackOnly in interface EJBContext (src)
Returns:
True if the current transaction is marked for rollback, false otherwise.

setRollbackOnly

public void setRollbackOnly()
Description copied from interface: EJBContext (src)
Mark the current transaction for rollback. The transaction will become permanently marked for rollback. A transaction marked for rollback can never commit. Only enterprise beans with container-managed transactions are allowed to use this method.

Specified by:
setRollbackOnly in interface EJBContext (src)

isCallerInRole

public boolean isCallerInRole(java.security.Identity id)
Deprecated.  

Description copied from interface: EJBContext (src)
Deprecated. Use boolean isCallerInRole(String roleName) instead.

Test if the caller has a given role.

This method is deprecated in EJB 1.1. The enterprise bean should use the isCallerInRole(String roleName) method instead.

Specified by:
isCallerInRole in interface EJBContext (src)
Parameters:
id - - The java.security.Identity of the role to be tested.
Returns:
True if the caller has the specified role.

isCallerInRole

public boolean isCallerInRole(java.lang.String roleName)
Checks if the current caller has a given role. The current caller is either the principal associated with the method invocation or the current run-as principal.

Specified by:
isCallerInRole in interface EJBContext (src)
Parameters:
roleName - - The name of the security role. The role must be one of the security roles that is defined in the deployment descriptor.
Returns:
True if the caller has the specified role.

getUserTransaction

public UserTransaction (src)  getUserTransaction()
Description copied from interface: EJBContext (src)
Obtain the transaction demarcation interface. Only enterprise beans with bean-managed transactions are allowed to to use the UserTransaction interface. As entity beans must always use container-managed transactions, only session beans with bean-managed transactions are allowed to invoke this method.

Specified by:
getUserTransaction in interface EJBContext (src)
Returns:
The UserTransaction interface that the enterprise bean instance can use for transaction demarcation.