Package org.apache.sandesha2.storage.beanmanagers

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


  public static String getSequenceIDFromInternalSequenceID(String internalSequenceID,
      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();
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;

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

      throws SandeshaException {

    ConfigurationContext configContext = rmMsgCtx.getMessageContext().getConfigurationContext();
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();
   
    String sequenceID = null;
   
    CreateSequence createSequence = (CreateSequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
    CreateSequenceResponse createSequenceResponse = (CreateSequenceResponse) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE);
    TerminateSequence terminateSequence = (TerminateSequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
    TerminateSequenceResponse terminateSequenceResponse = (TerminateSequenceResponse) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE);
    SequenceAcknowledgement sequenceAcknowledgement = (SequenceAcknowledgement) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
    Sequence sequence = (Sequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
    AckRequested ackRequest = (AckRequested) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.ACK_REQUEST);
    CloseSequence closeSequence = (CloseSequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE);
    CloseSequenceResponse closeSequenceResponse = (CloseSequenceResponse) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE_RESPONSE);
   
    //Setting message type.
    if (createSequence != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ);
    }else if (createSequenceResponse != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ_RESPONSE);
      sequenceID = createSequenceResponse.getIdentifier().getIdentifier();
    }else if (terminateSequence != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);
      sequenceID = terminateSequence.getIdentifier().getIdentifier();
    }else if (terminateSequenceResponse != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ_RESPONSE);
      sequenceID = terminateSequenceResponse.getIdentifier().getIdentifier();
    }else if (rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE) != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
      sequenceID = sequence.getIdentifier().getIdentifier();
    } else if (sequenceAcknowledgement != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.ACK);
      sequenceID = sequenceAcknowledgement.getIdentifier().getIdentifier();
    } else if (ackRequest != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.ACK_REQUEST);
      sequenceID = ackRequest.getIdentifier().getIdentifier();
    } else if (closeSequence != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CLOSE_SEQUENCE);
      sequenceID = closeSequence.getIdentifier().getIdentifier();
    } else if (closeSequenceResponse != null) {
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CLOSE_SEQUENCE_RESPONSE);
      sequenceID = closeSequenceResponse.getIdentifier().getIdentifier();
    } else
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.UNKNOWN);

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

    //deleting the create sequence entry.
    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);
     
    }

    offerProcessTransaction.commit();
   
View Full Code Here

   
    ConfigurationContext configurationContext = rmMessageContext.getConfigurationContext();
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext);

    SenderBeanMgr retransmitterBeanMgr = storageManager.getRetransmitterBeanMgr();
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();

    SenderBean findBean = new SenderBean();

    String sequnceID = SandeshaUtil.getSequenceIDFromRMMessage (rmMessageContext);
View Full Code Here

   
    MessageContext referenceMsg = referenceRMMessage.getMessageContext();
   
    ConfigurationContext configurationContext = referenceRMMessage.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();
View Full Code Here

   * @param sequenceID
   * @throws SandeshaException
   */
  public static void terminateAfterInvocation (ConfigurationContext configContext, String sequenceID) throws SandeshaException {
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();
    InvokerBeanMgr storageMapBeanMgr = storageManager.getStorageMapBeanMgr();

    //removing storageMap entries
    InvokerBean findStorageMapBean = new InvokerBean ();
    findStorageMapBean.setSequenceId(sequenceID);
    Collection collection = storageMapBeanMgr.find(findStorageMapBean);
    Iterator iterator = collection.iterator();
    while (iterator.hasNext()) {
      InvokerBean storageMapBean = (InvokerBean) iterator.next();
      storageMapBeanMgr.delete(storageMapBean.getKey());
    }
   
    SequencePropertyBean allSequenceBean = sequencePropertyBeanMgr.retrieve(Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
    ArrayList allSequenceList = (ArrayList) allSequenceBean.getValue();
   
    allSequenceList.remove(sequenceID);
  }
View Full Code Here

   * @param sequenceID
   * @throws SandeshaException
   */
  public static void terminateSendingSide (ConfigurationContext configContext, String sequenceID) throws SandeshaException {
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();
    SenderBeanMgr retransmitterBeanMgr = storageManager.getRetransmitterBeanMgr();
    CreateSeqBeanMgr createSeqBeanMgr = storageManager.getCreateSeqBeanMgr();
   
    SequencePropertyBean internalSequenceBean = sequencePropertyBeanMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
    if (internalSequenceBean==null)
      throw new SandeshaException ("TempSequence entry not found");
   
    String internalSequenceId = (String) internalSequenceBean.getValue();
   
    //removing retransmitterMgr entries
    SenderBean findRetransmitterBean = new SenderBean ();
    findRetransmitterBean.setInternalSequenceId(internalSequenceId);
    Collection collection = retransmitterBeanMgr.find(findRetransmitterBean);
    Iterator iterator = collection.iterator();
    while (iterator.hasNext()) {
      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);
    collection = sequencePropertyBeanMgr.find(findSequencePropertyBean1);
    iterator = collection.iterator();
    while (iterator.hasNext()) {
      SequencePropertyBean sequencePropertyBean = (SequencePropertyBean) iterator.next();
      sequencePropertyBeanMgr.delete(sequencePropertyBean.getSequenceId(),sequencePropertyBean.getName());
    }
   
    SequencePropertyBean findSequencePropertyBean2 = new SequencePropertyBean ();
    findSequencePropertyBean2.setSequenceId(internalSequenceId);
    collection = sequencePropertyBeanMgr.find(findSequencePropertyBean2);
    iterator = collection.iterator();
    while (iterator.hasNext()) {
      SequencePropertyBean sequencePropertyBean = (SequencePropertyBean) iterator.next();
      sequencePropertyBeanMgr.delete(sequencePropertyBean.getSequenceId(),sequencePropertyBean.getName());
    }
   
  }
View Full Code Here

        .getMessageContext().getConfigurationContext();
    StorageManager storageManager = SandeshaUtil
        .getSandeshaStorageManager(configurationContext);
    SenderBeanMgr retransmitterBeanMgr = storageManager
        .getRetransmitterBeanMgr();
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager
        .getSequencePropretyBeanMgr();

    SenderBean findBean = new SenderBean();

    Sequence sequence = (Sequence) applicationRMMsgContext
        .getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
    if (sequence == null)
      throw new SandeshaException(
          "Application message does not contain a sequence part");

    String sequenceId = sequence.getIdentifier().getIdentifier();

    SequencePropertyBean internalSequenceBean = sequencePropertyBeanMgr
        .retrieve(sequenceId,
            Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
    if (internalSequenceBean == null)
      throw new SandeshaException("Temp Sequence is not set");
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.