org.springframework.plugin.core
Interface PluginRegistry<T extends Plugin<S>,S>

Type Parameters:
T - the concrete plugin interface
S - the delimiter type
All Superinterfaces:
Iterable<T>
All Known Implementing Classes:
OrderAwarePluginRegistry, PluginRegistrySupport, SimplePluginRegistry

public interface PluginRegistry<T extends Plugin<S>,S>
extends Iterable<T>

Registry for plugins. Allows sophisticated typesafe access to implementations of interfaces extending {link Plugin}.

Author:
Oliver Gierke

Method Summary
 boolean contains(T plugin)
          Returns whether the registry contains a given plugin.
 int countPlugins()
          Returns the number of registered plugins.
 T getPluginFor(S delimiter)
          Returns the first plugin found for the given originating system.
<E extends Exception>
T
getPluginFor(S delimiter, E ex)
          Retrieves a required plugin from the registry or throw the given exception if none can be found.
 T getPluginFor(S delimiter, T plugin)
          Returns the first Plugin supporting the given delimiter or the given plugin if none can be found.
 List<T> getPlugins()
          Returns all Plugins contained in this registry.
 List<T> getPluginsFor(S delimiter)
          Returns all plugins for the given delimiter.
<E extends Exception>
List<T>
getPluginsFor(S delimiter, E ex)
          Retrieves all plugins for the given delimiter or throws an exception if no plugin can be found.
 List<T> getPluginsFor(S delimiter, List<? extends T> plugins)
          Returns all Plugins supporting the given delimiter or the given plugins if none found.
 boolean hasPluginFor(S delimiter)
          Returns whether the registry contains a Plugin matching the given delimiter.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

getPluginFor

T getPluginFor(S delimiter)
Returns the first plugin found for the given originating system. Thus, further configured plugins are ignored.

Parameters:
originatingSystem -
Returns:
a plugin for the given originating system or null if none found

getPluginsFor

List<T> getPluginsFor(S delimiter)
Returns all plugins for the given delimiter.

Parameters:
delimiter -
Returns:
a list of plugins or an empty list if none found

getPluginFor

<E extends Exception> T getPluginFor(S delimiter,
                                     E ex)
                                 throws E extends Exception
Retrieves a required plugin from the registry or throw the given exception if none can be found. If more than one plugins are found the first one will be returned.

Type Parameters:
E - the exception type to be thrown in case no plugin can be found
Parameters:
delimiter -
ex - the exception to be thrown in case no plugin can be found
Returns:
a single plugin for the given delimiter
Throws:
E - if no plugin can be found for the given delimiter
E extends Exception

getPluginsFor

<E extends Exception> List<T> getPluginsFor(S delimiter,
                                            E ex)
                                        throws E extends Exception
Retrieves all plugins for the given delimiter or throws an exception if no plugin can be found.

Type Parameters:
E - the exception type to be thrown
Parameters:
delimiter -
ex -
Returns:
all plugins for the given delimiter
Throws:
E - if no plugin can be found
E extends Exception

getPluginFor

T getPluginFor(S delimiter,
               T plugin)
Returns the first Plugin supporting the given delimiter or the given plugin if none can be found.

Parameters:
delimiter -
plugin -
Returns:
a single Plugin supporting the given delimiter or the given Plugin if none found

getPluginsFor

List<T> getPluginsFor(S delimiter,
                      List<? extends T> plugins)
Returns all Plugins supporting the given delimiter or the given plugins if none found.

Parameters:
delimiter -
plugins -
Returns:
all Plugins supporting the given delimiter or the given Plugins if none found

countPlugins

int countPlugins()
Returns the number of registered plugins.

Returns:
the number of plugins in the registry

contains

boolean contains(T plugin)
Returns whether the registry contains a given plugin.

Parameters:
plugin -
Returns:

hasPluginFor

boolean hasPluginFor(S delimiter)
Returns whether the registry contains a Plugin matching the given delimiter.

Parameters:
delimiter -
Returns:

getPlugins

List<T> getPlugins()
Returns all Plugins contained in this registry. Will return an immutable List to prevent outside modifications of the PluginRegistry content.

Returns:


Copyright © 2008–2014 Pivotal, Inc.. All rights reserved.