xmlBlaster 2.2.0 API

org.xmlBlaster.engine.mime
Class PublishPluginManager

java.lang.Object
  extended by org.xmlBlaster.util.plugin.PluginManagerBase
      extended by org.xmlBlaster.engine.mime.PublishPluginManager
All Implemented Interfaces:
java.util.EventListener, I_RunlevelListener, I_PluginManager

public class PublishPluginManager
extends PluginManagerBase
implements I_RunlevelListener

Loads publish() filter plugin depending on message MIME type. Please register your plugins in xmlBlaster.properties, for example:

 MimePublishPlugin[MyFilter][1.0]=com.mycompany.MyFilter
 


Field Summary
private static java.lang.String defaultPluginName
           
private  java.lang.Object dummyObject
          A dummy object which we put into the mimeCache if no plugins are found
private  ServerScope glob
           
private static java.util.logging.Logger log
           
private  int maxMimeCacheSize
          To avoid huge caches if every message sends crazy different mime types
private  java.lang.String ME
           
private  java.util.Map mimeCache
          Cache for up to now arrived message mime types
private  java.util.Map pluginMap
          Map holds the known plugins
static java.lang.String pluginPropertyName
           
 
Fields inherited from class org.xmlBlaster.util.plugin.PluginManagerBase
NO_PLUGIN_TYPE
 
Constructor Summary
PublishPluginManager(ServerScope glob)
           
 
Method Summary
 java.util.Map findMimePlugins(java.lang.String mime, java.lang.String mimeExtended)
           
 java.lang.String getDefaultPluginName(java.lang.String type, java.lang.String version)
           
 java.lang.String getName()
          A human readable name of the listener for logging.
protected  java.lang.String getPluginPropertyName()
           
 boolean hasPlugins()
          Are there any plugins?
 void initializePlugins()
          Instantiate all given plugins from xmlBlaster.properties.
 void postInstantiate(I_Plugin plugin_, PluginInfo pluginInfo)
          Called from base class after creation
 void runlevelChange(int from, int to, boolean force)
          Invoked on run level change, see RunlevelManager.RUNLEVEL_HALTED and RunlevelManager.RUNLEVEL_RUNNING

Enforced by I_RunlevelListener

 void shutdown()
           
 
Methods inherited from class org.xmlBlaster.util.plugin.PluginManagerBase
createPluginPropertyKey, getDummyPlugin, getFromPluginCache, getGlobal, getPluginObject, getPluginObject, getPluginObject, ignorePlugin, instantiatePlugin, instantiatePlugin, removeFromPluginCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private final java.lang.String ME

defaultPluginName

private static final java.lang.String defaultPluginName

pluginPropertyName

public static final java.lang.String pluginPropertyName
See Also:
Constant Field Values

glob

private final ServerScope glob

log

private static java.util.logging.Logger log

pluginMap

private final java.util.Map pluginMap
Map holds the known plugins


mimeCache

private final java.util.Map mimeCache
Cache for up to now arrived message mime types


dummyObject

private final java.lang.Object dummyObject
A dummy object which we put into the mimeCache if no plugins are found


maxMimeCacheSize

private final int maxMimeCacheSize
To avoid huge caches if every message sends crazy different mime types

Constructor Detail

PublishPluginManager

public PublishPluginManager(ServerScope glob)
                     throws XmlBlasterException
Throws:
XmlBlasterException
Method Detail

postInstantiate

public void postInstantiate(I_Plugin plugin_,
                            PluginInfo pluginInfo)
Called from base class after creation

Overrides:
postInstantiate in class PluginManagerBase

initializePlugins

public void initializePlugins()
                       throws XmlBlasterException
Instantiate all given plugins from xmlBlaster.properties.

E.g. MimePublishPlugin[PublishLenChecker][1.0]=org.xmlBlaster.engine.mime.demo.PublishLenChecker,DEFAULT_MAX_LEN=200

If invoked again, the loaded plugins are reset and reloaded with the current property settings

Throws:
XmlBlasterException

hasPlugins

public final boolean hasPlugins()
Are there any plugins?


findMimePlugins

public java.util.Map findMimePlugins(java.lang.String mime,
                                     java.lang.String mimeExtended)
Returns:
null if no plugin for this mime type found, otherwise a map with I_PublishFilter objects (= matching plugins) is returned

getPluginPropertyName

protected java.lang.String getPluginPropertyName()
Overrides:
getPluginPropertyName in class PluginManagerBase
Returns:
The name of the property in xmlBlaster.property "MimePublishPlugin" for "MimePublishPlugin[demo][1.0]"

getDefaultPluginName

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

shutdown

public void shutdown()
Overrides:
shutdown in class PluginManagerBase

getName

public java.lang.String getName()
A human readable name of the listener for logging.

Enforced by I_RunlevelListener

Specified by:
getName in interface I_RunlevelListener
Specified by:
getName in interface I_PluginManager
Overrides:
getName in class PluginManagerBase
Returns:
The name of the property in xmlBlaster.property, e.g. "Security.Server.Plugin" for "Security.Server.Plugin[simple][1.0]"

runlevelChange

public void runlevelChange(int from,
                           int to,
                           boolean force)
                    throws XmlBlasterException
Invoked on run level change, see RunlevelManager.RUNLEVEL_HALTED and RunlevelManager.RUNLEVEL_RUNNING

Enforced by I_RunlevelListener

Specified by:
runlevelChange in interface I_RunlevelListener
Parameters:
from - The current runlevel
to - The runlevel we want to switch to
force - If true force the change even if messages are lost
Throws:
XmlBlasterException

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.