Package org.apache.sandesha2.storage.beans

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


    return bean;
  }
 
  public static final RMSBean getRMSBeanFromSequenceId(StorageManager storageManager, String sequenceIDthrows SandeshaException {
    RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();
    RMSBean bean = rmsBeanMgr.retrieveBySequenceID(sequenceID);
    return bean;
  }
View Full Code Here


    RMDBean bean = storageManager.getRMDBeanMgr().retrieve(sequenceID);
    return bean;
  }
 
  public static long getLastMessageNumber(String internalSequenceID, StorageManager storageManager)throws SandeshaException {
    RMSBean rMSBean = getRMSBeanFromInternalSequenceId(storageManager, internalSequenceID);
    long lastMessageNumber = 0;
    if(rMSBean!=null){
      lastMessageNumber = rMSBean.getHighestOutMessageNumber();
    }
    return lastMessageNumber;
  }
View Full Code Here

  }

  public static String getSequenceIDFromInternalSequenceID(String internalSequenceID,
      StorageManager storageManager) throws SandeshaException {

    RMSBean rMSBean = getRMSBeanFromInternalSequenceId(storageManager, internalSequenceID);

    String sequeunceID = null;
    if (rMSBean != null &&
        rMSBean.getSequenceID() != null &&
        !rMSBean.getSequenceID().equals(Sandesha2Constants.TEMP_SEQUENCE_ID))
      sequeunceID = rMSBean.getSequenceID();

    return sequeunceID;
  }
View Full Code Here

  }

  public static boolean isAllMsgsAckedUpto(long highestInMsgNo, String internalSequenceId,
      StorageManager storageManager) throws SandeshaException {

    RMSBean rmsBean = SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, internalSequenceId);
   
    RangeString ackedMsgRanges = rmsBean.getClientCompletedMessages();
    long smallestMsgNo = 1;
    Range interestedRange = new Range(smallestMsgNo, highestInMsgNo);
    boolean allComplete = false;
    if(ackedMsgRanges!=null && ackedMsgRanges.isRangeCompleted(interestedRange)){
      allComplete = true;
View Full Code Here

    options.setProperty(Sandesha2Constants.MessageContextProperties.INTERNAL_SEQUENCE_ID, internalSequenceID);
    options.setProperty(SandeshaClientConstants.RM_SPEC_VERSION, oldRMSBean.getRMVersion());
    options.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.FALSE);

    //Update the RMSBean so as to mark it as reallocated if it isn't an RMSbean created for a previous reallocation
    RMSBean originallyReallocatedRMSBean = SandeshaUtil.isLinkedToReallocatedRMSBean(storageManager, oldRMSBean.getInternalSequenceID());
    if(originallyReallocatedRMSBean == null){
      oldRMSBean.setReallocated(Sandesha2Constants.WSRM_COMMON.REALLOCATED);
      storageManager.getRMSBeanMgr().update(oldRMSBean);
    } else {
      options.setProperty(Sandesha2Constants.MessageContextProperties.INTERNAL_SEQUENCE_ID, originallyReallocatedRMSBean.getInternalSequenceID());
      originallyReallocatedRMSBean.setInternalSeqIDOfSeqUsedForReallocation(null)
      storageManager.getRMSBeanMgr().update(originallyReallocatedRMSBean);

      //Setting this property so that the bean can be deleted
      oldRMSBean.setReallocated(Sandesha2Constants.WSRM_COMMON.ORIGINAL_REALLOCATED_BEAN_COMPLETE);
      oldRMSBean.setInternalSeqIDOfSeqUsedForReallocation(originallyReallocatedRMSBean.getInternalSequenceID());
      storageManager.getRMSBeanMgr().update(oldRMSBean);
    }

    //Commit current transaction that wraps the manageFaultMsg as we are about to start
    //resending msgs on a new seq and they will need to get a transaction on the
    //current thread
    if(transaction != null && transaction.isActive()) transaction.commit();

    //send the msgs - this will setup a new sequence to the same endpoint
    Iterator<MessageContext> it = msgsToSend.iterator();

    while(it.hasNext()){
      MessageContext msgCtx = (MessageContext)it.next();

      //Set the action
      client.getOptions().setAction(msgCtx.getWSAAction());

      //Set the message ID
      client.getOptions().setMessageId(msgCtx.getMessageID());

      //Get the AxisOperation
      AxisOperation axisOperation = msgCtx.getAxisOperation();

      //If it's oneway or async, reallocate
      EndpointReference replyTo = oldRMSBean.getReplyToEndpointReference();
      int mep = axisOperation.getAxisSpecificMEPConstant();
      if(mep == WSDLConstants.MEP_CONSTANT_OUT_ONLY){
        client.fireAndForget(msgCtx.getEnvelope().getBody().cloneOMElement().getFirstElement());
      } else if (replyTo == null || replyTo.hasAnonymousAddress()){
        //It is sync2way and therefore we should fail
        transaction = storageManager.getTransaction();

        RMSBeanMgr mgr = storageManager.getRMSBeanMgr();

        RMSBean finder = new RMSBean();
        finder.setSequenceID(oldRMSBean.getSequenceID());
        RMSBean bean = mgr.findUnique(finder);

        oldRMSBean.setReallocated(Sandesha2Constants.WSRM_COMMON.REALLOCATION_FAILED);
        storageManager.getRMSBeanMgr().update(oldRMSBean);
        throw new SandeshaException(SandeshaMessageKeys.reallocationForSyncRequestReplyNotSupported);
      } else {
View Full Code Here

  public static RMSBean isLinkedToReallocatedRMSBean(StorageManager storageManager, String internalSeqID) throws SandeshaException {
    if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Enter: SandeshaUtil::isLinkedToReallocatedRMSBean");
    //Need to check if it's an RMSBean created for reallocation.
    RMSBean finderBean = new RMSBean();
    finderBean.setInternalSeqIDOfSeqUsedForReallocation(internalSeqID);
    RMSBean reallocatedRMSBean = storageManager.getRMSBeanMgr().findUnique(finderBean);
 
    if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Enter: SandeshaUtil::isLinkedToReallocatedRMSBean, ReallocatedRMSBean: " + reallocatedRMSBean);
    return reallocatedRMSBean;
  }
View Full Code Here

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

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

        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");
     
      assertTrue(mgr.insert(createSeqBean1));

        RMSBean target = new RMSBean();
        target.setSequenceID("SeqId1");

        Iterator<RMSBean> iter = mgr.find(target).iterator();
        RMSBean tmp = (RMSBean) iter.next();
        assertTrue(tmp.getCreateSeqMsgID().equals("CreateSeqMsgId1"));
    }
View Full Code Here

        RMSBean tmp = (RMSBean) iter.next();
        assertTrue(tmp.getCreateSeqMsgID().equals("CreateSeqMsgId1"));
    }

    public void testInsert() throws SandeshaStorageException{
      RMSBean rMSBean = new RMSBean ();
      rMSBean.setInternalSequenceID("TmpSeqId4");
      rMSBean.setCreateSeqMsgID("CreateSeqMsgId4");
      rMSBean.setSequenceID("SeqId4");
        mgr.insert(rMSBean);
        RMSBean tmpbean = mgr.retrieve("CreateSeqMsgId4");
        assertTrue(tmpbean.getCreateSeqMsgID().equals("CreateSeqMsgId4"));
        assertTrue(tmpbean.getSequenceID().equals("SeqId4"));
        assertTrue(tmpbean.getInternalSequenceID().equals("TmpSeqId4"));
    }
View Full Code Here


    public void testRetrieve() throws SandeshaStorageException{
        assertNull(mgr.retrieve("CreateSeqMsgId5"));

      RMSBean rMSBean = new RMSBean ();
      rMSBean.setInternalSequenceID("TmpSeqId5");
      rMSBean.setCreateSeqMsgID("CreateSeqMsgId5");
      rMSBean.setSequenceID("SeqId5");
        mgr.insert(rMSBean);
        RMSBean tmp = mgr.retrieve("CreateSeqMsgId5");
        assertTrue(tmp.getCreateSeqMsgID().equals("CreateSeqMsgId5"));
    }
View Full Code Here

TOP

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

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.