public abstract class EjbContextSimulation extends Object implements javax.ejb.EJBContext
| Constructor and Description |
|---|
EjbContextSimulation() |
| Modifier and Type | Method and Description |
|---|---|
Identity |
getCallerIdentity()
Deprecated.
Use Principal getCallerPrincipal() instead.
|
Principal |
getCallerPrincipal()
Obtain the
java.security.Principal that identifies the caller. |
Map<String,Object> |
getContextData()
The
getContextData method enables a business method, lifecycle
callback method, or timeout method to retrieve any interceptor/webservices context
associated with its invocation. |
javax.ejb.EJBHome |
getEJBHome()
Obtain the enterprise bean's remote home interface.
|
javax.ejb.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.
|
javax.ejb.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)
Test if the caller has a given security role.
|
Object |
lookup(String name)
Lookup a resource within the
java: namespace. |
void |
setRollbackOnly()
Mark the current transaction for rollback.
|
public javax.ejb.EJBHome getEJBHome()
throws IllegalStateException
getEJBHome in interface javax.ejb.EJBContextIllegalStateException - if the enterprise bean
does not have a remote home interface.public javax.ejb.EJBLocalHome getEJBLocalHome()
throws IllegalStateException
getEJBLocalHome in interface javax.ejb.EJBContextIllegalStateException - if the enterprise bean
does not have a local home interface.public Properties getEnvironment()
Note: If the enterprise bean has no environment properties
this method returns an empty java.util.Properties object.
This method never returns null.
getEnvironment in interface javax.ejb.EJBContextpublic Identity getCallerIdentity()
java.security.Identity of the caller.
This method is deprecated in EJB 1.1. The Container
is allowed to return always null from this method. The enterprise
bean should use the getCallerPrincipal method instead.
getCallerIdentity in interface javax.ejb.EJBContextIdentity object that identifies the caller.public Principal getCallerPrincipal() throws IllegalStateException
java.security.Principal that identifies the caller.getCallerPrincipal in interface javax.ejb.EJBContextPrincipal object that identifies the caller. This
method never returns null.IllegalStateException - The Container throws the exception
if the instance is not allowed to call this method.public boolean isCallerInRole(Identity role)
This method is deprecated in EJB 1.1. The enterprise bean
should use the isCallerInRole(String roleName) method instead.
isCallerInRole in interface javax.ejb.EJBContextrole - The java.security.Identity of the role to be tested.public boolean isCallerInRole(String roleName) throws IllegalStateException
isCallerInRole in interface javax.ejb.EJBContextroleName - The name of the security role. The role must be one of
the security roles that is defined in the deployment descriptor.IllegalStateException - The Container throws the exception
if the instance is not allowed to call this method.public UserTransaction getUserTransaction() throws IllegalStateException
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 or message-driven
beans with bean-managed transactions are allowed to invoke this method.
getUserTransaction in interface javax.ejb.EJBContextUserTransaction interface that the enterprise bean
instance can use for transaction demarcation.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).public void setRollbackOnly()
throws IllegalStateException
Only enterprise beans with container-managed transactions are allowed to use this method.
setRollbackOnly in interface javax.ejb.EJBContextIllegalStateException - 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).public boolean getRollbackOnly()
throws IllegalStateException
Only enterprise beans with container-managed transactions are allowed to use this method.
getRollbackOnly in interface javax.ejb.EJBContextIllegalStateException - 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).public javax.ejb.TimerService getTimerService()
throws IllegalStateException
getTimerService in interface javax.ejb.EJBContextIllegalStateException - 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)public Object lookup(String name) throws IllegalArgumentException
java: namespace. Names referring to
entries within the private component namespace can be passed as
unqualified strings. In that case the lookup will be relative to
"java:comp/env/".
For example, assuming an enterprise bean defines an ejb-local-ref
with ejb-ref-name "ejb/BarRef" the following two
calls to EJBContext.lookup are equivalent :
ejbContext.lookup("ejb/BarRef");
ejbContext.lookup("java:comp/env/ejb/BarRef");
lookup in interface javax.ejb.EJBContextname - Name of the entryIllegalArgumentException - The Container throws the exception
if the given name does not match an entry within the component's
environment.public Map<String,Object> getContextData()
getContextData method enables a business method, lifecycle
callback method, or timeout method to retrieve any interceptor/webservices context
associated with its invocation.getContextData in interface javax.ejb.EJBContextMap<String,Object>
object will be returned.Copyright © 2017–2018. All rights reserved.