eu.scape_project.watch.plugin
Class PluginManager

java.lang.Object
  extended by eu.scape_project.watch.plugin.PluginManager

public final class PluginManager
extends Object

This is the watch plugin manager. It is responsible for loading PluginInterfaces. Currently it loads all jar files in a pre defined location and builds an internal registry of all PluginInterface classes in there. As soon as the getPlugin(String, String) method is called a new plugin is created and its init method is called. Calling the shutdown method of the plugin is the responsibility of the user of the PluginInterface.

Author:
Petar Petrov -

Method Summary
static PluginManager getDefaultPluginManager()
          Gets the default PluginManager.
 PluginInterface getPlugin(String pluginID, String version)
          Returns an initialized instance of the PluginInterface with the specified ID (classname) or null if the initializing process failed.
 List<PluginInfo> getPluginInfo()
          Retrieves info for all plugins currently in the registry.
 List<PluginInfo> getPluginInfo(PluginType type)
          Obtain plugin information about all plugins of the given type.
 List<PluginInfo> getPluginInfo(String name)
          Checks the plugin registry for a plugin with the given name and retrieves all plugins that have the specified name or an empty list.
 void reScan()
          Rescans the plugins folder on demand.
 void shutdown()
          This method should be called to stop PluginManager and all PluginInterfaces currently loaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDefaultPluginManager

public static PluginManager getDefaultPluginManager()
Gets the default PluginManager.

Returns:
the default PluginManager.

getPlugin

public PluginInterface getPlugin(String pluginID,
                                 String version)
Returns an initialized instance of the PluginInterface with the specified ID (classname) or null if the initializing process failed.

Parameters:
pluginID - the ID (classname) of the PluginInterface.
version - the version of the plugin, as there might be some ambiguities.
Returns:
a PluginInterface or null if the specified classname if not a PluginInterface.

getPluginInfo

public List<PluginInfo> getPluginInfo()
Retrieves info for all plugins currently in the registry.

Returns:
a list of PluginInfos

getPluginInfo

public List<PluginInfo> getPluginInfo(PluginType type)
Obtain plugin information about all plugins of the given type.

Parameters:
type - the type of the PluginInterface
Returns:
a list with PluginInfos
See Also:
PluginType}

getPluginInfo

public List<PluginInfo> getPluginInfo(String name)
Checks the plugin registry for a plugin with the given name and retrieves all plugins that have the specified name or an empty list. All comparisons are case insensitive. Note, that all types of plugins are checked.

Parameters:
name - the name of the plugin you are looking for.
Returns:
the list with the plugin info.

reScan

public void reScan()
Rescans the plugins folder on demand.


shutdown

public void shutdown()
This method should be called to stop PluginManager and all PluginInterfaces currently loaded.



Copyright © 2012. All Rights Reserved.