Package com.sun.ejb
Class EjbInvocation
- java.lang.Object
-
- org.glassfish.api.invocation.ComponentInvocation
-
- com.sun.ejb.EjbInvocation
-
- All Implemented Interfaces:
InterceptorManager.AroundInvokeContext
,TransactionOperationsManager
,jakarta.interceptor.InvocationContext
,Cloneable
,EJBInvocation
public class EjbInvocation extends ComponentInvocation implements jakarta.interceptor.InvocationContext, TransactionOperationsManager, EJBInvocation, InterceptorManager.AroundInvokeContext
The EjbInvocation object contains state associated with an invocation on an EJB or EJBHome (local/remote). It is usually created by generated code in *ObjectImpl and *HomeImpl classes. It is passed as a parameter to Container.preInvoke() * and postInvoke(), which are called by the EJB(Local)Object/EJB(Local)Home before and after an invocation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.glassfish.api.invocation.ComponentInvocation
ComponentInvocation.ComponentInvocationType
-
-
Field Summary
Fields Modifier and Type Field Description Method
beanMethod
Class<?>
clientInterface
Home, Remote, LocalHome, Local, WebService, or business interface through which a synchronous ejb invocation was made.jakarta.transaction.Transaction
clientTx
The client's transaction if any.ComponentContext
context
Object
ejb
The EJB instance to be invoked.EJBLocalRemoteObject
ejbObject
The EJBObject/EJBLocalObject which created this EjbInvocation object.Throwable
exception
This reflects any exception that has occurred during this invocation, including preInvoke, bean method execution, and postInvoke.Throwable
exceptionFromBeanMethod
Set to any exception directly thrown from bean method invocation, which could be either an application exception or a runtime exception.boolean
foundInTxCache
Tells if a CMP2.x bean was found in the Tx cache.InvocationInfo
invocationInfo
InvocationInfo object caches information about the current methodboolean
isBusinessInterface
True if this invocation was made through a local business interface or bean local view or a remote business interface.boolean
isHome
true if this is an invocation on the home object this is required for jacc.boolean
isLocal
Local flag: true if this invocation was through the 2.x (or earlier) Local client view, the 3.x local client view or a no-interface client view.boolean
isMessageDriven
true if this is a message-driven bean invocationboolean
isRemote
True if this invocation was made through the 2.x (or earlier) Remote client view or the 3.x remote client view.boolean
isTimerCallback
true if this is an ejb timeout method invocationboolean
isWebService
true if this is a web service invocationMethod
method
Method to be invoked.Object[]
methodParams
Used for JACC PolicyContextHandlers.jakarta.ejb.Timer
timer
int
transactionAttribute
The transaction attribute of the bean method.boolean
useFastPath
Tells if a fast path can be taken for a business method invocation.-
Fields inherited from class org.glassfish.api.invocation.ComponentInvocation
appName, componentId, container, instance, jndiEnvironment, moduleName, oldSecurityContext, registrationName, transaction
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
authorizeWebService(Method m)
Use the underlying container to authorize this invocationvoid
clearYetToSubmitStatus()
EjbInvocation
clone()
void
doAfterUtxBegin()
Called by the UserTransaction when transaction is started.Method
getBeanMethod()
Object
getCachedPermission()
Lock
getCMCLock()
Constructor
getConstructor()
Map<String,Object>
getContextData()
boolean
getDoTxProcessingInPostInvoke()
jakarta.ejb.EJBContext
getEJBContext()
EjbFutureTask
getEjbFutureTask()
SecurityManager
getEjbSecurityManager()
InterceptorManager.InterceptorChain
getInterceptorChain()
Object[]
getInterceptorInstances()
long
getInvId()
Object
getJaccEjb()
Used by JACC implementation to get an enterprise bean instance for the EnterpriseBean policy handler.Object
getMessage()
This is for EJB JAXWS only.Method
getMethod()
String
getMethodInterface()
This method returns the method interface constant for this EjbInvocation.Object[]
getMethodParams()
ClassLoader
getOriginalContextClassLoader()
Object[]
getParameters()
Integer
getPreInvokeTxStatus()
ResourceHandler
getResourceHandler()
jakarta.xml.soap.SOAPMessage
getSOAPMessage()
This is for EJB JAXWS only.Object
getTarget()
Object
getTimer()
Object
getTransactionOperationsManager()
boolean
getWasCancelCalled()
Method
getWebServiceMethod()
boolean
holdingSFSBSerializedLock()
Object
invokeBeanMethod()
Called from Interceptor Chain to invoke the actual bean method.boolean
isAWebService()
boolean
isCallerInRole(String role)
boolean
isClientInterfaceAssignableToOneOf(Class<?>... classes)
Checks if the client interface is not null and is assignable to at least one of classes in parameter.boolean
isContainerStartsTx()
boolean
mustInvokeAsynchronously()
Object
proceed()
void
setCMCLock(Lock l)
void
setContainerStartsTx(boolean containerStartsTx)
void
setDoTxProcessingInPostInvoke(boolean doTxProcessingInPostInvoke)
void
setEjbFutureTask(EjbFutureTask future)
void
setHoldingSFSBSerializedLock(boolean flag)
void
setInvId(long invId)
<T> void
setMessage(T message)
This is for EJB JAXWS only.void
setOriginalContextClassLoader(ClassLoader originalContextClassLoader)
void
setParameters(Object[] params)
Set the parameters that will be used to invoke the business method.void
setPreInvokeTxStatus(Integer txStatus)
void
setTransactionOperationsManager(TransactionOperationsManager transactionOperationsManager)
void
setWasCancelCalled(boolean flag)
void
setWebServiceContext(Object webServiceContext)
Method takes Object to decoupleEJBInvocation
interface from jaxws (which isn't available in all profiles).void
setWebServiceMethod(Method method)
String
toString()
Print most useful fields.void
userTransactionLookupAllowed()
Called by the UserTransaction lookup to verify access to the UserTransaction itself.boolean
userTransactionMethodsAllowed()
Called by the UserTransaction implementation to verify access to the UserTransaction methods.-
Methods inherited from class org.glassfish.api.invocation.ComponentInvocation
clearRegistry, getAppName, getAuth, getComponentId, getContainer, getContainerContext, getInstance, getInstanceName, getInvocationType, getJndiEnvironment, getJNDIEnvironment, getModuleName, getOldSecurityContext, getRegistrationName, getRegistry, getRegistryFor, getResourceTableKey, getTransaction, isPreInvokeDone, isPreInvokeDoneStatus, isTransactionCompleting, setAppName, setAuth, setAuth, setComponentId, setComponentInvocationType, setContainer, setInstance, setInstanceName, setInvocationType, setJndiEnvironment, setJNDIEnvironment, setModuleName, setOldSecurityContext, setPreInvokeDone, setPreInvokeDoneStatus, setRegistrationName, setRegistry, setRegistryFor, setResourceHandler, setResourceTableKey, setTransaction, setTransactionCompeting, setTransactionCompleting, setTransactionOperationsManager
-
-
-
-
Field Detail
-
context
public ComponentContext context
-
ejbObject
public EJBLocalRemoteObject ejbObject
The EJBObject/EJBLocalObject which created this EjbInvocation object. This identifies the target bean.
-
isLocal
public boolean isLocal
Local flag: true if this invocation was through the 2.x (or earlier) Local client view, the 3.x local client view or a no-interface client view.
-
isRemote
public boolean isRemote
True if this invocation was made through the 2.x (or earlier) Remote client view or the 3.x remote client view.
-
invocationInfo
public InvocationInfo invocationInfo
InvocationInfo object caches information about the current method
-
isBusinessInterface
public boolean isBusinessInterface
True if this invocation was made through a local business interface or bean local view or a remote business interface.
-
isWebService
public boolean isWebService
true if this is a web service invocation
-
isTimerCallback
public boolean isTimerCallback
true if this is an ejb timeout method invocation
-
isMessageDriven
public boolean isMessageDriven
true if this is a message-driven bean invocation
-
isHome
public boolean isHome
true if this is an invocation on the home object this is required for jacc.
-
clientInterface
public Class<?> clientInterface
Home, Remote, LocalHome, Local, WebService, or business interface through which a synchronous ejb invocation was made.
-
method
public Method method
Method to be invoked. This is a method of the EJB's local/remote component interface for invocations on EJB(Local)Objects, or of the local/remote Home interface for invocations on the EJBHome. Set by the EJB(Local)Object/EJB(Local)Home before calling Container.preInvoke().
-
ejb
public Object ejb
The EJB instance to be invoked. Set by Container and used by EJBObject/EJBHome.
-
exception
public Throwable exception
This reflects any exception that has occurred during this invocation, including preInvoke, bean method execution, and postInvoke.
-
exceptionFromBeanMethod
public Throwable exceptionFromBeanMethod
Set to any exception directly thrown from bean method invocation, which could be either an application exception or a runtime exception. This is set *in addition to* the this.exception field. Some container processing logic, e.g. @Remove, depends specifically on whether a bean method threw an exception.
-
clientTx
public jakarta.transaction.Transaction clientTx
The client's transaction if any. Set by the Container during preInvoke() and used by the Container during postInvoke().
-
transactionAttribute
public int transactionAttribute
The transaction attribute of the bean method. Set in generated EJBObject/Home/LocalObject/LocalHome class.
-
methodParams
public Object[] methodParams
Used for JACC PolicyContextHandlers. The handler can query the container back for parameters on the ejb. This is set during the method invocation and is not available for preInvoke calls.
-
timer
public jakarta.ejb.Timer timer
-
foundInTxCache
public boolean foundInTxCache
Tells if a CMP2.x bean was found in the Tx cache. Applicable only for CMP2.x beans
-
useFastPath
public boolean useFastPath
Tells if a fast path can be taken for a business method invocation.
-
beanMethod
public Method beanMethod
-
-
Method Detail
-
getOriginalContextClassLoader
public ClassLoader getOriginalContextClassLoader()
-
setOriginalContextClassLoader
public void setOriginalContextClassLoader(ClassLoader originalContextClassLoader)
-
getEjbFutureTask
public EjbFutureTask getEjbFutureTask()
-
setEjbFutureTask
public void setEjbFutureTask(EjbFutureTask future)
-
setWasCancelCalled
public void setWasCancelCalled(boolean flag)
-
getWasCancelCalled
public boolean getWasCancelCalled()
-
getInvId
public long getInvId()
-
setInvId
public void setInvId(long invId)
-
mustInvokeAsynchronously
public boolean mustInvokeAsynchronously()
-
clearYetToSubmitStatus
public void clearYetToSubmitStatus()
-
getDoTxProcessingInPostInvoke
public boolean getDoTxProcessingInPostInvoke()
-
setDoTxProcessingInPostInvoke
public void setDoTxProcessingInPostInvoke(boolean doTxProcessingInPostInvoke)
-
clone
public EjbInvocation clone()
- Overrides:
clone
in classComponentInvocation
-
getJaccEjb
public Object getJaccEjb()
Used by JACC implementation to get an enterprise bean instance for the EnterpriseBean policy handler. The jacc implementation should use this method rather than directly accessing the ejb field.- Specified by:
getJaccEjb
in interfaceEJBInvocation
- Returns:
- EnterpriseBean instance or null if not applicable for this invocation.
-
getMethodInterface
public String getMethodInterface()
This method returns the method interface constant for this EjbInvocation.
-
getCachedPermission
public Object getCachedPermission()
- Returns:
- CachedPermission associated with this invocation, or null if not available.
-
getEJBContext
public jakarta.ejb.EJBContext getEJBContext()
- Specified by:
getEJBContext
in interfaceEJBInvocation
- Returns:
- Returns the ejbCtx.
-
getPreInvokeTxStatus
public Integer getPreInvokeTxStatus()
-
setPreInvokeTxStatus
public void setPreInvokeTxStatus(Integer txStatus)
-
getCMCLock
public Lock getCMCLock()
-
setCMCLock
public void setCMCLock(Lock l)
-
holdingSFSBSerializedLock
public boolean holdingSFSBSerializedLock()
-
setHoldingSFSBSerializedLock
public void setHoldingSFSBSerializedLock(boolean flag)
-
getTransactionOperationsManager
public Object getTransactionOperationsManager()
- Overrides:
getTransactionOperationsManager
in classComponentInvocation
-
setTransactionOperationsManager
public void setTransactionOperationsManager(TransactionOperationsManager transactionOperationsManager)
-
userTransactionMethodsAllowed
public boolean userTransactionMethodsAllowed()
Called by the UserTransaction implementation to verify access to the UserTransaction methods.- Specified by:
userTransactionMethodsAllowed
in interfaceTransactionOperationsManager
-
userTransactionLookupAllowed
public void userTransactionLookupAllowed() throws NameNotFoundException
Called by the UserTransaction lookup to verify access to the UserTransaction itself.- Specified by:
userTransactionLookupAllowed
in interfaceTransactionOperationsManager
- Throws:
NameNotFoundException
-
doAfterUtxBegin
public void doAfterUtxBegin()
Called by the UserTransaction when transaction is started.- Specified by:
doAfterUtxBegin
in interfaceTransactionOperationsManager
-
getInterceptorChain
public InterceptorManager.InterceptorChain getInterceptorChain()
-
getTarget
public Object getTarget()
- Specified by:
getTarget
in interfacejakarta.interceptor.InvocationContext
- Returns:
- Returns the bean instance.
-
getTimer
public Object getTimer()
- Specified by:
getTimer
in interfacejakarta.interceptor.InvocationContext
- Returns:
- Returns the timer instance.
-
getMethod
public Method getMethod()
- Specified by:
getMethod
in interfaceEJBInvocation
- Specified by:
getMethod
in interfacejakarta.interceptor.InvocationContext
- Returns:
- For AroundInvoke/AroundTimeout methods, returns the bean class method being invoked. For lifecycle callback methods, returns null.
-
getBeanMethod
public Method getBeanMethod()
-
getConstructor
public Constructor getConstructor()
- Specified by:
getConstructor
in interfacejakarta.interceptor.InvocationContext
-
getParameters
public Object[] getParameters()
- Specified by:
getParameters
in interfacejakarta.interceptor.InvocationContext
- Returns:
- Returns the parameters that will be used to invoke the business method. If setParameters has been called, getParameters() returns the values to which the parameters have been set.
-
setParameters
public void setParameters(Object[] params)
Set the parameters that will be used to invoke the business method.- Specified by:
setParameters
in interfacejakarta.interceptor.InvocationContext
-
setWebServiceContext
public void setWebServiceContext(Object webServiceContext)
Method takes Object to decoupleEJBInvocation
interface from jaxws (which isn't available in all profiles).- Specified by:
setWebServiceContext
in interfaceEJBInvocation
- Parameters:
webServiceContext
- JAX-WS web service context used for the invocation
-
getContextData
public Map<String,Object> getContextData()
- Specified by:
getContextData
in interfacejakarta.interceptor.InvocationContext
- Returns:
- Returns the contextMetaData.
-
setMessage
public <T> void setMessage(T message)
This is for EJB JAXWS only.- Specified by:
setMessage
in interfaceEJBInvocation
- Parameters:
message
- an unconsumed message
-
getMessage
public Object getMessage()
This is for EJB JAXWS only.- Specified by:
getMessage
in interfaceEJBInvocation
- Returns:
- the JAXWS message
-
getSOAPMessage
public jakarta.xml.soap.SOAPMessage getSOAPMessage()
This is for EJB JAXWS only.
-
proceed
public Object proceed() throws Exception
- Specified by:
proceed
in interfacejakarta.interceptor.InvocationContext
- Throws:
Exception
-
toString
public String toString()
Print most useful fields. Don't do all of them (yet) since there are a large number.- Overrides:
toString
in classComponentInvocation
-
getInterceptorInstances
public Object[] getInterceptorInstances()
- Specified by:
getInterceptorInstances
in interfaceInterceptorManager.AroundInvokeContext
-
invokeBeanMethod
public Object invokeBeanMethod() throws Throwable
Description copied from interface:InterceptorManager.AroundInvokeContext
Called from Interceptor Chain to invoke the actual bean method. This method must throw any exception from the bean method *as is*, without being wrapped in an InvocationTargetException. The exception thrown from this method will be propagated through the application's interceptor code, so it must not be changed in order for any exception handling logic in that code to function properly.- Specified by:
invokeBeanMethod
in interfaceInterceptorManager.AroundInvokeContext
- Throws:
Throwable
-
getEjbSecurityManager
public SecurityManager getEjbSecurityManager()
-
isAWebService
public boolean isAWebService()
- Specified by:
isAWebService
in interfaceEJBInvocation
- Returns:
- true if it is a webservice invocation
-
getMethodParams
public Object[] getMethodParams()
- Specified by:
getMethodParams
in interfaceEJBInvocation
- Returns:
- the Method parameters for this Invocation
-
authorizeWebService
public boolean authorizeWebService(Method m) throws Exception
Description copied from interface:EJBInvocation
Use the underlying container to authorize this invocation- Specified by:
authorizeWebService
in interfaceEJBInvocation
- Parameters:
m
- method to be invoked- Returns:
- true if the invocation was authorized by the underlying container
- Throws:
Exception
-
isCallerInRole
public boolean isCallerInRole(String role)
- Specified by:
isCallerInRole
in interfaceEJBInvocation
- Returns:
- true if the SecurityManager reports that the caller is in role
-
setWebServiceMethod
public void setWebServiceMethod(Method method)
- Specified by:
setWebServiceMethod
in interfaceEJBInvocation
- Parameters:
method
- - web service endpoint method
-
getWebServiceMethod
public Method getWebServiceMethod()
- Specified by:
getWebServiceMethod
in interfaceEJBInvocation
- Returns:
- web service endpoint
Method
-
getResourceHandler
public ResourceHandler getResourceHandler()
- Overrides:
getResourceHandler
in classComponentInvocation
-
isContainerStartsTx
public boolean isContainerStartsTx()
-
setContainerStartsTx
public void setContainerStartsTx(boolean containerStartsTx)
-
isClientInterfaceAssignableToOneOf
public boolean isClientInterfaceAssignableToOneOf(Class<?>... classes)
Checks if the client interface is not null and is assignable to at least one of classes in parameter.- Parameters:
classes
- must not be null- Returns:
- true if the client interface is assignable to at least one of classes in parameter
-
-