Package org.apache.sandesha2.storage.beanmanagers

Examples of org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr


  private long getPreviousMsgNo(ConfigurationContext context,
      String internalSequenceId) throws SandeshaException {

    //retrieving the storage managers
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
   
    SequencePropertyBean nextMsgNoBean = seqPropMgr.retrieve(
        internalSequenceId,Sandesha2Constants.SequenceProperties.NEXT_MESSAGE_NUMBER);
   
    long nextMsgNo = -1;
    if (nextMsgNoBean != null) {
      Long nextMsgNoLng = new Long(nextMsgNoBean.getValue());
View Full Code Here


      String message = "Message number '" + msgNo + "' is invalid. Has to be larger than zero.";
      throw new SandeshaException (message);
    }
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
   
    SequencePropertyBean nextMsgNoBean = seqPropMgr.retrieve(
        internalSequenceId,Sandesha2Constants.SequenceProperties.NEXT_MESSAGE_NUMBER);

    boolean update = true;
    if (nextMsgNoBean == null) {
      update = false;
      nextMsgNoBean = new SequencePropertyBean();
      nextMsgNoBean.setSequenceID(internalSequenceId);
      nextMsgNoBean.setName(Sandesha2Constants.SequenceProperties.NEXT_MESSAGE_NUMBER);
    }

    nextMsgNoBean.setValue(new Long(msgNo).toString());
    if (update)
      seqPropMgr.update(nextMsgNoBean);
    else
      seqPropMgr.insert(nextMsgNoBean);

 
View Full Code Here

   
    SequenceReport sequenceReport = new SequenceReport ();
    sequenceReport.setSequenceDirection(SequenceReport.SEQUENCE_DIRECTION_OUT);
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
    CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();
   
    Transaction reportTransaction = storageManager.getTransaction();
   
    sequenceReport.setInternalSequenceID(internalSequenceID);
View Full Code Here

   * @throws SandeshaException
   */
  public static SandeshaReport getSandeshaReport (ConfigurationContext configurationContext) throws SandeshaException {
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
    SandeshaReport sandeshaReport = new SandeshaReport ();
    SequencePropertyBean internalSequenceFindBean = new SequencePropertyBean ();
    internalSequenceFindBean.setName(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
    Collection collection = seqPropMgr.find(internalSequenceFindBean);
    Iterator iterator = collection.iterator();
    while (iterator.hasNext()) {
      SequencePropertyBean bean = (SequencePropertyBean) iterator.next();
      String sequenceID = bean.getSequenceID();
      sandeshaReport.addToOutgoingSequenceList (sequenceID);
      sandeshaReport.addToOutgoingInternalSequenceMap(sequenceID,bean.getValue());
     
      SequenceReport report = getOutgoingSequenceReport(bean.getValue(),configurationContext);
     
      sandeshaReport.addToNoOfCompletedMessagesMap(sequenceID ,report.getCompletedMessages().size());
      sandeshaReport.addToSequenceStatusMap(sequenceID ,report.getSequenceStatus());
    }
   
   
    //incoming sequences
    SequencePropertyBean serverCompletedMsgsFindBean = new SequencePropertyBean ();
    serverCompletedMsgsFindBean.setName(Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES);
   
    Collection serverCompletedMsgsBeans = seqPropMgr.find(serverCompletedMsgsFindBean);
    Iterator iter = serverCompletedMsgsBeans.iterator();
    while (iter.hasNext()) {
      SequencePropertyBean serverCompletedMsgsBean = (SequencePropertyBean) iter.next();
      String sequenceID = serverCompletedMsgsBean.getSequenceID();
      sandeshaReport.addToIncomingSequenceList(sequenceID);
View Full Code Here

      throw new SandeshaException ("Sequence is not in a active state. Either create sequence response has not being received or sequence has been terminated," +
                     " cannot get sequenceID");
    }
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
   
    SequencePropertyBean sequenceIDBean = seqPropMgr.retrieve(internalSequenceID,Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID);
    if (sequenceIDBean==null)
      throw new SandeshaException ("SequenceIdBean is not set");
   
    String sequenceID = sequenceIDBean.getValue();
    return sequenceID;
View Full Code Here

      throw new SandeshaException ("Cannot generate the sequence report for the given internalSequenceID");
    if (sequenceReport.getSequenceStatus()!=SequenceReport.SEQUENCE_STATUS_ESTABLISHED)
      throw new SandeshaException ("Canot close the sequence since it is not active");
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
    SequencePropertyBean sequenceIDBean = seqPropMgr.retrieve(internalSequenceID,Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID);
    if (sequenceIDBean==null)
      throw new SandeshaException ("SequenceIdBean is not set");
   
    String sequenceID = sequenceIDBean.getValue();
View Full Code Here

    }
  }
 
  private static byte getServerSequenceStatus (String sequenceID,StorageManager storageManager) throws SandeshaException {
   
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
   
    SequencePropertyBean terminatedBean = seqPropMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TERMINATED);
    if (terminatedBean!=null) {
      return SequenceReport.SEQUENCE_STATUS_TERMINATED;
    }
   
    SequencePropertyBean timedOutBean = seqPropMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TIMED_OUT);
    if (timedOutBean!=null) {
      return SequenceReport.SEQUENCE_STATUS_TIMED_OUT;
    }
   
    NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();
View Full Code Here

  }
 
  private static SequenceReport getIncomingSequenceReport (String sequenceID,ConfigurationContext configCtx) throws SandeshaException {
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
   
    SequenceReport sequenceReport = new SequenceReport ();

    ArrayList completedMessageList =  AcknowledgementManager.getServerCompletedMessagesList (sequenceID,seqPropMgr);
View Full Code Here

      throw new SandeshaException ("Cannot generate the sequence report for the given internalSequenceID");
    if (sequenceReport.getSequenceStatus()!=SequenceReport.SEQUENCE_STATUS_ESTABLISHED)
      throw new SandeshaException ("Canot terminate the sequence since it is not active");
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
    SequencePropertyBean sequenceIDBean = seqPropMgr.retrieve(internalSequenceID,Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID);
    if (sequenceIDBean==null)
      throw new SandeshaException ("SequenceIdBean is not set");
   
    String sequenceID = sequenceIDBean.getValue();
View Full Code Here

          .getSandeshaStorageManager(configurationContext);
    } catch (SandeshaException e) {
      e.printStackTrace();
    }

    SequencePropertyBeanMgr seqPropMgr = storageManager
        .getSequencePropretyBeanMgr();

    SequencePropertyBean receivedMsgBean = new SequencePropertyBean(
        sequenceId, Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES, "");
   
   
    //setting the addressing version
    String addressingNamespaceValue = createSequenceMsg.getAddressingNamespaceValue();
    SequencePropertyBean addressingNamespaceBean = new SequencePropertyBean (
        sequenceId,Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE,addressingNamespaceValue);
    seqPropMgr.insert(addressingNamespaceBean);
   
    String anonymousURI = SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespaceValue);
   
    //If no replyTo value. Send responses as sync.
    SequencePropertyBean toBean = null;
    if (replyTo!=null) {
      toBean = new SequencePropertyBean(sequenceId,
        Sandesha2Constants.SequenceProperties.TO_EPR, replyTo.getAddress());
    }else {
      toBean = new SequencePropertyBean(sequenceId,
          Sandesha2Constants.SequenceProperties.TO_EPR, anonymousURI);
    }
   
    SequencePropertyBean replyToBean = new SequencePropertyBean(sequenceId,
        Sandesha2Constants.SequenceProperties.REPLY_TO_EPR, to.getAddress());
    SequencePropertyBean acksToBean = new SequencePropertyBean(sequenceId,
        Sandesha2Constants.SequenceProperties.ACKS_TO_EPR, acksTo.getAddress());

   
    seqPropMgr.insert(receivedMsgBean);
    seqPropMgr.insert(replyToBean);
    seqPropMgr.insert(acksToBean);
   
    if (toBean!=null)
      seqPropMgr.insert(toBean);

    NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();
    nextMsgMgr.insert(new NextMsgBean(sequenceId, 1)); // 1 will be the next
   
    // message to invoke. This will apply for only in-order invocations.

    SandeshaUtil.startSenderForTheSequence(configurationContext,sequenceId);
   
    //stting the RM SPEC version for this sequence.
    String createSequenceMsgAction = createSequenceMsg.getWSAAction();
    if (createSequenceMsgAction==null)
        throw new SandeshaException ("Create sequence message does not have the WSA:Action value");
   
    String messageRMNamespace = createSequence.getNamespaceValue();
   
    String specVersion = null;
    if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(messageRMNamespace)) {
      specVersion = Sandesha2Constants.SPEC_VERSIONS.v1_0;
    }else if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(messageRMNamespace)) {
      specVersion = Sandesha2Constants.SPEC_VERSIONS.v1_1;
    } else {
      throw new SandeshaException ("Create sequence message does not has a valid RM namespace value. Cant decide the RM version");
    }
   
    SequencePropertyBean specVerionBean = new SequencePropertyBean ();
    specVerionBean.setSequenceID(sequenceId);
    specVerionBean.setName(Sandesha2Constants.SequenceProperties.RM_SPEC_VERSION);
    specVerionBean.setValue(specVersion);
   
    seqPropMgr.insert(specVerionBean);
   
    //TODO get the SOAP version from the create seq message.
   
    return sequenceId;
  }
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr

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.