webfunds.utils
Class DirClassLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--webfunds.utils.DirClassLoader

public class DirClassLoader
extends java.lang.ClassLoader

A Directory-based class loader for plugins and wallets.


Constructor Summary
DirClassLoader(java.lang.String[] systemClasses)
          Loader to allow dynamic loading from systemClasses only.
DirClassLoader(java.lang.String dir, java.lang.String[] systemClasses)
          Loader to allow dynamic loading from directory dir, and having access to all classes within systemClasses.
 
Method Summary
 void init(java.lang.String[] systemClasses)
           
 java.lang.Class loadClass(java.lang.String name, boolean resolve)
          To load an actual class in dir (above), call loadClass with the dot-separated name of the class.
protected  byte[] loadClassData(java.lang.String name)
           
protected  void logmsg(java.lang.String s)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.ClassLoader
defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirClassLoader

public DirClassLoader(java.lang.String dir,
                      java.lang.String[] systemClasses)
               throws java.io.FileNotFoundException
Loader to allow dynamic loading from directory dir, and having access to all classes within systemClasses. As used in WebFunds, the wallet directory containing the compiled classes (for example ../classes) is passed as dir. Then, the names of the WebFunds' other hierarchies is passed as systemClasses, so that the rest of WebFunds might be made available to the plugged-in wallet.
Parameters:
dir - the location of the classes that this Loader is plugging in.
systemClasses - a list of hierarchies that are system, not plugin. (Note that "java" is added by default)

DirClassLoader

public DirClassLoader(java.lang.String[] systemClasses)
Loader to allow dynamic loading from systemClasses only. Compatible with other constructors, but uses Classpath only, so non-3rd-party packages can be treated in the same way.
Parameters:
systemClasses - a list of hierarchies that are system, not plugin. (Note that "java" is added by default)
Method Detail

logmsg

protected void logmsg(java.lang.String s)

init

public void init(java.lang.String[] systemClasses)

loadClassData

protected byte[] loadClassData(java.lang.String name)
                        throws java.lang.ClassNotFoundException

loadClass

public java.lang.Class loadClass(java.lang.String name,
                                 boolean resolve)
                          throws java.lang.ClassNotFoundException
To load an actual class in dir (above), call loadClass with the dot-separated name of the class.
Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
name - is the class name to be loaded (com.my.plugin)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception