Examples of RMDBean


Examples of org.apache.sandesha2.storage.beans.RMDBean

  public static RMDBean getRMDBeanFromSequenceId(StorageManager storageManager, String sequenceID)
 
  throws SandeshaException {
    RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
    RMDBean bean = new RMDBean();
    bean.setSequenceID(sequenceID);
   
    bean = rmdBeanMgr.findUnique(bean);

    return bean;
  }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMDBean

    ConfigurationContext configurationContext = rmMsgCtx.getConfigurationContext();
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(
              configurationContext, configurationContext.getAxisConfiguration());
   
    RMDBeanMgr rmdMgr = storageManager.getRMDBeanMgr();
    RMDBean rmdBean = rmdMgr.retrieve(sequenceId);
    String outBoundInternalSequence = rmdBean.getOutboundInternalSequence();
   
    RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();
    RMSBean findBean = new RMSBean ();
    findBean.setInternalSequenceID(outBoundInternalSequence);
    RMSBean rmsBean = rmsBeanMgr.findUnique (findBean);
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMDBean

    String sequenceId = closeSequence.getIdentifier().getIdentifier();
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx, configCtx
        .getAxisConfiguration());

    RMDBean rmdBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, sequenceId);

    // Check that the sender of this CloseSequence holds the correct token
    if(rmdBean != null && rmdBean.getSecurityTokenData() != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(msgCtx.getConfigurationContext());
      OMElement body = msgCtx.getEnvelope().getBody();
      SecurityToken token = secManager.recoverSecurityToken(rmdBean.getSecurityTokenData());
      secManager.checkProofOfPossession(token, body, msgCtx);
    }

    if (FaultManager.checkForUnknownSequence(rmMsgCtx, sequenceId, storageManager, false)) {
      if (log.isDebugEnabled())
        log.debug("Exit: CloseSequenceProcessor::processInMessage, Unknown sequence " + sequenceId);
      return false;
    }
   
    // throwing a fault if the sequence is terminated
    if (FaultManager.checkForSequenceTerminated(rmMsgCtx, sequenceId, rmdBean, false)) {
      if (log.isDebugEnabled())
        log.debug("Exit: CloseSequenceProcessor::processInMessage, Sequence terminated");
      return false;
    }

    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
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMDBean

  }

  private void pollRMDSide(SequenceEntry entry, boolean force) throws AxisFault {
    if(log.isDebugEnabled()) log.debug("Enter: PollingManager::pollRMDSide, force: " + force);
    RMDBeanMgr nextMsgMgr = storageManager.getRMDBeanMgr();
    RMDBean findBean = new RMDBean();
    findBean.setPollingMode(true);
    findBean.setTerminated(false);
    findBean.setSequenceID(entry.getSequenceId());
    RMDBean nextMsgBean = nextMsgMgr.findUnique(findBean);
   
    if(nextMsgBean == null) {
      // This sequence must have been terminated, or deleted
      stopThreadForSequence(entry.getSequenceId(), false);
    } else {
      // The sequence is still there, but if we have a running related sequence
      // that is not expecting replies then there is no need to poll.
      boolean doPoll = true;
      String outboundSequence = nextMsgBean.getOutboundInternalSequence();
      if(outboundSequence != null) {
        RMSBean findRMS = new RMSBean();
        findRMS.setInternalSequenceID(outboundSequence);
        findRMS.setTerminated(false);
        RMSBeanMgr mgr = storageManager.getRMSBeanMgr();
        RMSBean outbound = mgr.findUnique(findRMS);
        if(outbound != null && outbound.getExpectedReplies() == 0) {
          doPoll = false;
        }
      }
      if(force || doPoll)
        pollForSequence(null, null, nextMsgBean.getReferenceMessageKey(), nextMsgBean, entry);
    }

    if(log.isDebugEnabled()) log.debug("Exit: PollingManager::pollRMDSide");
  }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMDBean

    try {
      transaction = storageManager.getTransaction();
   
      // Check that both the Sequence header and message body have been secured properly
      RMDBeanMgr mgr = storageManager.getRMDBeanMgr();
      RMDBean bean = mgr.retrieve(sequenceId);
     
      if(bean != null && bean.getSecurityTokenData() != null) {
        SecurityManager secManager = SandeshaUtil.getSecurityManager(rmMsgCtx.getConfigurationContext());
       
        QName seqName = new QName(rmMsgCtx.getRMNamespaceValue(), Sandesha2Constants.WSRM_COMMON.SEQUENCE);
       
        SOAPEnvelope envelope = rmMsgCtx.getSOAPEnvelope();
        OMElement body = envelope.getBody();
        OMElement seqHeader = envelope.getHeader().getFirstChildWithName(seqName);
       
        SecurityToken token = secManager.recoverSecurityToken(bean.getSecurityTokenData());
       
        secManager.checkProofOfPossession(token, seqHeader, rmMsgCtx.getMessageContext());
        secManager.checkProofOfPossession(token, body, rmMsgCtx.getMessageContext());
      }
   
      if (bean != null) {
       
        if (msgNo == 0) {
          String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.invalidMsgNumber, Long
              .toString(msgNo));
          log.debug(message);
          throw new SandeshaException(message);
        }
   
        // Get the server completed message ranges list
        RangeString serverCompletedMessageRanges = bean.getServerCompletedMessages();
   
        // See if the message is in the list of completed ranges
        boolean msgNoPresentInList =
          serverCompletedMessageRanges.isMessageNumberInRanges(msgNo);
         
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMDBean

      service = null;
      if (sequenceID != null) {

        //If this is the RMD of the sequence
        RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
        RMDBean rmdFindBean = new RMDBean();
        rmdFindBean.setSequenceID(sequenceID);

        RMDBean rmdBean = rmdBeanMgr.findUnique(rmdFindBean);
        if (rmdBean != null) {

          String serviceName = rmdBean.getServiceName();
          if (serviceName != null) {
            service = configurationContext.getAxisConfiguration()
                .getService(serviceName);
          }
        }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMDBean

            found = true;
          rmVersion = rms.getRMVersion();
        }
       
      } else {
        RMDBean matcher = new RMDBean();
        matcher.setSequenceID(sequenceId);
        matcher.setTerminated(false);
        RMDBean rmd = storageManager.getRMDBeanMgr().findUnique(matcher);
        if(rmd != null) {
          found = true;
          rmVersion = rmd.getRMVersion();
        }
      }
      if (!found) {
        stopThreadForSequence(sequenceId, entry.isRmSource());
        if (log.isDebugEnabled()) log.debug("Exit: Sender::internalRun, sequence has ended");
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMDBean

        rmsBeans = storageManager.getRMSBeanMgr().find(finderBean);
             
        deleteRMSBeans(rmsBeans, propertyBean, deleteTime);
       
        // Remove any terminated RMDBeans.
        RMDBean finderRMDBean = new RMDBean();
        finderRMDBean.setTerminated(true);
       
        List rmdBeans = storageManager.getRMDBeanMgr().find(finderRMDBean);
 
        Iterator beans = rmdBeans.iterator();
        while (beans.hasNext()) {
          RMDBean rmdBean = (RMDBean)beans.next();
         
          long timeNow = System.currentTimeMillis();
          long lastActivated = rmdBean.getLastActivatedTime();
 
          // delete sequences that have been timedout or deleted for more than
          // the SequenceRemovalTimeoutInterval
          if ((lastActivated + deleteTime) < timeNow) {
            if (log.isDebugEnabled())
              log.debug("Deleting RMDBean " + deleteTime + " : " + rmdBean);
            storageManager.getRMDBeanMgr().delete(rmdBean.getSequenceID());
          }               
        }
      }

      // Terminate RMD Sequences that have been inactive.     
      if (propertyBean.getInactivityTimeoutInterval() > 0) {
        RMDBean finderRMDBean = new RMDBean();
        finderRMDBean.setTerminated(false);
       
        List rmdBeans = storageManager.getRMDBeanMgr().find(finderRMDBean);
     
        Iterator beans = rmdBeans.iterator();
        while (beans.hasNext()) {
          RMDBean rmdBean = (RMDBean)beans.next();
         
          long timeNow = System.currentTimeMillis();
          long lastActivated = rmdBean.getLastActivatedTime();
         
          if ((lastActivated + propertyBean.getInactivityTimeoutInterval()) < timeNow) {
            // Terminate
            rmdBean.setTerminated(true);
            rmdBean.setLastActivatedTime(timeNow);
            if (log.isDebugEnabled())
              log.debug(System.currentTimeMillis() + "Marking RMDBean as terminated " + rmdBean);
            storageManager.getRMDBeanMgr().update(rmdBean);
          }               
        }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMDBean

            log.warn(message);
          }
          // If the message is a reply, then the request may need to be acked. Rather
          // than just return a HTTP 202, we should try to send an ack.
          boolean sendAck = false;
          RMDBean inbound = null;
          String inboundSeq = bean.getInboundSequenceId();
          if(inboundSeq != null)
            inbound = SandeshaUtil.getRMDBeanFromSequenceId(manager, inboundSeq);
         
          if(inbound != null) {
            String acksTo = inbound.getAcksToEPR();
            EndpointReference acksToEPR = new EndpointReference(acksTo);
            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 {
            msgCtx.getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN, "false");
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.RMDBean

   
    ConfigurationContext context = terminateSeqMsg.getConfigurationContext();
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context,context.getAxisConfiguration());
   
    // Check that the sender of this TerminateSequence holds the correct token
    RMDBean rmdBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, sequenceId);
    if(rmdBean != null && rmdBean.getSecurityTokenData() != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(context);
      OMElement body = terminateSeqRMMsg.getSOAPEnvelope().getBody();
      SecurityToken token = secManager.recoverSecurityToken(rmdBean.getSecurityTokenData());
      secManager.checkProofOfPossession(token, body, terminateSeqRMMsg.getMessageContext());
    }

    if (FaultManager.checkForUnknownSequence(terminateSeqRMMsg, sequenceId, storageManager, false)) {
      if (log.isDebugEnabled())
        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) {
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.