public class RegistryClassLoader extends SecureClassLoader implements ResourceRegistry
SecureClassLoader
that derives classes and resource URL
s from a registry delegation
chain.Modifier and Type | Class and Description |
---|---|
protected class |
RegistryClassLoader.PrefixNode
A node class for policy hierarchy lookups.
|
Constructor and Description |
---|
RegistryClassLoader()
Default constructor.
|
RegistryClassLoader(ClassLoader parent)
Alternate constructor.
|
Modifier and Type | Method and Description |
---|---|
RegistryClassLoader |
addClass(String className)
Adds a class which requires, for linking purposes, resources exclusive to this class loader.
|
RegistryClassLoader |
addPackage(String packageName)
Adds a package whose classes require, for linking purposes, resources exclusive to this class loader.
|
RegistryClassLoader |
addRegistry(ResourceRegistry registry)
Adds a registry to the delegation chain.
|
protected Class<?> |
findClass(String className)
Attempts to derive a class from the registry delegation chain.
|
protected URL |
findResource(String pathname) |
protected Enumeration<URL> |
findResources(String pathname) |
InputStream |
getResourceAsStream(String pathname)
Gets an
InputStream to the resource at the given pathname. |
protected Class<?> |
loadClass(String className,
boolean resolve)
Attempts to derive a class first from this class loader's parent, and then from its
findClass(String)
method. |
void |
loadLibrary(String pathname)
Attempts to load a native library first from the class path, and then from the system's dynamic linker.
|
String |
toString()
Creates a human-readable representation of this class loader.
|
defineClass, defineClass, getPermissions
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getResource, getResources
public RegistryClassLoader()
public RegistryClassLoader(ClassLoader parent)
protected Class<?> loadClass(String className, boolean resolve) throws ClassNotFoundException
findClass(String)
method.loadClass
in class ClassLoader
ClassNotFoundException
- when the class could not be found.protected Class<?> findClass(String className) throws ClassNotFoundException
findClass
in class ClassLoader
ClassNotFoundException
- when the class could not be found.protected URL findResource(String pathname)
findResource
in class ClassLoader
protected Enumeration<URL> findResources(String pathname) throws IOException
findResources
in class ClassLoader
IOException
public InputStream getResourceAsStream(String pathname)
ResourceRegistry
InputStream
to the resource at the given pathname.getResourceAsStream
in interface ResourceRegistry
getResourceAsStream
in class ClassLoader
pathname
- the resource pathname.InputStream
to the resource or null
if not found.public void loadLibrary(String pathname)
public RegistryClassLoader addRegistry(ResourceRegistry registry)
public RegistryClassLoader addClass(String className)
public RegistryClassLoader addPackage(String packageName)