public ClassLoaderFacade run() { return new ClassLoaderFacade(getPrivateClassLoader()); } });
public ClassLoaderFacade run() { return new ClassLoaderFacade(getPrivateClassLoader()); } });
public void removeImport(ModuleImpl module) { // TODO: this doesn't hide removed module from // other modules that depend on this module. // but the notion of adding dependencies at runtime is broken anyway. if (dependencies.contains(module)) { dependencies.remove(module); getPrivateClassLoader().removeDelegate(module.getClassLoader()); } }
public void addImport(Module module) { //if (Utils.isLoggable(Level.INFO)) { // Utils.getDefaultLogger().info("For module" + getName() + " adding new dependent " + module.getName()); //} // TODO: this doesn't expose newly added module to // other modules that depend on this module. // but the notion of adding dependencies at runtime is broken anyway. if (!dependencies.contains(module)) { dependencies.add((ModuleImpl)module); getPrivateClassLoader().addDelegate(module.getClassLoader()); } }
public void removeImport(ModuleImpl module) { // TODO: this doesn't hide removed module from // other modules that depend on this module. // but the notion of adding dependencies at runtime is broken anyway. if (dependencies.contains(module)) { dependencies.remove(module); getPrivateClassLoader().removeDelegate(module.getClassLoader()); } }
public void addImport(Module module) { //if (Utils.isLoggable(Level.INFO)) { // Utils.getDefaultLogger().info("For module" + getName() + " adding new dependent " + module.getName()); //} // TODO: this doesn't expose newly added module to // other modules that depend on this module. // but the notion of adding dependencies at runtime is broken anyway. if (!dependencies.contains(module)) { dependencies.add((ModuleImpl)module); getPrivateClassLoader().addDelegate(module.getClassLoader()); } }
public Iterable<Class> getProvidersClass(String name) { List<Class> r = serviceClasses.get(name); if(r!=null) return r; // the worst case scenario in the race situation is we end up creating the same list twice, // which is not a big deal. for( String provider : getMetadata().getEntry(name).providerNames) { if(r==null) r = new ArrayList<Class>(); try { r.add(getPrivateClassLoader().loadClass(provider)); } catch (ClassNotFoundException e) { LogHelper.getDefaultLogger().log(Level.SEVERE, "Failed to load "+provider+" from "+getName(),e); } } if(r==null) r = Collections.emptyList(); serviceClasses.put(name, r); return r; }
public Iterable<Class> getProvidersClass(String name) { List<Class> r = serviceClasses.get(name); if(r!=null) return r; // the worst case scenario in the race situation is we end up creating the same list twice, // which is not a big deal. for( String provider : getMetadata().getEntry(name).providerNames) { if(r==null) r = new ArrayList<Class>(); try { r.add(getPrivateClassLoader().loadClass(provider)); } catch (ClassNotFoundException e) { LogHelper.getDefaultLogger().log(Level.SEVERE, "Failed to load "+provider+" from "+getName(),e); } } if(r==null) r = Collections.emptyList(); serviceClasses.put(name, r); return r; }
protected Class<?> findClass(String name) throws ClassNotFoundException { try { return super.findClass(name); } catch (ClassNotFoundException e) { // punch in. find the provider class, no matter where we are. ModuleImpl m = module.getRegistry().getProvidingModule(name); if(m!=null) return m.getPrivateClassLoader().loadClass(name); throw e; } }
public URL getResource(String name) { initialize(name); if(name.startsWith(META_INF_SERVICES)) { // punch in. find the service loader from any module String serviceName = name.substring(META_INF_SERVICES.length()); ModulesRegistry reg = module.getRegistry(); for( Module m : reg.getModules() ) { List<URL> list = m.getMetadata().getDescriptors(serviceName); if(!list.isEmpty()) return list.get(0); } // no such resource return super.getResource(name); } else { // normal service look up URL url = super.getResource(name); if(url!=null) return url; // commons-logging looks for a class file resource for providers, // so check for those if(name.endsWith(".class")) { String className = name.replace('/', '.').substring(0, name.length() - 6); ModuleImpl m = module.getRegistry().getProvidingModule(className); if(m!=null) return m.getPrivateClassLoader().getResource(name); } return null; } }
public URL getResource(String name) { initialize(name); if(name.startsWith(META_INF_SERVICES)) { // punch in. find the service loader from any module String serviceName = name.substring(META_INF_SERVICES.length()); ModulesRegistry reg = module.getRegistry(); for( Module m : reg.getModules() ) { List<URL> list = m.getMetadata().getDescriptors(serviceName); if(!list.isEmpty()) return list.get(0); } // no such resource return super.getResource(name); } else { // normal service look up URL url = super.getResource(name); if(url!=null) return url; // commons-logging looks for a class file resource for providers, // so check for those if(name.endsWith(".class")) { String className = name.replace('/', '.').substring(0, name.length() - 6); ModuleImpl m = module.getRegistry().getProvidingModule(className); if(m!=null) return m.getPrivateClassLoader().getResource(name); } return null; } }
protected Class<?> findClass(String name) throws ClassNotFoundException { try { return super.findClass(name); } catch (ClassNotFoundException e) { // punch in. find the provider class, no matter where we are. ModuleImpl m = module.getRegistry().getProvidingModule(name); if(m!=null) return m.getPrivateClassLoader().loadClass(name); throw e; } }
Class<ImportPolicy> importPolicyClass = (Class<ImportPolicy>) getPrivateClassLoader().loadClass(moduleDef.getImportPolicyClassName()); ImportPolicy importPolicy = importPolicyClass.newInstance(); importPolicy.prepare(this); getPrivateClassLoader().addDelegate(m.getClassLoader());
Class<ImportPolicy> importPolicyClass = (Class<ImportPolicy>) getPrivateClassLoader().loadClass(moduleDef.getImportPolicyClassName()); ImportPolicy importPolicy = importPolicyClass.newInstance(); importPolicy.prepare(this); getPrivateClassLoader().addDelegate(m.getClassLoader());
Class<LifecyclePolicy> lifecyclePolicyClass = (Class<LifecyclePolicy>) getPrivateClassLoader().loadClass(moduleDef.getLifecyclePolicyClassName()); lifecyclePolicy = lifecyclePolicyClass.newInstance(); } catch(ClassNotFoundException e) {
Class<LifecyclePolicy> lifecyclePolicyClass = (Class<LifecyclePolicy>) getPrivateClassLoader().loadClass(moduleDef.getLifecyclePolicyClassName()); lifecyclePolicy = lifecyclePolicyClass.newInstance(); } catch(ClassNotFoundException e) {