Commit 5df7e4ab authored by Matt Tucker's avatar Matt Tucker Committed by matt

Javadoc updates.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@411 b35dd754-fafc-0310-a699-88a17e54d16e
parent f15cfee6
......@@ -14,7 +14,36 @@ package org.jivesoftware.messenger.container;
import java.io.File;
/**
* Plugin interface.
* 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.
*
* @author Matt Tucker
*/
......
......@@ -24,8 +24,10 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Manages plugins.
* Loads and manages plugins. The <tt>plugins</tt> directory is monitored for any
* new plugins, and they are dynamically loaded.
*
* @see Plugin
* @author Matt Tucker
*/
public class PluginManager {
......@@ -35,6 +37,11 @@ public class PluginManager {
private boolean setupMode = !(Boolean.valueOf(JiveGlobals.getXMLProperty("setup")).booleanValue());
private ScheduledExecutorService executor = null;
/**
* Constructs a new plugin manager.
*
* @param pluginDir the plugin directory.
*/
public PluginManager(File pluginDir) {
this.pluginDirectory = pluginDir;
plugins = new HashMap<String,Plugin>();
......@@ -44,7 +51,7 @@ public class PluginManager {
* Starts plugins and the plugin monitoring service.
*/
public void start() {
executor = new ScheduledThreadPoolExecutor(2);
executor = new ScheduledThreadPoolExecutor(1);
executor.scheduleWithFixedDelay(new PluginMonitor(), 0, 5, TimeUnit.SECONDS);
}
......@@ -60,6 +67,16 @@ public class PluginManager {
for (Plugin plugin : plugins.values()) {
plugin.destroy();
}
plugins.clear();
}
/**
* Returns a Collection of all installed plugins.
*
* @return a Collection of all installed plugins.
*/
public Collection<Plugin> getPlugins() {
return Collections.unmodifiableCollection(plugins.values());
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment