001 /* 002 Licensed to the Apache Software Foundation (ASF) under one 003 or more contributor license agreements. See the NOTICE file 004 distributed with this work for additional information 005 regarding copyright ownership. The ASF licenses this file 006 to you under the Apache License, Version 2.0 (the 007 "License"); you may not use this file except in compliance 008 with the License. You may obtain a copy of the License at 009 010 http://www.apache.org/licenses/LICENSE-2.0 011 012 Unless required by applicable law or agreed to in writing, 013 software distributed under the License is distributed on an 014 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 KIND, either express or implied. See the License for the 016 specific language governing permissions and limitations 017 under the License. 018 */ 019 package org.apache.wiki.api.plugin; 020 021 import java.util.Map; 022 023 import org.apache.wiki.WikiContext; 024 import org.apache.wiki.api.exceptions.PluginException; 025 026 027 /** 028 * Defines an interface for plugins. Any instance of a wiki plugin should implement this interface. 029 */ 030 public interface WikiPlugin { 031 /** 032 * Name of the default plugin resource bundle. 033 */ 034 String CORE_PLUGINS_RESOURCEBUNDLE = "plugin.PluginResources"; 035 036 /** 037 * This is the main entry point for any plugin. The parameters are parsed, 038 * and a special parameter called "_body" signifies the name of the plugin 039 * body, i.e. the part of the plugin that is not a parameter of 040 * the form "key=value". This has been separated using an empty 041 * line. 042 * <P> 043 * Note that it is preferred that the plugin returns 044 * XHTML-compliant HTML (i.e. close all tags, use <br /> 045 * instead of <br>, etc. 046 * 047 * @param context The current WikiContext. 048 * @param params A Map which contains key-value pairs. Any 049 * parameter that the user has specified on the 050 * wiki page will contain String-String 051 * parameters, but it is possible that at some future date, 052 * JSPWiki will give you other things that are not Strings. 053 * 054 * @return HTML, ready to be included into the rendered page. 055 * 056 * @throws PluginException In case anything goes wrong. 057 */ 058 String execute( WikiContext context, Map< String, String > params ) throws PluginException; 059 060 }