public interface PluginManager
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_PACKAGE
This is the default package to try in case the instantiation fails.
|
static String |
PARAM_BODY
The name of the body content.
|
static String |
PARAM_BOUNDS
The name of the parameter containing the start and end positions in the
read stream of the plugin text (stored as a two-element int[], start
and end resp.).
|
static String |
PARAM_CMDLINE
The name of the command line content parameter.
|
static String |
PARAM_DEBUG
A special name to be used in case you want to see debug output
|
static String |
PROP_EXTERNALJARS
The property name defining which external jars will be added to the classpath when searching for plugin classes.
|
static String |
PROP_SEARCHPATH
The property name defining which packages will be searched for plugin classes.
|
Modifier and Type | Method and Description |
---|---|
void |
enablePlugins(boolean enabled)
Enables or disables plugin execution.
|
String |
execute(WikiContext context,
String commandline)
Parses a plugin.
|
String |
execute(WikiContext context,
String classname,
Map<String,String> params)
Executes a plugin class in the given context.
|
DefaultPluginManager.WikiPluginInfo |
getModuleInfo(String pluginName)
Returns the
DefaultPluginManager.WikiPluginInfo information about the provided pluginName. |
org.apache.oro.text.regex.Pattern |
getPluginPattern()
Returns plugin insert pattern.
|
String |
getPluginSearchPath()
Returns plugins' search path.
|
Collection<WikiModuleInfo> |
modules()
Returns a collection of modules currently managed by this ModuleManager.
|
WikiPlugin |
newWikiPlugin(String pluginName,
ResourceBundle rb)
Creates a
WikiPlugin . |
Map<String,String> |
parseArgs(String argstring)
Parses plugin arguments.
|
boolean |
pluginsEnabled()
Returns plugin execution status.
|
static final String PROP_SEARCHPATH
static final String PROP_EXTERNALJARS
static final String DEFAULT_PACKAGE
static final String PARAM_BODY
static final String PARAM_CMDLINE
static final String PARAM_BOUNDS
static final String PARAM_DEBUG
void enablePlugins(boolean enabled)
enabled
- True, if plugins should be globally enabled; false, if disabled.boolean pluginsEnabled()
org.apache.oro.text.regex.Pattern getPluginPattern()
String getPluginSearchPath()
String execute(WikiContext context, String classname, Map<String,String> params) throws PluginException
Used to be private, but is public since 1.9.21.
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.PluginException
- If the plugin execution failed for
some reason.Map<String,String> parseArgs(String argstring) throws IOException
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].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.IOException
- If the parsing fails.String execute(WikiContext context, String commandline) throws PluginException
This is the main entry point that is used.
context
- The current WikiContext.commandline
- The full command line, including plugin
name, parameters and body.PluginException
- From the plugin itself, it propagates, waah!Collection<WikiModuleInfo> modules()
WikiModuleInfo
class. This method should return something
which is safe to iterate over, even if the underlying collection changes.WikiModuleInfo
instances.DefaultPluginManager.WikiPluginInfo getModuleInfo(String pluginName)
DefaultPluginManager.WikiPluginInfo
information about the provided pluginName.pluginName
- WikiPlugin newWikiPlugin(String pluginName, ResourceBundle rb) throws PluginException
WikiPlugin
.pluginName
- plugin's classnamerb
- ResourceBundle
with i18ned text for exceptions.WikiPlugin
.PluginException
- if there is a problem building the WikiPlugin
.Copyright © 2001-2019 The Apache Software Foundation. All rights reserved.