Interface PluginManager

All Superinterfaces:
ModuleManager
All Known Implementing Classes:
DefaultPluginManager

public interface PluginManager
extends ModuleManager
  • Field Details

  • Method Details

    • enablePlugins

      void enablePlugins​(boolean enabled)
      Enables or disables plugin execution.
      Parameters:
      enabled - True, if plugins should be globally enabled; false, if disabled.
    • pluginsEnabled

      boolean pluginsEnabled()
      Returns plugin execution status. If false, plugins are not executed when they are encountered on a WikiPage, and an empty string is returned in their place.
      Returns:
      True, if plugins are enabled; false otherwise.
    • getPluginPattern

      org.apache.oro.text.regex.Pattern getPluginPattern()
      Returns plugin insert pattern.
      Returns:
      plugin insert pattern.
    • execute

      String execute​(Context context, String classname, Map<String,​String> params) throws PluginException
      Executes a plugin class in the given context.

      Used to be private, but is public since 1.9.21.

      Parameters:
      context - The current WikiContext.
      classname - The name of the class. Can also be a shortened version without the package name, since the class name is searched from the package search path.
      params - A parsed map of key-value pairs.
      Returns:
      Whatever the plugin returns.
      Throws:
      PluginException - If the plugin execution failed for some reason.
      Since:
      2.0
    • parseArgs

      Map<String,​String> parseArgs​(String argstring) throws IOException
      Parses plugin arguments. Handles quotes and all other kewl stuff.

      Special parameters

      The plugin body is put into a special parameter defined by PARAM_BODY; the plugin's command line into a parameter defined by PARAM_CMDLINE; and the bounds of the plugin within the wiki page text by a parameter defined by PARAM_BOUNDS, whose value is stored as a two-element int[] array, i.e., [start,end].
      Parameters:
      argstring - The argument string to the plugin. This is typically a list of key-value pairs, using "'" to escape spaces in strings, followed by an empty line and then the plugin body. In case the parameter is null, will return an empty parameter list.
      Returns:
      A parsed list of parameters.
      Throws:
      IOException - If the parsing fails.
    • execute

      String execute​(Context context, String commandline) throws PluginException
      Parses a plugin. Plugin commands are of the form:
      [{INSERT myplugin WHERE param1=value1, param2=value2}]
      myplugin may either be a class name or a plugin alias.

      This is the main entry point that is used.

      Parameters:
      context - The current WikiContext.
      commandline - The full command line, including plugin name, parameters and body.
      Returns:
      HTML as returned by the plugin, or possibly an error message.
      Throws:
      PluginException - From the plugin itself, it propagates, waah!
    • newWikiPlugin

      Creates a Plugin.
      Parameters:
      pluginName - plugin's classname
      rb - ResourceBundle with i18ned text for exceptions.
      Returns:
      a Plugin.
      Throws:
      PluginException - if there is a problem building the Plugin.