01: /*
02: JSPWiki - a JSP-based WikiWiki clone.
03:
04: Copyright (C) 2001 Janne Jalkanen (Janne.Jalkanen@iki.fi)
05:
06: This program is free software; you can redistribute it and/or modify
07: it under the terms of the GNU Lesser General Public License as published by
08: the Free Software Foundation; either version 2.1 of the License, or
09: (at your option) any later version.
10:
11: This program is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: GNU Lesser General Public License for more details.
15:
16: You should have received a copy of the GNU Lesser General Public License
17: along with this program; if not, write to the Free Software
18: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20: package com.ecyrd.jspwiki.plugin;
21:
22: import java.util.Map;
23:
24: import com.ecyrd.jspwiki.WikiContext;
25:
26: /**
27: * Defines an interface for plugins. Any instance of a wiki plugin
28: * should implement this interface.
29: *
30: * @author Janne Jalkanen
31: */
32: public interface WikiPlugin {
33: static final String CORE_PLUGINS_RESOURCEBUNDLE = "com.ecyrd.jspwiki.plugin.PluginResources";
34:
35: /**
36: * This is the main entry point for any plugin. The parameters are parsed,
37: * and a special parameter called "_body" signifies the name of the plugin
38: * body, i.e. the part of the plugin that is not a parameter of
39: * the form "key=value". This has been separated using an empty
40: * line.
41: * <P>
42: * Note that it is preferred that the plugin returns
43: * XHTML-compliant HTML (i.e. close all tags, use <br />
44: * instead of <br>, etc.
45: *
46: * @param context The current WikiContext.
47: * @param params A Map which contains key-value pairs. Any
48: * parameter that the user has specified on the
49: * wiki page will contain String-String
50: * parameters, but it is possible that at some future date,
51: * JSPWiki will give you other things that are not Strings.
52: *
53: * @return HTML, ready to be included into the rendered page.
54: *
55: * @throws PluginException In case anything goes wrong.
56: */
57:
58: public String execute(WikiContext context, Map params)
59: throws PluginException;
60: }
|