Package org.apache.sandesha2.storage.beans

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


    StorageManager storageManager = SandeshaUtil
        .getSandeshaStorageManager(ctx);
    SequencePropertyBeanMgr seqPropMgr = storageManager
        .getSequencePropretyBeanMgr();

    SequencePropertyBean seqBean = seqPropMgr.retrieve(sequenceId,
        Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES);
    String msgNoList = (String) seqBean.getValue();

    ArrayList ackRangeArrayList = SandeshaUtil.getAckRangeArrayList(
        msgNoList, factory,rmNamespaceValue);
    Iterator iterator = ackRangeArrayList.iterator();
    while (iterator.hasNext()) {
      AcknowledgementRange ackRange = (AcknowledgementRange) iterator
          .next();
      sequenceAck.addAcknowledgementRanges(ackRange);
    }
   
   
    SequencePropertyBean sequenceClosedBean = seqPropMgr.retrieve(sequenceId,Sandesha2Constants.SequenceProperties.SEQUENCE_CLOSED );
   
    if (sequenceClosedBean!=null && Sandesha2Constants.VALUE_TRUE.equals(sequenceClosedBean.getValue())) {
      //sequence is closed. so add the 'Final' part.
      if (SpecSpecificConstants.isAckFinalAllowed(rmVersion)) {
        AckFinal ackFinal = new AckFinal (factory,rmNamespaceValue);
        sequenceAck.setAckFinal(ackFinal);
      }
View Full Code Here


    ConfigurationContext configurationContext = rmMsgCtx.getMessageContext().getConfigurationContext();
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
   
    //Setting the ack depending on AcksTo.
    SequencePropertyBean acksToBean = seqPropMgr.retrieve(sequenceID,
        Sandesha2Constants.SequenceProperties.ACKS_TO_EPR);

    EndpointReference acksTo = new EndpointReference(acksToBean.getValue());
    String acksToStr = acksTo.getAddress();

    if (acksToStr == null)
      throw new SandeshaException(
          "acksToStr Seqeunce property is not set correctly");
View Full Code Here

    lastUpdatedTimeTransaction.commit();
   
    //Starting transaction
    Transaction ackTransaction = storageManager.getTransaction();

    SequencePropertyBean internalSequenceBean = seqPropMgr.retrieve(
        outSequenceId, Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);

    if (internalSequenceBean == null || internalSequenceBean.getValue() == null) {
      String message = "TempSequenceId is not set correctly";
      log.debug(message);
      throw new SandeshaException(message);
    }

    String internalSequenceId = (String) internalSequenceBean.getValue();

    //Following happens in the SandeshaGlobal handler
    rmMsgCtx.getMessageContext()
        .setProperty(Sandesha2Constants.ACK_PROCSSED, "true");

    //Removing relatesTo - Some v1_0 endpoints tend to set relatesTo value for ack messages.
    //Because of this dispatching may go wrong. So we set relatesTo value to null for ackMessages.
    //(this happens in the SandeshaGlobal handler). Do this only if this is a standalone ACK.
//    if (rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.ACK)
//      rmMsgCtx.setRelatesTo(null);

    SenderBean input = new SenderBean();
    input.setSend(true);
    input.setReSend(true);
    Collection retransmitterEntriesOfSequence = retransmitterMgr
        .find(input);

    ArrayList ackedMessagesList = new ArrayList ();
    while (ackRangeIterator.hasNext()) {
      AcknowledgementRange ackRange = (AcknowledgementRange) ackRangeIterator
          .next();
      long lower = ackRange.getLowerValue();
      long upper = ackRange.getUpperValue();

      for (long messageNo = lower; messageNo <= upper; messageNo++) {
        SenderBean retransmitterBean = getRetransmitterEntry(
            retransmitterEntriesOfSequence, messageNo);
        if (retransmitterBean != null)
          retransmitterMgr.delete(retransmitterBean.getMessageID());
       
        ackedMessagesList.add(new Long (messageNo));
      }
    }

    while (nackIterator.hasNext()) {
      Nack nack = (Nack) nackIterator.next();
      long msgNo = nack.getNackNumber();

      //TODO - Process Nack
    }
   
    //setting acked message date.
    //TODO add details specific to each message.
    long noOfMsgsAcked = getNoOfMessagesAcked(sequenceAck.getAcknowledgementRanges().iterator());
    SequencePropertyBean noOfMsgsAckedBean = seqPropMgr.retrieve(outSequenceId,Sandesha2Constants.SequenceProperties.NO_OF_OUTGOING_MSGS_ACKED);
    boolean added = false;
   
    if (noOfMsgsAckedBean==null) {
      added = true;
      noOfMsgsAckedBean = new SequencePropertyBean ();
      noOfMsgsAckedBean.setSequenceID(outSequenceId);
      noOfMsgsAckedBean.setName(Sandesha2Constants.SequenceProperties.NO_OF_OUTGOING_MSGS_ACKED);
    }
   
    noOfMsgsAckedBean.setValue(Long.toString(noOfMsgsAcked));
   
    if (added)
      seqPropMgr.insert(noOfMsgsAckedBean);
    else
      seqPropMgr.update(noOfMsgsAckedBean);
   
   
    //setting the completed_messages list. This gives all the messages of the sequence that were acked.
    SequencePropertyBean allCompletedMsgsBean = seqPropMgr.retrieve(internalSequenceId,Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
    if (allCompletedMsgsBean==null) {
      allCompletedMsgsBean = new SequencePropertyBean ();
      allCompletedMsgsBean.setSequenceID(internalSequenceId);
      allCompletedMsgsBean.setName(Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
     
      seqPropMgr.insert(allCompletedMsgsBean);
    }
       
    String str = ackedMessagesList.toString();
    allCompletedMsgsBean.setValue(str);
   
    seqPropMgr.update(allCompletedMsgsBean);   
   
    //commiting transaction
    ackTransaction.commit();
View Full Code Here

      ConfigurationContext configurationContext) throws SandeshaException {

    StorageManager storageManager = getSandeshaStorageManager(configurationContext);
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();

    SequencePropertyBean outSequenceBean = sequencePropertyBeanMgr.retrieve(internalSequenceID,
        Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID);

    String sequeunceID = null;
    if (outSequenceBean != null)
      sequeunceID = outSequenceBean.getValue();

    return sequeunceID;
  }
View Full Code Here

  public static String getRMVersion(String propertyKey, ConfigurationContext configurationContext)
      throws SandeshaException {
    StorageManager storageManager = getSandeshaStorageManager(configurationContext);

    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();
    SequencePropertyBean specVersionBean = sequencePropertyBeanMgr.retrieve(propertyKey,
        Sandesha2Constants.SequenceProperties.RM_SPEC_VERSION);

    if (specVersionBean == null)
      return null;

    return specVersionBean.getValue();
  }
View Full Code Here

  public static String getSequenceProperty(String id, String name, ConfigurationContext context)
      throws SandeshaException {
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();

    SequencePropertyBean sequencePropertyBean = sequencePropertyBeanMgr.retrieve(id, name);
    if (sequencePropertyBean == null)
      return null;
    else
      return sequencePropertyBean.getValue();
  }
View Full Code Here

    String propertyKey = null;
    if (rmMsgCtx.getMessageContext().getFLOW()==MessageContext.IN_FLOW) {
      propertyKey = sequenceID;
    } else {
      SequencePropertyBean internalSequenceIDBean = sequencePropertyBeanMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
      if (internalSequenceIDBean!=null) {
        propertyKey = internalSequenceIDBean.getValue();
      }
    }
   
        String rmNamespace = rmMsgCtx.getRMNamespaceValue();
        if (sequenceID!=null) {
View Full Code Here

    retransmitterMgr.delete(createSeqMsgId);

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

    createSeqResponseTransaction.commit();
   
   
    Transaction offerProcessTransaction = storageManager.getTransaction();
   
    //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(internalSequenceId,
              Sandesha2Constants.SequenceProperties.OFFERED_SEQUENCE);

      //TODO this should be detected in the Fault manager.
      if (offeredSequenceBean == null) {
        String message = "No offered sequence entry. But an accept was received";
        log.debug(message);
        throw new SandeshaException(message);
      }

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

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

      sequencePropMgr.insert(acksToBean);

      NextMsgBean nextMsgBean = new NextMsgBean();
      nextMsgBean.setSequenceID(offeredSequenceId);
      nextMsgBean.setNextMsgNoToProcess(1);

      NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();
      nextMsgMgr.insert(nextMsgBean);
     
      String rmSpecVersion = createSeqResponseRMMsgCtx.getRMSpecVersion();
     
      SequencePropertyBean specVersionBean = new SequencePropertyBean (
          offeredSequenceId,Sandesha2Constants.SequenceProperties.RM_SPEC_VERSION,rmSpecVersion);
      sequencePropMgr.insert(specVersionBean);
     
      SequencePropertyBean receivedMsgBean = new SequencePropertyBean(
          offeredSequenceId, Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES, "");
      sequencePropMgr.insert(receivedMsgBean);
     
      SequencePropertyBean msgsBean = new SequencePropertyBean();
      msgsBean.setSequenceID(offeredSequenceId);
      msgsBean.setName(Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
      msgsBean.setValue("");
      sequencePropMgr.insert(msgsBean);
     
     
      //setting the addressing version.
      String addressingNamespace = createSeqResponseRMMsgCtx.getAddressingNamespaceValue();
      SequencePropertyBean addressingVersionBean = new SequencePropertyBean (
          offeredSequenceId,Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE,addressingNamespace);
      sequencePropMgr.insert(addressingVersionBean);
     
    }
View Full Code Here

   * @return
   */
  public static ArrayList getClientCompletedMessagesList (String sequenceID,SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
 
    //first trying to get it from the internal sequence id.
    SequencePropertyBean internalSequenceBean = seqPropMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
    String internalSequenceID = null;
    if (internalSequenceBean!=null)
      internalSequenceID = internalSequenceBean.getValue();
   
    SequencePropertyBean completedMessagesBean = null;
    if (internalSequenceID!=null)
      completedMessagesBean = seqPropMgr.retrieve(internalSequenceID,Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
   
    if (completedMessagesBean==null)
      completedMessagesBean = seqPropMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
   
    ArrayList completedMsgList = null;
    if (completedMessagesBean!=null) {
      completedMsgList = SandeshaUtil.getArrayListFromString(completedMessagesBean.getValue());
    } else {
      String message = "Completed messages bean is null, for the sequence " + sequenceID;
      throw new SandeshaException (message);
    }
   
View Full Code Here

    return completedMsgList;
  }
 
  public static ArrayList getServerCompletedMessagesList (String sequenceID,SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
       
    SequencePropertyBean completedMessagesBean = null;

    completedMessagesBean = seqPropMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES);
   
    ArrayList completedMsgList = null;
    if (completedMessagesBean!=null) {
      completedMsgList = SandeshaUtil.getArrayListFromMsgsString (completedMessagesBean.getValue());
    } else {
      String message = "Completed messages bean is null, for the sequence " + sequenceID;
      throw new SandeshaException (message);
    }
   
View Full Code Here

TOP

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

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.