Package com.sun.ejb

Class EjbInvocation

  • All Implemented Interfaces:
    InterceptorManager.AroundInvokeContext, com.sun.enterprise.transaction.spi.TransactionOperationsManager, jakarta.interceptor.InvocationContext, Cloneable, org.glassfish.ejb.api.EJBInvocation

    public class EjbInvocation
    extends org.glassfish.api.invocation.ComponentInvocation
    implements jakarta.interceptor.InvocationContext, com.sun.enterprise.transaction.spi.TransactionOperationsManager, org.glassfish.ejb.api.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.

    • Field Detail

      • 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)
      • 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 class org.glassfish.api.invocation.ComponentInvocation
      • getJaccEjb

        public Object getJaccEjb()
        Specified by:
        getJaccEjb in interface org.glassfish.ejb.api.EJBInvocation
      • 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 interface org.glassfish.ejb.api.EJBInvocation
        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 class org.glassfish.api.invocation.ComponentInvocation
      • setTransactionOperationsManager

        public void setTransactionOperationsManager​(com.sun.enterprise.transaction.spi.TransactionOperationsManager transactionOperationsManager)
      • userTransactionMethodsAllowed

        public boolean userTransactionMethodsAllowed()
        Called by the UserTransaction implementation to verify access to the UserTransaction methods.
        Specified by:
        userTransactionMethodsAllowed in interface com.sun.enterprise.transaction.spi.TransactionOperationsManager
      • userTransactionLookupAllowed

        public void userTransactionLookupAllowed()
                                          throws NameNotFoundException
        Called by the UserTransaction lookup to verify access to the UserTransaction itself.
        Specified by:
        userTransactionLookupAllowed in interface com.sun.enterprise.transaction.spi.TransactionOperationsManager
        Throws:
        NameNotFoundException
      • doAfterUtxBegin

        public void doAfterUtxBegin()
        Called by the UserTransaction when transaction is started.
        Specified by:
        doAfterUtxBegin in interface com.sun.enterprise.transaction.spi.TransactionOperationsManager
      • getTarget

        public Object getTarget()
        Specified by:
        getTarget in interface jakarta.interceptor.InvocationContext
        Returns:
        Returns the bean instance.
      • getTimer

        public Object getTimer()
        Specified by:
        getTimer in interface jakarta.interceptor.InvocationContext
        Returns:
        Returns the timer instance.
      • getMethod

        public Method getMethod()
        Specified by:
        getMethod in interface org.glassfish.ejb.api.EJBInvocation
        Specified by:
        getMethod in interface jakarta.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 interface jakarta.interceptor.InvocationContext
      • getParameters

        public Object[] getParameters()
        Specified by:
        getParameters in interface jakarta.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 interface jakarta.interceptor.InvocationContext
      • setWebServiceContext

        public void setWebServiceContext​(Object webServiceContext)
        Specified by:
        setWebServiceContext in interface org.glassfish.ejb.api.EJBInvocation
      • getContextData

        public Map<String,​Object> getContextData()
        Specified by:
        getContextData in interface jakarta.interceptor.InvocationContext
        Returns:
        Returns the contextMetaData.
      • setMessage

        public <T> void setMessage​(T message)
        This is for EJB JAXWS only.
        Specified by:
        setMessage in interface org.glassfish.ejb.api.EJBInvocation
        Parameters:
        message - an unconsumed message
      • getMessage

        public Object getMessage()
        This is for EJB JAXWS only.
        Specified by:
        getMessage in interface org.glassfish.ejb.api.EJBInvocation
        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 interface jakarta.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 class Object
        Returns:
      • 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 interface InterceptorManager.AroundInvokeContext
        Throws:
        Throwable
      • getEjbSecurityManager

        public com.sun.enterprise.security.SecurityManager getEjbSecurityManager()
      • isAWebService

        public boolean isAWebService()
        Specified by:
        isAWebService in interface org.glassfish.ejb.api.EJBInvocation
      • getMethodParams

        public Object[] getMethodParams()
        Specified by:
        getMethodParams in interface org.glassfish.ejb.api.EJBInvocation
      • authorizeWebService

        public boolean authorizeWebService​(Method m)
                                    throws Exception
        Specified by:
        authorizeWebService in interface org.glassfish.ejb.api.EJBInvocation
        Throws:
        Exception
      • isCallerInRole

        public boolean isCallerInRole​(String role)
        Implements the method in org.glassfish.ejb.api.EJBInvocation
        Specified by:
        isCallerInRole in interface org.glassfish.ejb.api.EJBInvocation
        Returns:
        true if the SecurityManager reports that the caller is in role
      • setWebServiceMethod

        public void setWebServiceMethod​(Method method)
        Specified by:
        setWebServiceMethod in interface org.glassfish.ejb.api.EJBInvocation
      • getWebServiceMethod

        public Method getWebServiceMethod()
        Specified by:
        getWebServiceMethod in interface org.glassfish.ejb.api.EJBInvocation
      • getResourceHandler

        public org.glassfish.api.invocation.ResourceHandler getResourceHandler()
        Overrides:
        getResourceHandler in class org.glassfish.api.invocation.ComponentInvocation
      • isContainerStartsTx

        public boolean isContainerStartsTx()
      • setContainerStartsTx

        public void setContainerStartsTx​(boolean containerStartsTx)