Package org.apache.sandesha2.storage.beans

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


   
    Transaction reportTransaction = storageManager.getTransaction();
   
    sequenceReport.setInternalSequenceID(internalSequenceID);
   
    CreateSeqBean createSeqFindBean = new CreateSeqBean ();
    createSeqFindBean.setInternalSequenceID(internalSequenceID);
   
    CreateSeqBean createSeqBean = createSeqMgr.findUnique(createSeqFindBean);
   
    //if data not is available sequence has to be terminated or timedOut.
    if (createSeqBean==null) {
     
      //check weather this is an terminated sequence.
      if (isSequenceTerminated(internalSequenceID,seqPropMgr)) {
        fillTerminatedOutgoingSequenceInfo (sequenceReport,internalSequenceID,seqPropMgr);
       
        return sequenceReport;
      }
     
      if (isSequenceTimedout(internalSequenceID,seqPropMgr)) {
        fillTimedoutOutgoingSequenceInfo (sequenceReport,internalSequenceID,seqPropMgr);
       
        return sequenceReport;
      }
   
      //sequence must hv been timed out before establiching. 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.
      //(properties with key as the internalSequenceID get deleted in timing out)
     
      //so, setting the sequence status to INITIAL
      sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_INITIAL);
     
      //returning the current sequence report.
      return sequenceReport;
    }
   
    String outSequenceID = createSeqBean.getSequenceID();
    if (outSequenceID==null) {
       sequenceReport.setInternalSequenceID(internalSequenceID);
       sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_INITIAL);
       sequenceReport.setSequenceDirection(SequenceReport.SEQUENCE_DIRECTION_OUT);
      
View Full Code Here


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

    CreateSeqBean createSeqBean = createSeqMgr.retrieve(createSeqMsgId);
    if (createSeqBean == null) {
      String message = "Create Sequence entry is not found";
      log.debug(message);
      throw new SandeshaException(message);
    }

    String internalSequenceId = createSeqBean.getInternalSequenceID();
    if (internalSequenceId == null || "".equals(internalSequenceId)) {
      String message = "TempSequenceId has is not set";
      log.debug(message);
      throw new SandeshaException(message);
    }
   
    createSeqBean.setSequenceID(newOutSequenceId);
    createSeqMgr.update(createSeqBean);

    //deleting the create sequence entry.
    retransmitterMgr.delete(createSeqMsgId);
View Full Code Here

      SenderBean retransmitterBean = (SenderBean) iterator.next();
      retransmitterBeanMgr.delete(retransmitterBean.getMessageId());
    }
   
    //removing the createSeqMgrEntry
    CreateSeqBean findCreateSequenceBean = new CreateSeqBean ();
    findCreateSequenceBean.setInternalSequenceId(internalSequenceId);
    collection = createSeqBeanMgr.find(findCreateSequenceBean);
    iterator = collection.iterator();
    while (iterator.hasNext()) {
      CreateSeqBean createSeqBean = (CreateSeqBean) iterator.next();
      createSeqBeanMgr.delete(createSeqBean.getCreateSeqMsgId());
    }
   
    //removing sequence properties
    SequencePropertyBean findSequencePropertyBean1 = new SequencePropertyBean ();
    findSequencePropertyBean1.setSequenceId(internalSequenceId);
View Full Code Here

        //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);
        createSeqBean.setCreateSeqMsgId(SandeshaUtil.getUUID()); //this
        // is a
        // dummy
        // value.

        StorageManager storageManager = SandeshaUtil
View Full Code Here

    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);
View Full Code Here

    if (bean == null)
      return beans;

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

    CreateSeqBean temp;
    while (iterator.hasNext()) {
      temp = (CreateSeqBean) 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

    StorageManager storageManager = SandeshaUtil
        .getSandeshaStorageManager(applicationMsg.getConfigurationContext());
    CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();

    CreateSeqBean createSeqBean = new CreateSeqBean(internalSequenceId,
        createSeqMsg.getMessageID(), null);
    createSeqMgr.insert(createSeqBean);

    if (createSeqMsg.getReplyTo() == null)
      createSeqMsg.setReplyTo(new EndpointReference(
View Full Code Here

        StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx);
        mgr = storageManager.getCreateSeqBeanMgr();
    }

    public void testDelete() {
        mgr.insert(new CreateSeqBean("TmpSeqId1", "CreateSeqMsgId1", "SeqId1"));
        mgr.delete("CreateSeqMsgId1");
        assertNull(mgr.retrieve("CreateSeqMsgId1"));
    }
View Full Code Here

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

    public void testFind() {
        mgr.insert(new CreateSeqBean("TmpSeqId2", "CreateSeqMsgId2", "SeqId2"));
        mgr.insert(new CreateSeqBean("TmpSeqId2", "CreateSeqMsgId3", "SeqId3"));

        CreateSeqBean target = new CreateSeqBean();
        target.setInternalSequenceId("TmpSeqId2");

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

        }   else {
            tmp = (CreateSeqBean) iter.next();
            assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId3"));
        }
    }
View Full Code Here

            assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId3"));
        }
    }

    public void testInsert() {
        CreateSeqBean bean = new CreateSeqBean("TmpSeqId4", "CreateSeqMsgId4", "SeqId4");
        mgr.insert(bean);
        CreateSeqBean tmpbean = mgr.retrieve("CreateSeqMsgId4");
        assertTrue(tmpbean.getCreateSeqMsgId().equals("CreateSeqMsgId4"));
        assertTrue(tmpbean.getSequenceId().equals("SeqId4"));
        assertTrue(tmpbean.getInternalSequenceId().equals("TmpSeqId4"));
    }
View Full Code Here

TOP

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

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.