/** * {@inheritDoc} */ @Override public void destroy() { this.resourceFinder.destroy(); super.destroy(); }
/** * {@inheritDoc} */ @Override public Enumeration<URL> findResources(final String resourceName) throws IOException { // TODO this is not right // first get the resources from the parent classloaders Enumeration<?> parentResources = super.findResources(resourceName); // get the classes from my urls Enumeration<?> myResources = (Enumeration<?>) AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { return MonoParentJarFileClassLoader.this.resourceFinder.findResources(resourceName); } }, this.acc); // join the two together return new UnionEnumeration(parentResources, myResources); }
protected ClassLoader createChildClassLoader(String name, File dir, ClassLoader parentClassLoader) throws MalformedURLException { List urls = new ArrayList(); if (verbose) { try { log.info("Adding to classpath: " + dir.getCanonicalPath()); } catch (Exception e) { } } File[] files = dir.listFiles(); if (files != null) { for (int j = 0; j < files.length; j++) { if (files[j].getName().endsWith(".zip") || files[j].getName().endsWith(".jar")) { if (verbose) { try { log.info("Adding to classpath: " + name + " jar: " + files[j].getCanonicalPath()); } catch (Exception e) { } } urls.add(files[j].toURL()); } } } URL u[] = new URL[urls.size()]; urls.toArray(u); return new NamedClassLoader(name + ".ClassLoader", u, parentClassLoader); }
/** * {@inheritDoc} */ @Override public Enumeration<URL> findResources(final String resourceName) throws IOException { // TODO this is not right // first get the resources from the parent classloaders Enumeration<?> parentResources = super.findResources(resourceName); // get the classes from my urls Enumeration<?> myResources = (Enumeration<?>) AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { return MonoParentJarFileClassLoader.this.resourceFinder.findResources(resourceName); } }, this.acc); // join the two together return new UnionEnumeration(parentResources, myResources); }
List myResources = Collections.list(super.findResources(name)); resources.addAll(myResources); List myResources = Collections.list(super.findResources(name)); resources.addAll(myResources);
/** * {@inheritDoc} */ @Override public void destroy() { this.resourceFinder.destroy(); super.destroy(); }