Plugin.java 2.48 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/**
 * $RCSfile$
 * $Revision$
 * $Date$
 *
 * Copyright (C) 2004 Jive Software. All rights reserved.
 *
 * This software is published under the terms of the GNU Public License (GPL),
 * a copy of which is included in this distribution.
 */

package org.jivesoftware.messenger.container;

import java.io.File;

/**
Matt Tucker's avatar
Matt Tucker committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
 * Plugin interface. Plugins enhance the functionality of Jive Messenger. They can:<ul>
 *
 *      <li>Act as {@link org.jivesoftware.messenger.Component Components} to implement
 *      additional features in the XMPP protocol.
 *      <li>Dynamically modify the admin console.
 *      <li>Use the Jive Messenger API to add new functionality to server.
 * </ul>
 *
 * Plugins live in the <tt>plugins</tt> directory of <tt>messengerHome</tt>. Plugins
 * that are packaged as JAR files will be automatically expanded into directories. A
 * plugin directory should have the following structure:
 *
 * <pre>[pluginDir]
 *    |-- plugin.xml
 *    |-- classes/
 *    |-- lib/</pre>
 *
 * The <tt>classes</tt> and <tt>lib</tt> directory are optional. Any files in the
 * <tt>classes</tt> directory will be added to the classpath of the plugin, as well
 * as any JAR files in the <tt>lib</tt> directory. The <tt>plugin.xml</tt> file is
 * required, and specifies the className of the Plugin implementation. The XML file
 * should resemble the following XML:
 *
 * <pre>
 * &lt;?xml version="1.0" encoding="UTF-8"?&gt;
 * &lt;plugin&gt;
 *     &lt;class&gt;org.example.YourPlugin&lt;/class&gt;
 * &lt;/plugin&gt;</pre>
 *
 * Each plugin will be loaded in its own class loader.
Matt Tucker's avatar
Matt Tucker committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
 *
 * @author Matt Tucker
 */
public interface Plugin {

    /**
     * Returns the name of this plugin.
     *
     * @return the plugin's name.
     */
    public String getName();

    /**
     * Returns the description of the plugin or <tt>null</tt> if there is no description.
     *
     * @return this plugin's description.
     */
    public String getDescription();

    /**
     * Returns the author of this plugin.
     *
     * @return the plugin's author.
     */
    public String getAuthor();

    /**
     * The plugin's version.
     *
     * @return the version of the plugin.
     */
    public String getVersion();

    /**
     * Initializes the plugin.
     *
     * @param manager the plugin manager.
     * @param pluginDirectory the directory where the plugin is located.
     */
    public void initialize(PluginManager manager, File pluginDirectory);

    /**
     * Destroys the plugin.
     */
    public void destroy();

}