@Override public URL getResource(String name) { URL result = bundle.getResource(name); if (result != null) return result; // If this is a META-INF/services lookup, search in every // modules that we know of. if(name.startsWith(META_INF_SERVICES)) { // punch in. find the service loader from any module String serviceName = name.substring( META_INF_SERVICES.length()); for( Module m : registry.getModules() ) { List<URL> list = m.getMetadata().getDescriptors( serviceName); if(!list.isEmpty()) return list.get(0); } } return null; }
public Enumeration<URL> getResources(String name) throws IOException { 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()); Vector<URL> urls = new Vector<URL>(); ModulesRegistry reg = module.getRegistry(); for( Module m : reg.getModules() ) urls.addAll(m.getMetadata().getDescriptors(serviceName)); return urls.elements(); } else { // normal look up return super.getResources(name); } }
public Enumeration<URL> getResources(String name) throws IOException { 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()); Vector<URL> urls = new Vector<URL>(); ModulesRegistry reg = module.getRegistry(); for( Module m : reg.getModules() ) urls.addAll(m.getMetadata().getDescriptors(serviceName)); return urls.elements(); } else { // normal look up return super.getResources(name); } }
punchedInURLs.addAll(m.getMetadata().getDescriptors( serviceName));
if (!select(m)) continue; // We don't look in modules that don't meet punch in criteria if (m == APIModule) continue; // we have already looked up resources in apiModuleLoader punchedInURLs.addAll(m.getMetadata().getDescriptors(serviceName));
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; } }
List<URL> list = m.getMetadata().getDescriptors( serviceName); if(!list.isEmpty()) {
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; } }
Map<String, List<Descriptor>> descriptorMap = module.getModuleDefinition().getMetadata().getDescriptors();