Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.jsxe
Class JARClassLoader

    java.lang.Object
      java.lang.ClassLoader
          net.sourceforge.jsxe.JARClassLoader

public class JARClassLoader
extends ClassLoader

A class loader implementation that loads classes from JAR files. Also manages getting files from plugin JARs. It is used to load jsXe's plugins.

Since:
  jsXe 0.4 beta
Version:
  $Id: JARClassLoader.java 994 2006-07-07 03:46:17Z ian_lewis $
Author:
  Ian Lewis (IanLewis@member.fsf.org)

Field Summary
`static String` | `PLUGIN_AUTHOR` The manifest property that specifies the plugin Author
`static String` | `PLUGIN_CLASS` The manifest property that specifies the plugin class Note: This property is required
`static String` | `PLUGIN_DESCRIPTION` The manifest property that specifies the plugin description
`static String` | `PLUGIN_HUMAN_READABLE_NAME` The manifest property that specifies a human readable name for the plugin Note: This property is required
`static String` | `PLUGIN_NAME` The manifest property that specifies the plugin name.
`static String` | `PLUGIN_RELEASE_DATE` The manifest property that specifies the plugin URL
`static String` | `PLUGIN_URL` The manifest property that specifies the plugin URL
`static String` | `PLUGIN_VERSION` The manifest property that specifies the plugin version Note: This property is required

Constructor Summary
`JARClassLoader()`

Method Summary
`ArrayList` | `addDirectory(String path)` Adds all jar files in a directory to the search path for the class loader.
`void` | `addJarFile(File file)` Adds a jar file to the search path for the class loader and loads the jar as a plugin
`void` | `addJarFile(String path)` Adds a jar file to the search path for the class loader and loads the jar as a plugin.
`protected Class` | `findClass(String name)` Finds a class by looking for it on the jar files in the search path.
`protected URL` | `findResource(String name)` Finds the first resource matching the name in the jar files specified in the search path.
`protected Enumeration` | `findResources(String name)` Finds all resources matching the name in the jar files specified in the search path.
`ActionPlugin` | `getActionPlugin(String name)` Gets an action plugin by name.
`ArrayList` | `getActionPluginNames()` Returns an ArrayList object containing the names of the all installed action plugins that are not view plugins.
`ArrayList` | `getActionPlugins()` Gets all action plugins that are not view plugins.
`ArrayList` | `getAllPluginNames()` Gets a list of all the names of the loaded plugins.
`ArrayList` | `getAllPlugins()` Gets all plugins.
`ActionPlugin` | `getPlugin(String name)` Gets the plugin with the given name.
`String` | `getPluginProperty(ActionPlugin plugin, String key)` Gets a property for the given plugin.
`String` | `getPluginProperty(String name, String key)` Gets a property for the plugin with the given name.
`URL` | `getPluginResource(String name)` Finds the first resource matching the name in the jar files specified in the search path.
`Enumeration` | `getPluginResources(String name)` Finds all resources matching the name in the jar files specified in the search path.
`ViewPlugin` | `getViewPlugin(String name)` Gets the view plugin with the given name
`ArrayList` | `getViewPluginNames()` Gets the names of all loaded view plugins
`ArrayList` | `getViewPlugins()` Gets all view plugins.
`ArrayList` | `startPlugins()` Starts all the plugins from their respective jar files.

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, 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

### PLUGIN_NAME

    public static final String PLUGIN_NAME

  The manifest property that specifies the plugin name. Note: This property is required

  See Also:
    Constant Field Values

### PLUGIN_CLASS

    public static final String PLUGIN_CLASS

  The manifest property that specifies the plugin class Note: This property is required

  See Also:
    Constant Field Values

### PLUGIN_VERSION

    public static final String PLUGIN_VERSION

  The manifest property that specifies the plugin version Note: This property is required

  See Also:
    Constant Field Values

### PLUGIN_HUMAN_READABLE_NAME

    public static final String PLUGIN_HUMAN_READABLE_NAME

  The manifest property that specifies a human readable name for the plugin Note: This property is required

  See Also:
    Constant Field Values

### PLUGIN_AUTHOR

    public static final String PLUGIN_AUTHOR

  The manifest property that specifies the plugin Author

  See Also:
    Constant Field Values

### PLUGIN_RELEASE_DATE

    public static final String PLUGIN_RELEASE_DATE

  The manifest property that specifies the plugin URL

  See Also:
    Constant Field Values

### PLUGIN_URL

    public static final String PLUGIN_URL

  The manifest property that specifies the plugin URL

  See Also:
    Constant Field Values

### PLUGIN_DESCRIPTION

    public static final String PLUGIN_DESCRIPTION

  The manifest property that specifies the plugin description

  See Also:
    Constant Field Values

Constructor Detail

### JARClassLoader

    public JARClassLoader()

Method Detail

### findClass

    protected Class findClass(String name)
                       throws ClassNotFoundException

  Finds a class by looking for it on the jar files in the search path. The search path is specified by the `addJarFile(String)`, `addJarFile(File)`, and `addDirectory(String)` methods.

  Parameters:
    `name` - the class name
  Throws:
    `ClassNotFoundException`

### findResources

    protected Enumeration findResources(String name)
                                 throws IOException

  Finds all resources matching the name in the jar files specified in the search path. The search path is specified by the `addJarFile(String)`, `addJarFile(File)`, and `addDirectory(String)` methods.

  Parameters:
    `name` - the name of the resources to find
  Throws:
    `IOException`

### findResource

    protected URL findResource(String name)

  Finds the first resource matching the name in the jar files specified in the search path. The search path is specified by the `addJarFile(String)`, `addJarFile(File)`, and `addDirectory(String)` methods.

  Parameters:
    `name` - the name of the resources to find

### getPluginResources

    public Enumeration getPluginResources(String name)
                                   throws IOException

  Finds all resources matching the name in the jar files specified in the search path. The search path is specified by the `addJarFile(String)`, `addJarFile(File)`, and `addDirectory(String)` methods.

  Parameters:
    `name` - the name of the resources to find
  Throws:
    `IOException`

### getPluginResource

    public URL getPluginResource(String name)

  Finds the first resource matching the name in the jar files specified in the search path. The search path is specified by the `addJarFile(String)`, `addJarFile(File)`, and `addDirectory(String)` methods.

  Parameters:
    `name` - the name of the resources to find

### addJarFile

    public void addJarFile(String path)
                    throws FileNotFoundException,
                           IOException

  Adds a jar file to the search path for the class loader and loads the jar as a plugin.

  Parameters:
    `path` - the path to the jar file
  Throws:
    `FileNotFoundException`
    `IOException`

### addJarFile

    public void addJarFile(File file)
                    throws FileNotFoundException,
                           IOException

  Adds a jar file to the search path for the class loader and loads the jar as a plugin

  Parameters:
    `file` - the file to add
  Throws:
    `FileNotFoundException`
    `IOException`

### addDirectory

    public ArrayList addDirectory(String path)

  Adds all jar files in a directory to the search path for the class loader.

  Parameters:
    `path` - the path for the directory containing jar files
  Returns:
    an ArrayList of pathnames of jar files that could not be loaded.

### getAllPluginNames

    public ArrayList getAllPluginNames()

  Gets a list of all the names of the loaded plugins.

  Returns:
    an ArrayList of strings containing the names of the plugins
  Since:
    jsXe 0.3pre15

### getAllPlugins

    public ArrayList getAllPlugins()

  Gets all plugins.

  Returns:
    an ArrayList of plugins
  Since:
    jsXe 0.3pre15

### getViewPluginNames

    public ArrayList getViewPluginNames()

  Gets the names of all loaded view plugins

  Returns:
    an ArrayList of ViewPlugins

### getViewPlugins

    public ArrayList getViewPlugins()

  Gets all view plugins. You should run startPlugins() before calling this function.

  Returns:
    an ArrayList of ViewPlugin objects

### getViewPlugin

    public ViewPlugin getViewPlugin(String name)

  Gets the view plugin with the given name

  Returns:
    the view plugin

### getActionPluginNames

    public ArrayList getActionPluginNames()

  Returns an ArrayList object containing the names of the all installed action plugins that are not view plugins.

  Returns:
    an ArrayList of ActionPlugins

### getActionPlugins

    public ArrayList getActionPlugins()

  Gets all action plugins that are not view plugins. You should run startPlugins() before calling this function.

  Returns:
    an ArrayList of ActionPlugin objects

### getActionPlugin

    public ActionPlugin getActionPlugin(String name)

  Gets an action plugin by name. Not for use in retrieving ViewPlugins.

  Parameters:
    `name` - the name of the ActionPlugin you want to retrieve.
  Returns:
    the ActionPlugin or null if a plugin with the name given is not loaded.

### getPlugin

    public ActionPlugin getPlugin(String name)

  Gets the plugin with the given name. This may return either view plugins or ActionPlugins

  Returns:
    the plugin with the given name
  Since:
    jsXe 0.3pre15

### startPlugins

    public ArrayList startPlugins()

  Starts all the plugins from their respective jar files.

  Returns:
    an ArrayList of errors (either Strings or Exceptions).

### getPluginProperty

    public String getPluginProperty(String name,
                                    String key)

  Gets a property for the plugin with the given name.

  Returns:
    the value of the property
  Since:
    jsXe 0.3pre15

### getPluginProperty

    public String getPluginProperty(ActionPlugin plugin,
                                    String key)

  Gets a property for the given plugin.

  Returns:
    the value of the property.
  Since:
    jsXe 0.3pre15

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD