public List<URL> getDescriptors(String serviceName) { return getEntry(serviceName).resources; }
public void load(URL source, String serviceName) throws IOException { load(source,serviceName,source.openStream()); }
public ModuleMetadata getMetadata() { ModuleMetadata metadata = new ModuleMetadata(); generate(metadata); return metadata; }
@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; }
Map<String, List<Descriptor>> descriptorMap = module.getModuleDefinition().getMetadata().getDescriptors(); module.getModuleDefinition().getMetadata().addDescriptors(name, descriptors);
for( ModuleMetadata.Entry spi : newModule.getMetadata().getEntries() ) { for( String name : spi.providerNames ) providers.put(name,newModule);
result.addDescriptors(serviceLocatorName, descriptors);
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); } }
for( ModuleMetadata.Entry spi : newModule.getMetadata().getEntries() ) { for( String name : spi.providerNames ) providers.put(name,newModule);
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 List<URL> getDescriptors(String serviceName) { return getEntry(serviceName).resources; }
public void load(URL source, String serviceName) throws IOException { load(source,serviceName,source.openStream()); }
public ModuleMetadata getMetadata() { ModuleMetadata metadata = new ModuleMetadata(); generate(metadata); return metadata; }
punchedInURLs.addAll(m.getMetadata().getDescriptors( serviceName));
/** * Returns true if this module has any provider for the given service class. */ public boolean hasProvider(Class serviceClass) { String name = serviceClass.getName(); List<Class> v = serviceClasses.get(name); if(v!=null && !v.isEmpty()) return true; return getMetadata().getEntry(name).hasProvider(); }
public void load(URL source, String serviceName, InputStream is) throws IOException { Entry e = entries.get(serviceName); if(e==null) { e = new Entry(); entries.put(serviceName,e); e.load(source,is); } else { is.close(); } }
public Manifest getManifest() { return generate(new ModuleMetadata()); }
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));
/** * Returns true if this module has any provider for the given service class. */ public boolean hasProvider(Class serviceClass) { String name = serviceClass.getName(); List<Class> v = serviceClasses.get(name); if(v!=null && !v.isEmpty()) return true; return getMetadata().getEntry(name).hasProvider(); }
public void load(URL source, String serviceName, InputStream is) throws IOException { Entry e = entries.get(serviceName); if(e==null) { e = new Entry(); entries.put(serviceName,e); e.load(source,is); } else { is.close(); } }