Package org.graffiti.managers.pluginmgr
Class DefaultPluginManager
java.lang.Object
org.graffiti.managers.pluginmgr.DefaultPluginManager
- All Implemented Interfaces:
PluginManager
public class DefaultPluginManager extends Object implements PluginManager
Manages the list of plugins.
- Version:
- $Revision: 1.31 $
-
Field Summary
Fields Modifier and Type Field Description static DefaultPluginManager
lastInstance
-
Constructor Summary
Constructors Constructor Description DefaultPluginManager(Preferences prefs)
Constructs a newPluginManger
instance. -
Method Summary
Modifier and Type Method Description 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<PluginEntry>
getPluginEntries()
Returns the corrent list of plugin entries.Collection<RSSfeedDefinition>
getPluginFeeds()
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(PluginEntry[] plugins)
Loads the plugin from the given location.void
loadPlugins(PluginEntry[] plugins, ProgressViewer progressViewer)
void
loadPlugins(PluginEntry[] plugins, ProgressViewer progressViewer, boolean doAutomatic)
Loads the plugin from the given location.The progress made is displayed with progressViewer.void
loadStartupPlugins()
Loads the plugins which should be loaded on startup.void
loadStartupPlugins(ProgressViewer progressViewer)
Deprecated.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 theloadOnStartup
flag of the given object, to the given value.
-
Field Details
-
lastInstance
-
-
Constructor Details
-
DefaultPluginManager
Constructs a newPluginManger
instance.- Parameters:
prefs
- the preferences, which contain information about what to load during the instanciation of the plugin manager.
-
-
Method Details
-
isInstalled
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 interfacePluginManager
- Parameters:
name
- name of the plugin.- Returns:
true
if the plugin's name is in the list of plugin entries,false
otherwise.
-
setLoadOnStartup
Sets theloadOnStartup
flag of the given object, to the given value.- Specified by:
setLoadOnStartup
in interfacePluginManager
- Parameters:
name
- the name of the plugin.loadOnStartup
-true
, if the plugin should be loaded at startup.
-
getPluginEntries
Returns the corrent list of plugin entries.- Specified by:
getPluginEntries
in interfacePluginManager
- Returns:
- a
Collection
containing all the plugin entries.
-
getPluginInstance
Returns the plugin instance of the given plugin name.- Specified by:
getPluginInstance
in interfacePluginManager
- Parameters:
name
- the name of the plugin.- Returns:
- the instance of the plugin of the given name.
-
addPluginManagerListener
Adds the given plugin manager listener to the list of listeners.- Specified by:
addPluginManagerListener
in interfacePluginManager
- Parameters:
listener
- the new listener to add to the list.
-
createInstance
Returns a new instance of the plugin "main" class with the given plugin name.- Specified by:
createInstance
in interfacePluginManager
- 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 PluginManagerExceptionReturns 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 PluginManagerExceptionLoads the plugin from the given location.- Specified by:
loadPlugin
in interfacePluginManager
- 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
Loads the plugin from the given location.- Specified by:
loadPlugins
in interfacePluginManager
- 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(PluginEntry[] plugins, ProgressViewer progressViewer) throws PluginManagerException- Throws:
PluginManagerException
-
loadPlugins
public void loadPlugins(PluginEntry[] plugins, ProgressViewer progressViewer, boolean doAutomatic) throws PluginManagerExceptionLoads the plugin from the given location.The progress made is displayed with progressViewer.- Parameters:
plugins
- the plugin entries describing the plugins to be loadedprogressViewer
- the progress viewer that display the progress made- Throws:
PluginManagerException
- if an error occurs while loading or instantiating the plugin.
-
loadStartupPlugins
Loads the plugins which should be loaded on startup.- Specified by:
loadStartupPlugins
in interfacePluginManager
- Throws:
PluginManagerException
- if an error occurred while loading one of the plugins.
-
loadStartupPlugins
@Deprecated public void loadStartupPlugins(ProgressViewer progressViewer) throws PluginManagerExceptionDeprecated.Loads the plugins which should be loaded on startup. The progress made is displayed with progressViewer.- Specified by:
loadStartupPlugins
in interfacePluginManager
- Parameters:
progressViewer
- the progress viewer that display the progress made- Throws:
PluginManagerException
- if an error occurred while loading one of the plugins.
-
removePluginManagerListener
Removes the given plugin manager listener from the list of listeners.- Specified by:
removePluginManagerListener
in interfacePluginManager
- Parameters:
listener
- the listener to remove from the list of listeners.
-
savePrefs
Saves the plugin manager's prefs.- Specified by:
savePrefs
in interfacePluginManager
- Throws:
PluginManagerException
- if an error occurs while saving the preferences.
-
getPluginFeeds
- Specified by:
getPluginFeeds
in interfacePluginManager
-