| Method from org.jboss.mx.loading.LoaderRepository Detail: |
abstract public void addClassLoader(ClassLoader cl)
Add a class loader to the repository |
abstract public boolean addClassLoaderURL(ClassLoader cl,
URL url)
Update the set of URLs known to be associated with a previously added
class loader. |
void cacheLoadedClass(String name,
Class cls,
ClassLoader cl) {
synchronized( classes )
{
// Update the global cache
classes.put(name, cls);
if( log.isTraceEnabled() )
{
log.trace("cacheLoadedClass, classname: "+name+", class: "+cls
+", cl: "+cl);
}
/**
* TODO: Adding this implementation is a hack for jmx 1.2 checkin.
* Had to add this because need getCachedClass() to work.
* However, this method does not add loaded classes to collection
* to be unloaded when called to remove classloader.
* Hopefully this will be a short term workaround.
* Contact telrod@e2technologies.net if you have questions. -TME
*/
}
}
Add a class to the the cache |
void clear() {
classes.clear();
}
|
public int compare(LoaderRepository lr) {
if (lr == this)
return 0;
else
return -lr.reverseCompare(this);
}
Compare two loader repository, by default we do no special ordering |
public Class getCachedClass(String classname) {
return (Class)classes.get(classname);
}
|
public Vector getLoaders() {
nativeClassBySignature = new HashMap();
nativeClassBySignature.put("boolean", boolean.class);
nativeClassBySignature.put("byte", byte.class);
nativeClassBySignature.put("char", char.class);
nativeClassBySignature.put("double", double.class);
nativeClassBySignature.put("float", float.class);
nativeClassBySignature.put("int", int.class);
nativeClassBySignature.put("long", long.class);
nativeClassBySignature.put("short", short.class);
nativeClassBySignature.put("void", void.class);
nativeClassBySignature.put("boolean[]", boolean[].class);
nativeClassBySignature.put("byte[]", byte[].class);
nativeClassBySignature.put("char[]", char[].class);
nativeClassBySignature.put("double[]", double[].class);
nativeClassBySignature.put("float[]", float[].class);
nativeClassBySignature.put("int[]", int[].class);
nativeClassBySignature.put("long[]", long[].class);
nativeClassBySignature.put("short[]", short[].class);
return loaders;
}
Construct the native class map |
public static final Class getNativeClassForName(String className) {
// Check for native classes
return (Class)nativeClassBySignature.get(className);
}
Return the class of a java native type |
abstract public URL getResource(String name,
ClassLoader cl)
Find a resource URL for the given name |
abstract public void getResources(String name,
ClassLoader cl,
List urls)
Find all resource URLs for the given name. Since this typically
entails an exhuastive search of the repository it can be a relatively
slow operation. |
public Translator getTranslator() {
return translator;
}
|
public URL[] getURLs() {
return null;
}
|
abstract public Class loadClass(String className) throws ClassNotFoundException
Loads a class from the repository. This method attempts to load the class
using all the classloader registered to the repository. |
abstract public Class loadClass(String name,
boolean resolve,
ClassLoader cl) throws ClassNotFoundException
Load the given class from the repository |
abstract public Class loadClassBefore(ClassLoader stop,
String className) throws ClassNotFoundException
Loads a class from the repository, using the classloaders that were
registered before the given classloader. |
abstract public Class loadClassWithout(ClassLoader loader,
String className) throws ClassNotFoundException
Loads a class from the repository, excluding the given
classloader. |
abstract public RepositoryClassLoader newClassLoader(URL url,
boolean addToRepository) throws Exception
Create RepositoryClassLoader and optionally add it to the repository |
abstract public RepositoryClassLoader newClassLoader(URL url,
URL origURL,
boolean addToRepository) throws Exception
Create RepositoryClassLoader and optionally add it to the repository |
abstract public void removeClassLoader(ClassLoader cl)
Remove a cladd loader from the repository. |
protected int reverseCompare(LoaderRepository lr) {
return 0;
}
Allow subclasses to override the ordering |
public void setTranslator(Translator t) {
translator = t;
}
|