ajanta.server
Class AgentLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--java.security.SecureClassLoader
              |
              +--ajanta.server.AgentLoader

public class AgentLoader
extends java.security.SecureClassLoader

Class AgentLoader is our class loader which is used to isolate incoming agents into separate protection domains. Each executing agent is assigned a separate class loader object that is responsible for locating and loading any classes that are needed during the agent's execution. Whenever the agent code encounters an object reference for which the class is not currently loaded, the Java virtual machine requests the agent's class loader to load it.


Constructor Summary
AgentLoader(ajanta.server.AgentServer as, ajanta.naming.URN ag, ajanta.naming.URN c, ajanta.naming.URN owner, java.lang.String p)
           
 
Method Summary
protected  java.lang.Class loadClass(java.lang.String name, boolean resolve)
          The loadClass method is automatically invoked by the JVM whenever it encounters a reference of a type which is not already known to it.
 
Methods inherited from class java.security.SecureClassLoader
defineClass, getPermissions
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, 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
 

Constructor Detail

AgentLoader

public AgentLoader(ajanta.server.AgentServer as,
                   ajanta.naming.URN ag,
                   ajanta.naming.URN c,
                   ajanta.naming.URN owner,
                   java.lang.String p)
Parameters:
as - current agent server of the agent
ag - URN of the agent
c - URN of the codebase
p - startup path ...path to StartUP class
owner - URN of the agent's owner
Method Detail

loadClass

protected java.lang.Class loadClass(java.lang.String name,
                                    boolean resolve)
                             throws java.lang.ClassNotFoundException
The loadClass method is automatically invoked by the JVM whenever it encounters a reference of a type which is not already known to it. Our implementation of the class loader first searches the server's classpath --- the set of directories on the local file system which contain classes trusted by the server. If the requisite bytecode is found on the classpath, it is loaded into the virtual machine. Otherwise, the agent's code base is contacted to download the bytecode for the desired class. It send a ClassRequest to the code base for required class. Thus, if a trusted version of the required class is available locally, it is always used in preference to the code available from the agent's code base.

Overrides:
loadClass in class java.lang.ClassLoader
java.lang.ClassNotFoundException