private static String getCurrentTXID() throws TXFrameworkException { String txid; //Try WS-AT txid = UserTransactionFactory.userTransaction().transactionIdentifier(); if (!txid.equals("Unknown")) { return txid; } //Try WS-BA try { BusinessActivityManager businessActivityManager = BusinessActivityManagerFactory.businessActivityManager(); if (businessActivityManager.currentTransaction() != null) { txid = businessActivityManager.currentTransaction().toString(); if (!txid.equals("Unknown")) { return txid; } } } catch (SystemException e) { throw new TXFrameworkException("Error when looking up Business Activity", e); } //Try REST-AT HttpServletRequest req = ResteasyProviderFactory.getContextData(HttpServletRequest.class); String enlistUrl = req.getHeader("enlistURL"); if (enlistUrl != null) { String[] parts = enlistUrl.split("/"); return parts[parts.length - 1]; } throw new TXFrameworkException("No Transaction detected"); }
public Element putCoordinationContext(Element headerElement) throws UnknownTransactionException, SystemException { resume(); final TxContextImple txContext = (TxContextImple) BusinessActivityManager.getBusinessActivityManager().currentTransaction(); CoordinationContextType ctx = txContext.context().getCoordinationContext(); try { Document doc = headerElement.getOwnerDocument(); Element coord = doc.createElementNS(CoordinationConstants.WSCOOR_NAMESPACE, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT); headerElement.appendChild(coord); CoordinationContextHelper.serialise(ctx, headerElement); Element parent = doc.createElementNS(CoordinationConstants.WSCOOR_NAMESPACE, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT); Node tmp = headerElement.getElementsByTagNameNS(CoordinationConstants.WSCOOR_NAMESPACE, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT).item(0); parent.appendChild(tmp.cloneNode(true)); headerElement.replaceChild(parent, tmp); } catch (Exception e) { e.printStackTrace(); throw new SystemException("Coordination context has not been added to the header."); } return headerElement; }
public void resume() throws UnknownTransactionException, SystemException { if (!_txcontext.equals(BusinessActivityManager.getBusinessActivityManager().currentTransaction())) { BusinessActivityManager.getBusinessActivityManager().resume(_txcontext); _uba = UserBusinessActivity.getUserBusinessActivity(); } }
_txcontext = BusinessActivityManager.getBusinessActivityManager().currentTransaction(); _active = true;
(com.arjuna.mwlabs.wst11.ba.context.TxContextImple)businessActivityManager.currentTransaction() ; baContext = (txContext == null ? null : txContext.context()) ;
(com.arjuna.mwlabs.wst11.ba.context.TxContextImple)businessActivityManager.currentTransaction() ; baContext = (txContext == null ? null : txContext.context()) ;