|
Clearspace API (1.10.16) Core Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jivesoftware.base.plugin.PluginManager
public class PluginManager
Loads and manages plugins. The plugins directory is monitored for any new plugins, and they are dynamically loaded.
Plugin| Field Summary | |
|---|---|
protected ApplicationLifeCycle.Listener |
applicationLifeCycleListener
|
protected java.util.Map<java.util.Locale,java.util.List<java.util.ResourceBundle>> |
bundleCache
|
protected java.util.Map<Plugin<?>,java.lang.String> |
childPluginMap
|
protected java.util.Map<Plugin<?>,com.jivesoftware.base.plugin.PluginClassLoader> |
classloaders
|
protected java.util.List<java.lang.String> |
customURLMapperList
|
protected java.util.concurrent.ExecutorService |
delayedLoadExecutor
|
protected java.util.Set<java.lang.String> |
devPlugins
|
protected java.util.concurrent.ScheduledExecutorService |
executor
|
protected java.util.concurrent.atomic.AtomicBoolean |
initialized
|
protected java.util.Map<Plugin<?>,java.util.List<java.lang.String>> |
parentPluginMap
|
protected java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> |
pluginCSSs
|
protected java.io.File |
pluginDirectory
|
protected java.util.Map<Plugin<?>,java.io.File> |
pluginDirs
|
protected java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> |
pluginJavascripts
|
protected java.util.Set<PluginListener> |
pluginListeners
|
protected java.util.Map<java.lang.Object,PluginMetaDataImpl> |
pluginMeta
|
protected com.jivesoftware.base.plugin.PluginMonitor |
pluginMonitor
|
protected java.util.Map<java.lang.String,JiveProperties<java.lang.String,java.lang.String>> |
pluginProperties
|
protected java.util.Map<java.lang.String,com.jivesoftware.base.plugin.PluginConfigurationProvider> |
pluginProviders
|
protected java.util.Map<java.lang.String,Plugin<?>> |
plugins
|
| Constructor Summary | |
|---|---|
PluginManager(java.io.File pluginDir)
Constructs a new plugin manager. |
|
| Method Summary | |
|---|---|
protected void |
addPluginCSSSourceURLs(java.lang.String pluginName,
java.util.Collection<java.lang.String> urls)
Add a collection of CSS urls for a plugin. |
protected void |
addPluginJavascriptSourceURLs(java.lang.String pluginName,
java.util.Collection<java.lang.String> urls)
Add a collection of javascript urls for a plugin. |
void |
addPluginListener(PluginListener listener)
Registers a plugin applicationLifeCycleListener. |
protected void |
configureCaches(com.jivesoftware.base.plugin.PluginMetaData meta)
Checks to see if the plugin has a cache-config.xml. |
protected void |
configureDWR(com.jivesoftware.base.plugin.PluginMetaData meta)
Checks to see if the plugin has a dwr-plugin.xml. |
protected void |
configureUIComponents(org.dom4j.Document pluginXML,
org.dom4j.Element parentPluginNode,
java.lang.String pluginName)
|
protected void |
configureWebwork(com.jivesoftware.base.plugin.PluginMetaData meta)
|
void |
deletePlugin(Plugin<?> plugin)
Removes a plugin from the system. |
void |
destroy()
Shuts down all running plugins. |
protected com.jivesoftware.base.plugin.PluginClassLoader |
determinePluginClassLoader(java.io.File pluginDir,
org.dom4j.Element parentPluginNode)
|
java.util.Collection<java.lang.ClassLoader> |
getClassLoaders()
Returns a collection of all plugin classloaders. |
protected java.util.Set<java.lang.String> |
getDevPlugins()
Returns a set of all the plugins that have been specified with -DpluginDirs system property |
Plugin<?> |
getPlugin(java.lang.String name)
Returns a plugin by name or null if a plugin with that name does not exist. |
com.jivesoftware.base.plugin.PluginClassLoader |
getPluginClassloader(Plugin<?> plugin)
Returns the classloader of a plugin. |
java.util.Collection<java.lang.String> |
getPluginCSSSrcURLs()
Returns a list of all CSS source urls defined by plugins |
protected java.io.File |
getPluginDirectory()
Returns the directory {jiveHome}/plugins. |
protected java.io.File |
getPluginDirectory(Plugin<?> plugin)
Returns the plugin's directory. |
java.util.Collection<java.lang.String> |
getPluginJavascriptSrcURLs()
Returns a list of all javascript source urls defined by plugins |
protected java.util.Map<java.lang.String,Plugin<?>> |
getPluginMap()
Returns a map of plugin name plugin entries. |
com.jivesoftware.base.plugin.PluginMetaData |
getPluginMetaData(Plugin<?> plugin)
Returns meta data assosiated with the plugin. |
com.jivesoftware.base.plugin.PluginMetaData |
getPluginMetaData(java.lang.String name)
Returns meta data associated with the plugin. |
protected com.jivesoftware.base.plugin.PluginMonitor |
getPluginMonitor()
Returns the PluginMonitor instance. |
protected JiveProperties<java.lang.String,java.lang.String> |
getPluginProperties(java.lang.String pluginName)
Returns a object for storing and receving property setting for a plugin. |
java.util.ResourceBundle |
getPluginResourceBundle(Plugin<?> plugin,
java.util.Locale locale)
Acquires a plugins resource bundle which should be stored in /plugin_i18n in the plugin's classloader. |
java.util.List<java.util.ResourceBundle> |
getPluginResourceBundles(java.util.Locale l)
Returns all of the plugin resource bundles that match the specified locale. |
java.util.Collection<Plugin<?>> |
getPlugins()
Returns a Collection of all installed plugins. |
protected void |
handleDatabase(Plugin<?> plugin,
java.lang.String pluginName)
|
protected int |
handleUpgradeTasks(java.io.File pluginDir,
Plugin<?> p)
|
void |
initialize(JiveContext ctx)
Starts plugins and the plugin monitoring service. |
void |
installPlugin(java.io.InputStream in,
java.lang.String pluginFilename)
Installs or updates an existing plugin. |
protected void |
installPlugin(java.io.InputStream in,
java.lang.String pluginFilename,
boolean notifyCluster)
Installs or updates an existing plugin, with the option to notify the rest of the cluster. |
boolean |
isInitialized()
|
boolean |
isPluginDownloaded(java.lang.String pluginFilename)
Returns true if the specified filename, that belongs to a plugin, exists. |
protected boolean |
isValidVersion(org.dom4j.Document pluginXML,
java.io.File pluginDir,
boolean validVersion)
|
java.lang.Class<?> |
loadClass(Plugin<?> plugin,
java.lang.String className)
Loads a class from the classloader of a plugin. |
void |
loadPlugin(java.io.File pluginDir)
Loads a plug-in module into the container. |
protected void |
registerMacro(BaseMacro macroWrapper)
Registers a plugin macro with the owner's render manager. |
protected void |
registerMacros(com.jivesoftware.base.plugin.PluginMetaData meta)
|
protected void |
registerPlugin(org.dom4j.Element parentPluginNode,
com.jivesoftware.base.plugin.PluginClassLoader pluginLoader,
Plugin<?> plugin,
java.io.File pluginDir)
|
protected void |
registerPluginCSSURLs(com.jivesoftware.base.plugin.PluginMetaData meta)
|
protected void |
registerPluginJavascriptURLs(com.jivesoftware.base.plugin.PluginMetaData meta)
|
protected void |
registerSitemeshElements(com.jivesoftware.base.plugin.PluginMetaData meta)
|
protected void |
registerURLMapper(com.jivesoftware.base.plugin.PluginMetaData meta)
|
protected void |
registerWebServices(com.jivesoftware.base.plugin.PluginMetaData meta)
|
protected void |
registerWidgets(com.jivesoftware.base.plugin.PluginMetaData meta)
|
protected void |
removePluginCSSURLs(java.lang.String pluginName)
Remove CSS source urls specified by the plugin |
protected void |
removePluginJavaScriptURLs(java.lang.String pluginName)
Remove javascript source urls specified by the plugin |
void |
removePluginListener(PluginListener listener)
Unregisters a plugin applicationLifeCycleListener. |
void |
restartPlugin(Plugin<?> plugin)
Restarts the specified plugin. |
void |
unloadPlugin(java.lang.String pluginName)
Unloads a plugin. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.io.File pluginDirectory
protected java.util.Map<java.lang.String,Plugin<?>> plugins
protected java.util.Map<java.lang.Object,PluginMetaDataImpl> pluginMeta
protected java.util.Map<Plugin<?>,com.jivesoftware.base.plugin.PluginClassLoader> classloaders
protected java.util.Map<Plugin<?>,java.io.File> pluginDirs
protected java.util.concurrent.ScheduledExecutorService executor
protected java.util.Map<Plugin<?>,java.util.List<java.lang.String>> parentPluginMap
protected java.util.Map<Plugin<?>,java.lang.String> childPluginMap
protected java.util.Set<java.lang.String> devPlugins
protected com.jivesoftware.base.plugin.PluginMonitor pluginMonitor
protected java.util.Set<PluginListener> pluginListeners
protected java.util.Map<java.lang.String,com.jivesoftware.base.plugin.PluginConfigurationProvider> pluginProviders
protected java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> pluginJavascripts
protected java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> pluginCSSs
protected java.util.Map<java.lang.String,JiveProperties<java.lang.String,java.lang.String>> pluginProperties
protected java.util.Map<java.util.Locale,java.util.List<java.util.ResourceBundle>> bundleCache
protected java.util.concurrent.ExecutorService delayedLoadExecutor
protected ApplicationLifeCycle.Listener applicationLifeCycleListener
protected java.util.List<java.lang.String> customURLMapperList
protected java.util.concurrent.atomic.AtomicBoolean initialized
| Constructor Detail |
|---|
public PluginManager(java.io.File pluginDir)
pluginDir - the plugin directory.| Method Detail |
|---|
public void initialize(JiveContext ctx)
initialize in interface JiveManagerctx - the context to use during initializationpublic void destroy()
destroy in interface JiveManagerpublic boolean isInitialized()
public void installPlugin(java.io.InputStream in,
java.lang.String pluginFilename)
throws com.jivesoftware.base.plugin.PluginException
in - the input stream that contains the new plugin definition.pluginFilename - the filename of the plugin to create or update.
PluginException - Thrown if there are issues installing the plugin.
protected void installPlugin(java.io.InputStream in,
java.lang.String pluginFilename,
boolean notifyCluster)
throws com.jivesoftware.base.plugin.PluginException
in - the input stream that contains the new plugin definition.pluginFilename - the filename of the plugin to create or update.notifyCluster - Whether or not the cluster should be notified.
PluginException - Thrown if there are issues installing the plugin.public boolean isPluginDownloaded(java.lang.String pluginFilename)
pluginFilename - the filename of the plugin to create or update.
public java.util.Collection<Plugin<?>> getPlugins()
public java.util.Collection<java.lang.ClassLoader> getClassLoaders()
public Plugin<?> getPlugin(java.lang.String name)
name - the name of the plugin.
public com.jivesoftware.base.plugin.PluginMetaData getPluginMetaData(java.lang.String name)
name - The name of the plugin.
public com.jivesoftware.base.plugin.PluginMetaData getPluginMetaData(Plugin<?> plugin)
plugin - The plugin to acquire meta data for
public java.util.Collection<java.lang.String> getPluginJavascriptSrcURLs()
public java.util.Collection<java.lang.String> getPluginCSSSrcURLs()
protected void addPluginJavascriptSourceURLs(java.lang.String pluginName,
java.util.Collection<java.lang.String> urls)
pluginName - The name of the pluginurls - The urls added
protected void addPluginCSSSourceURLs(java.lang.String pluginName,
java.util.Collection<java.lang.String> urls)
pluginName - The name of the pluginurls - The urls addedprotected void removePluginJavaScriptURLs(java.lang.String pluginName)
pluginName - javascript source urls specified by the pluginprotected void removePluginCSSURLs(java.lang.String pluginName)
pluginName - CSS source urls specified by the pluginprotected java.io.File getPluginDirectory(Plugin<?> plugin)
plugin - the plugin.
protected JiveProperties<java.lang.String,java.lang.String> getPluginProperties(java.lang.String pluginName)
pluginName - The name of the plugin to get a properties object for.
public java.util.List<java.util.ResourceBundle> getPluginResourceBundles(java.util.Locale l)
l - The locale to acquire plugin resource bundles for.
getPluginResourceBundle(com.jivesoftware.base.plugin.Plugin>, java.util.Locale)
public void loadPlugin(java.io.File pluginDir)
throws com.jivesoftware.base.plugin.PluginException
pluginDir - the plugin directory.
PluginException - Thrown if there are issues installing the plugin.protected void registerPluginJavascriptURLs(com.jivesoftware.base.plugin.PluginMetaData meta)
protected void registerPluginCSSURLs(com.jivesoftware.base.plugin.PluginMetaData meta)
protected void registerWebServices(com.jivesoftware.base.plugin.PluginMetaData meta)
protected void registerURLMapper(com.jivesoftware.base.plugin.PluginMetaData meta)
protected void registerSitemeshElements(com.jivesoftware.base.plugin.PluginMetaData meta)
protected void registerMacros(com.jivesoftware.base.plugin.PluginMetaData meta)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
protected void registerWidgets(com.jivesoftware.base.plugin.PluginMetaData meta)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionprotected void registerMacro(BaseMacro macroWrapper)
macroWrapper - The macro to register
protected void registerPlugin(org.dom4j.Element parentPluginNode,
com.jivesoftware.base.plugin.PluginClassLoader pluginLoader,
Plugin<?> plugin,
java.io.File pluginDir)
protected boolean isValidVersion(org.dom4j.Document pluginXML,
java.io.File pluginDir,
boolean validVersion)
protected void handleDatabase(Plugin<?> plugin,
java.lang.String pluginName)
throws java.lang.Exception
java.lang.Exception
protected void configureUIComponents(org.dom4j.Document pluginXML,
org.dom4j.Element parentPluginNode,
java.lang.String pluginName)
throws java.lang.Exception
java.lang.Exceptionprotected void configureWebwork(com.jivesoftware.base.plugin.PluginMetaData meta)
protected void configureDWR(com.jivesoftware.base.plugin.PluginMetaData meta)
meta - The meta data object for the plugin.protected void configureCaches(com.jivesoftware.base.plugin.PluginMetaData meta)
meta - The meta data object for the plugin.
public java.util.ResourceBundle getPluginResourceBundle(Plugin<?> plugin,
java.util.Locale locale)
plugin - The plugin to acquire a resource bundle for.locale - The locale of the resource bundle.
protected com.jivesoftware.base.plugin.PluginClassLoader determinePluginClassLoader(java.io.File pluginDir,
org.dom4j.Element parentPluginNode)
protected int handleUpgradeTasks(java.io.File pluginDir,
Plugin<?> p)
public void unloadPlugin(java.lang.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 java.lang.Class<?> loadClass(Plugin<?> plugin,
java.lang.String className)
throws java.lang.ClassNotFoundException,
java.lang.IllegalAccessException,
java.lang.InstantiationException
plugin - the plugin.className - the name of the class to load.
java.lang.ClassNotFoundException - if the class was not found.
java.lang.IllegalAccessException - if not allowed to access the class.
java.lang.InstantiationException - if the class could not be created.public com.jivesoftware.base.plugin.PluginClassLoader getPluginClassloader(Plugin<?> plugin)
plugin - the plugin.
public void addPluginListener(PluginListener listener)
listener - The plugin to register.PluginListenerpublic void removePluginListener(PluginListener listener)
listener - the plugin to remove as a applicationLifeCycleListener.public void deletePlugin(Plugin<?> plugin)
plugin - The plugin too delete.public void restartPlugin(Plugin<?> plugin)
plugin - the specified plugin.protected java.util.Set<java.lang.String> getDevPlugins()
protected java.util.Map<java.lang.String,Plugin<?>> getPluginMap()
protected java.io.File getPluginDirectory()
protected com.jivesoftware.base.plugin.PluginMonitor getPluginMonitor()
PluginMonitor instance.
PluginMonitor instance.
|
Clearspace Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||