use of com.arjuna.mw.wsc11.context.Context in project narayana by jbosstm.
the class UserBusinessActivityImple method begin.
public void begin(int timeout) throws WrongStateException, SystemException {
try {
if (_ctxManager.currentTransaction() != null)
throw new WrongStateException();
Context ctx = startTransaction(timeout, null);
_ctxManager.resume(new TxContextImple(ctx));
} catch (InvalidCreateParametersException ex) {
tidyup();
throw new SystemException(ex.toString());
} catch (UnknownTransactionException ex) {
tidyup();
throw new SystemException(ex.toString());
} catch (SystemException ex) {
tidyup();
throw ex;
}
}
use of com.arjuna.mw.wsc11.context.Context in project narayana by jbosstm.
the class JaxBaseHeaderContextProcessor method handleOutboundMessage.
/**
* Handle the request.
*
* @param soapMessage The current message context.
* @param mustUnderstand Value of MustUnderstand attribute.
* @return whether the message was handled
*/
public boolean handleOutboundMessage(final SOAPMessage soapMessage, boolean mustUnderstand) {
if (soapMessage == null) {
return true;
}
try {
/*
* There should either be an Atomic Transaction *or* a Business Activity
* associated with the thread.
*/
final TransactionManager transactionManager = TransactionManagerFactory.transactionManager();
final com.arjuna.mw.wst11.BusinessActivityManager businessActivityManager = BusinessActivityManagerFactory.businessActivityManager();
final Context atContext;
if (transactionManager != null) {
final TxContextImple txContext = (TxContextImple) transactionManager.currentTransaction();
atContext = (txContext == null ? null : txContext.context());
} else {
atContext = null;
}
final Context baContext;
if (businessActivityManager != null) {
final com.arjuna.mwlabs.wst11.ba.context.TxContextImple txContext = (com.arjuna.mwlabs.wst11.ba.context.TxContextImple) businessActivityManager.currentTransaction();
baContext = (txContext == null ? null : txContext.context());
} else {
baContext = null;
}
final CoordinationContextType coordinationContext;
if (baContext != null) {
coordinationContext = baContext.getCoordinationContext();
} else if (atContext != null) {
coordinationContext = atContext.getCoordinationContext();
} else {
coordinationContext = null;
}
if (coordinationContext != null) {
final SOAPEnvelope env = soapMessage.getSOAPPart().getEnvelope();
SOAPHeader header = env.getHeader();
if (header == null) {
header = env.addHeader();
}
final Name name = env.createName(CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT, CoordinationConstants.WSCOOR_PREFIX, CoordinationConstants.WSCOOR_NAMESPACE);
final SOAPHeaderElement headerElement = header.addHeaderElement(name);
headerElement.addNamespaceDeclaration(CoordinationConstants.WSCOOR_PREFIX, CoordinationConstants.WSCOOR_NAMESPACE);
headerElement.setMustUnderstand(mustUnderstand);
CoordinationContextHelper.serialise(coordinationContext, headerElement);
}
} catch (final Throwable th) {
wstxLogger.i18NLogger.warn_mw_wst11_client_JaxHC11P_1("com.arjuna.mw.wst11.client.JaxBaseHeaderContextProcessor.handleRequest()", th);
}
return true;
}
Aggregations