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


public interface PluginCache<T extends Plugin>

The PluginCache is responsible of caching all plugins loaded and add / modify them at runtime. Thus, it is possible to add, remove or replace some plugins.

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

Method Summary
 void clear()
          Clear the plugin cache, forcing a reload at next getPlugins() call
 boolean contains(java.lang.String pluginName)
           
 java.util.Map<java.lang.String,PluginBinding<T>> getBindings()
          Load the plugins if not done and returns an unmodifiable map of plugins sorted by their names
 void registerPlugin(java.lang.String name, T plugin)
          Install a plugin at runtime in the current cache, overwriting existing one.
 void registerPlugins(java.util.Map<java.lang.String,T> plugins)
          Install some plugins at runtime in the current cache, overwriting existing ones.
 void removePlugins(java.lang.String... pluginNames)
          Remove some plugins from the current cache.
 

Method Detail

contains

boolean contains(java.lang.String pluginName)

getBindings

java.util.Map<java.lang.String,PluginBinding<T>> getBindings()
Load the plugins if not done and returns an unmodifiable map of plugins sorted by their names

Returns:
The plugins as an unmodifiable map

clear

void clear()
Clear the plugin cache, forcing a reload at next getPlugins() call


registerPlugin

void registerPlugin(java.lang.String name,
                    T plugin)
Install a plugin at runtime in the current cache, overwriting existing one.

Parameters:
name - The name of the plugin
plugin - The plugin instance

registerPlugins

void registerPlugins(java.util.Map<java.lang.String,T> plugins)
Install some plugins at runtime in the current cache, overwriting existing ones.

Parameters:
plugins - A map of plugins to register

removePlugins

void removePlugins(java.lang.String... pluginNames)
Remove some plugins from the current cache.

Parameters:
pluginNames - the plugins to remove


Copyright © 2008-2010 Mycila. All Rights Reserved.