net.sf.jaxodraw.plugin
Class JaxoPluginLoader

java.lang.Object
  extended by net.sf.jaxodraw.plugin.JaxoPluginLoader

public class JaxoPluginLoader
extends Object

Loads JaxoDraw plugins.

Since:
2.0

Constructor Summary
JaxoPluginLoader()
           
 
Method Summary
static File getPluginJar(JaxoPlugin plugin, String pluginDir)
          Tries to find the jar source file for a JaxoPlugin in the given directory.
 List<JaxoPlugin> loadPlugins(String pluginDirName)
          Load plugins.
 List<JaxoPlugin> loadPluginsFromJar(String filename)
          Loads plugins from a jar file.
 List<JaxoPlugin> reValidate(String pluginDirName)
          Invalidates the class loader responsible for plugin loading and re-scans the plugin dir, loading any found classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaxoPluginLoader

public JaxoPluginLoader()
Method Detail

loadPlugins

public List<JaxoPlugin> loadPlugins(String pluginDirName)
Load plugins. Scans the given directory for jar files, each jar file for a class that ends with "JaxoPlugin.class" and if this class implements JaxoPlugin, adds the jar to the classpath.

Parameters:
pluginDirName - the directory to scan for plugins.
Returns:
A list of JaxoPlugins that have been loaded.

reValidate

public List<JaxoPlugin> reValidate(String pluginDirName)
Invalidates the class loader responsible for plugin loading and re-scans the plugin dir, loading any found classes. This is the only way to remove plugins from the class loader.

Parameters:
pluginDirName - the directory to scan for plugins.
Returns:
A list of JaxoPlugins that have been loaded.
See Also:
loadPlugins(java.lang.String)

loadPluginsFromJar

public List<JaxoPlugin> loadPluginsFromJar(String filename)
Loads plugins from a jar file. If the jar contains any classes that end with "JaxoPlugin.class" and that implement JaxoPlugin, the jar is added to the classpath.

Parameters:
filename - absolute path to a jar file that contains a JaxoPlugin.
Returns:
A List of JaxoPlugins that have been loaded, or null if there was a problem or the jar didn't contain a JaxoPlugin.

getPluginJar

public static File getPluginJar(JaxoPlugin plugin,
                                String pluginDir)
Tries to find the jar source file for a JaxoPlugin in the given directory. The search is done via the pluginId() of the plugin, ie the first jar that contains a class whose name matches the pluginId is returned.

Parameters:
plugin - the plugin whose source jar to find.
pluginDir - the directory where jars are listed.
Returns:
a File whose jar contains the given plugin, or null if nothing is found.


Copyright © 2003-2011 The JaxoDraw team. All Rights Reserved.