Package org.impalaframework.module.definition

Examples of org.impalaframework.module.definition.ModuleDefinition


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


            + this.getClass().getName());
   
    ModuleStateHolder moduleStateHolder = getModuleStateHolder();
    RootModuleDefinition newDefinition = moduleStateHolder.cloneRootModuleDefinition();

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

    if (found != null) {

      String foundModuleName = found.getName();
     
      Assert.notNull(moduleOperationRegistry, "moduleOperationRegistry cannot be null");
     
      ModuleOperation operation = moduleOperationRegistry.getOperation(
          ModuleOperationConstants.ReloadNamedModuleOperation);
View Full Code Here

  }

  public ModuleOperationResult execute(ModuleOperationInput moduleOperationInput) {
   
    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);
   
View Full Code Here

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

      newParent.add(moduleDefinition);
      moduleDefinition.setParentDefinition(newParent);
    }

    TransitionSet transitions = calculator.getTransitions(oldRootDefinition, newRootDefinition);
    moduleStateHolder.processTransitions(transitions);
View Full Code Here

    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);
        moduleStateHolder.processTransitions(transitions);
        return true;
      }
      else {
        ModuleDefinition parent = definitionToRemove.getParentDefinition();
        if (parent != null) {
          parent.remove(moduleToRemove);
         
          definitionToRemove.setParentDefinition(null);

          TransitionSet transitions = calculator.getTransitions(oldRootDefinition, newRootDefinition);
          moduleStateHolder.processTransitions(transitions);
View Full Code Here

    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

    this.parentDefinition = parentDefinition;
    this.modulesToLoad = modulesToLoad;
  }

  public RootModuleDefinition getModuleDefinition() {
    ModuleDefinition currentParentDefinition = parentDefinition;
    for (String moduleName : modulesToLoad) {
      ModuleDefinition definition = buildModuleDefinition(currentParentDefinition, moduleName);
      currentParentDefinition = definition;
    }
    return rootModuleDefinition;
  }
View Full Code Here

 
  protected void buildChildDefinitions(ModuleDefinition parentDefinition, String parentModuleName) {
    Set<String> moduleChildren = children.get(parentModuleName);
    if (moduleChildren != null) {
      for (String moduleName : moduleChildren) {
        ModuleDefinition definition = buildModuleDefinition(parentDefinition, moduleName);
        buildChildDefinitions(definition, moduleName);
      }
    }
  }
View Full Code Here

    }
  }
 
  private RootModuleDefinition readRootModuleDefinition(Properties rootModuleProperties,
      TypeReader typeReader) {
    ModuleDefinition moduleDefinition = typeReader.readModuleDefinition(null, rootModuleName, rootModuleProperties);
    if (!(moduleDefinition instanceof RootModuleDefinition)) {
      throw new IllegalStateException("Type reader " + typeReader + " produced " + ModuleDefinition.class.getSimpleName() + " which is not an instance of " + RootModuleDefinition.class.getName());
    }
    RootModuleDefinition rootDefinition = (RootModuleDefinition) moduleDefinition;
    return rootDefinition;
View Full Code Here

    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.ModuleDefinition

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.