if (parentInv.getInvocationType() == ComponentInvocationType.SERVLET_INVOCATION) { ComponentInvocation inv = new ComponentInvocation(); inv.componentId = parentInv.getComponentId(); inv.setComponentInvocationType(parentInv.getInvocationType()); inv.instance = null; inv.container = parentInv.getContainerContext(); inv.transaction = null; result.add(inv); } else if (parentInv.getInvocationType() != ComponentInvocationType.EJB_INVOCATION) { ComponentInvocation cpy = new ComponentInvocation(); cpy.componentId = parentInv.getComponentId(); cpy.setComponentInvocationType(parentInv.getInvocationType()); cpy.instance = parentInv.getInstance(); cpy.container = parentInv.getContainerContext(); cpy.transaction = parentInv.getTransaction(); result.add(cpy);
public EntityManager lookupExtendedEntityManager(EntityManagerFactory emf) { EntityManager em = null; ComponentInvocation inv = invMgr.getCurrentInvocation(); if( (inv != null) && (inv.getInvocationType() == ComponentInvocation.ComponentInvocationType.EJB_INVOCATION )) { Object obj = inv.getContainer(); if (obj instanceof JavaEEContainer) { em = ((JavaEEContainer) obj).lookupExtendedEntityManager(emf); } } return em; }
private ComponentInvocation createComponentInvocation(ComponentInvocation currInv) { // ComponentInvocation newInv = new ComponentInvocation( // currInv.getComponentId(), // ComponentInvocation.ComponentInvocationType.SERVLET_INVOCATION, // currInv.getContainer(), // currInv.getAppName(), // currInv.getModuleName() // ); ComponentInvocation newInv = currInv.clone(); newInv.setResourceTableKey(null); newInv.instance = currInv.getInstance(); // if (naming) { // newInv.setJNDIEnvironment(currInv.getJNDIEnvironment()); // } if (!naming) { newInv.setJNDIEnvironment(null); } return newInv; }
public void preInvoke(ComponentInvocation prev) throws InvocationException { if ( prev != null && prev.getTransaction() != null && prev.isTransactionCompleting() == false) { // do not worry about delisting previous invocation resources // if transaction is being completed delistComponentResources(prev, true); // delist with TMSUSPEND } }
private ComponentInvocation.ComponentInvocationType getCurrentComponentType() { return getCurrentComponentInvocation().getInvocationType(); }
/** * Get the component id from the Invocation Manager. * * @return the component id as a string. */ private String getComponentId() throws NamingException { String id; ComponentInvocation ci; if (invMgr==null) { ci= habitat.<InvocationManager>getService(InvocationManager.class).getCurrentInvocation(); } else { ci= invMgr.getCurrentInvocation(); } if (ci == null) { throw new NamingException("Invocation exception: Got null ComponentInvocation "); } try { id = ci.getComponentId(); if (id == null) { throw new NamingException("Invocation exception: ComponentId is null"); } } catch (Throwable th) { NamingException ine = new NamingException("Invocation exception: " + th); ine.initCause(th); throw ine; } return id; }
private void enlistComponentResources(ComponentInvocation inv) throws InvocationException { try { Transaction tran = (Transaction) inv.getTransaction(); if (isTransactionActive(tran)) { List l = getExistingResourceList(inv.getInstance(), inv); if (l == null || l.size() == 0) return; Iterator it = l.iterator(); // END IASRI 4705808 TTT002 while(it.hasNext()) { TransactionalResource h = (TransactionalResource) it.next(); try{ enlistResource(tran,h); }catch(Exception ex){ if (_logger.isLoggable(Level.FINE)) _logger.log(Level.WARNING, "enterprise_distributedtx.pooling_excep", ex); it.remove(); handleResourceError(h,ex,tran); } } //END OF IASRI 4658504 } } catch (Exception ex) { _logger.log(Level.SEVERE, "enterprise_distributedtx.excep_in_enlist",ex); } }
/** * PostInvoke Transaction configuration for Servlet Container. * BaseContainer.preInvokeTx() handles all this for CMT EJB. * * Precondition: assumed called prior to current transcation being * suspended or released. * * @param suspend indicate whether the delisting is due to suspension or * transaction completion(commmit/rollback) */ public void postInvokeTx(boolean suspend, boolean checkServletInvocation) { final ComponentInvocation inv = invocationManager.getCurrentInvocation(); if (inv != null && (!checkServletInvocation || inv.getInvocationType() == ComponentInvocation.ComponentInvocationType.SERVLET_INVOCATION)) { try { transactionManager.delistComponentResources(suspend); } catch (java.rmi.RemoteException re) { throw new IllegalStateException(re); } finally { inv.setTransaction(null); } } }
transaction = (Transaction) i.getTransaction(); if (context_ != null && transaction != null) {
String moduleName = null; if (invocation != null) { componentId = invocation.getComponentId(); appName = invocation.getAppName(); moduleName = invocation.getModuleName();
public void beforePreInvoke(ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation newInv) throws InvocationException { if (invType == ComponentInvocationType.SERVLET_INVOCATION) { Object cont = newInv.getContainer(); if (cont instanceof ContainerBase) { Realm realm = ((ContainerBase) cont).getRealm(); if (realm instanceof RealmAdapter) { ((RealmAdapter) realm).preSetRunAsIdentity(newInv); } } } }
private void postInvoke(ComponentInvocation curInv){ ComponentInvocation invToUse = curInv; /* if(invToUse == null){ invToUse = getConnectorRuntime().getInvocationManager().getCurrentInvocation(); } */ if (invToUse == null) { return; } Object comp = invToUse.getInstance(); if (comp == null) { return; } handleLazilyAssociatedConnectionPools(comp, invToUse); }
appName = handle.getInvocation().getAppName(); if (invocation != null && !handle.isUseTransactionOfExecutionThread()) { invocation.setResourceTableKey(new PairKey(invocation.getInstance(), Thread.currentThread())); invocationManager.preInvoke(invocation);
public Object run() { SecurityContext.setCurrent( (SecurityContext) finv.getOldSecurityContext()); return null; } });
String servletName = inv.getInstanceName(); if (servletName != null) { return servletName; Object invInstance = inv.getInstance();
public ResourceHandler getResourceHandler() { ResourceHandler rh = super.getResourceHandler(); if (rh == null) { rh = context; } return rh; }
private ComponentInvocation createComponentInvocation(String componentId, String appName, String moduleName) { if (componentId == null && appName == null && moduleName == null) { return null; } ComponentInvocation newInv = new ComponentInvocation( componentId, ComponentInvocation.ComponentInvocationType.SERVLET_INVOCATION, null, appName, moduleName ); return newInv; }
public EjbInvocation clone() { EjbInvocation newInv = (EjbInvocation) super.clone(); newInv.ejb = null; newInv.exception = null; newInv.exceptionFromBeanMethod = null; newInv.clientTx = null; newInv.preInvokeTxStatus = null; newInv.originalContextClassLoader = null; return newInv; }
private Object getEJBContextObject() { // 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()); } return ((EjbInvocation) currentInv).context; } }
id = ci.getComponentId(); if (id == null) { NamingException nameEx = new NamingException(