|
Openfire 3.5.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.openfire.container.PluginManager
public class PluginManager
Loads and manages plugins. The plugins directory is monitored for any new plugins, and they are dynamically loaded.
An instance of this class can be obtained using: XMPPServer.getInstance().getPluginManager()
Plugin
,
XMPPServer.getPluginManager()
Nested Class Summary | |
---|---|
static class |
PluginManager.License
An enumberation for plugin license agreement types. |
Constructor Summary | |
---|---|
PluginManager(File pluginDir)
Constructs a new plugin manager. |
Method Summary | |
---|---|
void |
addPluginListener(PluginListener listener)
|
void |
addPluginManagerListener(PluginManagerListener listener)
|
String |
getAuthor(Plugin plugin)
Returns the author of a plugin. |
String |
getDatabaseKey(Plugin plugin)
Returns the database schema key of a plugin, if it exists. |
int |
getDatabaseVersion(Plugin plugin)
Returns the database schema version of a plugin, if it exists. |
String |
getDescription(Plugin plugin)
Returns the description of a plugin. |
PluginDevEnvironment |
getDevEnvironment(Plugin plugin)
Returns a plugin's dev environment if development mode is enabled for the plugin. |
PluginManager.License |
getLicense(Plugin plugin)
Returns the license agreement type that the plugin is governed by. |
String |
getMinServerVersion(Plugin plugin)
Returns the minimum server version this plugin can run within. |
String |
getName(Plugin plugin)
Returns the name of a plugin. |
Plugin |
getPlugin(String name)
Returns a plugin by name or null if a plugin with that name does not exist. |
PluginClassLoader |
getPluginClassloader(Plugin plugin)
Returns the classloader of a plugin. |
File |
getPluginDirectory(Plugin plugin)
Returns the plugin's directory. |
File |
getPluginFile(String name)
Returns the JAR or WAR file that created the plugin. |
Collection<Plugin> |
getPlugins()
Returns a Collection of all installed plugins. |
String |
getVersion(Plugin plugin)
Returns the version of a plugin. |
boolean |
installPlugin(InputStream in,
String pluginFilename)
Installs or updates an existing plugin. |
boolean |
isExecuted()
Returns true if at least one attempt to load plugins has been done. |
boolean |
isPluginDownloaded(String pluginFilename)
Returns true if the specified filename, that belongs to a plugin, exists. |
Class |
loadClass(Plugin plugin,
String className)
Loads a class from the classloader of a plugin. |
void |
removePluginListener(PluginListener listener)
|
void |
removePluginManagerListener(PluginManagerListener listener)
|
void |
shutdown()
Shuts down all running plugins. |
void |
start()
Starts plugins and the plugin monitoring service. |
void |
unloadPlugin(String pluginName)
Unloads a plugin. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PluginManager(File pluginDir)
pluginDir
- the plugin directory.Method Detail |
---|
public void start()
public void shutdown()
public boolean installPlugin(InputStream in, String pluginFilename)
in
- the input stream that contains the new plugin definition.pluginFilename
- the filename of the plugin to create or update.
public boolean isPluginDownloaded(String pluginFilename)
pluginFilename
- the filename of the plugin to create or update.
public Collection<Plugin> getPlugins()
public Plugin getPlugin(String name)
name
- the name of the plugin.
public File getPluginDirectory(Plugin plugin)
plugin
- the plugin.
public File getPluginFile(String name)
name
- the name of the plugin.
public boolean isExecuted()
TODO Current version does not consider child plugins that may be loaded in a second attempt. It either TODO consider plugins that were found but failed to be loaded due to some error.
public void unloadPlugin(String pluginName)
Plugin.destroyPlugin()
method will be called and then
any resources will be released. The name should be the name of the plugin directory
and not the name as given by the plugin meta-data. This method only removes
the plugin but does not delete the plugin JAR file. Therefore, if the plugin JAR
still exists after this method is called, the plugin will be started again the next
time the plugin monitor process runs. This is useful for "restarting" plugins.This method is called automatically when a plugin's JAR file is deleted.
pluginName
- the name of the plugin to unload.public Class loadClass(Plugin plugin, String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException
plugin
- the plugin.className
- the name of the class to load.
ClassNotFoundException
- if the class was not found.
IllegalAccessException
- if not allowed to access the class.
InstantiationException
- if the class could not be created.public PluginDevEnvironment getDevEnvironment(Plugin plugin)
plugin
- the plugin.
public String getName(Plugin plugin)
plugin
- the plugin.
public String getDescription(Plugin plugin)
plugin
- the plugin.
public String getAuthor(Plugin plugin)
plugin
- the plugin.
public String getVersion(Plugin plugin)
plugin
- the plugin.
public String getMinServerVersion(Plugin plugin)
plugin
- the plugin.
public String getDatabaseKey(Plugin plugin)
plugin
- the plugin.
public int getDatabaseVersion(Plugin plugin)
plugin
- the plugin.
public PluginManager.License getLicense(Plugin plugin)
PluginManager.License.other
is returned.
plugin
- the plugin.
public PluginClassLoader getPluginClassloader(Plugin plugin)
plugin
- the plugin.
public void addPluginListener(PluginListener listener)
public void removePluginListener(PluginListener listener)
public void addPluginManagerListener(PluginManagerListener listener)
public void removePluginManagerListener(PluginManagerListener listener)
|
Openfire 3.5.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |