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 */
019package org.apache.wiki.api.plugin;
020
021import org.apache.wiki.api.core.Context;
022import org.apache.wiki.api.exceptions.PluginException;
023
024import java.util.Map;
025
026
027/**
028 *  Defines an interface for plugins.  Any instance of a wiki plugin should implement this interface.
029 */
030public interface Plugin {
031
032    /** Name of the default plugin resource bundle. */
033    String CORE_PLUGINS_RESOURCEBUNDLE = "plugin.PluginResources";
034
035    /**
036     *  This is the main entry point for any plugin.  The parameters are parsed, and a special parameter called "_body" signifies the name
037     *  of the plugin body, i.e. the part of the plugin that is not a parameter of the form "key=value".  This has been separated using an
038     *  empty line.
039     *  <P>
040     *  Note that it is preferred that the plugin returns XHTML-compliant HTML (i.e. close all tags, use &lt;br /&gt; instead of
041     *  &lt;br&gt;, etc.
042     *
043     *  @param context The current WikiContext.
044     *  @param params  A Map which contains key-value pairs.  Any parameter that the user has specified on the
045     *                 wiki page will contain String-String parameters, but it is possible that at some future date,
046     *                 JSPWiki will give you other things that are not Strings.
047     *  @return HTML, ready to be included into the rendered page.
048     *  @throws PluginException In case anything goes wrong.
049     */
050    String execute( Context context, Map< String, String > params ) throws PluginException;
051    
052}