Package org.impalaframework.module.definition

Examples of org.impalaframework.module.definition.RootModuleDefinition


* @author Phil Zoio
*/
public class ShowModulesCommand implements Command {

  public boolean execute(CommandState commandState) {
    final RootModuleDefinition rootModuleDefinition = Impala.getRootModuleDefinition();
   
    printModuleInfo(rootModuleDefinition);
    return false;
  }
View Full Code Here


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

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

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

      String foundModuleName = found.getName();
     
View Full Code Here

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

  }
 
  protected void addModule(ModuleStateHolder moduleStateHolder, ModificationExtractor calculator,
      ModuleDefinition moduleDefinition) {

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

    ModuleDefinition parent = moduleDefinition.getParentDefinition();
   
    if (moduleDefinition instanceof RootModuleDefinition) {
      newRootDefinition = (RootModuleDefinition) moduleDefinition;
    }
    else {

      ModuleDefinition newParent = null;

      if (parent == null) {
        newParent = newRootDefinition;
      }
      else {
        String parentName = parent.getName();
        newParent = newRootDefinition.findChildDefinition(parentName, true);

        if (newParent == null) {
          throw new InvalidStateException("Unable to find parent module '" + parentName + "' in " + newRootDefinition);
        }
      }
View Full Code Here

  }
 
  protected boolean removeModule(ModuleStateHolder moduleStateHolder, ModificationExtractor calculator,
      String moduleToRemove) {
   
    RootModuleDefinition oldRootDefinition = moduleStateHolder.getRootModuleDefinition();
   
    if (oldRootDefinition == null) {
      return false;
    }
   
    RootModuleDefinition newRootDefinition = moduleStateHolder.cloneRootModuleDefinition();
    ModuleDefinition definitionToRemove = newRootDefinition.findChildDefinition(moduleToRemove, true);

    if (definitionToRemove != null) {
      if (definitionToRemove instanceof RootModuleDefinition) {
        //we're removing the rootModuleDefinition
        TransitionSet transitions = calculator.getTransitions(oldRootDefinition, null);
View Full Code Here

    }
    return like;
  }

  public void reloadRootModule() {
    RootModuleDefinition rootModuleDefinition = getModuleStateHolder().getRootModuleDefinition();
    ModuleOperation operation = facade.getModuleOperationRegistry().getOperation(
        ModuleOperationConstants.CloseRootModuleOperation);
    operation.execute(null);
    ConstructedModuleDefinitionSource newModuleDefinitionSource = new ConstructedModuleDefinitionSource(
        rootModuleDefinition);
View Full Code Here

  }

  /* **************************** getters ************************** */

  public boolean hasModule(String moduleName) {
    RootModuleDefinition rootModuleDefinition = getModuleStateHolder().getRootModuleDefinition();
    return (rootModuleDefinition.findChildDefinition(moduleName, true) != null);
  }
View Full Code Here

    RootModuleDefinition rootModuleDefinition = getModuleStateHolder().getRootModuleDefinition();
    return (rootModuleDefinition.findChildDefinition(moduleName, true) != null);
  }

  public String findLike(String moduleName) {
    RootModuleDefinition rootModuleDefinition = getModuleStateHolder().getRootModuleDefinition();
    ModuleDefinition definition = rootModuleDefinition.findChildDefinition(moduleName, false);
    if (definition != null) {
      return definition.getName();
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.impalaframework.module.definition.RootModuleDefinition

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.