net.sf.taverna.update.plugin
Class PluginManager

java.lang.Object
  extended by net.sf.taverna.update.plugin.PluginManager
All Implemented Interfaces:
java.util.EventListener, PluginListener

public class PluginManager
extends java.lang.Object
implements PluginListener

Author:
David Withers

Method Summary
 void addPlugin(Plugin plugin)
           
static void addPluginManagerListener(PluginManagerListener listener)
           
 void addPluginSite(PluginSite pluginSite)
          Adds a PluginSite.
 boolean checkForUpdates()
          Checks the PluginSites to find updates for installed plugins.
 java.util.List<Plugin> getIncompatiblePlugins(java.lang.String version, boolean omitDisabledPlugins)
          Returns a list of all currently installed and enabled plugins that would become incompatible with the version String supplied.
static PluginManager getInstance()
          Returns the singleton instance of the PluginManager.
 java.util.List<Plugin> getPlugins()
          Returns the plugins.
 java.util.List<Plugin> getPluginsFromSite(PluginSite pluginSite)
          Returns all the Plugins available from the PluginSite.
 java.util.List<PluginSite> getPluginSites()
          Returns the pluginSites.
 Repository getRepository()
           
 java.util.List<TavernaPluginSite> getTavernaPluginSites()
           
 java.util.List<Plugin> getUninstalledPluginsFromSite(PluginSite pluginSite)
          Returns all the Plugins available from the PluginSite that haven't already been installed.
 Plugin getUpdate(Plugin plugin)
          Returns the update for the plugin;
 boolean isUpdateAvailable(Plugin plugin)
          Returns true if an update is available for the plugin.
 void pluginChanged(PluginEvent event)
          Invoked when a plugin is changed.
 void removePlugin(Plugin plugin)
           
static void removePluginManagerListener(PluginManagerListener listener)
           
 void removePluginSite(PluginSite pluginSite)
          Removes a PluginSite.
 void savePlugins()
           
 void savePluginSites()
           
static void setRepository(Repository repository)
           
 void updatePlugin(Plugin plugin)
          If an update is available, removes the plugin an installs the update.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static PluginManager getInstance()
Returns the singleton instance of the PluginManager.

Returns:
the singleton instance of the PluginManager

getRepository

public Repository getRepository()

setRepository

public static void setRepository(Repository repository)

getPlugins

public java.util.List<Plugin> getPlugins()
Returns the plugins.

Returns:
the plugins

addPlugin

public void addPlugin(Plugin plugin)

getIncompatiblePlugins

public java.util.List<Plugin> getIncompatiblePlugins(java.lang.String version,
                                                     boolean omitDisabledPlugins)
Returns a list of all currently installed and enabled plugins that would become incompatible with the version String supplied. If teh omitDisbaledPlugins flag is set to true, then only enabled plugins will be returned

Parameters:
version - - the version String to check plugins against
omitDisabledPlugins - - flag to indicate that disabled plugins should be ignored
Returns:

removePlugin

public void removePlugin(Plugin plugin)

savePlugins

public void savePlugins()

getPluginSites

public java.util.List<PluginSite> getPluginSites()
Returns the pluginSites.

Returns:
the pluginSites

addPluginSite

public void addPluginSite(PluginSite pluginSite)
Adds a PluginSite.

Parameters:
pluginSite - the PluginSite to add

removePluginSite

public void removePluginSite(PluginSite pluginSite)
Removes a PluginSite.

Parameters:
pluginSite - the PluginSite to remove

savePluginSites

public void savePluginSites()

getPluginsFromSite

public java.util.List<Plugin> getPluginsFromSite(PluginSite pluginSite)
Returns all the Plugins available from the PluginSite.

Parameters:
pluginSite -
Returns:
all the Plugins available from the PluginSite

getUninstalledPluginsFromSite

public java.util.List<Plugin> getUninstalledPluginsFromSite(PluginSite pluginSite)
Returns all the Plugins available from the PluginSite that haven't already been installed.

Parameters:
pluginSite -
Returns:
all the uninstalled Plugins from the PluginSite

getUpdate

public Plugin getUpdate(Plugin plugin)
Returns the update for the plugin;

Parameters:
plugin -
Returns:

updatePlugin

public void updatePlugin(Plugin plugin)
If an update is available, removes the plugin an installs the update.

Parameters:
plugin - the plugin to update

isUpdateAvailable

public boolean isUpdateAvailable(Plugin plugin)
Returns true if an update is available for the plugin.

Parameters:
plugin -
Returns:

checkForUpdates

public boolean checkForUpdates()
Checks the PluginSites to find updates for installed plugins.

Returns:
true if updates are found

addPluginManagerListener

public static void addPluginManagerListener(PluginManagerListener listener)

removePluginManagerListener

public static void removePluginManagerListener(PluginManagerListener listener)

pluginChanged

public void pluginChanged(PluginEvent event)
Description copied from interface: PluginListener
Invoked when a plugin is changed.

Specified by:
pluginChanged in interface PluginListener

getTavernaPluginSites

public java.util.List<TavernaPluginSite> getTavernaPluginSites()