jrunx.util
Class DynamicClassLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--java.security.SecureClassLoader
              |
              +--java.net.URLClassLoader
                    |
                    +--jrunx.util.JRunURLClassLoader
                          |
                          +--jrunx.resource.ResourceURLClassLoader
                                |
                                +--jrunx.util.DynamicClassLoader

public class DynamicClassLoader
extends ResourceURLClassLoader

This class is a URLClassLoader that does automatic reloading and automatic compilation. The class provides the following:

To use this class, you can not simply create an instance and load the class you wish to use it on. Instead, you must call loadClass() on the class each time you wish to check if it needs to be reloaded, usually called when the class is to be instantiated.

We use a classloader within this classloader to actually load the classes. We get a new classloader when:

Note that the old ClassLoader still exists, we just no longer have a reference to it. It will stay around until all objects that were defined with it have been garbage collected.

From 12.7 of Java Lang. Spec.:
Reloading may not be transparent if, for example, the class has:

Author:
Tom Reilly, Brian Deitte

Constructor Summary
DynamicClassLoader(java.net.URL[] urls)
           
DynamicClassLoader(java.net.URL[] urls, boolean compile)
           
DynamicClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent, boolean compile)
           
 
Method Summary
static java.lang.String convertSlashName(java.lang.String name)
           
protected  java.lang.Class findClass(java.lang.String name)
           
static java.util.Set getClassDependencies(java.lang.Class cls)
           
static jrunx.util.ClassConstantPool read(java.io.InputStream stream)
           
 
Methods inherited from class jrunx.resource.ResourceURLClassLoader
findResource
 
Methods inherited from class jrunx.util.JRunURLClassLoader
addURL, classloaders, classloaders, definePackage, loadClass, loadClass, setLoadFrom, toString
 
Methods inherited from class java.net.URLClassLoader
definePackage, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass
 
Methods inherited from class java.lang.ClassLoader
defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, resolveClass, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DynamicClassLoader

public DynamicClassLoader(java.net.URL[] urls)

DynamicClassLoader

public DynamicClassLoader(java.net.URL[] urls,
                          boolean compile)

DynamicClassLoader

public DynamicClassLoader(java.net.URL[] urls,
                          java.lang.ClassLoader parent,
                          boolean compile)
Method Detail

findClass

protected java.lang.Class findClass(java.lang.String name)
                             throws java.lang.ClassNotFoundException
Overrides:
findClass in class JRunURLClassLoader

getClassDependencies

public static java.util.Set getClassDependencies(java.lang.Class cls)

read

public static jrunx.util.ClassConstantPool read(java.io.InputStream stream)
                                         throws java.io.IOException

convertSlashName

public static java.lang.String convertSlashName(java.lang.String name)


Copyright � 2002 Macromedia Corporation. All Rights Reserved.