Package org.apache.sandesha2.wsrm_2006_02

Examples of org.apache.sandesha2.wsrm_2006_02.Scenario_2_2$TestCallback


    // default addressing version
    String addressingNamespace = (String) msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
    if (addressingNamespace == null && !msgCtx.isServerSide())
      addressingNamespace = AddressingConstants.Final.WSA_NAMESPACE;

    RMElements elements = new RMElements(addressingNamespace);
   
    if (msgCtx.getEnvelope()!=null)
      elements.fromSOAPEnvelope(msgCtx.getEnvelope(), msgCtx.getWSAAction());

    String rmNamespace = null;

    if (elements.getCreateSequence() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ, elements.getCreateSequence());
      rmNamespace = elements.getCreateSequence().getNamespaceValue();
    }

    if (elements.getCreateSequenceResponse() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE, elements
          .getCreateSequenceResponse());
      rmNamespace = elements.getCreateSequenceResponse().getNamespaceValue();
    }

    if (elements.getSequence() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.SEQUENCE, elements.getSequence());
      rmNamespace = elements.getSequence().getNamespaceValue();
    }

    //In case of ack messages RM Namespace is decided based on the sequenceId of the last
    //sequence Ack. In other words Sandesha2 does not expect to receive two SequenceAcknowledgements
    //of different RM specifications in the same incoming message
    for (Iterator iter = elements.getSequenceAcknowledgements();iter.hasNext();) {
      SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) iter.next();
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT, sequenceAck);
      rmNamespace = sequenceAck.getNamespaceValue();
    }

    if (elements.getTerminateSequence() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ, elements.getTerminateSequence());
      rmNamespace = elements.getTerminateSequence().getNamespaceValue();
    }

    if (elements.getTerminateSequenceResponse() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE, elements
          .getTerminateSequenceResponse());
      rmNamespace = elements.getTerminateSequenceResponse().getNamespaceValue();
    }

    //In case of ack request messages RM Namespace is decided based on the sequenceId of the last
    //ack request.
    for (Iterator iter = elements.getAckRequests();iter.hasNext();) {
      AckRequested ackRequest = (AckRequested) iter.next();
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.ACK_REQUEST, ackRequest);
      rmNamespace = ackRequest.getNamespaceValue();
    }

    if (elements.getCloseSequence() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE, elements.getCloseSequence());
      rmNamespace = elements.getCloseSequence().getNamespaceValue();
    }

    if (elements.getCloseSequenceResponse() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE_RESPONSE, elements
          .getCloseSequenceResponse());
      rmNamespace = elements.getCloseSequenceResponse().getNamespaceValue();
    }
   
    if (elements.getUsesSequenceSTR() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.USES_SEQUENCE_STR, elements
          .getUsesSequenceSTR());
    }
   
    if (elements.getMakeConnection() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.MAKE_CONNECTION,
          elements.getMakeConnection());
      String makeConnectionNamespace = elements.getMakeConnection().getNamespaceValue();
      if (Sandesha2Constants.SPEC_2007_02.MC_NS_URI.equals(makeConnectionNamespace))
        rmNamespace = Sandesha2Constants.SPEC_2007_02.NS_URI;
    }
   
    if (elements.getMessagePending() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.MESSAGE_PENDING,
          elements.getMessagePending());
      String makeConnectionNamespace = elements.getMessagePending().getNamespaceValue();
      if (Sandesha2Constants.SPEC_2007_02.MC_NS_URI.equals(makeConnectionNamespace))
        rmNamespace = Sandesha2Constants.SPEC_2007_02.NS_URI;
    }
   
    if (elements.getSequenceFault() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.SEQUENCE_FAULT,
          elements.getSequenceFault());
    }

    if (rmNamespace!=null)
      rmMsgContext.setRMNamespaceValue(rmNamespace);
View Full Code Here


   
    // Generate the Sequence field.
    // -------------------------------
    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(Sandesha2Constants.SPEC_VERSIONS.v1_1);

    Sequence sequence = new Sequence(rmNamespaceValue);
    MessageNumber msgNumber = new MessageNumber(rmNamespaceValue);
    msgNumber.setMessageNumber(1);
    sequence.setMessageNumber(msgNumber);
    Identifier id1 = new Identifier(rmNamespaceValue);
    id1.setIndentifer(uuid);
    sequence.setIdentifier(id1);
    applicationRMMsg.setMessagePart(Sandesha2Constants.MessageParts.SEQUENCE, sequence);
    applicationRMMsg.addSOAPEnvelope();

    // --------------------------------------------
    // Finished generating Sequence part
View Full Code Here

  public static void processLastMessage(RMMsgContext rmMsgCtx) throws AxisFault {
   
    if (!Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmMsgCtx.getRMSpecVersion()))
      return;
   
    Sequence sequence = (Sequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
    String sequenceId = sequence.getIdentifier().getIdentifier();
   
    ConfigurationContext configurationContext = rmMsgCtx.getConfigurationContext();
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(
              configurationContext, configurationContext.getAxisConfiguration());
   
View Full Code Here

        Sandesha2Constants.MessageParts.TERMINATE_SEQ);
    TerminateSequenceResponse terminateSequenceResponse = (TerminateSequenceResponse) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE);
    Iterator sequenceAcknowledgementsIter = rmMsgCtx.getMessageParts(
        Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
    Sequence sequence = (Sequence) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.SEQUENCE);
    Iterator ackRequestedIter = rmMsgCtx.getMessageParts(
        Sandesha2Constants.MessageParts.ACK_REQUEST);
    CloseSequence closeSequence = (CloseSequence) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.CLOSE_SEQUENCE);
    CloseSequenceResponse closeSequenceResponse = (CloseSequenceResponse) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.CLOSE_SEQUENCE_RESPONSE);
    MakeConnection makeConnection = (MakeConnection) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.MAKE_CONNECTION);

    // Setting message type.
    if (createSequence != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ);
    } else if (createSequenceResponse != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ_RESPONSE);
      sequenceID = createSequenceResponse.getIdentifier().getIdentifier();
    } else if (terminateSequence != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);
      sequenceID = terminateSequence.getIdentifier().getIdentifier();
    } else if (terminateSequenceResponse != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ_RESPONSE);
      sequenceID = terminateSequenceResponse.getIdentifier().getIdentifier();
    } else if (rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE) != null) {
     
      Sequence seq = (Sequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
      LastMessage lastMessage = seq.getLastMessage();
      SOAPEnvelope envelope = rmMsgCtx.getSOAPEnvelope();
     
      if (lastMessage!=null && envelope.getBody().getFirstOMChild()==null) {
        //the message is an empty body last message
        rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.LAST_MESSAGE);
View Full Code Here

   
    // Generate the SequenceAck field.
    // -------------------------------
    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(Sandesha2Constants.SPEC_VERSIONS.v1_1);

    SequenceAcknowledgement sequenceAck = new SequenceAcknowledgement(rmNamespaceValue);
    // Set the sequenceId
    Identifier id = new Identifier(rmNamespaceValue);
    id.setIndentifer(sequenceId);
    sequenceAck.setIdentifier(id);
   
    // Set the Invalid range!
    AcknowledgementRange ackRange = new AcknowledgementRange(rmNamespaceValue);
    ackRange.setLowerValue(1);
    ackRange.setUpperValue(3);
    sequenceAck.addAcknowledgementRanges(ackRange);

    // Set the SequenceAcknowledgement part in the message
    applicationRMMsg.setMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT, sequenceAck);
    applicationRMMsg.addSOAPEnvelope();
View Full Code Here

    RMMsgContext closeSeqResponseRMMsg = RMMsgCreator.createCloseSeqResponseMsg(rmMsgCtx, rmdBean);
    MessageContext closeSequenceResponseMsg = closeSeqResponseRMMsg.getMessageContext();

    while (sequenceAckIter.hasNext()) {
      SequenceAcknowledgement sequenceAcknowledgement = (SequenceAcknowledgement) sequenceAckIter.next();
      closeSeqResponseRMMsg.setMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT,
          sequenceAcknowledgement);
    }
   
    closeSeqResponseRMMsg.setFlow(MessageContext.OUT_FLOW);
View Full Code Here

    //In case of ack messages RM Namespace is decided based on the sequenceId of the last
    //sequence Ack. In other words Sandesha2 does not expect to receive two SequenceAcknowledgements
    //of different RM specifications in the same incoming message
    for (Iterator iter = elements.getSequenceAcknowledgements();iter.hasNext();) {
      SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) iter.next();
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT, sequenceAck);
      rmNamespace = sequenceAck.getNamespaceValue();
    }

    if (elements.getTerminateSequence() != null) {
      rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ, elements.getTerminateSequence());
      rmNamespace = elements.getTerminateSequence().getNamespaceValue();
View Full Code Here

        rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
     
      sequenceID = sequence.getIdentifier().getIdentifier();
    } else if (sequenceAcknowledgementsIter.hasNext()) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.ACK);
      SequenceAcknowledgement sequenceAcknowledgement = (SequenceAcknowledgement) sequenceAcknowledgementsIter.next();
     
      //if there is only on sequenceAck, sequenceId will be set. Otherwise it will not be.
      if (!sequenceAcknowledgementsIter.hasNext())
        sequenceID = sequenceAcknowledgement.getIdentifier().getIdentifier();
    } else if (ackRequestedIter.hasNext()) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.ACK_REQUEST);
      AckRequested ackRequest = (AckRequested) ackRequestedIter.next();

      //if there is only on sequenceAck, sequenceId will be set. Otherwise it will not be.
View Full Code Here

    CreateSequence createSequence = (CreateSequence) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.CREATE_SEQ);
    CreateSequenceResponse createSequenceResponse = (CreateSequenceResponse) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE);
    TerminateSequence terminateSequence = (TerminateSequence) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.TERMINATE_SEQ);
    TerminateSequenceResponse terminateSequenceResponse = (TerminateSequenceResponse) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE);
    Iterator sequenceAcknowledgementsIter = rmMsgCtx.getMessageParts(
        Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
    Sequence sequence = (Sequence) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.SEQUENCE);
    Iterator ackRequestedIter = rmMsgCtx.getMessageParts(
        Sandesha2Constants.MessageParts.ACK_REQUEST);
    CloseSequence closeSequence = (CloseSequence) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.CLOSE_SEQUENCE);
    CloseSequenceResponse closeSequenceResponse = (CloseSequenceResponse) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.CLOSE_SEQUENCE_RESPONSE);
    MakeConnection makeConnection = (MakeConnection) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.MAKE_CONNECTION);

    // Setting message type.
    if (createSequence != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ);
    } else if (createSequenceResponse != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ_RESPONSE);
      sequenceID = createSequenceResponse.getIdentifier().getIdentifier();
    } else if (terminateSequence != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);
      sequenceID = terminateSequence.getIdentifier().getIdentifier();
    } else if (terminateSequenceResponse != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ_RESPONSE);
      sequenceID = terminateSequenceResponse.getIdentifier().getIdentifier();
    } else if (rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE) != null) {
     
View Full Code Here

        Sandesha2Constants.MessageParts.CREATE_SEQ);
    CreateSequenceResponse createSequenceResponse = (CreateSequenceResponse) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE);
    TerminateSequence terminateSequence = (TerminateSequence) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.TERMINATE_SEQ);
    TerminateSequenceResponse terminateSequenceResponse = (TerminateSequenceResponse) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE);
    Iterator sequenceAcknowledgementsIter = rmMsgCtx.getMessageParts(
        Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
    Sequence sequence = (Sequence) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.SEQUENCE);
    Iterator ackRequestedIter = rmMsgCtx.getMessageParts(
        Sandesha2Constants.MessageParts.ACK_REQUEST);
    CloseSequence closeSequence = (CloseSequence) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.CLOSE_SEQUENCE);
    CloseSequenceResponse closeSequenceResponse = (CloseSequenceResponse) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.CLOSE_SEQUENCE_RESPONSE);
    MakeConnection makeConnection = (MakeConnection) rmMsgCtx.getMessagePart(
        Sandesha2Constants.MessageParts.MAKE_CONNECTION);

    // Setting message type.
    if (createSequence != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ);
    } else if (createSequenceResponse != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ_RESPONSE);
      sequenceID = createSequenceResponse.getIdentifier().getIdentifier();
    } else if (terminateSequence != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);
      sequenceID = terminateSequence.getIdentifier().getIdentifier();
    } else if (terminateSequenceResponse != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ_RESPONSE);
      sequenceID = terminateSequenceResponse.getIdentifier().getIdentifier();
    } else if (rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE) != null) {
     
      Sequence seq = (Sequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
      LastMessage lastMessage = seq.getLastMessage();
      SOAPEnvelope envelope = rmMsgCtx.getSOAPEnvelope();
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.wsrm_2006_02.Scenario_2_2$TestCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.