/** * Retrieve the configuration via the ClassLoader. * @param resource The resource to load. * @param loader The default ClassLoader to use. * @return The ConfigurationSource for the configuration. */ protected ConfigurationSource getInputFromResource(final String resource, final ClassLoader loader) { final URL url = Loader.getResource(resource, loader); if (url == null) { return null; } InputStream is = null; try { is = url.openStream(); } catch (final IOException ioe) { return null; } if (is == null) { return null; } if (FileUtils.isFile(url)) { try { return new ConfigurationSource(is, FileUtils.fileFromURI((url.toURI()))); } catch (final URISyntaxException ex) { // Just ignore the exception. } } return new ConfigurationSource(is, resource); }
/** * Returns the classloader that will be used for scanning for classes. If no explicit * ClassLoader has been set by the calling, the context class loader will be used. * * @return the ClassLoader that will be used to scan for classes */ public ClassLoader getClassLoader() { return classloader != null ? classloader : (classloader = Loader.getClassLoader(ResolverUtil.class, null)); }