org.apache.tomcat.util.depend
Class DependClassLoader
java.lang.Object
java.lang.ClassLoader
org.apache.tomcat.util.depend.DependClassLoader
- Direct Known Subclasses:
- DependClassLoader12
- public class DependClassLoader
- extends java.lang.ClassLoader
This is a wrapper class loader that will delegate all calls to
the parent. It will also generate events for every loaded class,
for use in maintaining dependencies.
In order to keep this generic we'll use findResource() to find the
source of the class, and then forward to the class loader - that
means we duplicate the search operation.
Class loading happens only once per request, and this will have probably
little effect.
Also, the alternative is to use custom class loaders - there are many
reasons to avoid this.
In "production" sites reloading should be turned off anyway, so the
class loader will not be "wrapped"
Field Summary |
protected java.lang.ClassLoader |
parent
|
protected java.lang.ClassLoader |
parent2
|
protected java.lang.Object |
pd
|
Method Summary |
protected java.lang.Class |
defineClassCompat(java.lang.String name,
byte[] data,
int s,
int end,
java.net.URL res)
This method must be overriden to provide additional functionality,
like associating a protection domain |
static DependClassLoader |
getDependClassLoader(DependManager depM,
java.lang.ClassLoader parent,
java.lang.Object pd,
int debug)
|
java.lang.ClassLoader |
getParentLoader()
|
java.net.URL |
getResource(java.lang.String name)
|
java.io.InputStream |
getResourceAsStream(java.lang.String name)
|
protected java.lang.Class |
loadClass(java.lang.String name,
boolean resolve)
Resolves the specified name to a Class. |
protected java.lang.Class |
loadClassInternal1(java.lang.String name,
boolean resolve)
Actual class loading. |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
parent
protected java.lang.ClassLoader parent
parent2
protected java.lang.ClassLoader parent2
pd
protected java.lang.Object pd
DependClassLoader
public DependClassLoader(DependManager depM,
java.lang.ClassLoader parent,
java.lang.Object pd)
getDependClassLoader
public static DependClassLoader getDependClassLoader(DependManager depM,
java.lang.ClassLoader parent,
java.lang.Object pd,
int debug)
loadClass
protected java.lang.Class loadClass(java.lang.String name,
boolean resolve)
throws java.lang.ClassNotFoundException
- Resolves the specified name to a Class. The method loadClass()
is called by the virtual machine. As an abstract method,
loadClass() must be defined in a subclass of ClassLoader.
- Parameters:
name
- the name of the desired Class.resolve
- true if the Class needs to be resolved;
false if the virtual machine just wants to determine
whether the class exists or not
- Returns:
- the resulting Class.
- Throws:
java.lang.ClassNotFoundException
- if the class loader cannot
find a the requested class.
loadClassInternal1
protected java.lang.Class loadClassInternal1(java.lang.String name,
boolean resolve)
throws java.lang.ClassNotFoundException
- Actual class loading. The name 'loadClassInternal' generates a warning,
as a private method with the same name exists int ClassLoader in JDK1.1 ( Sun impl ).
- Throws:
java.lang.ClassNotFoundException
defineClassCompat
protected java.lang.Class defineClassCompat(java.lang.String name,
byte[] data,
int s,
int end,
java.net.URL res)
throws java.lang.ClassNotFoundException
- This method must be overriden to provide additional functionality,
like associating a protection domain
- Throws:
java.lang.ClassNotFoundException
getResource
public java.net.URL getResource(java.lang.String name)
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String name)
getParentLoader
public java.lang.ClassLoader getParentLoader()
Copyright © 2001 Apache Software Foundation. All Rights Reserved.