Search in sources :

Example 1 with ComponentInvocation

use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.

the class EJBSecurityManager method postInvoke.

/**
 * This method is used by Message Driven Bean Container to remove
 * the run-as identity information that was set up using the
 * preSetRunAsIdentity method
 */
public void postInvoke(ComponentInvocation inv) {
    if (runAs != null && inv.isPreInvokeDone()) {
        final ComponentInvocation finv = inv;
        AppservAccessController.doPrivileged(new PrivilegedAction() {

            public Object run() {
                SecurityContext.setCurrent((SecurityContext) finv.getOldSecurityContext());
                return null;
            }
        });
    }
}
Also used : ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation) PrivilegedAction(java.security.PrivilegedAction) SecurityContext(com.sun.enterprise.security.SecurityContext)

Example 2 with ComponentInvocation

use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.

the class JavaEEContextUtilImpl method pushContext.

/**
 * pushes Java EE invocation context
 *
 * @return the new context
 */
@Override
public Context pushContext() {
    ClassLoader oldClassLoader = Utility.getClassLoader();
    InvocationManager invMgr = serverContext.getInvocationManager();
    boolean invocationCreated = false;
    if (invMgr.getCurrentInvocation() == null && capturedInvocation != null) {
        ComponentInvocation newInvocation = capturedInvocation.clone();
        newInvocation.clearRegistry();
        invMgr.preInvoke(newInvocation);
        invocationCreated = true;
    }
    if (invocationCreated) {
        Utility.setContextClassLoader(getInvocationClassLoader());
    }
    return new ContextImpl.Context(oldClassLoader, invocationCreated ? invMgr.getCurrentInvocation() : null, invMgr);
}
Also used : BoundRequestContext(org.jboss.weld.context.bound.BoundRequestContext) ServerContext(org.glassfish.internal.api.ServerContext) ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation) InvocationManager(org.glassfish.api.invocation.InvocationManager)

Example 3 with ComponentInvocation

use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.

the class JavaEEContextUtilImpl method createInvocationContext.

private void createInvocationContext() {
    capturedInvocation = new ComponentInvocation();
    capturedInvocation.componentId = instanceComponentId;
    capturedInvocation.setJNDIEnvironment(compEnvMgr.getJndiNameEnvironment(instanceComponentId));
    capturedInvocation.setComponentInvocationType(ComponentInvocation.ComponentInvocationType.SERVLET_INVOCATION);
}
Also used : ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation)

Example 4 with ComponentInvocation

use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.

the class TimerServiceNamingProxy method getTimerServiceWrapper.

private Object getTimerServiceWrapper() {
    // Cannot store EjbContainerUtilImpl.getInstance() in an instance
    // variable because it shouldn't be accessed before EJB container
    // is initialized.
    // NamedNamingObjectProxy is initialized on the first lookup.
    ComponentInvocation currentInv = EjbContainerUtilImpl.getInstance().getCurrentInvocation();
    if (currentInv == null) {
        throw new IllegalStateException("no current invocation");
    } else if (currentInv.getInvocationType() != ComponentInvocation.ComponentInvocationType.EJB_INVOCATION) {
        throw new IllegalStateException("Illegal invocation type for EJB Context : " + currentInv.getInvocationType());
    }
    EJBTimerService ejbTimerService = EJBTimerService.getEJBTimerService();
    if (ejbTimerService == null) {
        throw new IllegalStateException("EJB Timer Service not " + "available");
    }
    return new EJBTimerServiceWrapper(ejbTimerService, (EJBContextImpl) ((EjbInvocation) currentInv).context);
}
Also used : EjbInvocation(com.sun.ejb.EjbInvocation) ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation)

Example 5 with ComponentInvocation

use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.

the class UserTransactionImpl method setRollbackOnly.

public void setRollbackOnly() throws IllegalStateException, SystemException {
    if (!initialized)
        init();
    if (userTx != null) {
        userTx.setRollbackOnly();
        return;
    }
    ComponentInvocation inv = invocationManager.getCurrentInvocation();
    if (inv != null) {
        checkUserTransactionMethodAccess(inv);
    }
    transactionManager.setRollbackOnly();
}
Also used : ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation)

Aggregations

ComponentInvocation (org.glassfish.api.invocation.ComponentInvocation)74 InvocationManager (org.glassfish.api.invocation.InvocationManager)14 JndiNameEnvironment (com.sun.enterprise.deployment.JndiNameEnvironment)8 EjbInvocation (com.sun.ejb.EjbInvocation)7 InvocationException (org.glassfish.api.invocation.InvocationException)7 SecurityContext (com.sun.enterprise.security.SecurityContext)6 WebModule (com.sun.enterprise.web.WebModule)6 PoolingException (com.sun.appserv.connectors.internal.api.PoolingException)5 InjectionException (com.sun.enterprise.container.common.spi.util.InjectionException)5 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)5 WebComponentInvocation (com.sun.enterprise.web.WebComponentInvocation)5 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)4 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)4 JavaEETransactionManager (com.sun.enterprise.transaction.api.JavaEETransactionManager)4 RemoteException (java.rmi.RemoteException)4 NamingException (javax.naming.NamingException)4 EJBInvocation (org.glassfish.ejb.api.EJBInvocation)4 ClientSecurityContext (com.sun.enterprise.security.common.ClientSecurityContext)3 Method (java.lang.reflect.Method)3 ArrayList (java.util.ArrayList)3