Package org.impalaframework.module.loader

Examples of org.impalaframework.module.loader.ModuleLoader


  }

  public boolean process(ModuleStateHolder moduleStateHolder, RootModuleDefinition newRootDefinition,
      ModuleDefinition moduleDefinition) {

    ModuleLoader moduleLoader = moduleLoaderRegistry.getModuleLoader(newRootDefinition.getType());
    ConfigurableApplicationContext parentContext = moduleStateHolder.getRootModuleContext();

    ClassLoader classLoader = parentContext.getClassLoader();

    RootModuleDefinition existingModuleDefinition = moduleStateHolder.getRootModuleDefinition();
    Resource[] existingResources = moduleLoader.getSpringConfigResources(existingModuleDefinition, classLoader);
    Resource[] newResources = moduleLoader.getSpringConfigResources(newRootDefinition, classLoader);

    // compare difference
    List<Resource> existingResourceList = newResourceList(existingResources);
    List<Resource> newResourceList = newResourceList(newResources);
    List<Resource> toAddList = new ArrayList<Resource>();

    for (Resource resource : newResourceList) {
      if (!existingResourceList.contains(resource)) {
        toAddList.add(resource);
      }
    }

    BeanDefinitionReader beanDefinitionReader = moduleLoader.newBeanDefinitionReader(parentContext,
        newRootDefinition);
    beanDefinitionReader.loadBeanDefinitions(toAddList.toArray(new Resource[toAddList.size()]));

    return true;
  }
View Full Code Here

TOP

Related Classes of org.impalaframework.module.loader.ModuleLoader

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.