java.lang.Objectjava.lang.ClassLoader
ucot.core.PluginClassLoader
public class PluginClassLoader
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.
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 |
---|
java.io.File pluginDir
private java.io.FileFilter jarFilter
Constructor Detail |
---|
public PluginClassLoader(java.io.File dir)
dir
- The directory for the class loader.Method Detail |
---|
protected java.lang.Class<?> findClass(java.lang.String name) throws java.lang.ClassNotFoundException
findClass
in class java.lang.ClassLoader
java.lang.ClassNotFoundException
protected byte[] loadClassData(java.lang.String name) throws java.lang.ClassNotFoundException
package.package1.ClassABCD
means file package/package1/ClassABCD.class
. Then the file
is located and if its is not found then ClassNotFoundException
is thrown.
name
- The class name we need to load.
java.lang.ClassNotFoundException
- Thrown if file for the class is not found.