Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
PluginClassLoader Class Reference
Inheritance diagram for PluginClassLoader:

Public Member Functions

 PluginClassLoader (String path)
 
URL getResource (String name)
 
InputStream getResourceAsStream (String name)
 
Class loadClass (String className) throws ClassNotFoundException
 
synchronized Class loadClass (String className, boolean resolveIt) throws ClassNotFoundException
 

Protected Member Functions

byte[] loadClassBytes (String name)
 

Protected Attributes

String path
 
Hashtable cache = new Hashtable()
 
Vector jarFiles
 

Detailed Description

ImageJ uses this class loader to load plugins and resources from the plugins directory and immediate subdirectories. This class loader will also load classes and resources from JAR files.

The class loader searches for classes and resources in the following order:

  1. Plugins directory
  2. Subdirectories of the Plugins directory
  3. JAR and ZIP files in the plugins directory and subdirectories

The class loader does not recurse into subdirectories beyond the first level.

Definition at line 20 of file PluginClassLoader.java.

Constructor & Destructor Documentation

PluginClassLoader ( String  path)
inline

Creates a new PluginClassLoader that searches in the directory path passed as a parameter. The constructor automatically finds all JAR and ZIP files in the path and first level of subdirectories. The JAR and ZIP files are stored in a Vector for future searches.

Parameters
paththe path to the plugins directory.

Definition at line 32 of file PluginClassLoader.java.

Member Function Documentation

URL getResource ( String  name)
inline

Returns a resource from the path or JAR files as a URL

Parameters
namea resource name.

Definition at line 63 of file PluginClassLoader.java.

InputStream getResourceAsStream ( String  name)
inline

Returns a resource from the path or JAR files as an InputStream

Parameters
namea resource name.

Definition at line 144 of file PluginClassLoader.java.

Class loadClass ( String  className) throws ClassNotFoundException
inline

Returns a Class from the path or JAR files. Classes are automatically resolved.

Parameters
classNamea class name without the .class extension.

Definition at line 198 of file PluginClassLoader.java.

synchronized Class loadClass ( String  className,
boolean  resolveIt 
) throws ClassNotFoundException
inline

Returns a Class from the path or JAR files. Classes are resolved if resolveIt is true.

Parameters
classNamea String class name without the .class extension. resolveIt a boolean (should almost always be true)

Definition at line 207 of file PluginClassLoader.java.

byte [] loadClassBytes ( String  name)
inlineprotected

This does the actual work of loading the bytes from the disk. Returns an array of bytes that will be defined as a Class. This should be overloaded to have the Class Loader look in more places.

Parameters
namea class name without the .class extension.

Definition at line 253 of file PluginClassLoader.java.


The documentation for this class was generated from the following file: