de.mud.jta

Class PluginLoader

Implemented Interfaces:
PluginBus
Known Direct Subclasses:
Common

public class PluginLoader
extends java.lang.Object
implements PluginBus

The plugin loader tries to load the plugin by name and returns a corresponding plugin object. It takes care of connecting filter plugins

Maintainer: Matthias L. Jugel

Version:
$Id: PluginLoader.java 499 2005-09-29 08:24:54Z leo $
Author:
Matthias L. Jugel, Marcus Mei???ner

Field Summary

static String
ID
holds the current version id

Constructor Summary

PluginLoader()
Create new plugin loader and set up with default plugin path.
PluginLoader(Vector path)
Create new plugin loader and set up with specified plugin path.

Method Summary

Plugin
addPlugin(String name, String id)
Add a new plugin to the system and register the plugin load as its communication bus.
Object
broadcast(PluginMessage message)
Implementation of the plugin bus.
Map
getPlugins()
void
registerPluginListener(PluginListener l)
Register a new plugin listener.
Plugin
replacePlugin(String name, String id)
Replace a plugin with a new one, actually reloads the plugin.

Field Details

ID

public static final String ID
holds the current version id

Constructor Details

PluginLoader

public PluginLoader()
Create new plugin loader and set up with default plugin path.

PluginLoader

public PluginLoader(Vector path)
Create new plugin loader and set up with specified plugin path.
Parameters:
path - the default search path for plugins

Method Details

addPlugin

public Plugin addPlugin(String name,
                        String id)
Add a new plugin to the system and register the plugin load as its communication bus. If the plugin is a filter plugin and if it is not the first filter the last added filter will be set as its filter source.
Parameters:
name - the string name of the plugin
Returns:
the newly created plugin or null in case of an error

broadcast

public Object broadcast(PluginMessage message)
Implementation of the plugin bus. Broadcast a message to all listeners we know of. The message takes care that the right methods are called in the listeners.
Specified by:
broadcast in interface PluginBus
Parameters:
message - the plugin message to be sent
Returns:
the answer to the sent message

getPlugins

public Map getPlugins()

registerPluginListener

public void registerPluginListener(PluginListener l)
Register a new plugin listener.
Specified by:
registerPluginListener in interface PluginBus

replacePlugin

public Plugin replacePlugin(String name,
                            String id)
Replace a plugin with a new one, actually reloads the plugin.
Parameters:
name - name of plugin to be replaced
id - unique id
Returns:
the newly loaded plugin