Package org.apache.sandesha2.wsrm

Examples of org.apache.sandesha2.wsrm.Identifier


    String rmVersion = rmsBean.getRMVersion();
    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmVersion);
   
    AckRequested ackRequest = new AckRequested(rmNamespaceValue)
   
    Identifier id = new Identifier(rmNamespaceValue);
    id.setIndentifer(sequenceId);
    ackRequest.setIdentifier(id);
    ackRequest.setMustUnderstand(true);
    applicationMsg.addAckRequested(ackRequest);

    if (applicationMsg.getWSAAction()==null) {
View Full Code Here


    MessageContext makeConnectionMessageCtx = SandeshaUtil.createNewRelatedMessageContext(referenceRMMessage,makeConnectionOperation);
    RMMsgContext makeConnectionRMMessageCtx = MsgInitializer.initializeMessage(makeConnectionMessageCtx);
   
    MakeConnection makeConnection = new MakeConnection();
    if (makeConnectionSeqId!=null) {
      Identifier identifier = new Identifier (rmNamespaceValue);
      identifier.setIndentifer(makeConnectionSeqId);
      makeConnection.setIdentifier(identifier);
    }
   
    if (makeConnectionAnonURI!=null) {
      makeConnection.setAddress(makeConnectionAnonURI);
View Full Code Here

    boolean continueSending = MessageRetransmissionAdjuster.adjustRetransmittion(
        rmMsgContext, senderBean, rmMsgContext.getConfigurationContext(), storageManager);
    if(!continueSending) return null;
   
    Identifier id = null;

    if(messageType == Sandesha2Constants.MessageTypes.APPLICATION ||
       messageType == Sandesha2Constants.MessageTypes.LAST_MESSAGE) {
     
      String namespace = SpecSpecificConstants.getRMNamespaceValue(rmVersion);
      Sequence sequence = rmMsgContext.getSequence();
      if(sequence == null) {
        sequence = new Sequence(namespace);
        sequence.setMessageNumber(senderBean.getMessageNumber());

        if(senderBean.isLastMessage() &&
            SpecSpecificConstants.isLastMessageIndicatorRequired(rmVersion)) {
          sequence.setLastMessage(true);
        }
       
        // We just create the id here, we will add the value in later
        id = new Identifier(namespace);
        sequence.setIdentifier(id);
        rmMsgContext.setSequence(sequence);
       
      }
     
    } else if(messageType == Sandesha2Constants.MessageTypes.TERMINATE_SEQ) {
      TerminateSequence terminate = rmMsgContext.getTerminateSequence();
      id = terminate.getIdentifier();

    } else if(messageType == Sandesha2Constants.MessageTypes.CLOSE_SEQUENCE) {
      CloseSequence close = rmMsgContext.getCloseSequence();
      id = close.getIdentifier();
   
    } else if(messageType == Sandesha2Constants.MessageTypes.ACK_REQUEST) {
      // The only time that we can have a message of this type is when we are sending a
      // stand-alone ack request, and in that case we only expect to find a single ack
      // request header in the message.
      Iterator<AckRequested> ackRequests = rmMsgContext.getAckRequests();
      AckRequested ackRequest = ackRequests.next();
      if (ackRequests.hasNext()) {
        throw new SandeshaException (SandeshaMessageHelper.getMessage(SandeshaMessageKeys.ackRequestMultipleParts));
      }
      id = ackRequest.getIdentifier();
    }
   
    // TODO consider adding an extra ack request, as we are about to send the message and we
    // know which sequence it is associated with.
   
    if(id != null && !senderBean.getSequenceID().equals(id.getIdentifier())) {
      id.setIndentifer(senderBean.getSequenceID());

      // Write the changes back into the message context
      rmMsgContext.addSOAPEnvelope();
    } else if(rmMsgContext.getProperty(RMMsgCreator.ACK_TO_BE_WRITTEN) != null){
      rmMsgContext.addSOAPEnvelope();
View Full Code Here

    }

    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);

    AckRequested ackRequested = new AckRequested(rmNamespaceValue);
    Identifier identifier = new Identifier(rmNamespaceValue);
    identifier.setIndentifer(sequenceID);
    ackRequested.setIdentifier(identifier);

    ackRequested.toHeader(dummyEnvelope.getHeader());

    return dummyEnvelope;
View Full Code Here

      }

      String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);

      CloseSequence closeSequence = new CloseSequence(rmNamespaceValue);
      Identifier identifier = new Identifier(rmNamespaceValue);
      identifier.setIndentifer(sequenceID);
      closeSequence.setIdentifier(identifier);
      if(closeSequence.isLastMsgNumberRequired(rmNamespaceValue)){
        LastMessageNumber lastMsgNumber = new LastMessageNumber(rmNamespaceValue);
        lastMsgNumber.setMessageNumber(SandeshaUtil.getLastMessageNumber(internalSequenceID, storageManager));
        closeSequence.setLastMessageNumber(lastMsgNumber);
View Full Code Here

      dummyEnvelope = factory.getDefaultEnvelope();
    }

    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);
    TerminateSequence terminateSequence = new TerminateSequence(rmNamespaceValue);
    Identifier identifier = new Identifier(rmNamespaceValue);
    identifier.setIndentifer(sequenceID);
    terminateSequence.setIdentifier(identifier);
    if(TerminateSequence.isLastMsgNumberRequired(rmNamespaceValue)){
      try
      {
        transaction = storageManager.getTransaction();
View Full Code Here

    try {

      MakeConnection makeConnection = rmMsgCtx.getMakeConnection();

      String address = makeConnection.getAddress();
      Identifier identifier = makeConnection.getIdentifier();

      // If there is no address or identifier - make the MissingSelection Fault.
      if (address == null && identifier == null)
        FaultManager.makeMissingSelectionFault(rmMsgCtx);

      if (makeConnection.getUnexpectedElement() != null)
        FaultManager.makeUnsupportedSelectionFault(rmMsgCtx, makeConnection.getUnexpectedElement());

      //some initial setup
      ConfigurationContext configurationContext = rmMsgCtx.getConfigurationContext();
      StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration());
      SecurityManager secManager = SandeshaUtil.getSecurityManager(configurationContext);
      SecurityToken token = secManager.getSecurityToken(rmMsgCtx.getMessageContext());

      //we want to find valid sender beans
      List<RMSequenceBean> possibleBeans = new ArrayList<RMSequenceBean>();
      int possibleBeanIndex = -10;
      SenderBean findSenderBean = new SenderBean();
      boolean secured = false;
      if (token != null && identifier == null) {
        secured = true;
        if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("token found " + token);
        //this means we have to scope our search for sender beans that belong to sequences that own the same token
        String data = secManager.getTokenRecoveryData(token);
        //first look for RMS beans
        RMSBean finderRMS = new RMSBean();
        finderRMS.setSecurityTokenData(data);
        finderRMS.setToEPR(address);
        List<RMSBean> tempList2 = storageManager.getRMSBeanMgr().find(finderRMS);
        possibleBeans.addAll(tempList2);

        //try looking for RMD beans too
        RMDBean finderRMD = new RMDBean();
        finderRMD.setSecurityTokenData(data);
        finderRMD.setToAddress(address);
        List<RMDBean> tempList = storageManager.getRMDBeanMgr().find(finderRMD);

        //combine these two into one list
        possibleBeans.addAll(tempList);

        int size = possibleBeans.size();

        if (size > 0) {
          //select one at random: TODO better method?
          Random random = new Random();
          possibleBeanIndex = random.nextInt(size);
          RMSequenceBean selectedSequence = (RMSequenceBean) possibleBeans.get(possibleBeanIndex);
          findSenderBean.setSequenceID(selectedSequence.getSequenceID());
          if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled())
            log.debug("sequence selected " + findSenderBean.getSequenceID());
        } else {
          //we cannot match a RMD with the correct security credentials so we cannot process this msg under RSP
          if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled())
            log.debug("Exit: MakeConnectionProcessor::processInMessage : no RM sequence bean with security credentials");
          return false;
        }

        // Commit this transaction to clear up held RMS/RMDBeans
        if (transaction != null && transaction.isActive())
          transaction.commit();

        // Get a new transaction
        transaction = storageManager.getTransaction();
      }

      //lookup a sender bean
      SenderBeanMgr senderBeanMgr = storageManager.getSenderBeanMgr();

      //selecting the set of SenderBeans that suit the given criteria.
      findSenderBean.setSend(true);
      findSenderBean.setTransportAvailable(false);

      if (address != null)
        findSenderBean.setToAddress(address);

      if (identifier != null) {
        if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled())
          log.debug("identifier set, this violates RSP " + identifier);
        findSenderBean.setSequenceID(identifier.getIdentifier());
      }

      SenderBean senderBean = null;
      boolean pending = false;
      while (true) {
View Full Code Here

    getConfigurationContext().registerOperationContext(rmMsgCtx.getMessageId(),opcontext);
    getMsgContext().setOperationContext(opcontext);
   
    CloseSequence closeSequencePart = rmMsgCtx.getCloseSequence();
    Identifier identifier = closeSequencePart.getIdentifier();
    if (identifier==null) {
      identifier = new Identifier (closeSequencePart.getNamespaceValue());
      closeSequencePart.setIdentifier(identifier);
    }
   
    rmMsgCtx.setWSAAction(SpecSpecificConstants.getCloseSequenceAction(getRMVersion()));
    rmMsgCtx.setSOAPAction(SpecSpecificConstants.getCloseSequenceAction (getRMVersion()));
View Full Code Here

    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(Sandesha2Constants.SPEC_VERSIONS.v1_1);
       
    //setup the sequenceAck portion of the msg
    SequenceAcknowledgement sequenceAck = new SequenceAcknowledgement(rmNamespaceValue, true);
    // Set the sequenceId
    Identifier id = new Identifier(rmNamespaceValue);
    id.setIndentifer(sequenceIDAck);
    sequenceAck.setIdentifier(id);
   
    // Set the Invalid range!
    Range ackRange = new Range(1,3);
    sequenceAck.addAcknowledgementRanges(ackRange);
View Full Code Here

   
    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(Sandesha2Constants.SPEC_VERSIONS.v1_1);
   
    //now add a sequence part to simulate a piggy backed application msg
    Sequence sequence = new Sequence(rmNamespaceValue);
    Identifier sequenceID = new Identifier(rmNamespaceValue);
    sequenceID.setIndentifer(sequenceIDApplicationMessage); //some new uuid ID
    sequence.setIdentifier(sequenceID);
    sequence.setMessageNumber(1);
    applicationRMMsg.setSequence(sequence);
   
    //setup the sequenceAck portion of the msg
    SequenceAcknowledgement sequenceAck = new SequenceAcknowledgement(rmNamespaceValue, true);
    // Set the sequenceId
    Identifier id = new Identifier(rmNamespaceValue);
    id.setIndentifer(sequenceIDAck);
    sequenceAck.setIdentifier(id);
   
    // Set the Invalid range!
    Range ackRange = new Range(1,3);
    sequenceAck.addAcknowledgementRanges(ackRange);
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.wsrm.Identifier

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.