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;
}
});
}
}
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);
}
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);
}
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);
}
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();
}
Aggregations