ucot.core
Class PluginClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by ucot.core.PluginClassLoader

public class PluginClassLoader
extends java.lang.ClassLoader

This is class loader for UCOT-programs plugins. It is used to load plugins from spesific directory. Currently it does not handle jar files properly so only plain class files can be loaded.

This class loader delegates class loading normally to its parents. If the classes are not found on general classpaths then classes are looked under the directory set at the construction time. Classes are located normal way: packages are directories and classes are files ending with .class-extension.

See Also:
PluginLoader

Field Summary
private  java.io.FileFilter jarFilter
          This is file filter for listin jar files.
(package private)  java.io.File pluginDir
           
 
Constructor Summary
PluginClassLoader(java.io.File dir)
          Costructs the classloader for spesific directory.
 
Method Summary
protected  java.lang.Class<?> findClass(java.lang.String name)
           
protected  byte[] loadClassData(java.lang.String name)
          Loads class data under the directory defined for this classloader.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, 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
 

Field Detail

pluginDir

java.io.File pluginDir

jarFilter

private java.io.FileFilter jarFilter
This is file filter for listin jar files.

Constructor Detail

PluginClassLoader

public PluginClassLoader(java.io.File dir)
Costructs the classloader for spesific directory.

Parameters:
dir - The directory for the class loader.
Method Detail

findClass

protected java.lang.Class<?> findClass(java.lang.String name)
                                throws java.lang.ClassNotFoundException
Overrides:
findClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException

loadClassData

protected byte[] loadClassData(java.lang.String name)
                        throws java.lang.ClassNotFoundException
Loads class data under the directory defined for this classloader. It modifies the class name so that package.package1.ClassABCD means file package/package1/ClassABCD.class. Then the file is located and if its is not found then ClassNotFoundException is thrown.

Parameters:
name - The class name we need to load.
Returns:
The data for the class.
Throws:
java.lang.ClassNotFoundException - Thrown if file for the class is not found.