Package org.impalaframework.classloader.graph

Examples of org.impalaframework.classloader.graph.GraphClassLoader


  }
 
  public GraphClassLoader newClassLoader(DependencyManager dependencyManager, ModuleDefinition moduleDefinition) {
   
    String moduleName = moduleDefinition.getName();
    GraphClassLoader classLoader = classLoaderRegistry.getClassLoader(moduleName);
    if (classLoader != null) {
      return classLoader;
    }
   
    ClassRetriever resourceLoader = newResourceLoader(moduleDefinition);
    List<ModuleDefinition> dependencies = dependencyManager.getOrderedModuleDependencies(moduleDefinition.getName());
   
    List<GraphClassLoader> classLoaders = new ArrayList<GraphClassLoader>();
    for (ModuleDefinition dependency : dependencies) {
      if (dependency.getName().equals(moduleDefinition.getName())) continue;
      classLoaders.add(newClassLoader(dependencyManager, dependency));
    }
   
    ClassLoader parentClassLoader = classLoaderRegistry.getParentClassLoader();
    ClassLoader classLoaderToUse = parentClassLoader != null ? parentClassLoader : GraphClassLoaderFactory.class.getClassLoader();
   
    GraphClassLoader gcl = new GraphClassLoader(classLoaderToUse , new DelegateClassLoader(classLoaders), resourceLoader, moduleDefinition, parentClassLoaderFirst);
    classLoaderRegistry.addClassLoader(moduleDefinition.getName(), gcl);
    return gcl;
  }
View Full Code Here


  }
 
  public GraphClassLoader newClassLoader(DependencyManager dependencyManager, ModuleDefinition moduleDefinition) {
   
    String moduleName = moduleDefinition.getName();
    GraphClassLoader classLoader = classLoaderRegistry.getClassLoader(moduleName);
    if (classLoader != null) {
      return classLoader;
    }
   
    ClassRetriever resourceLoader = newResourceLoader(moduleDefinition);
    List<ModuleDefinition> dependencies = dependencyManager.getOrderedModuleDependencies(moduleDefinition.getName());
   
    List<GraphClassLoader> classLoaders = new ArrayList<GraphClassLoader>();
    for (ModuleDefinition dependency : dependencies) {
      if (dependency.getName().equals(moduleDefinition.getName())) continue;
      classLoaders.add(newClassLoader(dependencyManager, dependency));
    }
   
    ClassLoader parentClassLoader = classLoaderRegistry.getApplicationClassLoader();
    ClassLoader classLoaderToUse = parentClassLoader != null ? parentClassLoader : GraphClassLoaderFactory.class.getClassLoader();
   
    GraphClassLoader gcl = new GraphClassLoader(classLoaderToUse , new DelegateClassLoader(classLoaders), resourceLoader, moduleDefinition, parentClassLoaderFirst);
    classLoaderRegistry.addClassLoader(moduleDefinition.getName(), gcl);
    return gcl;
  }
View Full Code Here

                    e.getMessage());
        }
    }
   
    public void testWithGraphClassLoader() throws Exception {
        GraphClassLoader rootClassLoader = newGraphClassLoader();

        factoryBean.setBeanClassLoader(rootClassLoader);
       
        doTest();
       
View Full Code Here

        assertTrue(attribute instanceof InternalFrameworkIntegrationServlet);
    }
   
    public void testMaybeCreateUrlClassLoader() throws Exception {
       
        final GraphClassLoader gcl = newGraphClassLoader();
        factoryBean.setBeanClassLoader(gcl);
        JasperClassLoader urlClassLoader = factoryBean.maybeCreateURLClassLoader();
        assertTrue(urlClassLoader.getURLs().length > 0);
       
        final URLClassLoader ucl = newUrlClassLoader();
View Full Code Here

       
        DependencyManager dependencyManager = new DependencyManager(rootDefinition);
        GraphClassLoaderFactory factory = new GraphClassLoaderFactory();
        factory.setModuleLocationResolver(resolver);
       
        GraphClassLoader rootClassLoader = factory.newClassLoader(new GraphClassLoaderRegistry(), dependencyManager, rootDefinition);
        return rootClassLoader;
    }
View Full Code Here

    }
   
    public GraphClassLoader newClassLoader(DependencyManager dependencyManager, ModuleDefinition moduleDefinition) {
       
        String moduleName = moduleDefinition.getName();
        GraphClassLoader classLoader = classLoaderRegistry.getClassLoader(moduleName);
        if (classLoader != null) {
            return classLoader;
        }
       
        ClassRetriever resourceLoader = newResourceLoader(moduleDefinition);
        List<ModuleDefinition> dependencies = dependencyManager.getOrderedModuleDependencies(moduleDefinition.getName());
       
        List<GraphClassLoader> classLoaders = new ArrayList<GraphClassLoader>();
        for (ModuleDefinition dependency : dependencies) {
            if (dependency.getName().equals(moduleDefinition.getName())) continue;
            classLoaders.add(newClassLoader(dependencyManager, dependency));
        }
       
        ClassLoader parentClassLoader = classLoaderRegistry.getApplicationClassLoader();
        ClassLoader classLoaderToUse = parentClassLoader != null ? parentClassLoader : GraphClassLoaderFactory.class.getClassLoader();
       
        GraphClassLoader gcl = new GraphClassLoader(classLoaderToUse , new DelegateClassLoader(classLoaders), resourceLoader, moduleDefinition, parentClassLoaderFirst);
        classLoaderRegistry.addClassLoader(moduleDefinition.getName(), gcl);
        return gcl;
    }
View Full Code Here

        if (classLoader instanceof URLClassLoader) {
            URLClassLoader cl = (URLClassLoader) classLoader;
            return new JasperClassLoader(cl.getURLs(), classLoader);
        }
        if (classLoader instanceof GraphClassLoader) {
            GraphClassLoader gcl = (GraphClassLoader) classLoader;
            final ClassRetriever classRetriever = gcl.getClassRetriever();
           
            if (classRetriever instanceof URLClassRetriever) {
                URLClassRetriever retriever = (URLClassRetriever) classRetriever;
                final URLClassLoader urlClassLoader = retriever.getUrlClassLoader();
                final ClassLoader parent = gcl.getParent();
               
                return new JasperClassLoader(urlClassLoader.getURLs(), parent);
            }
        }
        return null;
View Full Code Here

    }
   
    public GraphClassLoader newClassLoader(GraphClassLoaderRegistry classLoaderRegistry, DependencyManager dependencyManager, ModuleDefinition moduleDefinition) {
       
        String moduleName = moduleDefinition.getName();
        GraphClassLoader classLoader = classLoaderRegistry.getClassLoader(moduleName);
        if (classLoader != null) {
            return classLoader;
        }
       
        ClassRetriever resourceLoader = newResourceLoader(moduleDefinition);
        List<ModuleDefinition> dependencies = dependencyManager.getOrderedModuleDependencies(moduleDefinition.getName());
       
        List<GraphClassLoader> classLoaders = new ArrayList<GraphClassLoader>();
        for (ModuleDefinition dependency : dependencies) {
            if (dependency.getName().equals(moduleDefinition.getName())) continue;
            classLoaders.add(newClassLoader(classLoaderRegistry, dependencyManager, dependency));
        }
       
        ClassLoader parentClassLoader = classLoaderRegistry.getApplicationClassLoader();
        ClassLoader parentClassLoaderToUse = parentClassLoader != null ? parentClassLoader : GraphClassLoaderFactory.class.getClassLoader();
       
        GraphClassLoader gcl = newGraphClassLoader(moduleDefinition, resourceLoader, classLoaders, parentClassLoaderToUse);
        classLoaderRegistry.addClassLoader(moduleDefinition.getName(), gcl);
        return gcl;
    }
View Full Code Here

    protected GraphClassLoader newGraphClassLoader(
            ModuleDefinition moduleDefinition,
            ClassRetriever resourceLoader,
            List<GraphClassLoader> classLoaders,
            ClassLoader parentClassLoader) {
        return new GraphClassLoader(parentClassLoader, new DelegateClassLoader(classLoaders), resourceLoader, moduleDefinition, parentClassLoaderFirst);
    }
View Full Code Here

    public GraphClassLoader newClassLoader(GraphClassLoaderRegistry classLoaderRegistry, DependencyManager dependencyManager, ModuleDefinition moduleDefinition) {
       
        String moduleName = moduleDefinition.getName();
       
        //use registered class loader if it already exists
        GraphClassLoader classLoader = classLoaderRegistry.getClassLoader(moduleName);
        if (classLoader != null) {
            return classLoader;
        }
       
        //create new resource loader for current module definition
        ClassRetriever moduleClassResourceRetriever = newModuleClassResourceRetriever(moduleDefinition);
        List<ModuleDefinition> dependencies = dependencyManager.getOrderedModuleDependencies(moduleDefinition.getName());
       
        //add list of dependent class loaders
        List<GraphClassLoader> classLoaders = new ArrayList<GraphClassLoader>();
        for (ModuleDefinition dependency : dependencies) {
            if (dependency.getName().equals(moduleDefinition.getName())) continue;
            classLoaders.add(newClassLoader(classLoaderRegistry, dependencyManager, dependency));
        }
       
        //set up parent class loader
        ClassLoader parentClassLoader = classLoaderRegistry.getApplicationClassLoader();
        ClassLoader parentClassLoaderToUse = parentClassLoader != null ? parentClassLoader : GraphClassLoaderFactory.class.getClassLoader();
       
        //get third party package to resource mapping. Question: do we need to restrict to packages
        ClassRetriever moduleLibraryResourceRetriever = newModuleLibraryResourceRetriever(moduleDefinition);
       
        GraphClassLoader gcl = newGraphClassLoader(moduleDefinition, moduleClassResourceRetriever, moduleLibraryResourceRetriever, classLoaders, parentClassLoaderToUse);
        classLoaderRegistry.addClassLoader(moduleDefinition.getName(), gcl);
        return gcl;
    }
View Full Code Here

TOP

Related Classes of org.impalaframework.classloader.graph.GraphClassLoader

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.