edu.ucla.loni.LOVE
Class PluginLoader

java.lang.Object
  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
PluginLoader()
           
 
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

PluginLoader

public PluginLoader()
Method Detail

loadDirectory

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");

Parameters:
packDir - The directory to be loaded

loadAClass

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

Parameters:
className - Name of the class, including package name.

main

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

Throws:
java.lang.Exception