use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType in project narayana by jbosstm.
the class CoordinationContextHelper method deserialise.
/**
* Deserialise a coordination context from a DOM SOAP Header Element.
* @param headerElement The SOAP header element to deserialise.
* @return The coordination context.
* @throws JAXBException for errors during parsing.
*/
public static CoordinationContextType deserialise(final Element headerElement) throws JAXBException {
ClassLoader loader = getContextClassLoader();
try {
// use the XTS module loader so that JAXB can find its factory
setContextClassLoader(CoordinationContextHelper.class.getClassLoader());
JAXBContext jaxbContext = getJaxbContext();
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
// the header element is a valid CoordinationContextType node so we can unpack it directly
// using JAXB. n.b. we will see a mustUnderstand=1 in the otherAttributes which we probably don't
// want but it will do no harm.
CoordinationContextType coordinationContextType = unmarshaller.unmarshal(headerElement, CoordinationContextType.class).getValue();
return coordinationContextType;
} catch (Exception e) {
return null;
} finally {
// restore the original loader
setContextClassLoader(loader);
}
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType in project narayana by jbosstm.
the class JaxBaseHeaderContextProcessor method handleInboundMessage.
/**
* Handle the request.
* @param soapMessage The current message context.
* @param installSubordinateTx true if a subordinate transaction should be interposed and false
* if the handler should just resume the incoming transaction. currently only works for AT
* transactions but will eventually be extended to work for BA transactions too.
*/
protected boolean handleInboundMessage(final SOAPMessage soapMessage, boolean installSubordinateTx) {
if (soapMessage != null) {
try {
final SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
final SOAPHeader soapHeader = soapEnvelope.getHeader();
final SOAPHeaderElement soapHeaderElement = getHeaderElement(soapHeader, CoordinationConstants.WSCOOR_NAMESPACE, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT);
if (soapHeaderElement != null) {
final CoordinationContextType cc = CoordinationContextHelper.deserialise(soapHeaderElement);
final String coordinationType = cc.getCoordinationType();
if (AtomicTransactionConstants.WSAT_PROTOCOL.equals(coordinationType)) {
clearMustUnderstand(soapHeader, soapHeaderElement);
TxContext txContext = new TxContextImple(cc);
if (installSubordinateTx) {
txContext = SubordinateImporter.importContext(cc);
}
TransactionManagerFactory.transactionManager().resume(txContext);
} else if (BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME.equals(coordinationType)) {
// interposition is not yet implemented for business activities
clearMustUnderstand(soapHeader, soapHeaderElement);
TxContext txContext = new com.arjuna.mwlabs.wst11.ba.context.TxContextImple(cc);
if (installSubordinateTx) {
txContext = com.arjuna.mwlabs.wst11.ba.SubordinateImporter.importContext(cc);
}
BusinessActivityManagerFactory.businessActivityManager().resume(txContext);
} else {
wstxLogger.i18NLogger.warn_mw_wst11_service_JaxHC11P_2("com.arjuna.mw.wst11.service.JaxBaseHeaderContextProcessor.handleRequest(MessageContext context)", coordinationType);
}
}
} catch (final Throwable th) {
wstxLogger.i18NLogger.warn_mw_wst11_service_JaxHC11P_1("com.arjuna.mw.wst11.service.JaxBaseHeaderContextProcessor.handleRequest(MessageContext context)", th);
}
}
return true;
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType in project narayana by jbosstm.
the class TxContextImple method isSecure.
public boolean isSecure() {
if (valid()) {
CoordinationContextType coordinationContextType = _context.getCoordinationContext();
W3CEndpointReference epref = coordinationContextType.getRegistrationService();
NativeEndpointReference nativeRef = EndpointHelper.transform(NativeEndpointReference.class, epref);
String address = nativeRef.getAddress();
return address.startsWith("https");
}
return false;
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType in project narayana by jbosstm.
the class UserBusinessActivityStandaloneImple method getContext.
/**
* fetch the coordination context type stashed in the current BA context implememtation
* and use it to construct an instance of the coordination context extension type we need to
* send down the wire to the activation coordinator
* @param current the current AT context implememtation
* @return an instance of the coordination context extension type
*/
private CoordinationContext getContext(TxContextImple current) {
CoordinationContextType contextType = getContextType(current);
CoordinationContext context = new CoordinationContext();
context.setCoordinationType(contextType.getCoordinationType());
context.setExpires(contextType.getExpires());
context.setIdentifier(contextType.getIdentifier());
context.setRegistrationService(contextType.getRegistrationService());
return context;
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType in project narayana by jbosstm.
the class UserBusinessActivityStandaloneImple method getTerminationCoordinatorRPC.
private W3CEndpointReference getTerminationCoordinatorRPC(final TxContextImple ctx) throws SystemException {
final CoordinationContextType coordinationContext = ctx.context().getCoordinationContext();
final String messageId = MessageId.getMessageId();
try {
return RegistrationCoordinator.register(coordinationContext, messageId, null, ArjunaTXConstants.WSARJTX_PROTOCOL_TERMINATION_RPC);
} catch (final Throwable th) {
throw new SystemException(wstxLogger.i18NLogger.get_mwlabs_wst11_ba_remote_UserBusinessActivityImple_3());
}
}
Aggregations