| java.lang.Object java.lang.ClassLoader org.netbeans.ProxyClassLoader
All known Subclasses: org.netbeans.JarClassLoader,
ProxyClassLoader | public class ProxyClassLoader extends ClassLoader implements Util.PackageAccessibleClassLoader(Code) | | A class loader that has multiple parents and uses them for loading
classes and resources. It is optimized for working in the enviroment
of a deeply nested classloader hierarchy. It uses shared knowledge
about package population to route the loading request directly
to the correct classloader.
It doesn't load classes or resources itself, but allows subclasses
to add such functionality.
author: Petr Nejedly, Jesse Glick |
Constructor Summary | |
public | ProxyClassLoader(ClassLoader[] parents, boolean transitive) Create a multi-parented classloader.
Parameters: parents - all direct parents of this classloader, except system one. Parameters: coveredPackages - Enumeration of Strings if format "org.something" + * containing all packages to be covered by this classloader. |
Method Summary | |
final protected void | addCoveredPackages(Iterable<String> coveredPackages) | public void | append(ClassLoader[] nueparents) Add new parents dynamically. | protected Package | definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) This is here just for locking serialization purposes. | public void | destroy() | protected Class | doLoadClass(String pkg, String name) This ClassLoader can't load anything itself. | protected URL | findResource(String name) This ClassLoader can't load anything itself. | final protected synchronized Enumeration<URL> | findResources(String name) Finds all the resource with the given name. | protected Package | getPackage(String name) Returns a Package that has been defined by this class loader or any
of its parents. | public Package | getPackageAccessibly(String name) | protected Package | getPackageFast(String name, boolean recurse) Faster way to find a package. | protected synchronized Package[] | getPackages() Returns all of the Packages defined by this class loader and its parents. | public Package[] | getPackagesAccessibly() | final public URL | getResource(String name) Finds the resource with the given name.
Parameters: name - a "/"-separated path name that identifies the resource. | protected synchronized Class | loadClass(String name, boolean resolve) Loads the class with the specified name. | final protected void | setSystemClassLoader(ClassLoader s) | protected boolean | shouldDelegateResource(String pkg, ClassLoader parent) | protected Enumeration<URL> | simpleFindResources(String name) |
ProxyClassLoader | public ProxyClassLoader(ClassLoader[] parents, boolean transitive)(Code) | | Create a multi-parented classloader.
Parameters: parents - all direct parents of this classloader, except system one. Parameters: coveredPackages - Enumeration of Strings if format "org.something" + * containing all packages to be covered by this classloader. Parameters: transitive - whether other PCLs depending on this one willautomatically search through its parent list |
definePackage | protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException(Code) | | This is here just for locking serialization purposes.
Delegates to super.definePackage with proper locking.
Also tracks the package in our private cache, since
getPackageFast(...,...,false) will not call super.getPackage.
|
destroy | public void destroy()(Code) | | Called before releasing the classloader so it can itself unregister
from the global ClassLoader pool
|
doLoadClass | protected Class doLoadClass(String pkg, String name)(Code) | | This ClassLoader can't load anything itself. Subclasses
may override this method to do some class loading themselves. The
implementation should not throw any exception, just return
null if it can't load required class.
Parameters: name - the name of the class the resulting Class object or null |
findResource | protected URL findResource(String name)(Code) | | This ClassLoader can't load anything itself. Subclasses
may override this method to do some resource loading themselves.
Parameters: name - the resource name a URL for reading the resource, or null if the resource could not be found. |
findResources | final protected synchronized Enumeration<URL> findResources(String name) throws IOException(Code) | | Finds all the resource with the given name. The implementation of
this method uses the
ProxyClassLoader.simpleFindResources(String) method to find
all the resources available from this classloader and adds all the
resources from all the parents.
Parameters: name - the resource name an Enumeration of URLs for the resources throws: IOException - if I/O errors occur |
getPackage | protected Package getPackage(String name)(Code) | | Returns a Package that has been defined by this class loader or any
of its parents.
Parameters: name - the package name the Package corresponding to the given name, or null if not found |
getPackageFast | protected Package getPackageFast(String name, boolean recurse)(Code) | | Faster way to find a package.
Parameters: name - package name in org.netbeans.modules.foo format Parameters: sname - package name in org/netbeans/modules/foo/ format Parameters: recurse - whether to also ask parents located package, or null |
getPackages | protected synchronized Package[] getPackages()(Code) | | Returns all of the Packages defined by this class loader and its parents.
the array of Package objects defined by thisClassLoader |
getPackagesAccessibly | public Package[] getPackagesAccessibly()(Code) | | |
getResource | final public URL getResource(String name)(Code) | | Finds the resource with the given name.
Parameters: name - a "/"-separated path name that identifies the resource. a URL for reading the resource, or null ifthe resource could not be found. See Also: ProxyClassLoader.findResource(String) |
loadClass | protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException(Code) | | Loads the class with the specified name. The implementation of
this method searches for classes in the following order:
- Looks for a known package and pass the loading to the ClassLoader
for that package.
- For unknown packages passes the call directly
already been loaded.
Parameters: name - the name of the class Parameters: resolve - if true then resolve the class the resulting Class object exception: ClassNotFoundException - if the class could not be found |
Methods inherited from java.lang.ClassLoader | public synchronized void clearAssertionStatus()(Code)(Java Doc) final protected Class> defineClass(byte[] b, int off, int len) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, byte[] b, int off, int len) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, java.nio.ByteBuffer b, ProtectionDomain protectionDomain) throws ClassFormatError(Code)(Java Doc) protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException(Code)(Java Doc) protected Class> findClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected String findLibrary(String libname)(Code)(Java Doc) final protected Class> findLoadedClass(String name)(Code)(Java Doc) protected URL findResource(String name)(Code)(Java Doc) protected Enumeration<URL> findResources(String name) throws IOException(Code)(Java Doc) final protected Class> findSystemClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected Package getPackage(String name)(Code)(Java Doc) protected Package[] getPackages()(Code)(Java Doc) final public ClassLoader getParent()(Code)(Java Doc) public URL getResource(String name)(Code)(Java Doc) public InputStream getResourceAsStream(String name)(Code)(Java Doc) public Enumeration<URL> getResources(String name) throws IOException(Code)(Java Doc) public static ClassLoader getSystemClassLoader()(Code)(Java Doc) public static URL getSystemResource(String name)(Code)(Java Doc) public static InputStream getSystemResourceAsStream(String name)(Code)(Java Doc) public static Enumeration<URL> getSystemResources(String name) throws IOException(Code)(Java Doc) public Class> loadClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected synchronized Class> loadClass(String name, boolean resolve) throws ClassNotFoundException(Code)(Java Doc) final protected void resolveClass(Class> c)(Code)(Java Doc) public synchronized void setClassAssertionStatus(String className, boolean enabled)(Code)(Java Doc) public synchronized void setDefaultAssertionStatus(boolean enabled)(Code)(Java Doc) public synchronized void setPackageAssertionStatus(String packageName, boolean enabled)(Code)(Java Doc) final protected void setSigners(Class> c, Object[] signers)(Code)(Java Doc)
|
|
|