Examples of StorageManager


Examples of org.apache.sandesha2.storage.StorageManager

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

        if (service == null && rmdBean == null) {
          //If this is the RMD of the sequence
          RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();
          RMSBean rmsfindBean = new RMSBean();
          rmsfindBean.setSequenceID(sequenceID);

          RMSBean rmsBean = rmsBeanMgr.findUnique(rmsfindBean);
View Full Code Here

Examples of org.apache.sandesha2.storage.StorageManager

      log.debug(message);
      throw new SandeshaException(message);
    }
   
    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) {
      //
      // 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
View Full Code Here

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

Examples of org.apache.sandesha2.storage.StorageManager

    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

Examples of org.eclipse.osgi.storagemanager.StorageManager

    StateManager.DEBUG_PLATFORM_ADMIN = options.getBooleanOption(OPTION_PLATFORM_ADMIN, false);
    StateManager.DEBUG_PLATFORM_ADMIN_RESOLVER = options.getBooleanOption(OPTION_PLATFORM_ADMIN_RESOLVER, false);
  }

  protected StorageManager initFileManager(File baseDir, String lockMode, boolean readOnly) throws IOException {
    StorageManager sManager = new StorageManager(baseDir, lockMode, readOnly);
    try {
      sManager.open(!readOnly);
    } catch (IOException ex) {
      if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
        Debug.println("Error reading framework metadata: " + ex.getMessage()); //$NON-NLS-1$
        Debug.printStackTrace(ex);
      }
View Full Code Here

Examples of org.hornetq.core.persistence.StorageManager

            }
         };
         PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(arg[0], 1000l, scheduled, execfactory, false, null);
         HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<AddressSettings>();
         addressSettingsRepository.setDefault(new AddressSettings());
         StorageManager sm = new NullStorageManager();
         PagingManager manager = new PagingManagerImpl(pageStoreFactory, sm, addressSettingsRepository);

         manager.start();

         SimpleString stores[] = manager.getStoreNames();
View Full Code Here

Examples of org.terasology.persistence.StorageManager

    public void close() throws Exception {
        // it would be nice, if elements in the CoreRegistry implemented (Auto)Closeable

        // The StorageManager creates a thread pool (through TaskMaster)
        // which isn't closed automatically
        StorageManager storageManager = CoreRegistry.get(StorageManager.class);
        if (storageManager != null) {
            storageManager.finishSavingAndShutdown();
        }

        CoreRegistry.clear();

        super.close();
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.