Package net.sf.jaxodraw.plugin
Class JaxoPluginLoader
- java.lang.Object
-
- net.sf.jaxodraw.plugin.JaxoPluginLoader
-
public class JaxoPluginLoader extends java.lang.Object
Loads JaxoDraw plugins.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description JaxoPluginLoader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.io.File
getPluginJar(JaxoPlugin plugin, java.lang.String pluginDir)
Tries to find the jar source file for a JaxoPlugin in the given directory.java.util.List<JaxoPlugin>
loadPlugins(java.lang.String pluginDirName)
Load plugins.java.util.List<JaxoPlugin>
loadPluginsFromJar(java.lang.String filename)
Loads plugins from a jar file.java.util.List<JaxoPlugin>
reValidate(java.lang.String pluginDirName)
Invalidates the class loader responsible for plugin loading and re-scans the plugin dir, loading any found classes.
-
-
-
Method Detail
-
loadPlugins
public java.util.List<JaxoPlugin> loadPlugins(java.lang.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 java.util.List<JaxoPlugin> reValidate(java.lang.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 java.util.List<JaxoPlugin> loadPluginsFromJar(java.lang.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 java.io.File getPluginJar(JaxoPlugin plugin, java.lang.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.
-
-