java.lang.Object
org.jorigin.plugin.PluginToolkit
This class is a toolkit used for helping plugin management. Using this class, user can scan and load a list of plugins
related to a given package (
setPluginPackage(String)) from given locations on the system (addPluginDir(String),
addPluginDir(File)). The plugin loading is launched via the loadPlugins() method.- Since:
- 1.0.0
- Version:
- "1.0.14" - b202111241200L
- Author:
- Julien SEINTURIER - Université de Toulon / CNRS LIS umr 7020 - github.com/jorigin/jcommon (contact@jorigin.org)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddPluginDir(File pluginDir) Add a new path in the plugin search path.booleanaddPluginDir(String pluginDir) Add a new path in the plugin search path.voidAdd a Plugin Toolkit Listener to this plugin toolkitprotected voidFire a new plugin toolkit event to all registered listenersLoad all plugins available in the locations given to the toolkit.booleanremovePluginDir(File pluginDir) Remove the given path from the plugin search path list.booleanremovePluginDir(String pluginDir) Remove the given path from the plugin search path list.voidRemove a Plugin Toolkit Listener from this plugin toolkitvoidsetPluginPackage(String pluginPackage) Set the core package of the plugins.
-
Field Details
-
idListenerList
The attached listeners.
-
-
Constructor Details
-
PluginToolkit
public PluginToolkit()Constuct a new default plugin toolkit.
-
-
Method Details
-
addPluginDir
Add a new path in the plugin search path.- Parameters:
pluginDir- the path to insert in the plugin search list.- Returns:
- boolean true if the plugin search dir is added, false otherwise.
-
addPluginDir
Add a new path in the plugin search path.- Parameters:
pluginDir- the path to insert in the plugin search list.- Returns:
- boolean true if the plugin search dir is added, false otherwise.
-
removePluginDir
Remove the given path from the plugin search path list.- Parameters:
pluginDir- the plugin directory to remove.- Returns:
- true if the directory is succesfully removed, false otherwise.
-
removePluginDir
Remove the given path from the plugin search path list.- Parameters:
pluginDir- the plugin directory to remove.- Returns:
- true if the directory is succesfully removed, false otherwise.
-
setPluginPackage
Set the core package of the plugins.- Parameters:
pluginPackage- the core package of the plugins
-
addPluginToolkitListener
Add a Plugin Toolkit Listener to this plugin toolkit- Parameters:
l- the listener to add to the toolkit- See Also:
-
removePluginToolkitListener
Remove a Plugin Toolkit Listener from this plugin toolkit- Parameters:
l- the listener to remove- See Also:
-
fireEvent
Fire a new plugin toolkit event to all registered listeners- Parameters:
e- the event to fire.- See Also:
-
loadPlugins
Load all plugins available in the locations given to the toolkit. This method scan the available locations and looks for plugins with given package name. When available plugins are detected, the method instanciate them and store the instanciated plugins in the returned list.- Returns:
- ArrayList<
IPlugin> the plugins availables and instanciated. - See Also:
-