metaglue
Class ChainingClassLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--metaglue.ChainingClassLoader

public class ChainingClassLoader
extends ClassLoader

Handles a list of loader classes (usually MetaglueClassLoaders) and dispatches class loading to them in order. Also can remove class loaders. This code will override most of the ClassLoader methods, so that it will not cache classes on its own, but will instead rely on the caching done by its delegate and listed class loaders.


Constructor Summary
ChainingClassLoader()
           
 
Method Summary
 void addLoader(ClassLoader cl)
          Add a new class loader to the loader list.
 void addMetaglueClassLoader(Metaglue ma)
          Add a new Metaglue class loader to the loader list, given a Metaglue.
protected  Class findClass(String name)
           
 byte[] getClassData(String name)
           
 void removeLoader(ClassLoader cl)
          Removes a given class loader from the list.
 void removeLoaderForAgentID(AgentID aid)
          Removes any MetaglueClassLoader which has the given agentID for the agent it is monitoring.
protected  void setup()
           
 
Methods inherited from class java.lang.ClassLoader
defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainingClassLoader

public ChainingClassLoader()
Method Detail

addLoader

public void addLoader(ClassLoader cl)
Add a new class loader to the loader list.
Parameters:
cl - the class loader to be added.

addMetaglueClassLoader

public void addMetaglueClassLoader(Metaglue ma)
Add a new Metaglue class loader to the loader list, given a Metaglue.
Parameters:
cl - the class loader to be added.

removeLoader

public void removeLoader(ClassLoader cl)
Removes a given class loader from the list.
Parameters:
cl - the class loader to be removed.

removeLoaderForAgentID

public void removeLoaderForAgentID(AgentID aid)
Removes any MetaglueClassLoader which has the given agentID for the agent it is monitoring.
Parameters:
aid - The agentID for which any MetaglueClassLoaders should be removed.
See Also:
MetaglueClassLoader

getClassData

public byte[] getClassData(String name)
                    throws ClassNotFoundException

setup

protected void setup()

findClass

protected Class findClass(String name)
                   throws ClassNotFoundException
Overrides:
findClass in class ClassLoader