Examples of RMMsgContext


Examples of org.apache.sandesha2.RMMsgContext

      wireSeqId = rmBean.getSequenceID();
    }
   
    MessageContext referenceMessage = storageManager.retrieveMessageContext(referenceMsgKey,context);
    if(referenceMessage!=null){
      RMMsgContext referenceRMMessage = MsgInitializer.initializeMessage(referenceMessage);
      RMMsgContext makeConnectionRMMessage = RMMsgCreator.createMakeConnectionMessage(referenceRMMessage,
          rmBean, wireSeqId, wireAddress, storageManager);
     
     
      //we must set serverSide to false. Having serverSide as true (I.e. when polling for RMD) will cause the SenderWorker to ignore
      //the sync response message.
      makeConnectionRMMessage.getMessageContext().setServerSide(false);
     
      // Store properties so that we know which sequence we are polling for. This can be used
      // to match reply sequences up to requests, as well as to help process messagePending
      // headers.
      OperationContext ctx = makeConnectionRMMessage.getMessageContext().getOperationContext();
      ctx.setProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY, entry);
     
      makeConnectionRMMessage.setProperty(MessageContext.TRANSPORT_IN,null);
      //storing the MakeConnection message.
      String makeConnectionMsgStoreKey = SandeshaUtil.getUUID();
     
      //add an entry for the MakeConnection message to the sender (with ,send=true, resend=false)
      SenderBean makeConnectionSenderBean = new SenderBean ();
      makeConnectionSenderBean.setInternalSequenceID(internalSeqId);
      makeConnectionSenderBean.setMessageContextRefKey(makeConnectionMsgStoreKey);
      makeConnectionSenderBean.setMessageID(makeConnectionRMMessage.getMessageId());
      makeConnectionSenderBean.setMessageType(Sandesha2Constants.MessageTypes.MAKE_CONNECTION_MSG);
      makeConnectionSenderBean.setReSend(false);
      makeConnectionSenderBean.setSend(true);
      makeConnectionSenderBean.setSequenceID(rmBean.getSequenceID());
      EndpointReference to = makeConnectionRMMessage.getTo();
      if (to!=null)
        makeConnectionSenderBean.setToAddress(to.getAddress());

      SenderBeanMgr senderBeanMgr = storageManager.getSenderBeanMgr();
     
      //this message should not be sent until it is qualified. I.e. till it is sent through the Sandesha2TransportSender.
      makeConnectionRMMessage.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING, Sandesha2Constants.VALUE_FALSE);
     
      SandeshaUtil.executeAndStore(makeConnectionRMMessage, makeConnectionMsgStoreKey);
     
      senderBeanMgr.insert(makeConnectionSenderBean);     
    }
View Full Code Here

Examples of org.apache.sandesha2.RMMsgContext

            if (log.isDebugEnabled())
              log.debug("Exit: CreateSeqMsgProcessor::processInMessage " + Boolean.FALSE);       
            return false;
          }
         
          RMMsgContext requestSideRefRMMessage = MsgInitializer.initializeMessage(requestSideRefMessage);
          TerminateManager.addTerminateSequenceMessage(requestSideRefRMMessage, rmsBean.getInternalSequenceID(), rmsBean.getSequenceID(), storageManager);
        }
      }
       

      MessageContext outMessage = null;
 
      // Create the new sequence id, as well as establishing the beans that handle the
      // sequence state.
      RMDBean rmdBean = SequenceManager.setupNewSequence(createSeqRMMsg, storageManager, secManager, token);
       
      RMMsgContext createSeqResponse = RMMsgCreator.createCreateSeqResponseMsg(createSeqRMMsg, rmdBean);
      outMessage = createSeqResponse.getMessageContext();
      // Set a message ID for this Create Sequence Response message
      outMessage.setMessageID(SandeshaUtil.getUUID());
       
      createSeqResponse.setFlow(MessageContext.OUT_FLOW);
 
      // for making sure that this won't be processed again
      createSeqResponse.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE, "true");
     
      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) {
          if (log.isDebugEnabled())
            log.debug(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noAcceptPart));
          FaultManager.makeCreateSequenceRefusedFault(createSeqRMMsg,
                                                      SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noAcceptPart),
                                                      new Exception());
          // Return false if an Exception hasn't been thrown.
          if (log.isDebugEnabled())
            log.debug("Exit: CreateSeqMsgProcessor::processInMessage " + Boolean.FALSE);       
          return false;
        }
 
        // offered seq id
        String offeredSequenceID = offer.getIdentifer().getIdentifier();
       
        boolean offerEcepted = offerAccepted(offeredSequenceID, context, createSeqRMMsg, storageManager);
 
        if (offerEcepted) {
          // Setting the CreateSequence table entry for the outgoing
          // side.
          RMSBean rMSBean = new RMSBean();
          rMSBean.setSequenceID(offeredSequenceID);
          String outgoingSideInternalSequenceId = SandeshaUtil
              .getOutgoingSideInternalSequenceID(rmdBean.getSequenceID());
          rMSBean.setInternalSequenceID(outgoingSideInternalSequenceId);
          // this is a dummy value
          rMSBean.setCreateSeqMsgID(SandeshaUtil.getUUID());
           
          rMSBean.setToEPR(rmdBean.getToEPR());
          rMSBean.setAcksToEPR(rmdBean.getToEPR())// The acks need to flow back into this endpoint
          rMSBean.setReplyToEPR(rmdBean.getReplyToEPR());
          rMSBean.setLastActivatedTime(System.currentTimeMillis());
          rMSBean.setRMVersion(rmdBean.getRMVersion());
          rMSBean.setClientCompletedMessages(new RangeString());
 
          // 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.
           
          Endpoint endpoint = offer.getEndpoint();
          if (endpoint!=null) {
            // setting the OfferedEndpoint
            rMSBean.setOfferedEndPoint(endpoint.getEPR().getAddress());
          }
   
          rmdBean.setOutboundInternalSequence(outgoingSideInternalSequenceId);
          RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
          rmdBeanMgr.update(rmdBean);
 
          // Store the inbound token (if any) with the new sequence
          rMSBean.setSecurityTokenData(rmdBean.getSecurityTokenData());
         
          // If this new sequence has anonymous acksTo, then we must poll for the acks
          // If the inbound sequence is targetted at the WSRM anonymous URI, we need to start
          // polling for this sequence.
          String acksTo = rMSBean.getAcksToEPR();
          EndpointReference reference = new EndpointReference(acksTo);
          if ((acksTo == null || reference.hasAnonymousAddress()) &&
            Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(createSeqRMMsg.getRMSpecVersion())) {
            rMSBean.setPollingMode(true);
          }
         
          // Set the SOAP Version for this sequence.
          rMSBean.setSoapVersion(SandeshaUtil.getSOAPVersion(createSeqRMMsg.getSOAPEnvelope()));

          storageManager.getRMSBeanMgr().insert(rMSBean);
         
          SandeshaUtil.startWorkersForSequence(context, rMSBean);
         
        } else {
          // removing the accept part.
          createSeqResPart.setAccept(null);
          createSeqResponse.addSOAPEnvelope();
        }
      }
             
      //TODO add createSequenceResponse message as the referenceMessage to the RMDBean.
 
View Full Code Here

Examples of org.apache.sandesha2.RMMsgContext

   *
   * @return
   * @throws SandeshaException
   */
  public static RMMsgContext initializeMessage(MessageContext ctx) throws AxisFault {
    RMMsgContext rmMsgCtx = new RMMsgContext(ctx);

    populateRMMsgContext(ctx, rmMsgCtx);
    validateMessage(rmMsgCtx);
    return rmMsgCtx;
  }
View Full Code Here

Examples of org.apache.sandesha2.RMMsgContext

    }

    rmdBean.setClosed(true);
    storageManager.getRMDBeanMgr().update(rmdBean);

    RMMsgContext ackRMMsgCtx = AcknowledgementManager.generateAckMessage(rmMsgCtx, rmdBean, sequenceId, storageManager, true);
    // adding the ack part(s) to the envelope.
    Iterator sequenceAckIter = ackRMMsgCtx
        .getMessageParts(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);

    MessageContext closeSequenceMsg = rmMsgCtx.getMessageContext();

    RMMsgContext closeSeqResponseRMMsg = RMMsgCreator.createCloseSeqResponseMsg(rmMsgCtx, rmdBean);
    MessageContext closeSequenceResponseMsg = closeSeqResponseRMMsg.getMessageContext();

    while (sequenceAckIter.hasNext()) {
      SequenceAcknowledgement sequenceAcknowledgement = (SequenceAcknowledgement) sequenceAckIter.next();
      closeSeqResponseRMMsg.setMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT,
          sequenceAcknowledgement);
    }
   
    closeSeqResponseRMMsg.setFlow(MessageContext.OUT_FLOW);
    closeSeqResponseRMMsg.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE, "true");

    closeSequenceResponseMsg.setResponseWritten(true);

    closeSeqResponseRMMsg.addSOAPEnvelope();
   
    //
    // Now that we have generated the message we can commit the transaction
    //
    if(transaction != null && transaction.isActive()) {
View Full Code Here

Examples of org.apache.sandesha2.RMMsgContext

        }
      }
    }
   
    // Check if this is an application message and if it is a duplicate
    RMMsgContext rmMsgCtx = MsgInitializer.initializeMessage(msgContext);

    // Set the RMMMessageContext as a property on the message so we can retrieve it later
    msgContext.setProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT, rmMsgCtx);

   
    StorageManager storageManager =
      SandeshaUtil.getSandeshaStorageManager(rmMsgCtx.getConfigurationContext(),
          rmMsgCtx.getConfigurationContext().getAxisConfiguration());
   
    //processing any incoming faults.    
    //This is responsible for Sandesha2 specific
    InvocationResponse response = FaultManager.processMessagesForFaults(rmMsgCtx, storageManager);

    //both application msgs and lastMsg msgs will be processed in the same way here.
    if (rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.APPLICATION ||
        rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.LAST_MESSAGE) {
      processApplicationMessage(rmMsgCtx);
    }
   
    if (log.isDebugEnabled())
      log.debug("Exit: SandeshaGlobalInHandler::invoke " + response);
View Full Code Here

Examples of org.apache.sandesha2.RMMsgContext

            if(acksTo == null || acksToEPR.hasAnonymousAddress())
              sendAck = true;
          }
         
          if(sendAck) {
            RMMsgContext rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);
            RMMsgContext ackRMMsgCtx = AcknowledgementManager.generateAckMessage(
                rmMsgCtx, inbound, inbound.getSequenceID(), storageManager, true);
            AcknowledgementManager.sendAckNow(ackRMMsgCtx);
            msgCtx.getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN, "true");
            t.signalResponseReady();
          } else {
View Full Code Here

Examples of org.apache.sandesha2.RMMsgContext

  public AxisService findService(MessageContext msgContext) throws AxisFault {
    // TODO Auto-generated method stub
   
   
    ConfigurationContext configurationContext = msgContext.getConfigurationContext();
    RMMsgContext rmmsgContext = MsgInitializer.initializeMessage(msgContext);
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration());
   
    Transaction transaction = storageManager.getTransaction();
   
    AxisService service;
    try {
      String sequenceID = (String) rmmsgContext
          .getProperty(Sandesha2Constants.MessageContextProperties.SEQUENCE_ID);
      service = null;
      if (sequenceID != null) {

        //If this is the RMD of the sequence
View Full Code Here

Examples of org.apache.sandesha2.RMMsgContext

        log.debug("Exit: TerminateSeqMsgProcessor::processInMessage, unknown sequence");
      return false;
    }

    // add the terminate sequence response if required.
    RMMsgContext terminateSequenceResponse = null;
    if (SpecSpecificConstants.isTerminateSequenceResponseRequired(terminateSeqRMMsg.getRMSpecVersion()))
      terminateSequenceResponse = getTerminateSequenceResponse(terminateSeqRMMsg, rmdBean, sequenceId, storageManager);

    setUpHighestMsgNumbers(context, storageManager, sequenceId, terminateSeqRMMsg);
   
   
   
    boolean inOrderInvocation = SandeshaUtil.getDefaultPropertyBean(context.getAxisConfiguration()).isInOrder();
   
   
    //if the invocation is inOrder and if this is RM 1.1 there is a posibility of all the messages having eleady being invoked.
    //In this case we should do the full termination.
   
    boolean doFullTermination = false;
   
    if (inOrderInvocation) {

      long highestMsgNo = rmdBean.getHighestInMessageNumber();
      long nextMsgToProcess = rmdBean.getNextMsgNoToProcess();
     
      if (nextMsgToProcess>highestMsgNo) {
        //all the messages have been invoked, u can do the full termination
        doFullTermination = true;
      }
    } else {
      //for not-inorder case, always do the full termination.
      doFullTermination = true;
    }
   
    if (doFullTermination) {
      TerminateManager.cleanReceivingSideAfterInvocation(sequenceId, storageManager);
      TerminateManager.cleanReceivingSideOnTerminateMessage(context, sequenceId, storageManager);
    } else
      TerminateManager.cleanReceivingSideOnTerminateMessage(context, sequenceId, storageManager);

    rmdBean.setTerminated(true);   
    rmdBean.setLastActivatedTime(System.currentTimeMillis());
    storageManager.getRMDBeanMgr().update(rmdBean);


    //sending the terminate sequence response
    if (terminateSequenceResponse != null) {
      //
      // As we have processed the input and prepared the response we can commit the
      // transaction now.
      if(transaction != null && transaction.isActive()) transaction.commit();
     
      MessageContext outMessage = terminateSequenceResponse.getMessageContext();
      EndpointReference toEPR = outMessage.getTo();
     
      AxisEngine engine = new AxisEngine(terminateSeqMsg.getConfigurationContext());
           
      outMessage.setServerSide(true);
           
      try {             
        engine.send(outMessage);
      } catch (AxisFault e) {
        if (log.isDebugEnabled())
          log.debug("Unable to send terminate sequence response", e);
       
        throw new SandeshaException(
            SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotSendTerminateResponse), e);
      }
     
      if (toEPR.hasAnonymousAddress()) {
        terminateSeqMsg.getOperationContext().setProperty(
            org.apache.axis2.Constants.RESPONSE_WRITTEN, "true");
      } else {
        terminateSeqMsg.getOperationContext().setProperty(
            org.apache.axis2.Constants.RESPONSE_WRITTEN, "false");
      }

    } else {
      //if RM 1.0 Anonymous scenario we will be trying to attache the TerminateSequence of the response side
      //as the response message.
     
      String outgoingSideInternalSeqId = SandeshaUtil.getOutgoingSideInternalSequenceID(sequenceId);
      SenderBean senderFindBean = new SenderBean ();
      senderFindBean.setInternalSequenceID(outgoingSideInternalSeqId);
      senderFindBean.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);
      senderFindBean.setSend(true);
      senderFindBean.setReSend(false);
     
      SenderBean outgoingSideTerminateBean = storageManager.getSenderBeanMgr().findUnique(senderFindBean);
      if (outgoingSideTerminateBean!=null) {
     
        EndpointReference toEPR = new EndpointReference (outgoingSideTerminateBean.getToAddress());
        if (toEPR.hasAnonymousAddress()) {
          String messageKey = outgoingSideTerminateBean
              .getMessageContextRefKey();
          MessageContext message = storageManager
              .retrieveMessageContext(messageKey, context);

          RMMsgContext rmMessage = MsgInitializer.initializeMessage(message);
         
          // attaching the this outgoing terminate message as the
          // response to the incoming terminate message.
          message.setTransportOut(terminateSeqMsg.getTransportOut());
          message.setProperty(MessageContext.TRANSPORT_OUT,terminateSeqMsg.getProperty(MessageContext.TRANSPORT_OUT));
View Full Code Here

Examples of org.apache.sandesha2.RMMsgContext

      StorageManager storageManager) throws AxisFault {

    if (log.isDebugEnabled())
      log.debug("Enter: TerminateSeqMsgProcessor::addTerminateSequenceResponse, " + sequenceId);

    RMMsgContext terminateSeqResponseRMMsg = RMMsgCreator.createTerminateSeqResponseMsg(terminateSeqRMMsg, rmdBean);
    MessageContext outMessage = terminateSeqResponseRMMsg.getMessageContext();

    RMMsgContext ackRMMessage = AcknowledgementManager.generateAckMessage(terminateSeqRMMsg, rmdBean,
        sequenceId,  storageManager, true);
   
    // copy over the ack parts
    Iterator iter = ackRMMessage.getMessageParts(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
    while (iter.hasNext()) {
      SequenceAcknowledgement seqAck = (SequenceAcknowledgement) iter.next();
      terminateSeqResponseRMMsg.setMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT, seqAck);
    }
   
View Full Code Here

Examples of org.apache.sandesha2.RMMsgContext

  private static final Log log = LogFactory.getLog(RMMessageReceiver.class);
 
  public final void receive(MessageContext msgCtx) throws AxisFault {
    if(log.isDebugEnabled()) log.debug("Entry: RMMessageReceiver::receive");
   
    RMMsgContext rmMsgCtx = null;
   
    if (msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT) != null)
      rmMsgCtx = (RMMsgContext)msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT);
    else
      rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);
   
    if(log.isDebugEnabled()) log.debug("MsgReceiver got type: " + SandeshaUtil.getMessageTypeString(rmMsgCtx.getMessageType()))

    // Note that some messages (such as stand-alone acks) will be routed here, but
    // the headers will already have been processed. Therefore we should not assume
    // that we will have a MsgProcessor every time.
    MsgProcessor msgProcessor = MsgProcessorFactory.getMessageProcessor(rmMsgCtx);
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.