Package org.impalaframework.module.holder

Examples of org.impalaframework.module.holder.ModuleStateHolder


    Assert.notNull(moduleOperationInput, "moduleOperationInput cannot be null");
    String moduleToReload = moduleOperationInput.getModuleName();
    Assert.notNull(moduleToReload, "moduleName is required as it specifies the name of the module to reload in "
        + this.getClass().getName());

    ModuleStateHolder moduleStateHolder = getModuleStateHolder();
    RootModuleDefinition oldRootDefinition = moduleStateHolder.getRootModuleDefinition();
    RootModuleDefinition newRootDefinition = moduleStateHolder.cloneRootModuleDefinition();

    ModificationExtractorRegistry modificationExtractor = getModificationExtractorRegistry();
    ModificationExtractor calculator = modificationExtractor
        .getModificationExtractor(ModificationExtractorType.STRICT);

    ModuleDefinition childDefinition = newRootDefinition.findChildDefinition(moduleToReload, true);

    if (childDefinition != null) {
      childDefinition.setState(ModuleState.STALE);

      TransitionSet transitions = calculator.getTransitions(oldRootDefinition, newRootDefinition);
      moduleStateHolder.processTransitions(transitions);

      boolean result = !transitions.getModuleTransitions().isEmpty();
      return result ? ModuleOperationResult.TRUE : ModuleOperationResult.FALSE;
    }
   
View Full Code Here


    super();
  }

  public ModuleOperationResult execute(ModuleOperationInput moduleOperationInput) {
   
    ModuleStateHolder moduleStateHolder = getModuleStateHolder();
    ModificationExtractorRegistry modificationExtractorRegistry = getModificationExtractorRegistry();
    ModificationExtractor calculator = modificationExtractorRegistry
        .getModificationExtractor(ModificationExtractorType.STRICT);
    RootModuleDefinition rootModuleDefinition = moduleStateHolder.getRootModuleDefinition();
   
    if (rootModuleDefinition != null) {
      logger.info("Shutting down application context");
      TransitionSet transitions = calculator.getTransitions(rootModuleDefinition, null);
      moduleStateHolder.processTransitions(transitions);
      return ModuleOperationResult.TRUE;
    }
    else {
      return ModuleOperationResult.FALSE;
    }
View Full Code Here

    String moduleToReload = moduleOperationInput.getModuleName();
    Assert.notNull(moduleToReload,
        "moduleName is required as it specifies the name used to match the module to reload in "
            + this.getClass().getName());
   
    ModuleStateHolder moduleStateHolder = getModuleStateHolder();
    RootModuleDefinition newDefinition = moduleStateHolder.cloneRootModuleDefinition();

    ModuleDefinition found = newDefinition.findChildDefinition(moduleToReload, false);

    if (found != null) {
View Full Code Here

  }

  public ModuleOperationResult execute(ModuleOperationInput moduleOperationInput) {

    Assert.notNull(moduleOperationInput, "moduleOperationInput cannot be null");
    ModuleStateHolder moduleStateHolder = getModuleStateHolder();
   
    //note that the module definition source is externally supplied
    ModuleDefinitionSource newModuleDefinitionSource = moduleOperationInput.getModuleDefinitionSource();
    Assert.notNull(newModuleDefinitionSource, "moduleDefinitionSource is required as it specifies the new module definition to apply in " + this.getClass().getName());
   
    RootModuleDefinition newModuleDefinition = newModuleDefinitionSource.getModuleDefinition();
    RootModuleDefinition oldModuleDefinition = getExistingModuleDefinitionSource();
   
    ModificationExtractorType modificationExtractorType = getModificationExtractorType();
   
    // figure out the modules to reload
    ModificationExtractor calculator = getModificationExtractorRegistry()
        .getModificationExtractor(modificationExtractorType);
    TransitionSet transitions = calculator.getTransitions(oldModuleDefinition, newModuleDefinition);
    moduleStateHolder.processTransitions(transitions);
    return ModuleOperationResult.TRUE;
  }
View Full Code Here

   
    Assert.notNull(moduleOperationInput, "moduleOperationInput cannot be null");
    ModuleDefinition moduleToAdd = moduleOperationInput.getModuleDefinition();
    Assert.notNull(moduleToAdd, "moduleName is required as it specifies the name of the module to add in " + this.getClass().getName());
   
    ModuleStateHolder moduleStateHolder = getModuleStateHolder();
    ModificationExtractor calculator = getModificationExtractorRegistry().getModificationExtractor(ModificationExtractorType.STICKY);
   
    addModule(moduleStateHolder, calculator, moduleToAdd);
    return new ModuleOperationResult(true);
  }
View Full Code Here

   
    Assert.notNull(moduleOperationInput, "moduleOperationInput cannot be null");
    String moduleToRemove = moduleOperationInput.getModuleName();
    Assert.notNull(moduleToRemove, "moduleName is required as it specifies the name of the module to remove in " + this.getClass().getName());
   
    ModuleStateHolder moduleStateHolder = getModuleStateHolder();
    ModificationExtractor calculator = getModificationExtractorRegistry().getModificationExtractor(ModificationExtractorType.STRICT);
    boolean result = removeModule(moduleStateHolder, calculator, moduleToRemove);
    return result ? ModuleOperationResult.TRUE : ModuleOperationResult.FALSE;
  }
View Full Code Here

  }

  /* **************************** private methods ************************** */

  private ConfigurableApplicationContext internalGet() {
    ModuleStateHolder stateHolder = getModuleStateHolder();
    return stateHolder.getRootModuleContext();
  }
View Full Code Here

  }

  /* **************************** private methods ************************** */

  private ConfigurableApplicationContext internalGet() {
    ModuleStateHolder stateHolder = getModuleStateHolder();
    return stateHolder.getRootModuleContext();
  }
View Full Code Here

          + " as no attribute '" + WebConstants.IMPALA_FACTORY_ATTRIBUTE
          + "' has been set up. Have you set up your Impala ContextLoader correctly?");
    }

    final String servletName = servlet.getServletName();
    ModuleStateHolder moduleStateHolder = facade.getModuleStateHolder();
   
    if (!initialized) {
     
      ModuleStateChangeNotifier moduleStateChangeNotifier = facade.getModuleStateChangeNotifier();
      moduleStateChangeNotifier.addListener(new ModuleStateChangeListener() {

        public void moduleStateChanged(ModuleStateHolder moduleStateHolder, ModuleStateChange change) {
          try {
            servlet.init();
          }
          catch (Exception e) {
            logger.error("Unable to reinitialize servlet " + servlet.getServletName(), e);
          }
        }

        public String getModuleName() {
          return servletName;
        }

        public Transition getTransition() {
          return Transition.UNLOADED_TO_LOADED;
        }
       
      });
      this.initialized = true;
    }

    ConfigurableApplicationContext context = moduleStateHolder.getModule(servletName);
    if (context != null) {
      if (context instanceof WebApplicationContext) {
        return (WebApplicationContext) context;
      }
      else {
View Full Code Here

    }

    String moduleName = getServletName();
    if (!initialized) {

      ModuleStateHolder moduleStateHolder = factory.getModuleStateHolder();
      RootModuleDefinition rootDefinition = moduleStateHolder.cloneRootModuleDefinition();
      ModuleDefinition newDefinition = newModuleDefinition(moduleName, rootDefinition);

      ModuleOperation operation = factory.getModuleOperationRegistry().getOperation(
          ModuleOperationConstants.AddModuleOperation);
      operation.execute(new ModuleOperationInput(null, newDefinition, null));
View Full Code Here

TOP

Related Classes of org.impalaframework.module.holder.ModuleStateHolder

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.