Examples of SequencePropertyBeanMgr


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

      }

      StorageManager storageManager = SandeshaUtil
          .getSandeshaStorageManager(rmMsgContext.getMessageContext()
              .getConfigurationContext());
      SequencePropertyBeanMgr seqPropMgr = storageManager
          .getSequencePropretyBeanMgr();
      SequencePropertyBean receivedMsgsBean = seqPropMgr.retrieve(
          sequenceId, Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES);
      String receivedMsgStr = (String) receivedMsgsBean.getValue();

      ApplicationMsgProcessor ackProcessor = new ApplicationMsgProcessor();
      //Even though the duplicate message is dropped, hv to send the ack if needed.
View Full Code Here

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

        NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();

        InvokerBeanMgr storageMapMgr = storageManager
            .getStorageMapBeanMgr();

        SequencePropertyBeanMgr sequencePropMgr = storageManager
            .getSequencePropretyBeanMgr();

        Transaction preInvocationTransaction = storageManager.getTransaction();
       
        //Getting the incomingSequenceIdList
        SequencePropertyBean allSequencesBean = (SequencePropertyBean) sequencePropMgr
            .retrieve(
                Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,
                Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
        if (allSequencesBean == null)
          continue;

        ArrayList allSequencesList = SandeshaUtil.getArrayListFromString (allSequencesBean
            .getValue());
       
        preInvocationTransaction.commit();
       
        Iterator allSequencesItr = allSequencesList.iterator();

        currentIteration: while (allSequencesItr.hasNext()) {

          String sequenceId = (String) allSequencesItr.next();
         
          Transaction invocationTransaction = storageManager.getTransaction();   //Transaction based invocation
         
          NextMsgBean nextMsgBean = nextMsgMgr.retrieve(sequenceId);
          if (nextMsgBean == null) {

            String message = "Next message not set correctly. Removing invalid entry.";
            log.debug(message);
            allSequencesItr.remove();
           
            //cleaning the invalid data of the all sequences.
            allSequencesBean.setValue(allSequencesList.toString());
            sequencePropMgr.update(allSequencesBean)
           
            throw new SandeshaException (message);
          }

          long nextMsgno = nextMsgBean.getNextMsgNoToProcess();
View Full Code Here

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

      return;
    }
   
    ConfigurationContext context = terminateSeqMsg.getConfigurationContext();
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();

    Transaction terminateReceivedTransaction = storageManager.getTransaction();
    SequencePropertyBean terminateReceivedBean = new SequencePropertyBean ();
    terminateReceivedBean.setSequenceID(sequenceId);
    terminateReceivedBean.setName(Sandesha2Constants.SequenceProperties.TERMINATE_RECEIVED);
    terminateReceivedBean.setValue("true");
   
    sequencePropertyBeanMgr.insert(terminateReceivedBean);
   
    //add the terminate sequence response if required.
    if (SpecSpecificConstants.isTerminateSequenceResponseRequired (terminateSeqRMMsg.getRMSpecVersion()))
      addTerminateSequenceResponse (terminateSeqRMMsg,sequenceId);
   
    setUpHighestMsgNumbers(context,storageManager,sequenceId,terminateSeqRMMsg);
   
    terminateReceivedTransaction.commit();
   
    Transaction terminateTransaction = storageManager.getTransaction();
    TerminateManager.cleanReceivingSideOnTerminateMessage(context,sequenceId);
   
   
    SequencePropertyBean terminatedBean = new SequencePropertyBean (
             sequenceId,Sandesha2Constants.SequenceProperties.SEQUENCE_TERMINATED,Sandesha2Constants.VALUE_TRUE);
   
    sequencePropertyBeanMgr.insert(terminatedBean);
   
   
    terminateTransaction.commit();
   
    //removing an entry from the listener
View Full Code Here

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

    terminateSeqRMMsg.pause();
  }

  private void setUpHighestMsgNumbers (ConfigurationContext configCtx, StorageManager storageManager, String sequenceID, RMMsgContext terminateRMMsg) throws SandeshaException {
   
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
   
    String highestImMsgNumberStr = SandeshaUtil.getSequenceProperty(sequenceID,Sandesha2Constants.SequenceProperties.HIGHEST_IN_MSG_NUMBER,configCtx);
    String highestImMsgKey = SandeshaUtil.getSequenceProperty(sequenceID,Sandesha2Constants.SequenceProperties.HIGHEST_IN_MSG_KEY,configCtx);
   
    long highestInMsgNo = 0;
    if (highestImMsgNumberStr!=null) {
      if (highestImMsgKey==null)
        throw new SandeshaException ("Key of the highest message number has not been stored");
     
      highestInMsgNo = Long.parseLong(highestImMsgNumberStr);
    }
   
    //following will be valid only for the server side, since the obtained int. seq ID is only valid there.
    String responseSideInternalSequenceID = SandeshaUtil.getOutgoingSideInternalSequenceID(sequenceID);
   
    long highestOutMsgNo = 0;
    try {
      boolean addResponseSideTerminate = false;
      if (highestInMsgNo==0) {
        addResponseSideTerminate=false;
      } else {
       
        //setting the last in message property
        SequencePropertyBean lastInMsgBean = new SequencePropertyBean (
            sequenceID,Sandesha2Constants.SequenceProperties.LAST_IN_MESSAGE_NO,highestImMsgNumberStr);
        seqPropMgr.insert(lastInMsgBean);
       
        MessageContext highestInMsg = storageManager.retrieveMessageContext(highestImMsgKey,configCtx);
        MessageContext highestOutMessage = highestInMsg.getOperationContext().getMessageContext(OperationContextFactory.MESSAGE_LABEL_OUT_VALUE);
       
        if (highestOutMessage!=null) {
          RMMsgContext highestOutRMMsg = MsgInitializer.initializeMessage(highestOutMessage);
          Sequence seqPartOfOutMsg = (Sequence) highestOutRMMsg.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
       
          if (seqPartOfOutMsg!=null) {
           
            //response message of the last in message can be considered as the last out message.
            highestOutMsgNo = seqPartOfOutMsg.getMessageNumber().getMessageNumber();
            SequencePropertyBean highestOutMsgBean = new SequencePropertyBean (
                responseSideInternalSequenceID,
                Sandesha2Constants.SequenceProperties.LAST_OUT_MESSAGE_NO,
                new Long(highestOutMsgNo).toString() );
         
            seqPropMgr.insert(highestOutMsgBean);
            addResponseSideTerminate = true;
          }
        }
      }
     
View Full Code Here

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

    ConfigurationContext configurationContext = msgContext.getConfigurationContext();
    Options options = msgContext.getOptions();
   
    StorageManager storageManager = SandeshaUtil
        .getSandeshaStorageManager(configurationContext);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
   
    String toAddress = rmMsgCtx.getTo().getAddress();
    String sequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
        String internalSeqenceID = SandeshaUtil.getInternalSequenceID(toAddress,sequenceKey);
       
        String outSequenceID = SandeshaUtil.getSequenceProperty(internalSeqenceID,Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID,configurationContext);
        if (outSequenceID==null)
          throw new SandeshaException ("SequenceID was not found. Cannot send the terminate message");
       
    Transaction addTerminateSeqTransaction = storageManager.getTransaction();
   
    String terminated = SandeshaUtil.getSequenceProperty(outSequenceID,
        Sandesha2Constants.SequenceProperties.TERMINATE_ADDED,configurationContext);
   
   
   
    //registring an InOutOperationContext for this.
    //since the serviceContext.fireAndForget only sets a inOnly One
    //this does not work when there is a terminateSequnceResponse
    //TODO do processing of terminateMessagesCorrectly., create a new message instead of sendign the one given by the serviceClient
    //TODO important
    try {
      AxisOperation oldOPeration = msgContext.getAxisOperation();
      AxisOperation outInAxisOp = new OutInAxisOperation (new QName ("temp"));
      //setting flows
      outInAxisOp.setRemainingPhasesInFlow(oldOPeration.getRemainingPhasesInFlow());
     
      OperationContext opcontext = OperationContextFactory.createOperationContext(OperationContextFactory.MEP_CONSTANT_OUT_IN,outInAxisOp);
        opcontext.setParent(msgContext.getServiceContext());
      configurationContext.registerOperationContext(rmMsgCtx.getMessageId(),opcontext);
    } catch (AxisFault e1) {
      throw new SandeshaException ("Could not register an outInAxisOperation");
    }
   
    if (terminated != null
        && "true".equals(terminated)) {
      String message = "Terminate was added previously.";
      log.info(message);
      return;
    }

    TerminateSequence terminateSequencePart = (TerminateSequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
    terminateSequencePart.getIdentifier().setIndentifer(outSequenceID);
   
    rmMsgCtx.setFlow(MessageContext.OUT_FLOW);
    msgContext.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE,"true");
   
    rmMsgCtx.setTo(new EndpointReference(toAddress));
   
    String rmVersion = SandeshaUtil.getRMVersion(internalSeqenceID,configurationContext);
    if (rmVersion==null)
      throw new SandeshaException ("Cant find the rmVersion of the given message");
   
    rmMsgCtx.setWSAAction(SpecSpecificConstants.getTerminateSequenceAction(rmVersion));
    rmMsgCtx.setSOAPAction(SpecSpecificConstants.getTerminateSequenceSOAPAction(rmVersion));

    String transportTo = SandeshaUtil.getSequenceProperty(internalSeqenceID,Sandesha2Constants.SequenceProperties.TRANSPORT_TO,configurationContext);
    if (transportTo!=null) {
      rmMsgCtx.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
    }
   
    try {
      rmMsgCtx.addSOAPEnvelope();
    } catch (AxisFault e) {
      throw new SandeshaException(e.getMessage());
    }

    String key = SandeshaUtil.getUUID();
   
    SenderBean terminateBean = new SenderBean();
    terminateBean.setMessageContextRefKey(key);

   
    storageManager.storeMessageContext(key,msgContext);

   
    //Set a retransmitter lastSentTime so that terminate will be send with
    // some delay.
    //Otherwise this get send before return of the current request (ack).
    //TODO: refine the terminate delay.
    terminateBean.setTimeToSend(System.currentTimeMillis()
        + Sandesha2Constants.TERMINATE_DELAY);

    terminateBean.setMessageID(msgContext.getMessageID());
   
    //this will be set to true at the sender.
    terminateBean.setSend(true);
   
    msgContext.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING,
        Sandesha2Constants.VALUE_FALSE);
   
    terminateBean.setReSend(false);

    SenderBeanMgr retramsmitterMgr = storageManager
        .getRetransmitterBeanMgr();

    retramsmitterMgr.insert(terminateBean);
   
    SequencePropertyBean terminateAdded = new SequencePropertyBean();
    terminateAdded.setName(Sandesha2Constants.SequenceProperties.TERMINATE_ADDED);
    terminateAdded.setSequenceID(outSequenceID);
    terminateAdded.setValue("true");

   
    seqPropMgr.insert(terminateAdded);
   
    //This should be dumped to the storage by the sender
    TransportOutDescription transportOut = msgContext.getTransportOut();
    rmMsgCtx.setProperty(Sandesha2Constants.ORIGINAL_TRANSPORT_OUT_DESC,transportOut);
    rmMsgCtx.setProperty(Sandesha2Constants.MESSAGE_STORE_KEY,key);
View Full Code Here

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

    outMessage = Utils.createOutMessageContext(createSeqMsg)//createing a new response message.
   
    ConfigurationContext context = createSeqMsg.getConfigurationContext();
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
    Transaction createSequenceTransaction = storageManager.getTransaction();   //begining of a new transaction

    try {
      String newSequenceId = SequenceManager.setupNewSequence(createSeqRMMsg)//newly created sequnceID.
     
      RMMsgContext createSeqResponse = RMMsgCreator.createCreateSeqResponseMsg(
          createSeqRMMsg, outMessage,newSequenceId);    // converting the blank out message in to a create
                                                            // sequence response.
      createSeqResponse.setFlow(MessageContext.OUT_FLOW);
     
      createSeqResponse.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE,"true")//for making sure that this wont be processed again.
      CreateSequenceResponse createSeqResPart = (CreateSequenceResponse) createSeqResponse.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE);

     
      //OFFER PROCESSING
      SequenceOffer offer = createSeqPart.getSequenceOffer();
      if (offer != null) {
        Accept accept = createSeqResPart.getAccept();
        if (accept == null) {
          String message = "An accept part has not been generated for the create seq request with an offer part";
          log.debug(message);
          throw new SandeshaException(message);
        }

        String offeredSequenceID = offer.getIdentifer().getIdentifier(); //offered seq. id.
       
        boolean offerEcepted = offerAccepted (offeredSequenceID,context,createSeqRMMsg);
       
        if (offerEcepted)  {
          //Setting the CreateSequence table entry for the outgoing side.
          CreateSeqBean createSeqBean = new CreateSeqBean();
          createSeqBean.setSequenceID(offeredSequenceID);
          String outgoingSideInternalSequenceID = SandeshaUtil.getOutgoingSideInternalSequenceID(newSequenceId);
          createSeqBean.setInternalSequenceID(outgoingSideInternalSequenceID);
          createSeqBean.setCreateSeqMsgID(SandeshaUtil.getUUID()); //this is a dummy value.
       
          CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();
          createSeqMgr.insert(createSeqBean);
       
          //Setting sequence properties for the outgoing sequence.
          //Only will be used by the server side response path. Will be wasted properties for the client side.
       
          //setting the out_sequence_id
          SequencePropertyBean outSequenceBean = new SequencePropertyBean();
          outSequenceBean.setName(Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID);
          outSequenceBean.setValue(offeredSequenceID);
          outSequenceBean.setSequenceID(outgoingSideInternalSequenceID);
          seqPropMgr.insert(outSequenceBean);

          //setting the internal_sequence_id
          SequencePropertyBean internalSequenceBean = new SequencePropertyBean();
          internalSequenceBean.setName(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
          internalSequenceBean.setSequenceID(offeredSequenceID);
          internalSequenceBean.setValue(outgoingSideInternalSequenceID);
          seqPropMgr.insert(internalSequenceBean);
        } else {
          //removing the accept part.
          createSeqResPart.setAccept(null);
          createSeqResponse.addSOAPEnvelope();
        }
      }

      EndpointReference acksTo = createSeqPart.getAcksTo().getAddress().getEpr();
      if (acksTo == null || acksTo.getAddress() == null
          || acksTo.getAddress() == "") {
        String message = "Acks to not present in the create sequence message";
        log.debug(message);
        throw new AxisFault(message);
      }

      SequencePropertyBean acksToBean = new SequencePropertyBean(
          newSequenceId, Sandesha2Constants.SequenceProperties.ACKS_TO_EPR,acksTo.getAddress());

      seqPropMgr.insert(acksToBean);
     
      outMessage.setResponseWritten(true);

      //commiting tr. before sending the response msg.
      createSequenceTransaction.commit();
     
      Transaction updateLastActivatedTransaction = storageManager.getTransaction();
      SequenceManager.updateLastActivatedTime(newSequenceId,createSeqRMMsg.getMessageContext().getConfigurationContext());
      updateLastActivatedTransaction.commit();
     
      AxisEngine engine = new AxisEngine(context);
      engine.send(outMessage);
     
      SequencePropertyBean toBean = seqPropMgr.retrieve(newSequenceId,Sandesha2Constants.SequenceProperties.TO_EPR);
      if (toBean==null) {
        String message = "Internal Error: wsa:To value is not set";
        log.debug(message);
        throw new SandeshaException (message);
      }
View Full Code Here

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

   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx);
   
    Transaction closeSequenceTransaction = storageManager.getTransaction();
   
    SequencePropertyBeanMgr sequencePropMgr = storageManager.getSequencePropretyBeanMgr();
    SequencePropertyBean sequenceClosedBean = new SequencePropertyBean ();
    sequenceClosedBean.setSequenceID(sequenceID);
    sequenceClosedBean.setName(Sandesha2Constants.SequenceProperties.SEQUENCE_CLOSED);
    sequenceClosedBean.setValue(Sandesha2Constants.VALUE_TRUE);
   
    sequencePropMgr.insert(sequenceClosedBean);
   
    RMMsgContext ackRMMsgCtx = AcknowledgementManager.generateAckMessage(rmMsgCtx,sequenceID);
   
    MessageContext ackMsgCtx = ackRMMsgCtx.getMessageContext();
   
View Full Code Here

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

    removeReceivingSideProperties(configContext,sequenceID);
  }

  private static void removeReceivingSideProperties (ConfigurationContext configContext, String sequenceID) throws SandeshaException {
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();
    SequencePropertyBean allSequenceBean = sequencePropertyBeanMgr.retrieve(Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
   
    if (allSequenceBean!=null) {
      log.debug("AllSequence bean is null");
     
      ArrayList allSequenceList = SandeshaUtil.getArrayListFromString(allSequenceBean.getValue());
      allSequenceList.remove(sequenceID);
   
      //updating
      allSequenceBean.setValue(allSequenceList.toString());
      sequencePropertyBeanMgr.update(allSequenceBean);
    }
  }
View Full Code Here

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

   */
  public static void terminateSendingSide (ConfigurationContext configContext, String internalSequenceID,boolean serverSide) throws SandeshaException {
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
   
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
   
    SequencePropertyBean seqTerminatedBean = new SequencePropertyBean (internalSequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TERMINATED,Sandesha2Constants.VALUE_TRUE);
    seqPropMgr.insert(seqTerminatedBean);
   
    cleanSendingSideData(configContext,internalSequenceID,serverSide);
  }
View Full Code Here

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

  }
 
  public static void timeOutSendingSideSequence (ConfigurationContext context,String internalSequenceID, boolean serverside) throws SandeshaException {
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
   
    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
    SequencePropertyBean seqTerminatedBean = new SequencePropertyBean (internalSequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TIMED_OUT,Sandesha2Constants.VALUE_TRUE);
    seqPropMgr.insert(seqTerminatedBean);
   
    cleanSendingSideData(context,internalSequenceID,serverside);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.