org.jivesoftware.spark
Class PluginManager

java.lang.Object
  extended by org.jivesoftware.spark.PluginManager
All Implemented Interfaces:
MainWindowListener

public class PluginManager
extends java.lang.Object
implements MainWindowListener

This manager is responsible for the loading of all Plugins and Workspaces within Spark environment.

Author:
Derek DeMoro

Field Summary
static java.io.File PLUGINS_DIRECTORY
          The root Plugins Directory.
 
Method Summary
 void addPlugin(PublicPlugin plugin)
          Adds and installs a new plugin into Spark.
static PluginManager getInstance()
          Returns the singleton instance of PluginManager, creating it if necessary.
 Plugin getPlugin(java.lang.Class communicatorPlugin)
          Returns the instance of the plugin class initialized during startup.
 java.lang.ClassLoader getPluginClassLoader()
          Returns the plugin classloader.
 java.util.Collection getPlugins()
          Returns a Collection of Plugins.
 java.util.List<PublicPlugin> getPublicPlugins()
          Returns a collection of all public plugins.
 void initializePlugins()
          Loads and initalizes all Plugins.
 boolean isInstalled(PublicPlugin plugin)
          Returns true if the specified plugin is installed.
 void loadPlugins()
          Loads all Plugin from the agent plugins.xml and extension lib.
 void mainWindowActivated()
          Invoked by the MainWindow when it has been activated, such as when it is coming out of a minimized state.
 void mainWindowDeactivated()
          Invoked by the MainWindow when it has been minimized in the toolbar.
 void registerPlugin(Plugin plugin)
          Registers a plugin.
 void removePlugin(Plugin plugin)
          Removes a plugin from the plugin list.
 void removePublicPlugin(PublicPlugin plugin)
          Removes and uninstall a plugin from Spark.
 void shutdown()
          Invoked by the MainWindow when it is about the shutdown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGINS_DIRECTORY

public static java.io.File PLUGINS_DIRECTORY
The root Plugins Directory.

Method Detail

getInstance

public static PluginManager getInstance()
Returns the singleton instance of PluginManager, creating it if necessary.

Returns:
the singleton instance of PluginManager

loadPlugins

public void loadPlugins()
Loads all Plugin from the agent plugins.xml and extension lib.


getPluginClassLoader

public java.lang.ClassLoader getPluginClassLoader()
Returns the plugin classloader.

Returns:
the plugin classloader.

registerPlugin

public void registerPlugin(Plugin plugin)
Registers a plugin.

Parameters:
plugin - the plugin to register.

removePlugin

public void removePlugin(Plugin plugin)
Removes a plugin from the plugin list.

Parameters:
plugin - the plugin to remove.

getPlugins

public java.util.Collection getPlugins()
Returns a Collection of Plugins.

Returns:
a Collection of Plugins.

getPlugin

public Plugin getPlugin(java.lang.Class communicatorPlugin)
Returns the instance of the plugin class initialized during startup.

Parameters:
communicatorPlugin - the plugin to find.
Returns:
the instance of the plugin.

initializePlugins

public void initializePlugins()
Loads and initalizes all Plugins.

See Also:
Plugin

shutdown

public void shutdown()
Description copied from interface: MainWindowListener
Invoked by the MainWindow when it is about the shutdown. When invoked, the MainWindowListener should do anything necessary to persist their current state. MainWindowListeners authors should take care to ensure that any extraneous processing is not performed on this method, as it would cause a delay in the shutdown process.

Specified by:
shutdown in interface MainWindowListener
See Also:
MainWindow

mainWindowActivated

public void mainWindowActivated()
Description copied from interface: MainWindowListener
Invoked by the MainWindow when it has been activated, such as when it is coming out of a minimized state. When invoked, the MainWindowListener should do anything necessary to smoothly transition back to the application.

Specified by:
mainWindowActivated in interface MainWindowListener
See Also:
MainWindow

mainWindowDeactivated

public void mainWindowDeactivated()
Description copied from interface: MainWindowListener
Invoked by the MainWindow when it has been minimized in the toolbar.

Specified by:
mainWindowDeactivated in interface MainWindowListener
See Also:
MainWindow

addPlugin

public void addPlugin(PublicPlugin plugin)
               throws java.lang.Exception
Adds and installs a new plugin into Spark.

Parameters:
plugin - the plugin to install.
Throws:
java.lang.Exception - thrown if there was a problem loading the plugin.

getPublicPlugins

public java.util.List<PublicPlugin> getPublicPlugins()
Returns a collection of all public plugins.

Returns:
the collection of public plugins.

removePublicPlugin

public void removePublicPlugin(PublicPlugin plugin)
Removes and uninstall a plugin from Spark.

Parameters:
plugin - the plugin to uninstall.

isInstalled

public boolean isInstalled(PublicPlugin plugin)
Returns true if the specified plugin is installed.

Parameters:
plugin - the PublicPlugin plugin to check.
Returns:
true if installed.