org.graffiti.managers.pluginmgr
Class DefaultPluginManager

java.lang.Object
  extended by org.graffiti.managers.pluginmgr.DefaultPluginManager
All Implemented Interfaces:
PluginManager

public class DefaultPluginManager
extends Object
implements PluginManager

Manages the list of plugins.

Version:
$Revision: 5779 $

Constructor Summary
DefaultPluginManager(Preferences prefs)
          Constructs a new PluginManger instance.
 
Method Summary
 void addPluginManagerListener(PluginManagerListener listener)
          Adds the given plugin manager listener to the list of listeners.
 GenericPlugin createInstance(URL pluginLocation)
          Returns a new instance of the plugin "main" class with the given plugin name.
 GenericPlugin createInstance(URL pluginLocation, ProgressViewer progressViewer)
          Returns a new instance of the plugin "main" class with the given plugin name.
 Collection<Entry> getPluginEntries()
          Returns the current list of plugin entries.
 GenericPlugin getPluginInstance(String name)
          Returns the plugin instance of the given plugin name.
 boolean isInstalled(String name)
          Checks if the plugin is already installed, i.e.
 void loadPlugin(PluginDescription description, URL pluginLocation, Boolean loadOnStartup)
          Loads the plugin from the given location.
 void loadPlugins(Entry[] plugins)
          Loads the plugin from the given location.
 void loadPlugins(Entry[] plugins, ProgressViewer progressViewer)
          Loads the plugin from the given location.The progress made is displayed with progressViewer.
 void loadPlugins(Entry[] plugins, ProgressViewer progressViewer, boolean topLevel)
           
 void loadStartupPlugins()
          Loads the plugins which should be loaded on startup.
 void loadStartupPlugins(ProgressViewer progressViewer)
          Loads the plugins which should be loaded on startup.
 void removePluginManagerListener(PluginManagerListener listener)
          Removes the given plugin manager listener from the list of listeners.
 void savePrefs()
          Saves the plugin manager's prefs.
 void setLoadOnStartup(String name, Boolean loadOnStartup)
          Sets the loadOnStartup flag of the given object, to the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPluginManager

public DefaultPluginManager(Preferences prefs)
Constructs a new PluginManger instance.

Parameters:
prefs - the preferences, which contain information about what to load during the instanciation of the plugin manager.
Method Detail

isInstalled

public boolean isInstalled(String name)
Checks if the plugin is already installed, i.e. if the plugin's name is in the list of plugin entries.

Specified by:
isInstalled in interface PluginManager
Parameters:
name - name of the plugin.
Returns:
true if the plugin's name is in the list of plugin entries, false otherwise.

setLoadOnStartup

public void setLoadOnStartup(String name,
                             Boolean loadOnStartup)
Sets the loadOnStartup flag of the given object, to the given value.

Specified by:
setLoadOnStartup in interface PluginManager
Parameters:
name - the name of the plugin.
loadOnStartup - true, if the plugin should be loaded at startup.

getPluginEntries

public Collection<Entry> getPluginEntries()
Returns the current list of plugin entries.

Specified by:
getPluginEntries in interface PluginManager
Returns:
a Collection containing all the plugin entries.

getPluginInstance

public GenericPlugin getPluginInstance(String name)
Returns the plugin instance of the given plugin name.

Specified by:
getPluginInstance in interface PluginManager
Parameters:
name - the name of the plugin.
Returns:
the instance of the plugin of the given name.

addPluginManagerListener

public void addPluginManagerListener(PluginManagerListener listener)
Adds the given plugin manager listener to the list of listeners.

Specified by:
addPluginManagerListener in interface PluginManager
Parameters:
listener - the new listener to add to the list.

createInstance

public GenericPlugin createInstance(URL pluginLocation)
                             throws PluginManagerException
Returns a new instance of the plugin "main" class with the given plugin name.

Specified by:
createInstance in interface PluginManager
Parameters:
pluginLocation - the URL to the plugin.
Returns:
the instantiated plugin.
Throws:
PluginManagerException - an error occured while loading or instantiating the plugin.

createInstance

public GenericPlugin createInstance(URL pluginLocation,
                                    ProgressViewer progressViewer)
                             throws PluginManagerException
Returns a new instance of the plugin "main" class with the given plugin name. The progress made is displayed with progressViewer.

Parameters:
pluginLocation - the URL to the plugin.
progressViewer - the progress viewer that display the progress made
Returns:
the instantiated plugin.
Throws:
PluginManagerException - an error occured while loading or instantiating the plugin.

loadPlugin

public void loadPlugin(PluginDescription description,
                       URL pluginLocation,
                       Boolean loadOnStartup)
                throws PluginManagerException
Loads the plugin from the given location.

Specified by:
loadPlugin in interface PluginManager
Parameters:
description - DOCUMENT ME!
pluginLocation - the location of the plugin.
loadOnStartup - true, if the given plugin should be loaded at the startup.
Throws:
PluginManagerException - if an error occurs while loading or instantiating the plugin.

loadPlugins

public void loadPlugins(Entry[] plugins)
                 throws PluginManagerException
Loads the plugin from the given location.

Specified by:
loadPlugins in interface PluginManager
Parameters:
plugins - the plugin entries describing the plugins to be loaded
Throws:
PluginManagerException - if an error occurs while loading or instantiating the plugin.

loadPlugins

public void loadPlugins(Entry[] plugins,
                        ProgressViewer progressViewer)
                 throws PluginManagerException
Loads the plugin from the given location.The progress made is displayed with progressViewer.

Parameters:
plugins - the plugin entries describing the plugins to be loaded
progressViewer - the progress viewer that display the progress made
Throws:
PluginManagerException - if an error occurs while loading or instantiating the plugin.

loadPlugins

public void loadPlugins(Entry[] plugins,
                        ProgressViewer progressViewer,
                        boolean topLevel)
                 throws PluginManagerException
Throws:
PluginManagerException

loadStartupPlugins

public void loadStartupPlugins()
                        throws PluginManagerException
Loads the plugins which should be loaded on startup.

Specified by:
loadStartupPlugins in interface PluginManager
Throws:
PluginManagerException - if an error occurred while loading one of the plugins.

loadStartupPlugins

public void loadStartupPlugins(ProgressViewer progressViewer)
                        throws PluginManagerException
Loads the plugins which should be loaded on startup. The progress made is displayed with progressViewer.

Specified by:
loadStartupPlugins in interface PluginManager
Parameters:
progressViewer - the progress viewer that display the progress made
Throws:
PluginManagerException - if an error occurred while loading one of the plugins.

removePluginManagerListener

public void removePluginManagerListener(PluginManagerListener listener)
Removes the given plugin manager listener from the list of listeners.

Specified by:
removePluginManagerListener in interface PluginManager
Parameters:
listener - the listener to remove from the list of listeners.

savePrefs

public void savePrefs()
               throws PluginManagerException
Saves the plugin manager's prefs.

Specified by:
savePrefs in interface PluginManager
Throws:
PluginManagerException - if an error occurrs while saving the preferences.


Generated at 2012-05-30 11:00:36 PM CEST