|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
gate.util.GateClassLoader
public class GateClassLoader
GATE's class loader, which allows loading of classes over the net. A list of URLs is searched, which should point at .jar files or to directories containing class file hierarchies. The class loader is unusual in supporting reloading of classes, which is useful for CREOLE developers who want to recompile modules without relaunching GATE. The loader is also used for creating JAPE RHS action classes.
| Field Summary | |
|---|---|
private static GateClassLoader |
cachedReloader
A cache used by the reloadClass method to store the last new loader that we created. |
private static boolean |
DEBUG
Debug flag |
| Constructor Summary | |
|---|---|
GateClassLoader()
Default construction - use an empty URL list. |
|
GateClassLoader(ClassLoader parent)
Chaining constructor. |
|
GateClassLoader(URL[] urls)
Default construction with URLs list. |
|
GateClassLoader(URL[] urls,
ClassLoader parent)
Chaining constructor with URLs list. |
|
| Method Summary | |
|---|---|
void |
addURL(URL url)
Appends the specified URL to the list of URLs to search for classes and resources. |
Class<?> |
defineGateClass(String name,
byte[] bytes,
int offset,
int len)
Forward a call to super.defineClass, which is protected and final in super. |
Class<?> |
findExistingClass(String name)
Given a fully qualified class name, this method returns the instance of Class if it is already loaded using the ClassLoader or it returns null. |
Class<?> |
loadClass(String name,
boolean resolve)
Delegate loading to the super class (loadClass has protected access there). |
Class<?> |
reloadClass(String name)
Reload a class. |
void |
resolveGateClass(Class<?> c)
Forward a call to super.resolveClass, which is protected and final in super. |
| Methods inherited from class java.net.URLClassLoader |
|---|
definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance |
| Methods inherited from class java.security.SecureClassLoader |
|---|
defineClass, defineClass |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final boolean DEBUG
private static GateClassLoader cachedReloader
| Constructor Detail |
|---|
public GateClassLoader()
public GateClassLoader(ClassLoader parent)
public GateClassLoader(URL[] urls)
public GateClassLoader(URL[] urls,
ClassLoader parent)
| Method Detail |
|---|
public void addURL(URL url)
addURL in class URLClassLoader
public Class<?> loadClass(String name,
boolean resolve)
throws ClassNotFoundException
loadClass in class ClassLoaderClassNotFoundException
public Class<?> defineGateClass(String name,
byte[] bytes,
int offset,
int len)
public void resolveGateClass(Class<?> c)
public Class<?> findExistingClass(String name)
name -
public Class<?> reloadClass(String name)
throws ClassNotFoundException
The method works by avoiding the normal chaining behaviour of class loaders by creating a star-shaped group of parallel loaders. Each of these chains of the system class loader, but as long as the class that we wish to reload wan't loaded by the system loader, it will not be present in a new loader of this type.
An implication is that reloaded classes must always be instantiated via the class returned from this method.
ClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||