Examples of RMSBean


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()));
        }
        else{
          //we will never be able to reply to this msg - at the moment the best bet is
          //to not process the reply anymore
          if(log.isDebugEnabled()) log.debug("Could not find RMS bean for polled msg");
View Full Code Here

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

     
      //we deliver msg 2
      //set highest out msg number to 1
      String internalSequenceId = SandeshaUtil.getInternalSequenceID(to, sequenceKey);
      t = mgr.getTransaction();
      RMSBean rmsBean = SandeshaUtil.getRMSBeanFromInternalSequenceId(mgr, internalSequenceId);
      rmsBean.setNextMessageNumber(1);
      // Update the bean
      mgr.getRMSBeanMgr().update(rmsBean);
      t.commit();
     
      clientOptions.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(2));
View Full Code Here

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

   
    // Get a transaction for the property finding
    Transaction transaction = storageManager.getTransaction();
   
    // Get the highest out message property
    RMSBean rmsBean = SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, internalSequenceId);
   
    transaction.commit();
   
    long highestOutMsgNum = rmsBean.getHighestOutMessageNumber();
    Long highestOutMsgKey = new Long(highestOutMsgNum);
   
    long timeNow = System.currentTimeMillis();
    long timeToComplete = timeNow + waitTime;
    boolean complete = false;   
View Full Code Here

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

    RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();
   
    String seqID = SandeshaUtil.getUUID();
   
    // Mockup an RMSBean
    RMSBean rmsBean = new RMSBean();
    rmsBean.setCreateSeqMsgID(SandeshaUtil.getUUID());
    rmsBean.setSequenceID(seqID);
    rmsBean.setInternalSequenceID(SandeshaUtil.getInternalSequenceID(seqID, null));
    rmsBean.setToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setAcksToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setReplyToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
    rmsBean.setClientCompletedMessages(new RangeString());
    rmsBean.setNextMessageNumber(1);
   
    // Create a transaction and insert the RMSBean
    Transaction tran = storageManager.getTransaction();
   
    rmsBeanMgr.insert(rmsBean);
View Full Code Here

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

    String dummyMessageString = (String) msgContext.getOptions().getProperty(SandeshaClientConstants.DUMMY_MESSAGE);
    boolean dummyMessage = false;
    if (dummyMessageString != null && Sandesha2Constants.VALUE_TRUE.equals(dummyMessageString))
      dummyMessage = true;

    RMSBean rmsBean = SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, internalSequenceId);

    //see if the sequence is closed
    if(rmsBean != null && rmsBean.isSequenceClosedClient()){
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotSendMsgAsSequenceClosed, internalSequenceId));
    }

    //see if the sequence is terminated
    if(rmsBean != null && rmsBean.isTerminateAdded()) {
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotSendMsgAsSequenceTerminated, internalSequenceId));
    }

    //see if the sequence is timed out
    if(rmsBean != null && rmsBean.isTimedOut()){
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotSendMsgAsSequenceTimedout, internalSequenceId));
    }
   
    // If the call application is a 2-way MEP, and uses a anonymous replyTo, and the
    // RM 1.1 spec level, then we must have MakeConnection enabled. We check that here,
    // before we start creating a new Sequence.
    if(!serverSide) {
      AxisOperation op = msgContext.getAxisOperation();
      int mep = WSDLConstants.MEP_CONSTANT_INVALID;
      if(op != null) {
        mep = op.getAxisSpecifMEPConstant();
      }
      if(mep == WSDLConstants.MEP_CONSTANT_OUT_IN) {
        String specVersion = null;
        if(rmsBean == null) {
          specVersion = SequenceManager.getSpecVersion(msgContext, storageManager);
        } else {
          specVersion = rmsBean.getRMVersion();
        }
        if(specVersion == Sandesha2Constants.SPEC_VERSIONS.v1_1) {
          SandeshaPolicyBean policy = SandeshaUtil.getPropertyBean(configContext.getAxisConfiguration());
          if(!policy.isEnableMakeConnection()) {
            String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.makeConnectionDisabled);
            throw new SandeshaException(message);
          }
        }
      }
    }

    //setting the reference msg store key.
    if (rmsBean!=null && rmsBean.getReferenceMessageStoreKey()==null) {
      //setting this application message as the reference, if it hsnt already been set.
     
      String referenceMsgKey = SandeshaUtil.getUUID();
      storageManager.storeMessageContext(referenceMsgKey, msgContext);
      rmsBean.setReferenceMessageStoreKey(referenceMsgKey);
    }
   
    String outSequenceID = null;

    if (rmsBean == null) {
      // SENDING THE CREATE SEQUENCE.
      synchronized (RMSBeanMgr.class) {
        // There is a timing window where 2 sending threads can hit this point
        // at the same time and both will create an RMSBean to the same endpoint
        // with the same internal sequenceid
        // Check that someone hasn't created the bean
        rmsBean = SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, internalSequenceId);
       
        // if first message - setup the sending side sequence - both for the
        // server and the client sides.
        if (rmsBean == null) {
          rmsBean = SequenceManager.setupNewClientSequence(msgContext, internalSequenceId, storageManager);
          rmsBean = addCreateSequenceMessage(rmMsgCtx, rmsBean, storageManager);
        }
      }
   
    } else {
      outSequenceID = rmsBean.getSequenceID();
    }
   
    // the message number that was last used.
    long systemMessageNumber = rmsBean.getNextMessageNumber();

    // The number given by the user has to be larger than the last stored
    // number.
    if (givenMessageNumber > 0 && givenMessageNumber <= systemMessageNumber) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.msgNumberNotLargerThanLastMsg, Long
          .toString(givenMessageNumber));
      throw new SandeshaException(message);
    }

    // Finding the correct message number.
    long messageNumber = -1;
    if (givenMessageNumber > 0) // if given message number is valid use it.
                  // (this is larger than the last stored due
                  // to the last check)
      messageNumber = givenMessageNumber;
    else if (systemMessageNumber > 0) { // if system message number is valid
                      // use it.
      messageNumber = systemMessageNumber + 1;
    } else { // This is the first message (systemMessageNumber = -1)
      messageNumber = 1;
    }

    if (serverSide) {
      // Deciding whether this is the last message. We assume it is if it relates to
      // a message which arrived with the LastMessage flag on it.
      RMDBean rmdBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, inboundSequence);     
      // Get the last in message
      String lastRequestId = rmdBean.getLastInMessageId();
      RelatesTo relatesTo = msgContext.getRelatesTo();
      if(relatesTo != null && lastRequestId != null &&
          lastRequestId.equals(relatesTo.getValue())) {
        lastMessage = true;
      }
     
      //or a constant property may call it as the last msg
      Boolean inboundLast = (Boolean) msgContext.getProperty(Sandesha2Constants.MessageContextProperties.INBOUND_LAST_MESSAGE);
      if (inboundLast!=null && inboundLast.booleanValue())
        lastMessage = true;
    }
   
    if (lastMessage)
      rmsBean.setLastOutMessage(messageNumber);   

    // set this as the response highest message.
    rmsBean.setHighestOutMessageNumber(messageNumber);
   
    // saving the used message number, and the expected reply count
    boolean startPolling = false;
    if (!dummyMessage) {
      rmsBean.setNextMessageNumber(messageNumber);

      // Identify the MEP associated with the message.
      AxisOperation op = msgContext.getAxisOperation();
      int mep = WSDLConstants.MEP_CONSTANT_INVALID;
      if(op != null) {
        mep = op.getAxisSpecifMEPConstant();
      }

      if(mep == WSDLConstants.MEP_CONSTANT_OUT_IN) {
        // We only match up requests and replies when we are doing sync interactions
        EndpointReference replyTo = msgContext.getReplyTo();
        if(replyTo == null || replyTo.hasAnonymousAddress()) {
          long expectedReplies = rmsBean.getExpectedReplies();
          rmsBean.setExpectedReplies(expectedReplies + 1);
        }

        // If we support the RM anonymous URI then rewrite the ws-a anon to use the RM equivalent.
        //(do should be done only for WSRM 1.1)
       
        if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(rmMsgCtx.getRMSpecVersion())) {
          String oldAddress = (replyTo == null) ? null : replyTo.getAddress();
          EndpointReference newReplyTo = SandeshaUtil.rewriteEPR(rmsBean, msgContext
              .getReplyTo(), configContext);
          String newAddress = (newReplyTo == null) ? null : newReplyTo.getAddress();
          if (newAddress != null && !newAddress.equals(oldAddress)) {
            // We have rewritten the replyTo. If this is the first message that we have needed to
            // rewrite then we should set the sequence up for polling, and once we have saved the
            // changes to the sequence then we can start the polling thread.
            msgContext.setReplyTo(newReplyTo);
            if (!rmsBean.isPollingMode()) {
              rmsBean.setPollingMode(true);
              startPolling = true;
            }
          }
        }
      }
    }
   
    RelatesTo relatesTo = msgContext.getRelatesTo();
    if(relatesTo != null) {
      rmsBean.setHighestOutRelatesTo(relatesTo.getValue());
    }

    // setting async ack endpoint for the server side. (if present)
    if (serverSide) {
      if (rmsBean.getToEPR() != null) {
        msgContext.setProperty(SandeshaClientConstants.AcksTo, rmsBean.getToEPR());
      }
    }

    // Update the rmsBean
    storageManager.getRMSBeanMgr().update(rmsBean);
View Full Code Here

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

          transaction = storageManager.getTransaction();
         
          // Get the internal sequence id from the context
          String internalSequenceId = (String)rmMsgCtx.getProperty(Sandesha2Constants.MessageContextProperties.INTERNAL_SEQUENCE_ID);
         
          RMSBean bean = SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, internalSequenceId);
         
          if (bean != null) {           
            bean.setLastSendError(e);
            bean.setLastSendErrorTimestamp(System.currentTimeMillis());
          }
         
          // Update the RMSBean
          storageManager.getRMSBeanMgr().update(bean);
         
          // Commit the properties
          if(transaction != null) {
            transaction.commit();
            transaction = null;
          }
        }
        catch (Exception e1)
        {
          if (log.isErrorEnabled())
            log.error(e1);
        } finally {
          if (transaction != null) {
            transaction.rollback();
            transaction = null;
          }
        }
       
      }
      // Establish the transaction for post-send processing
      transaction = storageManager.getTransaction();

      // update or delete only if the object is still present.
      SenderBean bean1 = senderBeanMgr
          .retrieve(senderBean.getMessageID());
      if (bean1 != null) {
        if (senderBean.isReSend()) {
          bean1.setTimeToSend(senderBean.getTimeToSend());
          senderBeanMgr.update(bean1);
        } else {
          senderBeanMgr.delete(bean1.getMessageID());

          // removing the message from the storage.
          String messageStoredKey = bean1.getMessageContextRefKey();
          storageManager.removeMessageContext(messageStoredKey);
        }
      }

      // Commit the transaction to release the SenderBean

      if (transaction!=null)
        transaction.commit();
     
      transaction = null;

      if (successfullySent && !msgCtx.isServerSide())
        checkForSyncResponses(msgCtx);
     
      if ((rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.TERMINATE_SEQ)
          &&
           (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(rmMsgCtx.getRMNamespaceValue()))) {
        try {
          transaction = storageManager.getTransaction();
          //terminate message sent using the SandeshaClient. Since the terminate message will simply get the
          //InFlow of the reference message get called which could be zero sized (OutOnly operations).
         
          // terminate sending side if this is the WSRM 1.0 spec.
          // If the WSRM versoion is 1.1 termination will happen in the terminate sequence response message.
         
          TerminateSequence terminateSequence = (TerminateSequence) rmMsgCtx
              .getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
          String sequenceID = terminateSequence.getIdentifier().getIdentifier();
 
          RMSBean rmsBean = SandeshaUtil.getRMSBeanFromSequenceId(storageManager, sequenceID);
          TerminateManager.terminateSendingSide(rmsBean, storageManager);
         
          if(transaction != null && transaction.isActive()) transaction.commit();
          transaction = null;
        } finally {
View Full Code Here

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

      if (createTransaction)
        reportTransaction = storageManager.getTransaction();

      sequenceReport.setInternalSequenceID(internalSequenceID);

      RMSBean createSeqFindBean = new RMSBean();
      createSeqFindBean.setInternalSequenceID(internalSequenceID);

      RMSBean rMSBean = createSeqMgr.findUnique(createSeqFindBean);

      // if data not is available sequence has to be terminated or
      // timedOut.
      if (rMSBean != null && rMSBean.isTerminated()) {

        // check weather this is an terminated sequence.
        sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_TERMINATED);

        fillOutgoingSequenceInfo(sequenceReport, rMSBean, storageManager);

        return sequenceReport;

      } else if (rMSBean != null && rMSBean.isTimedOut()) {

        sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_TIMED_OUT);
       
        fillOutgoingSequenceInfo(sequenceReport, rMSBean, storageManager);

        return sequenceReport;
       
      } else if (rMSBean == null) {

        // sequence must hv been timed out before establishing. No other
        // posibility I can think of.
        // this does not get recorded since there is no key (which is
        // normally the sequenceID) to store it.

        // so, setting the sequence status to INITIAL
        sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_INITIAL);

        // returning the current sequence report.
        return sequenceReport;
      }

      String outSequenceID = rMSBean.getSequenceID();
      if (outSequenceID == null) {
        sequenceReport.setInternalSequenceID(internalSequenceID);
        sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_INITIAL);
        sequenceReport.setSequenceDirection(SequenceReport.SEQUENCE_DIRECTION_OUT);
        if(rMSBean.getSecurityTokenData() != null) sequenceReport.setSecureSequence(true);

        return sequenceReport;
      }

      sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_ESTABLISHED);
View Full Code Here

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

      reportTransaction = storageManager.getTransaction();

      List rmsBeans = storageManager.getRMSBeanMgr().find(null);
      Iterator iterator = rmsBeans.iterator();
      while (iterator.hasNext()) {
        RMSBean bean = (RMSBean) iterator.next();
        String sequenceID = bean.getSequenceID();
        sandeshaReport.addToOutgoingSequenceList(sequenceID);
        sandeshaReport.addToOutgoingInternalSequenceMap(sequenceID, bean.getInternalSequenceID());

        SequenceReport report = getOutgoingSequenceReport(bean.getInternalSequenceID(), configurationContext);

        sandeshaReport.addToNoOfCompletedMessagesMap(sequenceID, report.getCompletedMessages().size());
        sandeshaReport.addToSequenceStatusMap(sequenceID, report.getSequenceStatus());
      }
View Full Code Here

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

    Transaction tran = null;
   
    try {
      tran = storageManager.getTransaction();
     
      RMSBean rmsBean = SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, internalSequenceId);
      //see if the sequence is terminated
      boolean terminatedSequence = false;
      if (rmsBean != null && rmsBean.isTerminated())
        terminatedSequence = true;
 
      //see if the sequence is timed out
      if(rmsBean != null && rmsBean.isTimedOut()){
        terminatedSequence = true;
      }
 
      if (terminatedSequence) {   
        // Delete the rmsBean
        storageManager.getRMSBeanMgr().delete(rmsBean.getCreateSeqMsgID());
      }
     
      if(tran != null && tran.isActive()) tran.commit();
      tran = null;
   
View Full Code Here

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

    Exception resultException = null;
   
    try
    {
      transaction = storageManager.getTransaction();
      RMSBean bean = SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, internalSequenceId);
     
      if (bean != null) {           
        resultException = bean.getLastSendError();
      }
    }
    finally
    {
      // Commit the tran whatever happened
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.