Examples of RMSBean


Examples of org.apache.sandesha2.storage.beans.RMSBean

      log.debug("Enter: TerminateSeqMsgProcessor::processOutMessage");

    // Get the parent processor to setup the out message
    setupOutMessage(rmMsgCtx);
   
    RMSBean rmsBean = SandeshaUtil.getRMSBeanFromInternalSequenceId(getStorageManager(), getInternalSequenceID());
   
    // Check if the sequence is already terminated (stored on the internal sequenceid)
    if (rmsBean.isTerminateAdded()) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.terminateAddedPreviously);
      log.debug(message);
      if (log.isDebugEnabled())
        log.debug("Exit: TerminateSeqMsgProcessor::processOutMessage, sequence previously terminated");
      return true;
    }

    AxisOperation terminateOp = SpecSpecificConstants.getWSRMOperation(
        Sandesha2Constants.MessageTypes.TERMINATE_SEQ,
        rmMsgCtx.getRMSpecVersion(),
        getMsgContext().getAxisService());
 
    OperationContext opcontext = ContextFactory.createOperationContext(terminateOp, getMsgContext().getServiceContext());
    opcontext.setParent(getMsgContext().getServiceContext());

    getConfigurationContext().registerOperationContext(rmMsgCtx.getMessageId(),  opcontext);

    getMsgContext().setOperationContext(opcontext);
    getMsgContext().setAxisOperation(terminateOp);

    TerminateSequence terminateSequencePart = (TerminateSequence) rmMsgCtx
        .getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
    terminateSequencePart.getIdentifier().setIndentifer(getOutSequenceID());

    rmMsgCtx.setWSAAction(SpecSpecificConstants.getTerminateSequenceAction(getRMVersion()));
    rmMsgCtx.setSOAPAction(SpecSpecificConstants.getTerminateSequenceSOAPAction(getRMVersion()));
   
    rmsBean.setTerminateAdded(true);

    // Update the RMSBean with the terminate added flag
    getStorageManager().getRMSBeanMgr().update(rmsBean);

    // Send the outgoing message
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMSBean

    }

    SenderBeanMgr retransmitterMgr = storageManager.getSenderBeanMgr();
    RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();

    RMSBean rmsBean = rmsBeanMgr.retrieve(createSeqMsgId);
    if (rmsBean == null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.createSeqEntryNotFound);
      log.debug(message);
      throw new SandeshaException(message);
    }

    // Check that the create sequence response message proves possession of the correct token
    String tokenData = rmsBean.getSecurityTokenData();
    if(tokenData != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(configCtx);
      MessageContext crtSeqResponseCtx = createSeqResponseRMMsgCtx.getMessageContext();
      OMElement body = crtSeqResponseCtx.getEnvelope().getBody();
      SecurityToken token = secManager.recoverSecurityToken(tokenData);
      secManager.checkProofOfPossession(token, body, crtSeqResponseCtx);
    }

    String internalSequenceId = rmsBean.getInternalSequenceID();
    if (internalSequenceId == null || "".equals(internalSequenceId)) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.tempSeqIdNotSet);
      log.debug(message);
      throw new SandeshaException(message);
    }
    createSeqResponseRMMsgCtx.setProperty(Sandesha2Constants.MessageContextProperties.INTERNAL_SEQUENCE_ID,internalSequenceId);
   
    rmsBean.setSequenceID(newOutSequenceId);

    // We should poll for any reply-to that uses the anonymous URI, when MakeConnection
    // is enabled.
    if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(createSeqResponseRMMsgCtx.getRMSpecVersion())) {
      SandeshaPolicyBean policy = SandeshaUtil.getPropertyBean(configCtx.getAxisConfiguration());
      if(policy.isEnableMakeConnection()) {
        String acksTo = rmsBean.getAcksToEPR();
        EndpointReference reference = new EndpointReference(acksTo);
        if(acksTo == null || reference.hasAnonymousAddress()) {
          rmsBean.setPollingMode(true);
        }
      }
    }

    SenderBean createSequenceSenderBean = retransmitterMgr.retrieve(createSeqMsgId);
    if (createSequenceSenderBean == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.createSeqEntryNotFound));

    // deleting the create sequence entry.
    retransmitterMgr.delete(createSeqMsgId);
   
    // Remove the create sequence message
    storageManager.removeMessageContext(rmsBean.getCreateSequenceMsgStoreKey());
       
    // processing for accept (offer has been sent)
    Accept accept = createSeqResponsePart.getAccept();
    if (accept != null) {

      // TODO this should be detected in the Fault manager.
      if (rmsBean.getOfferedSequence() == null) {
        String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.accptButNoSequenceOffered);
        log.debug(message);
        throw new SandeshaException(message);
      }

      RMDBean rMDBean = new RMDBean();
     
      EndpointReference acksToEPR = accept.getAcksTo().getEPR();
      rMDBean.setAcksToEPR(acksToEPR.getAddress());
      rMDBean.setSequenceID(rmsBean.getOfferedSequence());
      rMDBean.setNextMsgNoToProcess(1);
      rMDBean.setOutboundInternalSequence(rmsBean.getInternalSequenceID());

      rMDBean.setServiceName(createSeqResponseRMMsgCtx.getMessageContext().getAxisService().getName());
     
      //Storing the referenceMessage of the sending side sequence as the reference message
      //of the receiving side as well.
      //This can be used when creating new outgoing messages.
     
      String referenceMsgStoreKey = rmsBean.getReferenceMessageStoreKey();
      MessageContext referenceMsg = storageManager.retrieveMessageContext(referenceMsgStoreKey, configCtx);
     
      String newMessageStoreKey = SandeshaUtil.getUUID();
      storageManager.storeMessageContext(newMessageStoreKey,referenceMsg);
     
      rMDBean.setReferenceMessageKey(newMessageStoreKey);

      // If this is an offered sequence that needs polling then we need to setup the
      // rmdBean for polling too, so that it still gets serviced after the outbound
      // sequence terminates.
      if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(createSeqResponseRMMsgCtx.getRMSpecVersion())) {
        if(rmsBean.isPollingMode()) {
          rMDBean.setPollingMode(true);
        }
      }
     
      String rmSpecVersion = createSeqResponseRMMsgCtx.getRMSpecVersion();
      rMDBean.setRMVersion(rmSpecVersion);
     
      EndpointReference toEPR = createSeqResponseRMMsgCtx.getTo();
      if (toEPR==null) {
        //Most probably this is a sync response message, using the replyTo of the request message
        OperationContext operationContext = createSeqResponseRMMsgCtx.getMessageContext().getOperationContext();
        if (operationContext!=null) {
          MessageContext createSequnceMessage = operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
          if (createSequnceMessage!=null)
            toEPR = createSequnceMessage.getReplyTo();
        }
      }
     
      if (toEPR!=null)
        rMDBean.setToAddress(toEPR.getAddress());
     
      rMDBean.setServerCompletedMessages(new RangeString());
      RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();

      // Store the security token for the offered sequence
      rMDBean.setSecurityTokenData(rmsBean.getSecurityTokenData());
     
      rMDBean.setLastActivatedTime(System.currentTimeMillis());
     
      rmdBeanMgr.insert(rMDBean);
      SandeshaUtil.startWorkersForSequence(configCtx, rMDBean);
    }
   
    rmsBean.setLastActivatedTime(System.currentTimeMillis());
    rmsBeanMgr.update(rmsBean);
    SandeshaUtil.startWorkersForSequence(configCtx, rmsBean);

    // Locate and update all of the messages for this sequence, now that we know
    // the sequence id.
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMSBean

      //on the sending transport's backchannel. Since the msg was stored without a sequence header
      //we need to lookup the namespace using the RMS bean
      if(log.isDebugEnabled()) log.debug("Looking up rmNamespace from RMS bean");
      String sequenceID = matchingMessage.getSequenceID();
      if(sequenceID!=null){
        RMSBean rmsBean = new RMSBean();
        rmsBean.setSequenceID(sequenceID);
        rmsBean = storageManager.getRMSBeanMgr().findUnique(rmsBean);
        if(rmsBean!=null){
          returnRMMsg.setRMNamespaceValue(SpecSpecificConstants.getRMNamespaceValue(rmsBean.getRMVersion()));
        }
      }
    }
    setTransportProperties (returnMessage, pollMessage);
   
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMSBean

  public static RMSBean setupNewClientSequence(MessageContext firstAplicationMsgCtx,
      String internalSequenceId, StorageManager storageManager) throws SandeshaException {
    if (log.isDebugEnabled())
      log.debug("Enter: SequenceManager::setupNewClientSequence");
   
    RMSBean rmsBean = new RMSBean();
    rmsBean.setInternalSequenceID(internalSequenceId);

    // If we are server-side, we use the details from the inbound sequence to help set
    // up the reply sequence.
    String inboundSequence = null;
    RMDBean inboundBean = null;
    if(firstAplicationMsgCtx.isServerSide()) {
      inboundSequence = (String) firstAplicationMsgCtx.getProperty(Sandesha2Constants.MessageContextProperties.INBOUND_SEQUENCE_ID);
      if(inboundSequence != null) {
        inboundBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, inboundSequence);
      }
    }
   
    // Finding the spec version
    String specVersion = getSpecVersion(firstAplicationMsgCtx, storageManager);
    rmsBean.setRMVersion(specVersion);

    // Set up the To EPR
    EndpointReference toEPR = firstAplicationMsgCtx.getTo();

    if (toEPR == null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.toEPRNotValid, null);
      log.debug(message);
      throw new SandeshaException(message);
    }

    rmsBean.setToEPR(toEPR.getAddress());

    // Discover the correct acksTo and replyTo EPR for this RMSBean
    EndpointReference acksToEPR = null;
    EndpointReference replyToEPR = null;

    if (firstAplicationMsgCtx.isServerSide()) {
      // Server side, we want the replyTo and AcksTo EPRs to point into this server.
      // We can work that out by looking at the RMD bean that pulled the message in,
      // and copying its 'ReplyTo' address.
      if(inboundBean != null && inboundBean.getReplyToEPR() != null) {
        acksToEPR = new EndpointReference(inboundBean.getReplyToEPR());
        replyToEPR = new EndpointReference(inboundBean.getReplyToEPR());
      } else {
        String beanInfo = (inboundBean == null) ? "null" : inboundBean.toString();
        String message = SandeshaMessageHelper.getMessage(
            SandeshaMessageKeys.cannotChooseAcksTo, inboundSequence, beanInfo);
        SandeshaException e = new SandeshaException(message);
        if(log.isDebugEnabled()) log.debug("Throwing", e);
        throw e;
      }

    } else {
      replyToEPR = firstAplicationMsgCtx.getReplyTo();

      // For client-side sequences there are 3 options:
      // 1) An explict AcksTo, set via the client API
      // 2) The replyTo from the app message
      // 3) The anonymous URI (for which we can leave a null EPR)
      String acksTo = (String) firstAplicationMsgCtx.getProperty(SandeshaClientConstants.AcksTo);
      if (acksTo != null) {
        if (log.isDebugEnabled())
          log.debug("Using explicit AcksTo, addr=" + acksTo);
        acksToEPR = new EndpointReference(acksTo);
      } else if(replyToEPR != null) {
        if (log.isDebugEnabled())
          log.debug("Using replyTo EPR as AcksTo, addr=" + replyToEPR.getAddress());
        acksToEPR = replyToEPR;
      }
    }
    // In case either of the replyTo or AcksTo is anonymous, rewrite them using the AnonURI template
    //(this should be done only for RM 1.1)
    ConfigurationContext config = firstAplicationMsgCtx.getConfigurationContext();
   
    if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(specVersion)) {
      replyToEPR = SandeshaUtil.rewriteEPR(rmsBean, replyToEPR, config);
      acksToEPR = SandeshaUtil.rewriteEPR(rmsBean, acksToEPR, config);
    }
   
    // Store both the acksTo and replyTo
    if(replyToEPR != null) rmsBean.setReplyToEPR(replyToEPR.getAddress());
    if(acksToEPR  != null) rmsBean.setAcksToEPR(acksToEPR.getAddress());
   
    // New up the client completed message ranges list
    rmsBean.setClientCompletedMessages(new RangeString());

    // saving transportTo value;
    String transportTo = (String) firstAplicationMsgCtx.getProperty(Constants.Configuration.TRANSPORT_URL);
    if (transportTo != null) {
      rmsBean.setTransportTo(transportTo);
    }

    // Set the soap version use by this client
    rmsBean.setSoapVersion(SandeshaUtil.getSOAPVersion(firstAplicationMsgCtx.getEnvelope()));

    //setting the autoTermination property for the client side.
    if (!firstAplicationMsgCtx.isServerSide()) {
      Object avoidAutoTermination = firstAplicationMsgCtx.getProperty(SandeshaClientConstants.AVOID_AUTO_TERMINATION);
      if (avoidAutoTermination!=null && JavaUtils.isTrueExplicitly(avoidAutoTermination))
        rmsBean.setAvoidAutoTermination(true);
    }
    // updating the last activated time.
    rmsBean.setLastActivatedTime(System.currentTimeMillis());
   
    if (log.isDebugEnabled())
      log.debug("Exit: SequenceManager::setupNewClientSequence " + rmsBean);
    return rmsBean;
  }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMSBean

        .getAxisConfiguration());

    SenderBeanMgr retransmitterMgr = storageManager.getSenderBeanMgr();

    String outSequenceId = sequenceAck.getIdentifier().getIdentifier();
    RMSBean rmsBean = SandeshaUtil.getRMSBeanFromSequenceId(storageManager, outSequenceId);

    if (outSequenceId == null || "".equals(outSequenceId)) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.outSeqIDIsNull);
      log.debug(message);
      throw new SandeshaException(message);
    }
    if (FaultManager.checkForUnknownSequence(rmMsgCtx, outSequenceId, storageManager, piggybackedAck)) {
      if (log.isDebugEnabled())
        log.debug("Exit: AcknowledgementProcessor::processAckHeader, Unknown sequence");
      return;
    }
    if (FaultManager.checkForSequenceTerminated(rmMsgCtx, outSequenceId, rmsBean, piggybackedAck)) {
      if (log.isDebugEnabled())
        log.debug("Exit: AcknowledgementProcessor::processAckHeader, Sequence terminated");
      return;
    }

    // Check that the sender of this Ack holds the correct token
    String internalSequenceId = rmsBean.getInternalSequenceID();
    if(rmsBean.getSecurityTokenData() != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(configCtx);
      SecurityToken token = secManager.recoverSecurityToken(rmsBean.getSecurityTokenData());
     
      secManager.checkProofOfPossession(token, soapHeader, msgCtx);
    }
   
    if(log.isDebugEnabled()) log.debug("Got Ack for RM Sequence: " + outSequenceId + ", internalSeqId: " + internalSequenceId);
    Iterator ackRangeIterator = sequenceAck.getAcknowledgementRanges().iterator();

    if (FaultManager.checkForUnknownSequence(rmMsgCtx, outSequenceId, storageManager, piggybackedAck)) {
      if (log.isDebugEnabled())
        log.debug("Exit: AcknowledgementProcessor::processAckHeader, Unknown sequence ");
      return;
    }
   
    if (FaultManager.checkForInvalidAcknowledgement(rmMsgCtx, sequenceAck, storageManager, rmsBean, piggybackedAck)) {
      if (log.isDebugEnabled())
        log.debug("Exit: AcknowledgementProcessor::processAckHeader, Invalid Ack range ");
      return;
    }
   
    String replyToAddress = rmsBean.getReplyToEPR();
    EndpointReference replyTo = new EndpointReference (replyToAddress);
    boolean anonReplyTo = replyTo.hasAnonymousAddress();
   
    String rmVersion = rmMsgCtx.getRMSpecVersion();
   
    // Compare the clientCompletedMessages with the range we just got, to work out if there
    // is any new information in this ack message
    RangeString completedMessages = rmsBean.getClientCompletedMessages();
    long numberOfNewMessagesAcked = 0;

    while(ackRangeIterator.hasNext()) {
      AcknowledgementRange ackRange = (AcknowledgementRange) ackRangeIterator.next();
      long lower = ackRange.getLowerValue();
      long upper = ackRange.getUpperValue();
      Range ackedRange = new Range(lower, upper);
      // Quick check to see if the whole range is already covered
      if(!completedMessages.isRangeCompleted(ackedRange)) {
        //we now know that this range is complete so we update it. This should aggregate the
        //ranges together and tell us which numbers are newly acked
        Range[] newRanges = completedMessages.addRange(ackedRange).getRanges();
       
        // We now take each newly acked message in turn and see if we need to update a sender bean
        for (int rangeIndex=0; rangeIndex < newRanges.length; rangeIndex++) {
          //now work on each newly acked message in this range
          for(long messageNo = newRanges[rangeIndex].lowerValue; messageNo<=newRanges[rangeIndex].upperValue; messageNo++){
           
            numberOfNewMessagesAcked++;
            SenderBean matcher = new SenderBean();
            matcher.setSequenceID(outSequenceId);
           
            matcher.setMessageNumber(messageNo);
           
            SenderBean retransmitterBean = retransmitterMgr.findUnique(matcher);
            if (retransmitterBean != null) {
              // Check we haven't got an Ack for a message that hasn't been sent yet !
              if (retransmitterBean.getSentCount() == 0) {
                FaultManager.makeInvalidAcknowledgementFault(rmMsgCtx, sequenceAck, ackRange,
                    storageManager, piggybackedAck);
                if (log.isDebugEnabled())
                  log.debug("Exit: AcknowledgementProcessor::processAckHeader, Invalid Ack");
                return;
              }
             
              String storageKey = retransmitterBean.getMessageContextRefKey();
             
              boolean syncResponseNeeded = false;
              if (Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmVersion) && anonReplyTo) {
                MessageContext applicationMessage = storageManager.retrieveMessageContext(storageKey, configCtx);
                AxisOperation operation = applicationMessage.getAxisOperation();
                if(operation!= null) {
                  int mep = operation.getAxisSpecifMEPConstant();
                  syncResponseNeeded = (mep == WSDLConstants.MEP_CONSTANT_OUT_IN);
                }
              }

              if (!syncResponseNeeded) {
                // removing the application message from the storage.
                retransmitterMgr.delete(retransmitterBean.getMessageID());
                storageManager.removeMessageContext(storageKey);
              }
            }
          }//end for
        }//end for
      } //end while
    }

    // updating the last activated time of the sequence.
    rmsBean.setLastActivatedTime(System.currentTimeMillis());

    //adding a MakeConnection for the response sequence if needed.
    if (rmsBean.getOfferedSequence() != null) {

      RMDBeanMgr rMDBeanMgr = storageManager.getRMDBeanMgr();
      RMDBean rMDBean = rMDBeanMgr.retrieve(outSequenceId);
     
      if (rMDBean!=null && rMDBean.isPollingMode()) {
        PollingManager manager = storageManager.getPollingManager();
        if(manager != null) manager.schedulePollingRequest(rMDBean.getSequenceID(), false);
      }
    }

    // We overwrite the previous client completed message ranges with the
    // latest view, but only if it is an update i.e. contained a new
    // ack range (which is because we do not previous acks arriving late
    // to break us)
    if (numberOfNewMessagesAcked>0) {
      rmsBean.setClientCompletedMessages(completedMessages);
      long noOfMsgsAcked = rmsBean.getNumberOfMessagesAcked() + numberOfNewMessagesAcked;
      rmsBean.setNumberOfMessagesAcked(noOfMsgsAcked);
    }
   
    // Update the RMSBean
    storageManager.getRMSBeanMgr().update(rmsBean);

    // Try and terminate the sequence
    if (!rmsBean.isAvoidAutoTermination())
      TerminateManager.checkAndTerminate(rmMsgCtx.getConfigurationContext(), storageManager, rmsBean);

    if (log.isDebugEnabled())
      log.debug("Exit: AcknowledgementProcessor::processAckHeader");
  }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMSBean

    if (bean == null)
      return beans;

    Iterator iterator = table.values().iterator();

    RMSBean temp;
    while (iterator.hasNext()) {
      temp = (RMSBean) iterator.next();

      boolean equal = true;

      if (bean.getCreateSeqMsgID() != null
          && !bean.getCreateSeqMsgID().equals(
              temp.getCreateSeqMsgID()))
        equal = false;

      if (bean.getSequenceID() != null
          && !bean.getSequenceID().equals(temp.getSequenceID()))
        equal = false;

      if (bean.getInternalSequenceID() != null
          && !bean.getInternalSequenceID().equals(
              temp.getInternalSequenceID()))
        equal = false;

      if (equal)
        beans.add(temp);
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMSBean

    String createSeqMsgId = relatesTo.getValue();

    SenderBeanMgr senderBeanMgr = storageManager.getSenderBeanMgr();
    RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();

    RMSBean rmsBean = rmsBeanMgr.retrieve(createSeqMsgId);
    if (rmsBean == null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.createSeqEntryNotFound);
      log.debug(message);
      throw new SandeshaException(message);
    }

    // Check that the create sequence response message proves possession of the correct token
    String tokenData = rmsBean.getSecurityTokenData();
    if(tokenData != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(configCtx);
      MessageContext crtSeqResponseCtx = createSeqResponseRMMsgCtx.getMessageContext();
      OMElement body = crtSeqResponseCtx.getEnvelope().getBody();
      SecurityToken token = secManager.recoverSecurityToken(tokenData);
      secManager.checkProofOfPossession(token, body, crtSeqResponseCtx);
    }

    String internalSequenceId = rmsBean.getInternalSequenceID();
    if (internalSequenceId == null || "".equals(internalSequenceId)) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.tempSeqIdNotSet);
      log.debug(message);
      throw new SandeshaException(message);
    }
    createSeqResponseRMMsgCtx.setProperty(Sandesha2Constants.MessageContextProperties.INTERNAL_SEQUENCE_ID,internalSequenceId);
   
    String sequencePropertyKey = SandeshaUtil.getSequencePropertyKey(createSeqResponseRMMsgCtx);
   
    rmsBean.setSequenceID(newOutSequenceId);
    rmsBeanMgr.update(rmsBean);

    SenderBean createSequenceSenderBean = senderBeanMgr.retrieve(createSeqMsgId);
    if (createSequenceSenderBean == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.createSeqEntryNotFound));

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

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

    sequencePropMgr.insert(outSequenceBean);
    sequencePropMgr.insert(internalSequenceBean);
   
    // Store the security token under the new sequence id
    if(tokenData != null) {
      SequencePropertyBean newToken = new SequencePropertyBean(newOutSequenceId,
          Sandesha2Constants.SequenceProperties.SECURITY_TOKEN, tokenData);
      sequencePropMgr.insert(newToken);
    }

    // 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(sequencePropertyKey,
          Sandesha2Constants.SequenceProperties.OFFERED_SEQUENCE);

      // TODO this should be detected in the Fault manager.
      if (offeredSequenceBean == null) {
        String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.accptButNoSequenceOffered);
        log.debug(message);
        throw new SandeshaException(message);
      }

      String offeredSequenceId = (String) offeredSequenceBean.getValue();

      EndpointReference acksToEPR = accept.getAcksTo().getEPR();
      SequencePropertyBean acksToBean = new SequencePropertyBean();
      acksToBean.setName(Sandesha2Constants.SequenceProperties.ACKS_TO_EPR);
      acksToBean.setSequencePropertyKey(offeredSequenceId);
      acksToBean.setValue(acksToEPR.getAddress());

      sequencePropMgr.insert(acksToBean);

      RMDBean rmdBean = new RMDBean();
      rmdBean.setSequenceID(offeredSequenceId);
      rmdBean.setNextMsgNoToProcess(1);
     

      boolean pollingMode = false;
      if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(createSeqResponseRMMsgCtx.getRMSpecVersion())) {
        String replyToAddress = SandeshaUtil.getSequenceProperty(sequencePropertyKey,
                Sandesha2Constants.SequenceProperties.REPLY_TO_EPR, storageManager);
        if (replyToAddress!=null) {
          if (AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals(replyToAddress))
            pollingMode = true;
          else if (AddressingConstants.Final.WSA_ANONYMOUS_URL.equals(replyToAddress))
            pollingMode = true;
          else if (replyToAddress.startsWith(Sandesha2Constants.WSRM_ANONYMOUS_URI_PREFIX))
            pollingMode = true;
        }
      }
     
      //Storing the referenceMessage of the sending side sequence as the reference message
      //of the receiving side as well.
      //This can be used when creating new outgoing messages.
     
      String referenceMsgStoreKey = rmsBean.getReferenceMessageStoreKey();
      MessageContext referenceMsg = storageManager.retrieveMessageContext(referenceMsgStoreKey, configCtx);
     
      String newMessageStoreKey = SandeshaUtil.getUUID();
      storageManager.storeMessageContext(newMessageStoreKey,referenceMsg);
     
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMSBean

        RMSBean tmp = mgr.retrieve("CreateSeqMsgId5");
        assertTrue(tmp.getCreateSeqMsgID().equals("CreateSeqMsgId5"));
    }

    public void testUpdate() throws SandeshaStorageException {
      RMSBean createSeqBean = new RMSBean ();
      createSeqBean.setInternalSequenceID("TmpSeqId6");
      createSeqBean.setCreateSeqMsgID("CreateSeqMsgId6");
      createSeqBean.setSequenceID("SeqId6");
       
        mgr.insert(createSeqBean);
        createSeqBean.setInternalSequenceID("TmpSeqId7");
        mgr.update(createSeqBean);
        RMSBean tmp = mgr.retrieve("CreateSeqMsgId6");
        assertTrue(tmp.getInternalSequenceID().equals("TmpSeqId7"));
    }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMSBean

    public void tearDown() throws Exception {
      transaction.commit();
    }

    public void testDelete() throws SandeshaStorageException {
      RMSBean createSeqBean = new RMSBean ();
      createSeqBean.setInternalSequenceID("TmpSeqId1");
      createSeqBean.setCreateSeqMsgID("CreateSeqMsgId1");
      createSeqBean.setSequenceID("SeqId1");
        mgr.insert(createSeqBean);
        mgr.delete("CreateSeqMsgId1");
        assertNull(mgr.retrieve("CreateSeqMsgId1"));
    }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMSBean

        mgr.delete("CreateSeqMsgId1");
        assertNull(mgr.retrieve("CreateSeqMsgId1"));
    }

    public void testFind() throws SandeshaStorageException {
      RMSBean createSeqBean1 = new RMSBean ();
      createSeqBean1.setInternalSequenceID("TmpSeqId1");
      createSeqBean1.setCreateSeqMsgID("CreateSeqMsgId1");
      createSeqBean1.setSequenceID("SeqId1");
     
      RMSBean createSeqBean2 = new RMSBean ();
      createSeqBean2.setInternalSequenceID("TmpSeqId1");
      createSeqBean2.setCreateSeqMsgID("CreateSeqMsgId2");
      createSeqBean2.setSequenceID("SeqId2");
     
        mgr.insert(createSeqBean1);
        mgr.insert(createSeqBean2);

        RMSBean target = new RMSBean();
        target.setInternalSequenceID("TmpSeqId1");

        Iterator iter = mgr.find(target).iterator();
        RMSBean tmp = (RMSBean) iter.next();
        if (tmp.getCreateSeqMsgID().equals("CreateSeqMsgId1")) {
            tmp = (RMSBean) iter.next();
            assertTrue(tmp.getCreateSeqMsgID().equals("CreateSeqMsgId2"));

        }   else {
            tmp = (RMSBean) iter.next();
            assertTrue(tmp.getCreateSeqMsgID().equals("CreateSeqMsgId1"));
        }
    }
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.