java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
abbot.util.PathClassLoader
abbot.util.PreloadingClassLoader
abbot.script.AppClassLoader
- public class AppClassLoader
- extends abbot.util.PreloadingClassLoader
A custom class loader which installs itself as if it were the application
class loader, optionally preloading all classes. A classpath of null is
equivalent to the system property java.class.path.
The class loader may optionally load a class before the parent class
loader gets a chance to look for the class (instead of the default
behavior, which always delegates to the parent class loader first). This
behavior enables the class to be reloaded simply by using a new instance of
this class loader.
This class mimics the behavior of sun.misc.Launcher$AppClassLoader as much
as possible.
Bootstrap classes are always delegated to the bootstrap loader, with the
exception of the sun.applet package, which will never be delegated, since
it does not work properly unless it is reloaded.
| Nested classes inherited from class java.lang.ClassLoader |
|
|
Constructor Summary |
AppClassLoader(java.lang.String classPath,
boolean delegate)
Constructs a AppClassLoader with a custom classpath, indicating
whether the class loader should delegate to its parent class loader
prior to searching for a given resource. |
| Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
PS
protected static final java.lang.String PS
eventQueue
private AppClassLoader.AppEventQueue eventQueue
- A new event queue installed for the lifetime of this class loader.
bootstrapLoader
private AppClassLoader.BootstrapClassLoader bootstrapLoader
- For use in checking if a class is in the bootstrap class path.
defaultPathLoader
private abbot.util.PreloadingClassLoader defaultPathLoader
- For use in checking if a class is in the framework class path.
classPath
private java.lang.String classPath
oldClassLoader
private java.lang.ClassLoader oldClassLoader
- Old class loader context for the thread where this loader was
installed.
installedThread
private java.lang.Thread installedThread
oldClassPath
private java.lang.String oldClassPath
mustPreloadPrefixes
private java.lang.String[] mustPreloadPrefixes
- List of bootstrap classes we most definitely want to be loaded by this
class loader, rather than any parent, or the bootstrap loader.
bootstrapPrefixes
private static final java.lang.String[] bootstrapPrefixes
AppClassLoader
public AppClassLoader(java.lang.String classPath,
boolean delegate)
- Constructs a AppClassLoader with a custom classpath, indicating
whether the class loader should delegate to its parent class loader
prior to searching for a given resource.
The class path argument may use either a colon or semicolon to separate
its elements.
shouldDelegate
protected boolean shouldDelegate(java.lang.String name)
isExtension
private boolean isExtension(java.lang.String name)
getBootstrapPath
protected java.lang.String getBootstrapPath()
- Returns the path to the primary JRE classes, not including any
extensions. This is primarily needed for loading
sun.applet.AppletViewer, since most other classes in the bootstrap path
should only be loaded by the bootstrap loader.
findClass
public java.lang.Class findClass(java.lang.String name)
throws java.lang.ClassNotFoundException
- Finds and loads the class with the specified name from the search
path. If the class is a bootstrap class, use our own bootstrap loader.
isBootstrapClass
boolean isBootstrapClass(java.lang.String name)
install
public void install()
- Ensure that everything else subsequently loaded on the same thread or
any subsequently spawned threads uses the given class loader. Also
ensure that classes loaded by the event dispatch thread and threads it
spawns use the given class loader.
uninstall
public void uninstall()
- Reverse the effects of install. Has no effect if the class loader
has not been installed on any thread.
mustPreload
private boolean mustPreload(java.lang.String name)
- Does the given class absolutely need to be preloaded?