com.mycila.plugin.api
Interface PluginResolver<T extends Plugin>


public interface PluginResolver<T extends Plugin>

The PluginResolver is responsible of checking for module dependencies to resolve missing dependencies, runnable plugins and provides methods to facilitate plugin access.

Author:
Mathieu Carbou (mathieu.carbou@gmail.com)

Method Summary
 boolean contains(java.lang.String name)
          Check if a plugin name exist
 java.util.SortedSet<java.lang.String> getMissingDependencies()
          Returns all dependencies missing, regardless of all plugins
 java.util.SortedMap<java.lang.String,java.util.SortedSet<java.lang.String>> getMissingDependenciesByPlugin()
          Get the list of plugin names that have been declared as dependencies in Plugin.getBefore() and Plugin.getAfter() but that have not been loaded (because not found, inexisting, ...)
 T getPlugin(java.lang.String name)
          Get a specific plugin.
 java.util.SortedSet<PluginBinding<T>> getPlugins()
          Get all available plugins
 java.util.List<PluginBinding<T>> getResolvedPlugins()
          Get the list of plugins in order of dependencies, resolved by getResolvedPluginsName().
 java.util.List<java.lang.String> getResolvedPluginsName()
          List all plugin names, in order of dependencies / execution, thanks to Plugin.getBefore() and Plugin.getAfter().
 

Method Detail

getPlugin

T getPlugin(java.lang.String name)
Get a specific plugin. Ensure null safe returns.

Parameters:
name - The plugin name
Returns:
The plugin instance
Throws:
InexistingPluginException - The plugin does not exist

getPlugins

java.util.SortedSet<PluginBinding<T>> getPlugins()
Get all available plugins

Returns:
A map of plugins sorted by their name

contains

boolean contains(java.lang.String name)
Check if a plugin name exist

Parameters:
name - The name of the plugin
Returns:
True if the plugin can be retreived

getMissingDependenciesByPlugin

java.util.SortedMap<java.lang.String,java.util.SortedSet<java.lang.String>> getMissingDependenciesByPlugin()
Get the list of plugin names that have been declared as dependencies in Plugin.getBefore() and Plugin.getAfter() but that have not been loaded (because not found, inexisting, ...)

Returns:
The list of the missing dependencies. The key is the plugin name and the value is the set of dependencies not found for this plugin.

getMissingDependencies

java.util.SortedSet<java.lang.String> getMissingDependencies()
Returns all dependencies missing, regardless of all plugins

Returns:
A set of plugin names missing

getResolvedPluginsName

java.util.List<java.lang.String> getResolvedPluginsName()
List all plugin names, in order of dependencies / execution, thanks to Plugin.getBefore() and Plugin.getAfter().

Notes:
- cyclic dependencies (i.e. plugin A depend on B, B on C, and C on A) are detected and an exception is thrown.
- this method only returns plugin names that have been loaded and can be used. So if a plugin A depends on a plugin B in its getBefore declaration, and the plugin B is not loaded, A will be returned in this list but not B.

Returns:
A list of plugin names, in dependency order
Throws:
CyclicDependencyException - A cyclic dependency has been found

getResolvedPlugins

java.util.List<PluginBinding<T>> getResolvedPlugins()
Get the list of plugins in order of dependencies, resolved by getResolvedPluginsName().

Returns:
the list of plugin instances in order of execution


Copyright © 2008-2010 Mycila. All Rights Reserved.