1 /** 2 * $RCSfile: Plugin.java,v $ 3 * $Revision: 1.5 $ 4 * $Date: 2005/04/11 21:02:05 $ 5 * 6 * Copyright (C) 2004 Jive Software. All rights reserved. 7 * 8 * This software is published under the terms of the GNU Public License (GPL), 9 * a copy of which is included in this distribution. 10 */ 11 12 package org.jivesoftware.messenger.container; 13 14 import java.io.File; 15 16 /** 17 * Plugin interface. Plugins enhance the functionality of Jive Messenger. They can:<ul> 18 * 19 * <li>Act as {@link org.xmpp.component.Component Components} to implement 20 * additional features in the XMPP protocol. 21 * <li>Dynamically modify the admin console. 22 * <li>Use the Jive Messenger API to add new functionality to server. 23 * </ul> 24 * 25 * Plugins live in the <tt>plugins</tt> directory of <tt>home</tt>. Plugins 26 * that are packaged as JAR files will be automatically expanded into directories. A 27 * plugin directory should have the following structure: 28 * 29 * <pre>[pluginDir] 30 * |-- plugin.xml 31 * |-- classes/ 32 * |-- lib/</pre> 33 * 34 * The <tt>classes</tt> and <tt>lib</tt> directory are optional. Any files in the 35 * <tt>classes</tt> directory will be added to the classpath of the plugin, as well 36 * as any JAR files in the <tt>lib</tt> directory. The <tt>plugin.xml</tt> file is 37 * required, and specifies the className of the Plugin implementation. The XML file 38 * should resemble the following XML: 39 * 40 * <pre> 41 * <?xml version="1.0" encoding="UTF-8"?> 42 * <plugin> 43 * <class>org.example.YourPlugin</class> 44 * <name>Example Plugin</name> 45 * <description>This is an example plugin.</description> 46 * <author>Foo Inc.</author> 47 * <version>1.0</version> 48 * <minServerVersion>2.1.2</minServerVersion> 49 * </plugin></pre> 50 * 51 * Each plugin will be loaded in its own class loader. 52 * 53 * @author Matt Tucker 54 */ 55 public interface Plugin { 56 57 /** 58 * Initializes the plugin. 59 * 60 * @param manager the plugin manager. 61 * @param pluginDirectory the directory where the plugin is located. 62 */ 63 public void initializePlugin(PluginManager manager, File pluginDirectory); 64 65 /** 66 * Destroys the plugin.<p> 67 * 68 * Implementations of this method must release all resources held 69 * by the plugin such as file handles, database or network connections, 70 * and references to core Jive Messenger classes. In other words, a 71 * garbage collection executed after this method is called must be able 72 * to clean up all plugin classes. 73 */ 74 public void destroyPlugin(); 75 76 }