public abstract class BaseContext extends java.lang.Object implements EJBContext, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
BaseContext.Call |
static class |
BaseContext.State |
class |
BaseContext.UserTransactionWrapper |
Modifier and Type | Field and Description |
---|---|
protected SecurityService |
securityService |
protected UserTransaction |
userTransaction |
Modifier | Constructor and Description |
---|---|
protected |
BaseContext(SecurityService securityService) |
protected |
BaseContext(SecurityService securityService,
UserTransaction userTransaction) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
check(ThreadContext context,
BaseContext.Call call) |
void |
doCheck(BaseContext.Call call) |
java.security.Identity |
getCallerIdentity()
Obtain the
java.security.Identity of the caller. |
java.security.Principal |
getCallerPrincipal()
Obtain the
java.security.Principal that identifies the caller. |
protected java.security.Principal |
getCallerPrincipal(SecurityService securityService) |
java.util.Map<java.lang.String,java.lang.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. |
EJBHome |
getEJBHome()
Obtain the enterprise bean's remote home interface.
|
EJBLocalHome |
getEJBLocalHome()
Obtain the enterprise bean's local home interface.
|
java.util.Properties |
getEnvironment()
Obtain the enterprise bean's environment properties.
|
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.
|
UserTransaction |
getUserTransaction(UserTransaction userTransaction) |
protected java.lang.IllegalStateException |
illegal(BaseContext.Call call,
Operation operation) |
boolean |
isCallerInRole(java.security.Identity identity)
Test if the caller has a given role.
|
protected boolean |
isCallerInRole(SecurityService securityService,
java.lang.String roleName) |
boolean |
isCallerInRole(java.lang.String s)
Test if the caller has a given security role.
|
boolean |
isTimerMethodAllowed() |
boolean |
isUserTransactionAccessAllowed() |
java.lang.Object |
lookup(java.lang.String name)
Lookup a resource within the
java: namespace. |
void |
setRollbackOnly()
Mark the current transaction for rollback.
|
protected java.lang.Object |
writeReplace() |
protected final SecurityService securityService
protected final UserTransaction userTransaction
protected BaseContext(SecurityService securityService)
protected BaseContext(SecurityService securityService, UserTransaction userTransaction)
protected abstract void check(ThreadContext context, BaseContext.Call call)
protected java.lang.IllegalStateException illegal(BaseContext.Call call, Operation operation)
public java.util.Map<java.lang.String,java.lang.Object> getContextData()
EJBContext
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 EJBContext
Map<String,Object>
object will be returned.public void doCheck(BaseContext.Call call)
public EJBHome getEJBHome()
EJBContext
getEJBHome
in interface EJBContext
public EJBLocalHome getEJBLocalHome()
EJBContext
getEJBLocalHome
in interface EJBContext
public java.security.Principal getCallerPrincipal()
EJBContext
java.security.Principal
that identifies the caller.getCallerPrincipal
in interface EJBContext
Principal
object that identifies the caller. This
method never returns null
.protected java.security.Principal getCallerPrincipal(SecurityService securityService)
public boolean isCallerInRole(java.lang.String s)
EJBContext
isCallerInRole
in interface EJBContext
s
- The name of the security role. The role must be one of
the security roles that is defined in the deployment descriptor.protected boolean isCallerInRole(SecurityService securityService, java.lang.String roleName)
public UserTransaction getUserTransaction() throws java.lang.IllegalStateException
EJBContext
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 EJBContext
UserTransaction
interface that the enterprise bean
instance can use for transaction demarcation.java.lang.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 UserTransaction getUserTransaction(UserTransaction userTransaction) throws java.lang.IllegalStateException
java.lang.IllegalStateException
public void setRollbackOnly() throws java.lang.IllegalStateException
EJBContext
setRollbackOnly
in interface EJBContext
java.lang.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).public boolean getRollbackOnly() throws java.lang.IllegalStateException
EJBContext
getRollbackOnly
in interface EJBContext
java.lang.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).public TimerService getTimerService() throws java.lang.IllegalStateException
EJBContext
getTimerService
in interface EJBContext
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)public boolean isTimerMethodAllowed()
public boolean isUserTransactionAccessAllowed()
public final java.util.Properties getEnvironment()
EJBContext
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 EJBContext
public final java.security.Identity getCallerIdentity()
EJBContext
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 EJBContext
Identity
object that identifies the caller.public final boolean isCallerInRole(java.security.Identity identity)
EJBContext
This method is deprecated in EJB 1.1. The enterprise bean
should use the isCallerInRole(String roleName)
method instead.
isCallerInRole
in interface EJBContext
identity
- The java.security.Identity
of the role to be tested.public java.lang.Object lookup(java.lang.String name)
EJBContext
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 EJBContext
name
- Name of the entryprotected java.lang.Object writeReplace() throws java.io.ObjectStreamException
java.io.ObjectStreamException