コード例 #1
0
  /**
   * 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;
  }
コード例 #2
0
  /** Suspend the current transaction. */
  protected void suspendTransaction() {
    try {
      /*
       * There should either be an Atomic Transaction *or* a Business Activity
       * associated with the thread.
       */
      final TransactionManager transactionManager = TransactionManagerFactory.transactionManager();
      final BusinessActivityManager businessActivityManager =
          BusinessActivityManagerFactory.businessActivityManager();

      if (transactionManager != null) {
        transactionManager.suspend();
      }

      if (businessActivityManager != null) {
        businessActivityManager.suspend();
      }
    } catch (final Throwable th) {
      wstxLogger.i18NLogger.warn_mw_wst11_service_JaxHC11P_1(
          "com.arjuna.mw.wst11.service.JaxBaseHeaderContextProcessor.suspendTransaction()", th);
    }
  }