org.mycore.services.plugins
Class TextFilterPluginManager

java.lang.Object
  extended by org.mycore.services.plugins.TextFilterPluginManager

public class TextFilterPluginManager
extends Object

Loads and manages plugins

Author:
Thomas Scheffler (yagee)

Method Summary
 void clear()
          removes all plugins from the manager
static TextFilterPluginManager getInstance()
           
 TextFilterPlugin getPlugin(MCRFileContentType ct)
          returns TextFilterPlugin to corresponding MIME type
 Collection getPlugins()
          returns a Collection of all loaded plugins.
 boolean isSupported(MCRFileContentType ct)
          checks whether content type is supported
 void loadPlugins()
          load TextFilterPlugins from the MCR.PluginDirectory
 void reloadPlugins()
          removes all plugins and reload plugins after that This is when you delete a plugin while the application is running, replacing one with a new version or if you just add one.
 Reader transform(MCRFileContentType ct, InputStream input)
          returns a Reader for the characters of the InputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TextFilterPluginManager getInstance()

loadPlugins

public void loadPlugins()
load TextFilterPlugins from the MCR.PluginDirectory


clear

public void clear()
removes all plugins from the manager


reloadPlugins

public void reloadPlugins()
removes all plugins and reload plugins after that This is when you delete a plugin while the application is running, replacing one with a new version or if you just add one.


getPlugins

public Collection getPlugins()
returns a Collection of all loaded plugins.

Returns:
a Collection of Plugins

getPlugin

public TextFilterPlugin getPlugin(MCRFileContentType ct)
returns TextFilterPlugin to corresponding MIME type

Parameters:
ct - supported MIME type
Returns:
corresponding TextFilterPlugin or null if MIME is emtpy or null

isSupported

public boolean isSupported(MCRFileContentType ct)
checks whether content type is supported

Parameters:
ct - content type of Inputstream
Returns:
true if content type is supported, else false

transform

public Reader transform(MCRFileContentType ct,
                        InputStream input)
                 throws FilterPluginTransformException
returns a Reader for the characters of the InputStream

Parameters:
ct - ContentType of the InputStream
input - InputStream to be parsed
Returns:
null if ContentType is unsupported, else a Reader for the parsed characters
Throws:
FilterPluginTransformException