Package org.impalaframework.module

Examples of org.impalaframework.module.RootModuleDefinition


                "META-INF/impala-bootstrap.xml",
                "META-INF/impala-jmx-bootstrap.xml" ,
                "META-INF/impala-jmx-adaptor-bootstrap.xml"});
        Object bean = context.getBean("moduleManagementFacade");
        facade = ObjectUtils.cast(bean, ModuleManagementFacade.class);
        RootModuleDefinition moduleDefinition = new Provider().getModuleDefinition();

        TransitionSet transitions = facade.getModificationExtractorRegistry()
                .getModificationExtractor(ModificationExtractorType.STICKY).getTransitions(null, null, moduleDefinition);

        ModuleStateHolder moduleStateHolder = facade.getApplicationManager().getCurrentApplication().getModuleStateHolder();
View Full Code Here


  }

  public RootModuleDefinition getModuleDefinition() {
    Properties rootModuleProperties = getPropertiesForModule(rootModuleName);
    TypeReader typeReader = getTypeReadeRegistry().getTypeReader(ModuleTypes.ROOT);
    RootModuleDefinition rootModuleDefinition = readRootModuleDefinition(rootModuleProperties, typeReader);
   
    //recursively build child definitions
    buildChildDefinitions(rootModuleDefinition, rootModuleName);
   
    for (String sibling : siblings) {
      ModuleDefinition siblingDefinition = buildModuleDefinition(null, sibling);
      buildChildDefinitions(siblingDefinition, siblingDefinition.getName());
      rootModuleDefinition.addSibling(siblingDefinition);
    }
    return rootModuleDefinition;
  }
View Full Code Here

      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

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

    RootModuleDefinition oldRootDefinition = moduleStateHolder.cloneRootModuleDefinition();
    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

  public RootModuleDefinition getRootModuleDefinition() {
    return rootModuleDefinition;
  }

  public RootModuleDefinition cloneRootModuleDefinition() {
    RootModuleDefinition newDefinition = ModuleDefinitionUtils.cloneAndUnfreeze(rootModuleDefinition);
    return newDefinition;
  }
View Full Code Here

    public TransitionSet getTransitions(RootModuleDefinition originalDefinition, RootModuleDefinition newDefinition) {

        List<ModuleStateChange> transitions = new ArrayList<ModuleStateChange>();
       
        RootModuleDefinition copy = ModuleDefinitionUtils.cloneAndUnfreeze(originalDefinition);
        DependencyManager dependencyManager = new DependencyManager(copy);
        Collection<ModuleDefinition> sortedModules = dependencyManager.getAllModules();
       
        for (ModuleDefinition moduleDefinition : sortedModules) {
            if (ModuleState.ERROR.equals(moduleDefinition.getState()) || ModuleState.DEPENDENCY_FAILED.equals(moduleDefinition.getState())) {
                transitions.add(new ModuleStateChange(Transition.UNLOADED_TO_LOADED, moduleDefinition));
                moduleDefinition.setState(ModuleState.LOADING);
            }
        }
       
        copy.freeze();
        return new TransitionSet(transitions, copy);
    }
View Full Code Here

    public RootModuleDefinition getRootModuleDefinition() {
        return rootModuleDefinition;
    }

    public RootModuleDefinition cloneRootModuleDefinition() {
        RootModuleDefinition newDefinition = ModuleDefinitionUtils.cloneAndUnfreeze(rootModuleDefinition);
        return newDefinition;
    }
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.cloneRootModuleDefinition();
        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

TOP

Related Classes of org.impalaframework.module.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.