Package com.sun.ejb.containers
Class EJBContextImpl
- java.lang.Object
-
- com.sun.ejb.containers.EJBContextImpl
-
- All Implemented Interfaces:
ComponentContext
,jakarta.ejb.EJBContext
,Serializable
,ResourceHandler
- Direct Known Subclasses:
AbstractSessionContextImpl
,EntityContextImpl
,MessageBeanContextImpl
public abstract class EJBContextImpl extends Object implements jakarta.ejb.EJBContext, ComponentContext, Serializable
Implementation of jakarta.ejb.EJBContext for the J2EE Reference Implementation.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EJBContextImpl.BeanState
-
Field Summary
Fields Modifier and Type Field Description protected BaseContainer
container
protected EJBLocalObjectImpl
ejbLocalBusinessObjectImpl
protected EJBLocalObjectImpl
ejbLocalObjectImpl
protected EJBObjectImpl
ejbObjectImpl
protected EJBObjectImpl
ejbRemoteBusinessObjectImpl
protected jakarta.ejb.EJBObject
ejbStub
protected boolean
inEjbRemove
protected Context
initialContext
protected boolean
isLocalInterfaceSupported
protected boolean
isRemoteInterfaceSupported
protected JCDIService.JCDIInjectionContext
jcdiInjectionContext
protected EJBLocalObjectImpl
optionalEjbLocalBusinessObjectImpl
protected EJBContextImpl.BeanState
state
protected jakarta.transaction.Transaction
transaction
-
Constructor Summary
Constructors Modifier Constructor Description protected
EJBContextImpl(Object ejb, BaseContainer container)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
checkAccessToCallerSecurity()
Overridden in containers that allow access to isCallerInRole() and getCallerPrincipal()protected void
checkActivatePassivate()
void
checkTimerServiceMethodAccess()
The EJB spec makes a distinction between access to the TimerService object itself (via EJBContext.getTimerService) and access to the methods on TimerService, Timer, and TimerHandle.void
decrementConcurrentInvokeCount()
Decrement the number of concurrent invocations on this bean (could happen with re-entrant bean).protected void
doGetSetRollbackTxAttrCheck()
Identity
getCallerIdentity()
Deprecated.Principal
getCallerPrincipal()
int
getConcurrentInvokeCount()
Get the number of concurrent invocations on this bean (could happen with re-entrant bean).Container
getContainer()
Get the Container instance which created this Context.Map<String,Object>
getContextData()
Object
getEJB()
Get the EJB instance associated with this context.jakarta.ejb.EJBHome
getEJBHome()
jakarta.ejb.EJBLocalHome
getEJBLocalHome()
jakarta.ejb.EJBLocalObject
getEJBLocalObject()
This is a SessionContext/EntityContext method.jakarta.ejb.EJBObject
getEJBObject()
This is a SessionContext/EntityContext method.Properties
getEnvironment()
Object[]
getInterceptorInstances()
protected Object
getKey()
long
getLastTimeUsed()
List
getResourceList()
Get all the resources associated with the contextboolean
getRollbackOnly()
protected EJBContextImpl.BeanState
getState()
jakarta.transaction.Transaction
getTransaction()
Get the Transaction object associated with this Context.jakarta.transaction.UserTransaction
getUserTransaction()
protected boolean
inActivatePassivate()
protected boolean
inActivatePassivate(ComponentInvocation inv)
void
incrementConcurrentInvokeCount()
Increment the number of concurrent invocations on this bean (could happen with re-entrant bean).boolean
isCallerInRole(String roleRef)
boolean
isCallerInRole(Identity identity)
Deprecated.Object
lookup(String name)
void
registerResource(ResourceHandle h)
Register a resource opened by the EJB instance associated with this Context.void
setRollbackOnly()
void
setTransaction(jakarta.transaction.Transaction tr)
void
touch()
void
unregisterResource(ResourceHandle h)
Unregister a resource from this Context.
-
-
-
Field Detail
-
container
protected transient BaseContainer container
-
transaction
protected transient jakarta.transaction.Transaction transaction
-
initialContext
protected transient Context initialContext
-
ejbStub
protected transient jakarta.ejb.EJBObject ejbStub
-
ejbObjectImpl
protected transient EJBObjectImpl ejbObjectImpl
-
ejbRemoteBusinessObjectImpl
protected transient EJBObjectImpl ejbRemoteBusinessObjectImpl
-
ejbLocalObjectImpl
protected transient EJBLocalObjectImpl ejbLocalObjectImpl
-
ejbLocalBusinessObjectImpl
protected transient EJBLocalObjectImpl ejbLocalBusinessObjectImpl
-
optionalEjbLocalBusinessObjectImpl
protected transient EJBLocalObjectImpl optionalEjbLocalBusinessObjectImpl
-
state
protected transient EJBContextImpl.BeanState state
-
isRemoteInterfaceSupported
protected boolean isRemoteInterfaceSupported
-
isLocalInterfaceSupported
protected boolean isLocalInterfaceSupported
-
inEjbRemove
protected transient boolean inEjbRemove
-
jcdiInjectionContext
protected transient JCDIService.JCDIInjectionContext jcdiInjectionContext
-
-
Constructor Detail
-
EJBContextImpl
protected EJBContextImpl(Object ejb, BaseContainer container)
-
-
Method Detail
-
getTransaction
public jakarta.transaction.Transaction getTransaction()
Description copied from interface:ComponentContext
Get the Transaction object associated with this Context.- Specified by:
getTransaction
in interfaceComponentContext
-
setTransaction
public void setTransaction(jakarta.transaction.Transaction tr)
-
getState
protected EJBContextImpl.BeanState getState()
-
getLastTimeUsed
public long getLastTimeUsed()
-
touch
public void touch()
-
getEJB
public Object getEJB()
Description copied from interface:ComponentContext
Get the EJB instance associated with this context.- Specified by:
getEJB
in interfaceComponentContext
-
getContainer
public Container getContainer()
Description copied from interface:ComponentContext
Get the Container instance which created this Context.- Specified by:
getContainer
in interfaceComponentContext
-
registerResource
public void registerResource(ResourceHandle h)
Register a resource opened by the EJB instance associated with this Context.
-
unregisterResource
public void unregisterResource(ResourceHandle h)
Unregister a resource from this Context.
-
getResourceList
public List getResourceList()
Get all the resources associated with the context- Specified by:
getResourceList
in interfaceComponentContext
- Specified by:
getResourceList
in interfaceResourceHandler
-
getConcurrentInvokeCount
public int getConcurrentInvokeCount()
Get the number of concurrent invocations on this bean (could happen with re-entrant bean). Used by TM.
-
incrementConcurrentInvokeCount
public void incrementConcurrentInvokeCount()
Increment the number of concurrent invocations on this bean (could happen with re-entrant bean). Used by TM.
-
decrementConcurrentInvokeCount
public void decrementConcurrentInvokeCount()
Decrement the number of concurrent invocations on this bean (could happen with re-entrant bean). Used by TM.
-
getEJBObject
public jakarta.ejb.EJBObject getEJBObject() throws IllegalStateException
This is a SessionContext/EntityContext method.- Throws:
IllegalStateException
-
getEJBLocalObject
public jakarta.ejb.EJBLocalObject getEJBLocalObject() throws IllegalStateException
This is a SessionContext/EntityContext method.- Throws:
IllegalStateException
-
getEJBHome
public jakarta.ejb.EJBHome getEJBHome()
- Specified by:
getEJBHome
in interfacejakarta.ejb.EJBContext
-
getEJBLocalHome
public jakarta.ejb.EJBLocalHome getEJBLocalHome()
- Specified by:
getEJBLocalHome
in interfacejakarta.ejb.EJBContext
-
getEnvironment
public Properties getEnvironment()
-
getCallerIdentity
public Identity getCallerIdentity()
Deprecated.
-
getCallerPrincipal
public Principal getCallerPrincipal()
- Specified by:
getCallerPrincipal
in interfacejakarta.ejb.EJBContext
-
getContextData
public Map<String,Object> getContextData()
- Specified by:
getContextData
in interfacejakarta.ejb.EJBContext
- Returns:
- Returns the contextMetaData.
-
isCallerInRole
public boolean isCallerInRole(Identity identity)
Deprecated.
-
isCallerInRole
public boolean isCallerInRole(String roleRef)
- Specified by:
isCallerInRole
in interfacejakarta.ejb.EJBContext
-
checkAccessToCallerSecurity
protected void checkAccessToCallerSecurity() throws IllegalStateException
Overridden in containers that allow access to isCallerInRole() and getCallerPrincipal()- Throws:
IllegalStateException
-
getUserTransaction
public jakarta.transaction.UserTransaction getUserTransaction() throws IllegalStateException
- Specified by:
getUserTransaction
in interfacejakarta.ejb.EJBContext
- Throws:
IllegalStateException
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException
- Specified by:
setRollbackOnly
in interfacejakarta.ejb.EJBContext
- Throws:
IllegalStateException
-
getRollbackOnly
public boolean getRollbackOnly() throws IllegalStateException
- Specified by:
getRollbackOnly
in interfacejakarta.ejb.EJBContext
- Throws:
IllegalStateException
-
doGetSetRollbackTxAttrCheck
protected void doGetSetRollbackTxAttrCheck()
-
getInterceptorInstances
public Object[] getInterceptorInstances()
-
checkTimerServiceMethodAccess
public void checkTimerServiceMethodAccess() throws IllegalStateException
The EJB spec makes a distinction between access to the TimerService object itself (via EJBContext.getTimerService) and access to the methods on TimerService, Timer, and TimerHandle. The latter case is covered by this check. It is overridden in the applicable concrete context impl subclasses.- Specified by:
checkTimerServiceMethodAccess
in interfaceComponentContext
- Throws:
IllegalStateException
-
checkActivatePassivate
protected void checkActivatePassivate() throws IllegalStateException
- Throws:
IllegalStateException
-
inActivatePassivate
protected boolean inActivatePassivate()
-
inActivatePassivate
protected boolean inActivatePassivate(ComponentInvocation inv)
-
getKey
protected Object getKey()
-
-