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; } }
/** * Tries to find a class from the {@link ModuleClassLoader} that this facade is wrapping, * without doing further delegation to ancestors. */ Class getClass(String name) throws ClassNotFoundException { if (matchExportedPackage(name)) { Class c = privateLoader.findClassDirect(name); classesLoaded++; return c; } return null; }
public ModuleClassLoader run() { return new ModuleClassLoader( ModuleImpl.this, urls, registry.getParentClassLoader()); } });
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()); } }
protected Module newModule(ModuleDefinition moduleDef) { Module m = new ModuleImpl(this, moduleDef); for (ModuleLifecycleListener l : getLifecycleListeners()) { l.moduleInstalled(m); } return m; }
protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { initialize(name); return super.loadClass(name, resolve); }
public ClassLoaderFacade run() { return new ClassLoaderFacade(getPrivateClassLoader()); } });
public class ConfigurationModuleFactory { public static Module 03_default() { final Module module = new ModuleImpl(); module.setComponent(02Interface.class, new 02()); return module; } public static Module 02_default() { final Module module = new ModuleImpl(); module.setComponent(01Interface.class, new 01()); return module; } }
protected List<ActiveDescriptor> parseInhabitants( Module module, String name, ServiceLocator serviceLocator, List<PopulatorPostProcessor> postProcessors) throws IOException { return ((ModuleImpl)module).parseInhabitants(name, postProcessors); }
@Override public Module find(Class clazz) { Module m = super.find(clazz); if (m == null) return proxyMod[0]; return m; }
/** * Detach this module from its registry. This does not free any of the * loaded resources. Only proper release of all references to the public * class loader will ensure module being garbage collected. * Detached modules are orphan and will be garbage collected if resources * are properly disposed. */ public void detach() { registry.remove(this); }
/** * Creates a new child {@link ModulesRegistryImpl} in this {@link ModulesRegistryImpl}. */ public ModulesRegistry createChild() { return new ModulesRegistryImpl(this); }
/** Creates a new instance of ClassLoaderFacade */ public ClassLoaderFacade(ModuleClassLoader privateLoader) { super(EMPTY_URLS, privateLoader.getParent()); this.privateLoader = privateLoader; }
/** * Works like {@link #findResource(String)} but only looks at * this module, without delegating to ancestors. */ URL findResourceDirect(String name) { return privateLoader.findResourceDirect(name); }
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; } }
/** * Tries to find a class from the {@link ModuleClassLoader} that this facade is wrapping, * without doing further delegation to ancestors. */ Class getClass(String name) throws ClassNotFoundException { if (matchExportedPackage(name)) { Class c = privateLoader.findClassDirect(name); classesLoaded++; return c; } return null; }
public ModuleClassLoader run() { return new ModuleClassLoader( ModuleImpl.this, urls, registry.getParentClassLoader()); } });
protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { initialize(name); return super.loadClass(name, resolve); }
public ClassLoaderFacade run() { return new ClassLoaderFacade(getPrivateClassLoader()); } });
protected List<ActiveDescriptor> parseInhabitants( Module module, String name, ServiceLocator serviceLocator, List<PopulatorPostProcessor> postProcessors) throws IOException { return ((ModuleImpl)module).parseInhabitants(name, postProcessors); }