Examples of CreateSequenceResponse


Examples of org.apache.sandesha2.wsrm.CreateSequenceResponse

      createSeqResponse.setFlow(MessageContext.OUT_FLOW);
 
      // for making sure that this won't be processed again
      createSeqResponse.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE, "true");
     
      CreateSequenceResponse createSeqResPart = createSeqResponse.getCreateSequenceResponse();
 
      // OFFER PROCESSING
      SequenceOffer offer = createSeqPart.getSequenceOffer();
      if (offer != null) {
        Accept accept = createSeqResPart.getAccept();
        if (accept == null) {
          if (log.isDebugEnabled())
            log.debug(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noAcceptPart));
          FaultManager.makeCreateSequenceRefusedFault(createSeqRMMsg, SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noAcceptPart),
                                new Exception(),
                                null);
          // Return false if an Exception hasn't been thrown.
          if (log.isDebugEnabled())
            log.debug("Exit: CreateSeqMsgProcessor::processInMessage " + Boolean.FALSE);       
          return false;
        }
 
        // offered seq id
        String offeredSequenceID = offer.getIdentifer().getIdentifier();

        //Need to see if this is a duplicate offer.
        //If it is we can't accept the offer as we can't be sure it has come from the same client.
        RMSBean finderBean = new RMSBean ();
        finderBean.setSequenceID(offeredSequenceID);
        RMSBean rMSBean = storageManager.getRMSBeanMgr().findUnique(finderBean);
        boolean offerAccepted = false;
        String outgoingSideInternalSequenceId = SandeshaUtil
          .getOutgoingSideInternalSequenceID(rmdBean.getSequenceID());

        if(rMSBean != null){
          if (log.isDebugEnabled())
            log.debug("Duplicate offer so we can't accept as we can't be sure it's from the same client: " + offeredSequenceID);
          offerAccepted = false;
        } else {
          boolean isValidseqID = isValidseqID(offeredSequenceID, context, createSeqRMMsg, storageManager);
          offerAccepted = true;
       
          //Before processing this offer any further we need to perform some extra checks
          //on the offered EP if WS-RM Spec 1.1 is being used
          if(isValidseqID && Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(rmdBean.getRMVersion())){
            Endpoint endpoint = offer.getEndpoint();
            if (endpoint!=null) {
              //Check to see if the offer endpoint has a value of WSA Anonymous
              String addressingNamespace = (String) createSeqRMMsg.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
              String endpointAddress = endpoint.getEPR().getAddress();
              if(SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespace).equals(endpointAddress)){
                //We will still accept this offer but we should warn the user that this MEP is not always reliable or efficient
                if (log.isDebugEnabled())
                  log.debug("CSeq msg contains offer with an anonymous EPR")
                log.warn(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.sequenceMEPWarning, createSeqRMMsg.getMessageContext().getMessageID(),
                    offeredSequenceID));
              }
              rMSBean = new RMSBean();
              //Set the offered EP
              rMSBean.setOfferedEndPointEPR(endpoint.getEPR());
           
            } else {
              //Don't accept the offer
              if (log.isDebugEnabled())
                log.debug("Offer Refused as it included a null endpoint")
              offerAccepted = false;
            }
          } else if (isValidseqID && Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmdBean.getRMVersion())){
            rMSBean = new RMSBean();
          }
          if(isValidseqID){
            // Setting the CreateSequence table entry for the outgoing
            // side.
            rMSBean.setSequenceID(offeredSequenceID)
            rMSBean.setInternalSequenceID(outgoingSideInternalSequenceId);
            // this is a dummy value
            rMSBean.setCreateSeqMsgID(SandeshaUtil.getUUID());
         
            //Try inserting the new RMSBean
            if(!storageManager.getRMSBeanMgr().insert(rMSBean)){
              offerAccepted = false;
            }
          }
        }

        if (offerAccepted) {
          if(rmdBean.getToEndpointReference() != null){
            rMSBean.setToEndpointReference(rmdBean.getToEndpointReference());
          } else {
            //It's Sync2Way so set to address to anonymous when spec 1.0 is used
            String specVersion = rmdBean.getRMVersion();
            if (Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(specVersion)) {
              rMSBean.setToEndpointReference(new EndpointReference(AddressingConstants.Submission.WSA_ANONYMOUS_URL));
            }  
          }
         
          rMSBean.setAcksToEndpointReference(rmdBean.getReplyToEndpointReference())// The acks need to flow back into this endpoint
          rMSBean.setReplyToEndpointReference(rmdBean.getReplyToEndpointReference());
          rMSBean.setLastActivatedTime(System.currentTimeMillis());
          rMSBean.setRMVersion(rmdBean.getRMVersion());
          rMSBean.setClientCompletedMessages(new RangeString());
 
          // Setting sequence properties for the outgoing sequence.
          // Only will be used by the server side response path. Will
          // be wasted properties for the client side.
   
          rmdBean.setOutboundInternalSequence(outgoingSideInternalSequenceId);
          RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
          rmdBeanMgr.update(rmdBean);
 
          // Store the inbound token (if any) with the new sequence
          rMSBean.setSecurityTokenData(rmdBean.getSecurityTokenData());
         
          // If this new sequence has anonymous acksTo, then we must poll for the acks
          // If the inbound sequence is targetted at the WSRM anonymous URI, we need to start
          // polling for this sequence.
          EndpointReference reference = rMSBean.getAcksToEndpointReference();
          if ((reference == null || reference.hasAnonymousAddress()) &&
            Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(createSeqRMMsg.getRMSpecVersion())) {
            rMSBean.setPollingMode(true);
          }
         
          // Set the SOAP Version for this sequence.
          rMSBean.setSoapVersion(SandeshaUtil.getSOAPVersion(createSeqRMMsg.getSOAPEnvelope()));

          storageManager.getRMSBeanMgr().update(rMSBean);
         
          SandeshaUtil.startWorkersForSequence(context, rMSBean);
         
        } else {
          // removing the accept part.
          createSeqResPart.setAccept(null);
          createSeqResponse.addSOAPEnvelope();
        }
      }
             
      //TODO add createSequenceResponse message as the referenceMessage to the RMDBean.
View Full Code Here

Examples of org.apache.sandesha2.wsrm.CreateSequenceResponse

          createSequence.fromOMElement(body);
        } else if(Sandesha2Constants.SPEC_2005_02.QNames.CreateSequence.equals(firstBodyQName)) {
          createSequence = new CreateSequence(namespace);
          createSequence.fromOMElement(body);
        } else if(Sandesha2Constants.SPEC_2007_02.QNames.CreateSequenceResponse.equals(firstBodyQName)) {
          createSequenceResponse = new CreateSequenceResponse(namespace);
          createSequenceResponse.fromOMElement(body);
        } else if(Sandesha2Constants.SPEC_2005_02.QNames.CreateSequenceResponse.equals(firstBodyQName)) {
          createSequenceResponse = new CreateSequenceResponse(namespace);
          createSequenceResponse.fromOMElement(body);
        } else if(Sandesha2Constants.SPEC_2007_02.QNames.CloseSequence.equals(firstBodyQName)) {
          closeSequence = new CloseSequence(namespace);
          closeSequence.fromOMElement(body);
        } else if(Sandesha2Constants.SPEC_2005_02.QNames.CloseSequence.equals(firstBodyQName)) {
View Full Code Here

Examples of org.apache.sandesha2.wsrm.CreateSequenceResponse

          createSequence.fromOMElement(body);
        } else if(Sandesha2Constants.SPEC_2005_02.QNames.CreateSequence.equals(firstBodyQName)) {
          createSequence = new CreateSequence(namespace);
          createSequence.fromOMElement(body);
        } else if(Sandesha2Constants.SPEC_2007_02.QNames.CreateSequenceResponse.equals(firstBodyQName)) {
          createSequenceResponse = new CreateSequenceResponse(namespace);
          createSequenceResponse.fromOMElement(body);
        } else if(Sandesha2Constants.SPEC_2005_02.QNames.CreateSequenceResponse.equals(firstBodyQName)) {
          createSequenceResponse = new CreateSequenceResponse(namespace);
          createSequenceResponse.fromOMElement(body);
        } else if(Sandesha2Constants.SPEC_2007_02.QNames.CloseSequence.equals(firstBodyQName)) {
          closeSequence = new CloseSequence(namespace);
          closeSequence.fromOMElement(body);
        } else if(Sandesha2Constants.SPEC_2005_02.QNames.CloseSequence.equals(firstBodyQName)) {
View Full Code Here

Examples of org.apache.sandesha2.wsrm.CreateSequenceResponse

    IOMRMElement messagePart = createSeqMessage
        .getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
    CreateSequence cs = (CreateSequence) messagePart;

    CreateSequenceResponse response = new CreateSequenceResponse(factory);

    Identifier identifier = new Identifier(factory);
    identifier.setIndentifer(newSequenceID);

    response.setIdentifier(identifier);

    SequenceOffer offer = cs.getSequenceOffer();
    if (offer != null) {
      String outSequenceId = offer.getIdentifer().getIdentifier();

      if (outSequenceId != null && !"".equals(outSequenceId)) {

        Accept accept = new Accept(factory);
        EndpointReference acksToEPR = createSeqMessage.getTo();
        AcksTo acksTo = new AcksTo(factory);
        Address address = new Address(factory);
        address.setEpr(acksToEPR);
        acksTo.setAddress(address);
        accept.setAcksTo(acksTo);
        response.setAccept(accept);
      }

    }

    SOAPEnvelope envelope = factory.getDefaultEnvelope();
    response.toOMElement(envelope.getBody());
    outMessage
        .setWSAAction(Sandesha2Constants.WSRM.Actions.ACTION_CREATE_SEQUENCE_RESPONSE);
    outMessage
        .setSoapAction(Sandesha2Constants.WSRM.Actions.SOAP_ACTION_CREATE_SEQUENCE_RESPONSE);
View Full Code Here

Examples of org.apache.sandesha2.wsrm.CreateSequenceResponse

            "Internal error - Generated sequence id is null");

      RMMsgContext createSeqResponse = RMMsgCreator
          .createCreateSeqResponseMsg(createSeqRMMsg, outMessage,
              newSequenceId);
      CreateSequenceResponse createSeqResPart = (CreateSequenceResponse) createSeqResponse
          .getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE);

      //If an offer is accepted do necessary procesing.
      Accept accept = createSeqResPart.getAccept();
      if (accept != null) {
        SequenceOffer offer = createSeqPart.getSequenceOffer();
        if (offer == null)
          throw new SandeshaException(
              "Internal error - no offer for the response message with Accept");

        //Setting the CreateSequence table entry.
        String incomingSeqId = createSeqResPart.getIdentifier()
            .getIdentifier();
        String outSequenceId = offer.getIdentifer().getIdentifier();
        CreateSeqBean createSeqBean = new CreateSeqBean();
        createSeqBean.setSequenceId(outSequenceId);
        createSeqBean.setInternalSequenceId(newSequenceId);
View Full Code Here

Examples of org.apache.sandesha2.wsrm.CreateSequenceResponse

      AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor();
      ackProcessor.processMessage(createSeqResponseRMMsgCtx);
    }

    //Processing the create sequence response.
    CreateSequenceResponse createSeqResponsePart = (CreateSequenceResponse) createSeqResponseRMMsgCtx
        .getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE);
    if (createSeqResponsePart == null)
      throw new SandeshaException("Create Sequence Response part is null");

    String newOutSequenceId = createSeqResponsePart.getIdentifier()
        .getIdentifier();
    if (newOutSequenceId == null)
      throw new SandeshaException("New sequence Id is null");

    ConfigurationContext configCtx = createSeqResponseRMMsgCtx
        .getMessageContext().getConfigurationContext();
    String createSeqMsgId = createSeqResponseRMMsgCtx.getMessageContext()
        .getRelatesTo().getValue();

    StorageManager storageManager = SandeshaUtil
        .getSandeshaStorageManager(configCtx);

    SenderBeanMgr retransmitterMgr = storageManager
        .getRetransmitterBeanMgr();
    CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();

    CreateSeqBean createSeqBean = createSeqMgr.retrieve(createSeqMsgId);
    if (createSeqBean == null)
      throw new SandeshaException("Create Sequence entry is not found");

    String internalSequenceId = createSeqBean.getInternalSequenceId();
    if (internalSequenceId == null || "".equals(internalSequenceId))
      throw new SandeshaException("TempSequenceId has is not set");

    //deleting the create sequence entry.
    retransmitterMgr.delete(createSeqMsgId);

    //storing new out sequence id
    SequencePropertyBeanMgr sequencePropMgr = storageManager
        .getSequencePropretyBeanMgr();
    SequencePropertyBean outSequenceBean = new SequencePropertyBean(
        internalSequenceId, Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID,
        newOutSequenceId);
    SequencePropertyBean internalSequenceBean = new SequencePropertyBean(
        newOutSequenceId,
        Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID, internalSequenceId);
    sequencePropMgr.insert(outSequenceBean);
    sequencePropMgr.insert(internalSequenceBean);

    //processing for accept (offer has been sent)
    Accept accept = createSeqResponsePart.getAccept();
    if (accept != null) {
      //Find offered sequence from internal sequence id.
      SequencePropertyBean offeredSequenceBean = sequencePropMgr
          .retrieve(internalSequenceId,
              Sandesha2Constants.SequenceProperties.OFFERED_SEQUENCE);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.