|
|||||||||
Home >> All >> edu >> emory >> mathcs >> util >> [ classloader overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
edu.emory.mathcs.util.classloader
Class GenericClassLoader

java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
edu.emory.mathcs.util.classloader.GenericClassLoader
- Direct Known Subclasses:
- URIClassLoader
- public class GenericClassLoader
- extends java.security.SecureClassLoader
This class loader can be used to find class, resource and library handles as well as load classes, resources and libraries using abstract ResourceFinder entity encapsulating the searching approach. Resource handles allow accessing meta-information (like Attributes, Certificates etc.) related to classes, resources and libraries prior to loading them.
GenericClassLoader is intended to be used as a base for custom class loaders. In most applications, GenericClassLoader can be used directly -- the application-specific functionality of resource searching can often be completely delegated to the resource finder. See URIClassLoader for a concrete implementation using a simple resource finder.
- Version:
- 1.0
Nested Class Summary |
Nested classes inherited from class java.lang.ClassLoader |
|
Field Summary | |
private java.security.AccessControlContext |
acc
|
protected ResourceFinder |
finder
|
Fields inherited from class java.security.SecureClassLoader |
|
Fields inherited from class java.lang.ClassLoader |
|
Constructor Summary | |
GenericClassLoader(ResourceFinder finder)
Creates new GenericClassLoader instance using specified ResourceFinder to find resources and with default parent class loader. |
|
GenericClassLoader(ResourceFinder finder,
java.lang.ClassLoader parent)
Creates new GenericClassLoader instance using specified ResourceFinder to find resources and having specified parent class loader. |
Method Summary | |
protected java.lang.Class |
defineClass(java.lang.String name,
ResourceHandle h)
|
protected java.lang.Package |
definePackage(java.lang.String name,
java.util.jar.Manifest man,
java.net.URL url)
Defines a new package by name in this ClassLoader. |
protected java.lang.Class |
findClass(java.lang.String name)
Finds and loads the class with the specified name. |
protected java.lang.String |
findLibrary(java.lang.String libname)
Returns the absolute path name of a native library. |
protected java.net.URL |
findResource(java.lang.String name)
Finds the resource with the specified name. |
protected java.util.Enumeration |
findResources(java.lang.String name)
Returns an Enumeration of URLs representing all of the resources having the specified name. |
protected ResourceHandle |
getClassHandle(java.lang.String name)
Finds the ResourceHandle object for the class with the specified name. |
static java.net.URLStreamHandler |
getDefaultURLStreamHandler(java.lang.String protocol)
|
protected ResourceHandle |
getLibraryHandle(java.lang.String name)
Finds the ResourceHandle object for the native library with the specified name. |
private static java.lang.String |
getManifestVal(java.util.jar.Attributes entryAttr,
java.util.jar.Attributes mainAttr,
java.util.jar.Attributes.Name key)
|
protected ResourceHandle |
getResourceHandle(java.lang.String name)
Finds the ResourceHandle object for the resource with the specified name. |
protected java.util.Enumeration |
getResourceHandles(java.lang.String name)
Returns an Enumeration of ResourceHandle objects representing all of the resources having the specified name. |
private boolean |
isSealed(java.lang.String name,
java.util.jar.Manifest man)
returns true if the specified package name is sealed according to the given manifest. |
Methods inherited from class java.security.SecureClassLoader |
defineClass, getPermissions |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
finder
protected ResourceFinder finder
acc
private java.security.AccessControlContext acc
Constructor Detail |
GenericClassLoader
public GenericClassLoader(ResourceFinder finder, java.lang.ClassLoader parent)
- Creates new GenericClassLoader instance using specified
ResourceFinder to find resources and having specified
parent class loader.
GenericClassLoader
public GenericClassLoader(ResourceFinder finder)
- Creates new GenericClassLoader instance using specified
ResourceFinder to find resources and with default
parent class loader.
Method Detail |
findClass
protected java.lang.Class findClass(java.lang.String name) throws java.lang.ClassNotFoundException
- Finds and loads the class with the specified name.
defineClass
protected java.lang.Class defineClass(java.lang.String name, ResourceHandle h) throws java.io.IOException
isSealed
private boolean isSealed(java.lang.String name, java.util.jar.Manifest man)
- returns true if the specified package name is sealed according to the
given manifest.
findResource
protected java.net.URL findResource(java.lang.String name)
- Finds the resource with the specified name.
findResources
protected java.util.Enumeration findResources(java.lang.String name) throws java.io.IOException
- Returns an Enumeration of URLs representing all of the resources
having the specified name.
findLibrary
protected java.lang.String findLibrary(java.lang.String libname)
- Returns the absolute path name of a native library. The VM
invokes this method to locate the native libraries that belong
to classes loaded with this class loader. If this method returns
null
, the VM searches the library along the path specified as thejava.library.path
property. This method invokegetLibraryHandle(java.lang.String)
55 method to find handle of this library. If the handle is found and its URL protocol is "file", the system-dependent absolute library file path is returned. Otherwise this method returns null.Subclasses can override this method to provide specific approaches in library searching.
getClassHandle
protected ResourceHandle getClassHandle(java.lang.String name)
- Finds the ResourceHandle object for the class with the specified name.
Unlike
findClass()
, this method does not load the class.
getResourceHandle
protected ResourceHandle getResourceHandle(java.lang.String name)
- Finds the ResourceHandle object for the resource with the specified name.
getLibraryHandle
protected ResourceHandle getLibraryHandle(java.lang.String name)
- Finds the ResourceHandle object for the native library with the specified
name.
The library name must be '/'-separated path. The last part of this
path is substituted by its system-dependent mapping (using
System.mapLibraryName(String)>
System.mapLibraryName(String)
55 method). Next, theResourceFinder
is used to look for the library as it was ordinary resource.Subclasses can override this method to provide specific approaches in library searching.
getResourceHandles
protected java.util.Enumeration getResourceHandles(java.lang.String name)
- Returns an Enumeration of ResourceHandle objects representing all of the
resources having the specified name.
definePackage
protected java.lang.Package definePackage(java.lang.String name, java.util.jar.Manifest man, java.net.URL url) throws java.lang.IllegalArgumentException
- Defines a new package by name in this ClassLoader. The attributes
contained in the specified Manifest will be used to obtain package
version and sealing information. For sealed packages, the additional
URL specifies the code source URL from which the package was loaded.
getManifestVal
private static java.lang.String getManifestVal(java.util.jar.Attributes entryAttr, java.util.jar.Attributes mainAttr, java.util.jar.Attributes.Name key)
getDefaultURLStreamHandler
public static java.net.URLStreamHandler getDefaultURLStreamHandler(java.lang.String protocol)
|
|||||||||
Home >> All >> edu >> emory >> mathcs >> util >> [ classloader overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |