JML

org.jmlspecs.racwrap.runner
Class ChxClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byorg.jmlspecs.racwrap.runner.ChxClassLoader

public class ChxClassLoader
extends ClassLoader

ChxClassLoader is the custom classloader that will load the wrapper classes when needed.


Nested Class Summary
 
Nested classes inherited from class java.lang.ClassLoader
 
Field Summary
private  Hashtable classes
           
private  Hashtable tree
           
 
Fields inherited from class java.lang.ClassLoader
 
Constructor Summary
ChxClassLoader(Node root)
          Constructor.
 
Method Summary
private  byte[] getByteArray(Location loc)
          Given the location of a class, return the contents of the file.
 Class loadClass(String name)
          Alias for loadClass(name, null);
 Class loadClass(String name, boolean resolve)
          This classloader does *not* follow the Java ClassLoader delegation model.
private  Class loadClassFromTree(String name)
          Given the name of a class, this method will find the location of the class (if it knows about it), and load it.
private  void populate(Hashtable lookupParent, Node nodeParent)
          The classloader does not use the Node directly, rather it creates a new tree based on the class tree.
 void printTree()
           
 void printTree(Hashtable parent, int level)
          prints the internal tree representation to stdout.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classes

private Hashtable classes

tree

private Hashtable tree
Constructor Detail

ChxClassLoader

public ChxClassLoader(Node root)
Constructor.

Parameters:
root - The root node of the tree.
Method Detail

populate

private void populate(Hashtable lookupParent,
                      Node nodeParent)
The classloader does not use the Node directly, rather it creates a new tree based on the class tree. This is to make it easier to lookup names of classes. That is, "$chx_*" classes are not easily located in the original tree.


loadClass

public Class loadClass(String name)
                throws ClassNotFoundException
Alias for loadClass(name, null);

Overrides:
loadClass in class ClassLoader
Throws:
ClassNotFoundException

loadClass

public Class loadClass(String name,
                       boolean resolve)
                throws ClassNotFoundException
This classloader does *not* follow the Java ClassLoader delegation model. This is because we want to preempt the system classloader from loading the classes that are requested.

Overrides:
loadClass in class ClassLoader
Throws:
ClassNotFoundException

loadClassFromTree

private Class loadClassFromTree(String name)
Given the name of a class, this method will find the location of the class (if it knows about it), and load it.


getByteArray

private byte[] getByteArray(Location loc)
Given the location of a class, return the contents of the file.

Returns:
returns an array of bytes that is the contents of the file.

printTree

public void printTree(Hashtable parent,
                      int level)
prints the internal tree representation to stdout. Useful for debugging.


printTree

public void printTree()

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.