public interface EJBContext
The EJBContext interface provides an instance with access to the container-provided runtime context of an enterprise Bean instance.
This interface is extended by the SessionContext and EntityContext interface to provide additional methods specific to the enterprise Bean type.
Modifier and Type | Method and Description |
---|---|
Identity |
getCallerIdentity()
Deprecated. Use Principal getCallerPrincipal() instead.
|
Principal |
getCallerPrincipal()
Obtains the java.security.Principal of the caller.
|
Map<String,Object> |
getContextData()
Returns the context data associated with this invocation or lifecycle callback.
|
EJBHome |
getEJBHome()
Obtain the enterprise bean's remote home interface.
|
EJBLocalHome |
getEJBLocalHome()
Obtain the enterprise bean's local home interface.
|
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 |
getTimerService()
Get access to the EJB Timer Service.
|
UserTransaction |
getUserTransaction()
Obtain the transaction demarcation interface.
|
boolean |
isCallerInRole(Identity role)
Deprecated. Use boolean isCallerInRole(String roleName) instead.
|
boolean |
isCallerInRole(String roleName)
Tests if the caller has a given role.
|
Object |
lookup(String name)
Lookup a resource within the component's private naming context.
|
void |
setRollbackOnly()
Mark the current transaction for rollback.
|
EJBHome getEJBHome()
IllegalStateException
- - if the enterprise bean does not have a remote home interface.EJBLocalHome getEJBLocalHome()
IllegalStateException
- - if the enterprise bean does not have a local home interface.Properties getEnvironment()
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.
Identity getCallerIdentity()
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.
Principal getCallerPrincipal()
Map<String,Object> getContextData()
boolean isCallerInRole(Identity role)
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.
role
- - The java.security.Identity of the role to be tested.boolean isCallerInRole(String roleName)
roleName
- - The name of the security role. The role must be one of the security roles that
is defined in the deployment descriptor.UserTransaction getUserTransaction() throws IllegalStateException
IllegalStateException
- - The Container throws the exception if the instance is not
allowed to use the UserTransaction interface (i.e. the instance is of a bean with container-managed
transactions).void setRollbackOnly() throws IllegalStateException
IllegalStateException
- - The Container throws the exception if the instance is not
allowed to use this method (i.e. the instance is of a bean with bean-managed transactions).boolean getRollbackOnly() throws IllegalStateException
IllegalStateException
- - The Container throws the exception if the instance
is not allowed to use this method (i.e. the instance is of a bean with bean-managed transactions).TimerService getTimerService() throws IllegalStateException
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)Object lookup(String name) throws IllegalArgumentException
name
- - Name of the entry (relative to java:comp/env).IllegalArgumentException
- - The Container throws the exception if
the given name does not match an entry within the component's environment.Copyright © 2016 JBoss by Red Hat. All rights reserved.