xmlBlaster 2.2.0 client API

org.xmlBlaster.util.plugin
Class PluginManagerBase

java.lang.Object
  extended by org.xmlBlaster.util.plugin.PluginManagerBase
All Implemented Interfaces:
I_PluginManager
Direct Known Subclasses:
CbServerPluginManager, DispatchPluginManager, ProtocolPluginManager, QueuePluginManager

public class PluginManagerBase
extends java.lang.Object
implements I_PluginManager

Base class to load plugins.

A typical syntax in the xmlBlaster.properties file is:

   MimeSubscribePlugin[ContentLenFilter][1.0]=\
       org.xmlBlaster.engine.mime.demo.ContentLenFilter,\
       DEFAULT_MAX_LEN=200,DEFAULT_MIN_LEN=20,classpath=mime.jar
 

Author:
Michele Laghi, W. Kleinertz (wkl) H. Goetzger, Konrad Krafft, Marcel Ruff

Field Summary
protected  Global glob
           
static java.lang.String NO_PLUGIN_TYPE
           
 
Constructor Summary
PluginManagerBase(Global glob)
           
 
Method Summary
 java.lang.String createPluginPropertyKey(java.lang.String type, java.lang.String version)
           
 java.lang.String getDefaultPluginName(java.lang.String type, java.lang.String version)
           
 I_Plugin getDummyPlugin()
          Tries to return an instance of the default plugin.
 I_Plugin getFromPluginCache(java.lang.String id)
           
protected  Global getGlobal()
           
 java.lang.String getName()
           
 I_Plugin getPluginObject(PluginInfo pluginInfo)
          Return a specific plugin, if one is loaded already it is taken from cache.
 I_Plugin getPluginObject(java.lang.String typeVersion)
           
 I_Plugin getPluginObject(java.lang.String type, java.lang.String version)
          Return a specific plugin, if one is loaded already it is taken from cache.
protected  java.lang.String getPluginPropertyName()
           
static boolean ignorePlugin(java.lang.String typeVersion)
          Plugin with type=="undef" are ignored
protected  I_Plugin instantiatePlugin(PluginInfo pluginInfo)
          Create a plugin instance without caching it.
protected  I_Plugin instantiatePlugin(PluginInfo pluginInfo, boolean usePluginCache)
          Loads a plugin.
protected  void postInstantiate(I_Plugin plugin, PluginInfo pluginInfo)
          Is called after a plugin in instantiated, allows the base class to do specific actions.
 I_Plugin removeFromPluginCache(java.lang.String id)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

glob

protected final Global glob

NO_PLUGIN_TYPE

public static final java.lang.String NO_PLUGIN_TYPE
See Also:
Constant Field Values
Constructor Detail

PluginManagerBase

public PluginManagerBase(Global glob)
Method Detail

getGlobal

protected Global getGlobal()

getPluginObject

public I_Plugin getPluginObject(java.lang.String typeVersion)
                         throws XmlBlasterException
Parameters:
type - and version with comma separator e.g. "RMI,1.0"
Throws:
XmlBlasterException

getPluginObject

public I_Plugin getPluginObject(java.lang.String type,
                                java.lang.String version)
                         throws XmlBlasterException
Return a specific plugin, if one is loaded already it is taken from cache.

This code is thread save.

Specified by:
getPluginObject in interface I_PluginManager
Parameters:
String - The type of the requested plugin.
String - The version of the requested plugin.
Returns:
I_Plugin The plugin which is suitable to handle the request or null if type=="undef"
Throws:
XmlBlasterException - Thrown if no suitable plugin has been found.

getPluginObject

public I_Plugin getPluginObject(PluginInfo pluginInfo)
                         throws XmlBlasterException
Return a specific plugin, if one is loaded already it is taken from cache.

This code is thread save.

Parameters:
String - The type of the requested plugin.
String - The version of the requested plugin.
Returns:
I_Plugin The plugin which is suitable to handle the request or null if type=="undef"
Throws:
XmlBlasterException - Thrown if no suitable plugin has been found.

getFromPluginCache

public I_Plugin getFromPluginCache(java.lang.String id)

removeFromPluginCache

public I_Plugin removeFromPluginCache(java.lang.String id)

postInstantiate

protected void postInstantiate(I_Plugin plugin,
                               PluginInfo pluginInfo)
                        throws XmlBlasterException
Is called after a plugin in instantiated, allows the base class to do specific actions. Is NOT called when plugin got from cache.

Throws:
XmlBlasterException

getDefaultPluginName

public java.lang.String getDefaultPluginName(java.lang.String type,
                                             java.lang.String version)
Specified by:
getDefaultPluginName in interface I_PluginManager
Parameters:
type - can be null
version - can be null
Returns:
please return your default plugin classname or null if not specified

getDummyPlugin

public I_Plugin getDummyPlugin()
                        throws XmlBlasterException
Tries to return an instance of the default plugin.

Throws:
XmlBlasterException

getPluginPropertyName

protected java.lang.String getPluginPropertyName()
Returns:
The name of the property in xmlBlaster.property, e.g. "Security.Server.Plugin" for "Security.Server.Plugin[simple][1.0]"

getName

public java.lang.String getName()
Specified by:
getName in interface I_PluginManager
Returns:
The name of the property in xmlBlaster.property, e.g. "Security.Server.Plugin" for "Security.Server.Plugin[simple][1.0]"

createPluginPropertyKey

public final java.lang.String createPluginPropertyKey(java.lang.String type,
                                                      java.lang.String version)
Specified by:
createPluginPropertyKey in interface I_PluginManager
Returns:
e.g. "Security.Server.Plugin[simple][1.0]"

instantiatePlugin

protected I_Plugin instantiatePlugin(PluginInfo pluginInfo)
                              throws XmlBlasterException
Create a plugin instance without caching it.

Throws:
XmlBlasterException
See Also:
instantiatePlugin(PluginInfo, boolean false)

instantiatePlugin

protected I_Plugin instantiatePlugin(PluginInfo pluginInfo,
                                     boolean usePluginCache)
                              throws XmlBlasterException
Loads a plugin.

Parameters:
pluginInfo - Contains the plugin information
usePluginCache - If true the plugin is remembered in our cache and e.g. retrievable with getPluginObject()
Returns:
I_Plugin or null if plugin type is set to "undef"
Throws:
XmlBlasterException - Thrown if loading or initializing failed.

ignorePlugin

public static final boolean ignorePlugin(java.lang.String typeVersion)
Plugin with type=="undef" are ignored


shutdown

public void shutdown()

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.