Пример #1
0
 public void addMessageContext(MessageContext msgContext, OperationContext opContext)
     throws AxisFault {
   if (!opContext.isComplete()) {
     opContext.getMessageContexts().put(MESSAGE_LABEL_IN_VALUE, msgContext);
     opContext.setComplete(true);
   } else {
     throw new AxisFault(Messages.getMessage("mepcompleted"));
   }
 }
Пример #2
0
  /**
   * This will implement the mediate method of the Mediator interface and will provide the
   * functionality of cloning message into the specified targets and mediation
   *
   * @param synCtx - MessageContext which is subjected to the cloning
   * @return boolean true if this needs to be further mediated (continueParent=true)
   */
  public boolean mediate(MessageContext synCtx) {

    if (synCtx.getEnvironment().isDebugEnabled()) {
      if (super.divertMediationRoute(synCtx)) {
        return true;
      }
    }

    SynapseLog synLog = getLog(synCtx);

    if (synLog.isTraceOrDebugEnabled()) {
      synLog.traceOrDebug("Start : Clone mediator");

      if (synLog.isTraceTraceEnabled()) {
        synLog.traceTrace("Message : " + synCtx.getEnvelope());
      }
    }

    // get the targets list, clone the message for the number of targets and then
    // mediate the cloned messages using the targets
    Iterator<Target> iter = targets.iterator();
    int i = 0;
    while (iter.hasNext()) {
      if (synLog.isTraceOrDebugEnabled()) {
        synLog.traceOrDebug(
            "Submitting "
                + (i + 1)
                + " of "
                + targets.size()
                + " messages for "
                + (isSequential() ? "sequential processing" : "parallel processing"));
      }

      MessageContext clonedMsgCtx = getClonedMessageContext(synCtx, i++, targets.size());
      ContinuationStackManager.addReliantContinuationState(
          clonedMsgCtx, i - 1, getMediatorPosition());
      iter.next().mediate(clonedMsgCtx);
    }

    // if the continuation of the parent message is stopped from here set the RESPONSE_WRITTEN
    // property to SKIP to skip the blank http response
    OperationContext opCtx =
        ((Axis2MessageContext) synCtx).getAxis2MessageContext().getOperationContext();
    if (!continueParent && opCtx != null) {
      opCtx.setProperty(Constants.RESPONSE_WRITTEN, "SKIP");
    }

    // finalize tracing and debugging
    synLog.traceOrDebug("End : Clone mediator");

    // if continue parent is true mediators after the clone will be called for the further
    // mediation of the message which is subjected for clonning (parent message)
    return continueParent;
  }
Пример #3
0
 public void addFaultMessageContext(MessageContext msgContext, OperationContext opContext)
     throws AxisFault {
   HashMap<String, MessageContext> mep = opContext.getMessageContexts();
   MessageContext faultMessageCtxt = (MessageContext) mep.get(MESSAGE_LABEL_FAULT_VALUE);
   if (faultMessageCtxt != null) {
     throw new AxisFault(Messages.getMessage("mepcompleted"));
   } else {
     mep.put(MESSAGE_LABEL_FAULT_VALUE, msgContext);
     opContext.setComplete(true);
     opContext.cleanup();
   }
 }