Class PluginLoader

  extended by java.lang.ClassLoader
      extended by edu.ucla.loni.LOVE.PluginLoader

public class PluginLoader
extends java.lang.ClassLoader

This class will look at .class files under plugins folder and retrieve these classes for use as plugins.

It provides centralized service for plugin loading. All the plugin classes that are loaded before will be stored in cache for later usages.

The reason to extend ClassLoader is that we can use those native, protected method of it. Those method can provide many powerful functionality.

BUG/TO DO: Still don't know how to deal with Jarred class file. if classes are jarred, the program can no longer list all the files in the directory thus can't load classes.

Constructor Summary
Method Summary
static java.lang.Class loadAClass(java.lang.String className)
          Load a single class as specified by the parameter.
static java.util.Hashtable loadDirectory(java.lang.String packDir)
          Load the classes in a directory .plugins.* Example of usage: loadDirectory("edu.ucla.loni.LOVE.plugin.colormap");
static void main(java.lang.String[] args)
          Test program
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, loadClass, 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


public PluginLoader()
Method Detail


public static java.util.Hashtable loadDirectory(java.lang.String packDir)
Load the classes in a directory .plugins.* Example of usage: loadDirectory("edu.ucla.loni.LOVE.plugin.colormap");

packDir - The directory to be loaded


public static java.lang.Class loadAClass(java.lang.String className)
Load a single class as specified by the parameter.

className - Name of the class, including package name.


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