Package org.apache.sandesha2.storage

Examples of org.apache.sandesha2.storage.StorageManager


    if(parameter != null) config.removeParameter(parameter);
    parameter = config.getParameter(Sandesha2Constants.PERMANENT_STORAGE_MANAGER);
    if(parameter != null) config.removeParameter(parameter);

    try {
      StorageManager inMemorytorageManager = SandeshaUtil.getInMemoryStorageManager(configContext);
      inMemorytorageManager.initStorage(module);
    } catch (SandeshaStorageException e) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.cannotInitInMemoryStorageManager,
          e.toString());
      log.debug(message,e);
    }
   
    try {
      StorageManager permanentStorageManager = SandeshaUtil.getPermanentStorageManager(configContext);
      permanentStorageManager.initStorage(module);
    } catch (SandeshaStorageException e) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.cannotInitPersistentStorageManager,
          e.toString());
      log.debug(message,e);
View Full Code Here


    return new RMPolicyExtension();
  }

  public void shutdown(ConfigurationContext configurationContext) throws AxisFault {
    if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::shutdown, " + configurationContext);
    StorageManager storageManager = SandeshaUtil.
      getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration());

    if (storageManager!=null) {
      SandeshaThread sender = storageManager.getSender();
      SandeshaThread invoker = storageManager.getInvoker();
      SandeshaThread pollingManager = storageManager.getPollingManager();
     
      //stopping threads.
      if (sender!=null)
        sender.stopRunning();
      if (invoker!=null)
        invoker.stopRunning();
      if (pollingManager!=null)
        pollingManager.stopRunning();
     
      //shutting down the storage manager.
      storageManager.shutdown();
    }
   
    if(log.isDebugEnabled()) log.debug("Exit: SandeshaModule::shutdown");
  }
View Full Code Here

        log.debug("Exit: SandeshaOutHandler::invoke, Application processing done " + returnValue);
      return returnValue;
    }
   
    msgCtx.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE, "true");
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context, context.getAxisConfiguration());

    Transaction transaction = null;

    try {
      transaction = storageManager.getTransaction();
     
      // getting rm message
      RMMsgContext rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);

      MsgProcessor msgProcessor = null;
View Full Code Here

    if (log.isDebugEnabled()) log.debug("SandeshaInHandler::invoke Continuing beyond basic checks");

    Transaction transaction = null;

    try {
      StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context, context.getAxisConfiguration());
      transaction = storageManager.getTransaction();

      AxisService axisService = msgCtx.getAxisService();
      if (axisService == null) {
        String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.axisServiceIsNull);
        log.debug(message);
        throw new AxisFault(message);
      }

      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);

      // validating the message
      MessageValidator.validateIncomingMessage(rmMsgCtx, storageManager);
     
      // commit the current transaction
      if(transaction != null && transaction.isActive()) transaction.commit();
      transaction = storageManager.getTransaction();

      // Process Ack headers in the message
      AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor();
      ackProcessor.processAckHeaders(rmMsgCtx);

      // commit the current transaction
      if(transaction != null && transaction.isActive()) transaction.commit();
      transaction = storageManager.getTransaction();

      // Process Ack Request headers in the message
      AckRequestedProcessor reqProcessor = new AckRequestedProcessor();
      if(reqProcessor.processAckRequestedHeaders(rmMsgCtx)){
        returnValue = InvocationResponse.SUSPEND;
      }
     
      // Process MessagePending headers
      MessagePendingProcessor pendingProcessor = new MessagePendingProcessor();
      pendingProcessor.processMessagePendingHeaders(rmMsgCtx);

      // commit the current transaction
      if(transaction != null && transaction.isActive()) transaction.commit();
      transaction = storageManager.getTransaction();

      // Process the Sequence header, if there is one
      SequenceProcessor seqProcessor = new SequenceProcessor();
      returnValue = seqProcessor.processSequenceHeader(rmMsgCtx, transaction);
View Full Code Here

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

    // Check if this is a duplicate message
    Sequence sequence = (Sequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
    String sequenceId = sequence.getIdentifier().getIdentifier();
    long msgNo = sequence.getMessageNumber().getMessageNumber();

    StorageManager storageManager =
      SandeshaUtil.getSandeshaStorageManager(rmMsgCtx.getConfigurationContext(),
          rmMsgCtx.getConfigurationContext().getAxisConfiguration());
   
    Transaction transaction = null;
   
    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());
      }
     
      MessageContext messageContext = 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);
         
        if (!msgNoPresentInList) {
          serverCompletedMessageRanges.addRange(new Range(msgNo));
         
          storageManager.getRMDBeanMgr().update(bean);
        }
        else {
          
          if (log.isDebugEnabled())
              log.debug("Detected duplicate message " + msgNo);
           
          boolean isDuplicate = true;
          //still allow this msg if we have no corresponding invoker bean for it and we are inOrder
          boolean isInOrder =
            SandeshaUtil.getDefaultPropertyBean(rmMsgCtx.getConfigurationContext().getAxisConfiguration()).isInOrder();
          if(isInOrder)
          {
            InvokerBean finderBean = new InvokerBean();
            finderBean.setMsgNo(msgNo);
            finderBean.setSequenceID(sequenceId);
            List invokerBeanList = storageManager.getInvokerBeanMgr().find(finderBean);
            if((invokerBeanList==null || invokerBeanList.size()==0)
                && bean.getNextMsgNoToProcess()<=msgNo){
              isDuplicate = false;
              if (log.isDebugEnabled())
                log.debug("Allowing completed message on sequence " + sequenceId + ", msgNo " + msgNo);
View Full Code Here

      }
    }
   
    ConfigurationContext configurationContext = msgContext.getConfigurationContext();
    RMMsgContext rmmsgContext = MsgInitializer.initializeMessage(msgContext);
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration());
   
    Transaction transaction = storageManager.getTransaction();
   
    AxisService service = null;
    try {
      String sequenceID = (String) rmmsgContext
          .getProperty(Sandesha2Constants.MessageContextProperties.SEQUENCE_ID);
View Full Code Here

      ConfigurationContext configurationContext, boolean createTransaction) throws SandeshaException {

    SequenceReport sequenceReport = new SequenceReport();
    sequenceReport.setSequenceDirection(SequenceReport.SEQUENCE_DIRECTION_OUT);

    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,configurationContext.getAxisConfiguration());
    RMSBeanMgr createSeqMgr = storageManager.getRMSBeanMgr();

    Transaction reportTransaction = null;

    try {
      if (createTransaction)
        reportTransaction = storageManager.getTransaction();

      sequenceReport.setInternalSequenceID(internalSequenceID);

      RMSBean createSeqFindBean = new RMSBean();
      createSeqFindBean.setInternalSequenceID(internalSequenceID);
View Full Code Here

   * @return
   * @throws SandeshaException
   */
  public static SandeshaReport getSandeshaReport(ConfigurationContext configurationContext) throws SandeshaException {

    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,configurationContext.getAxisConfiguration());
    SandeshaReport sandeshaReport = new SandeshaReport();

    Transaction reportTransaction = null;

    try {
      reportTransaction = storageManager.getTransaction();

      List rmsBeans = storageManager.getRMSBeanMgr().find(null);
      Iterator iterator = rmsBeans.iterator();
      while (iterator.hasNext()) {
        RMSBean bean = (RMSBean) iterator.next();
        String sequenceID = bean.getSequenceID();
        sandeshaReport.addToOutgoingSequenceList(sequenceID);
        sandeshaReport.addToOutgoingInternalSequenceMap(sequenceID, bean.getInternalSequenceID());

        SequenceReport report = getOutgoingSequenceReport(bean.getInternalSequenceID(), configurationContext);

        sandeshaReport.addToNoOfCompletedMessagesMap(sequenceID, report.getCompletedMessages().size());
        sandeshaReport.addToSequenceStatusMap(sequenceID, report.getSequenceStatus());
      }

      // incoming sequences
      Collection rmdBeans = storageManager.getRMDBeanMgr().find(null);

      Iterator iter = rmdBeans.iterator();
      while (iter.hasNext()) {
        RMDBean serverCompletedMsgsBean = (RMDBean) iter.next();
        String sequenceID = serverCompletedMsgsBean.getSequenceID();
View Full Code Here

      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.noSequenceEstablished,
          internalSequenceID));
    }

    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,configurationContext.getAxisConfiguration());

    // Get a transaction to retrieve the properties
    Transaction transaction = null;
    String sequenceID = null;
   
    try
    {
      transaction = storageManager.getTransaction();
      sequenceID = SandeshaUtil.getSequenceIDFromInternalSequenceID(internalSequenceID, storageManager);   
    }
    finally
    {
      // Commit the transaction as it was only a retrieve
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.storage.StorageManager

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.