Package org.apache.sandesha2.storage.beans

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


        assertTrue(tmp.getNextMsgNoToProcess() == 1004);
    }

    public void testRetrieve() throws SandeshaStorageException {
        assertNull(mgr.retrieve("SeqId5"));
        mgr.insert(new RMDBean("SeqId5", 1005));

        RMDBean tmp = mgr.retrieve("SeqId5");
        assertTrue(tmp.getNextMsgNoToProcess() == 1005);
    }
View Full Code Here


        RMDBean tmp = mgr.retrieve("SeqId5");
        assertTrue(tmp.getNextMsgNoToProcess() == 1005);
    }

    public void testUpdate() throws SandeshaStorageException {
        RMDBean bean = new RMDBean("SeqId6", 1006);
        mgr.insert(bean);
        bean.setNextMsgNoToProcess(1007);
        mgr.update(bean);
        RMDBean tmp = mgr.retrieve("SeqId6");
        assertTrue(tmp.getNextMsgNoToProcess() ==1007);
    }
View Full Code Here

        RMSBean rmsBean = SandeshaUtil.getRMSBeanFromSequenceId(
            storageManager, sequenceID);
        if (rmsBean != null)
          rmVersionOfSequence = rmsBean.getRMVersion();
        else {
          RMDBean rmdBean = SandeshaUtil.getRMDBeanFromSequenceId(
              storageManager, sequenceID);
          if (rmdBean != null)
            rmVersionOfSequence = rmdBean.getRMVersion();
        }

        String rmNamespaceOfMsg = rmMsg.getRMNamespaceValue();
        String rmNamespaceOfSequence = null;
        if (rmVersionOfSequence != null)
View Full Code Here

        boolean highestMessage = false;
        if (sequence.getLastMessage() != null) {
          //this will work for RM 1.0 only
          highestMessage = true;
        } else {
          RMDBean rmdBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, invokerBean.getSequenceID());
         
          if (rmdBean!=null && rmdBean.isTerminated()) {
            long highestInMsgNo = rmdBean.getHighestInMessageNumber();
            if (invokerBean.getMsgNo()==highestInMsgNo)
              highestMessage = true;
          }
        }
       
        if (highestMessage) {
          //do cleaning stuff that hs to be done after the invocation of the last message.
          TerminateManager.cleanReceivingSideAfterInvocation(invokerBean.getSequenceID(), storageManager);
          // exit from current iteration. (since an entry
          // was removed)
          if(log.isDebugEnabled()) log.debug("Exit: InvokerWorker::run Last message return")
          if(transaction != null && transaction.isActive()) transaction.commit();
          return;
        }
      }
     
      if(!ignoreNextMsg){
        // updating the next msg to invoke
        RMDBean rMDBean = storageManager.getRMDBeanMgr().retrieve(invokerBean.getSequenceID());
        long nextMsgNo = rMDBean.getNextMsgNoToProcess();
       
        if (!(invokerBean.getMsgNo()==nextMsgNo)) {
          String message = "Operated message number is different from the Next Message Number to invoke";
          throw new SandeshaException (message);
        }
       
        nextMsgNo++;
        rMDBean.setNextMsgNoToProcess(nextMsgNo);
        storageManager.getRMDBeanMgr().update(rMDBean);
      }
     
      if(transaction != null && transaction.isActive()) transaction.commit();
      transaction = null;
View Full Code Here

      // incoming sequences
      Collection rmdBeans = storageManager.getRMDBeanMgr().find(null);

      Iterator iter = rmdBeans.iterator();
      while (iter.hasNext()) {
        RMDBean serverCompletedMsgsBean = (RMDBean) iter.next();
        String sequenceID = serverCompletedMsgsBean.getSequenceID();
        sandeshaReport.addToIncomingSequenceList(sequenceID);

        SequenceReport sequenceReport = getIncomingSequenceReport(sequenceID, configurationContext);

        sandeshaReport.addToNoOfCompletedMessagesMap(sequenceID, sequenceReport.getCompletedMessages().size());
View Full Code Here

  }

  private static byte getServerSequenceStatus(String sequenceID, StorageManager storageManager)
      throws SandeshaException {

    RMDBean rmdBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, sequenceID);
    if (rmdBean != null && rmdBean.isTerminated()) {
      return SequenceReport.SEQUENCE_STATUS_TERMINATED;
    }

/*  Only outbound sequences time out 
    SequencePropertyBean timedOutBean = seqPropMgr.retrieve(sequenceID,
View Full Code Here

    try {
      reportTransaction = storageManager.getTransaction();

      SequenceReport sequenceReport = new SequenceReport();

      RMDBean rmdBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, sequenceID);

      List completedMessageList = rmdBean.getServerCompletedMessages().getContainedElementsAsNumbersList();
     
      Iterator iter = completedMessageList.iterator();
      while (iter.hasNext()) {
        sequenceReport.addCompletedMessage((Long) iter.next());
      }

      sequenceReport.setSequenceID(sequenceID);
      sequenceReport.setInternalSequenceID(sequenceID); // for the
                                // incoming side
                                // internalSequenceID=sequenceID
      sequenceReport.setSequenceDirection(SequenceReport.SEQUENCE_DIRECTION_IN);

      sequenceReport.setSequenceStatus(getServerSequenceStatus(sequenceID, storageManager));

      if(rmdBean.getSecurityTokenData() != null) sequenceReport.setSecureSequence(true);
     
      if (reportTransaction!=null && reportTransaction.isActive()) reportTransaction.commit();
      reportTransaction = null;

      return sequenceReport;
View Full Code Here

     
      String inboundSequenceId = senderBean.getInboundSequenceId();
      if (inboundSequenceId==null)
        throw new SandeshaException ("InboundSequenceID is not set for the sequence:" + id);
     
      RMDBean incomingSequenceBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, inboundSequenceId);
     
      if (incomingSequenceBean!=null)
        RMMsgCreator.addAckMessage(rmMsgContext, inboundSequenceId, incomingSequenceBean);
     
    }
View Full Code Here

  }

  private void pollRMDSide(SequenceEntry entry, boolean force) throws AxisFault {
    if(log.isDebugEnabled()) log.debug("Enter: PollingManager::pollRMDSide, force: " + force);
    RMDBeanMgr nextMsgMgr = storageManager.getRMDBeanMgr();
    RMDBean findBean = new RMDBean();
    findBean.setPollingMode(true);
    findBean.setTerminated(false);
    findBean.setSequenceID(entry.getSequenceId());
    RMDBean nextMsgBean = nextMsgMgr.findUnique(findBean);
   
    if(nextMsgBean == null) {
      // This sequence must have been terminated, or deleted
      stopThreadForSequence(entry.getSequenceId(), false);
    } else {
      // The sequence is still there, but if we have a running related sequence
      // that is not expecting replies then there is no need to poll.
      boolean doPoll = true;
      String outboundSequence = nextMsgBean.getOutboundInternalSequence();
      if(outboundSequence != null) {
        RMSBean findRMS = new RMSBean();
        findRMS.setInternalSequenceID(outboundSequence);
        findRMS.setTerminated(false);
        RMSBeanMgr mgr = storageManager.getRMSBeanMgr();
        RMSBean outbound = mgr.findUnique(findRMS);
        if(outbound != null && outbound.getExpectedReplies() == 0) {
          doPoll = false;
        }
      }
      if(force || doPoll)
        pollForSequence(null, null, nextMsgBean.getReferenceMessageKey(), nextMsgBean, entry);
    }

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

            found = true;
          rmVersion = rms.getRMVersion();
        }
       
      } else {
        RMDBean matcher = new RMDBean();
        matcher.setSequenceID(sequenceId);
        matcher.setTerminated(false);
        RMDBean rmd = storageManager.getRMDBeanMgr().findUnique(matcher);
        if(rmd != null) {
          found = true;
          rmVersion = rmd.getRMVersion();
        }
      }
      if (!found) {
        stopThreadForSequence(sequenceId, entry.isRmSource());
        if (log.isDebugEnabled()) log.debug("Exit: Sender::internalRun, sequence has ended");
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.storage.beans.RMDBean

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.