|
Clearspace API (2.5.29) Core Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jivesoftware.base.plugin.PluginManagerImpl
public class PluginManagerImpl
Loads and manages plugins. The plugins directory is monitored for any new plugins, and they are dynamically loaded.
Plugin| Field Summary | |
|---|---|
protected Map<String,String> |
brokenPlugins
|
protected Map<Locale,List<ResourceBundle>> |
bundleCache
|
protected Map<String,com.jivesoftware.base.plugin.PluginClassLoader> |
classloaders
|
protected Collection<com.jivesoftware.base.plugin.PluginConfigurator> |
configurators
|
protected List<String> |
customURLMapperList
|
protected Set<String> |
devPlugins
|
protected com.jivesoftware.base.event.v2.EventDispatcher |
eventDispatcher
|
protected AtomicBoolean |
initialized
|
protected static PluginManagerImpl |
instance
|
protected com.jivesoftware.community.license.ClearspaceLicenseManager |
licenseManager
|
protected com.jivesoftware.base.plugin.dao.PluginDAO |
pluginDAO
|
protected File |
pluginDirectory
|
protected Map<Plugin<?>,File> |
pluginDirs
|
protected Set<PluginListener> |
pluginListeners
|
protected Map<Object,PluginMetaDataImpl> |
pluginMeta
|
protected Map<String,JiveProperties<String,String>> |
pluginProperties
|
protected com.jivesoftware.base.plugin.dao.PluginPropertyDAO |
pluginPropertyDAO
|
protected Map<String,Plugin<?>> |
plugins
|
protected com.jivesoftware.util.task.TaskEngine |
taskEngine
|
protected com.jivesoftware.community.upgrade.UpgradeManager |
upgradeManager
|
| Constructor Summary | |
|---|---|
protected |
PluginManagerImpl()
Constructs a new plugin manager. |
| Method Summary | |
|---|---|
void |
addPluginListener(PluginListener listener)
Registers a plugin applicationLifeCycleListener. |
protected File |
createLocalCache(com.jivesoftware.base.plugin.dao.PluginDbBean bean)
Pulls the plugin jar file from the database outputs it to the pluginDirectory and expands the jar file. |
protected boolean |
createPluginCacheDirectories(List<com.jivesoftware.base.plugin.dao.PluginDbBean> pluginBeans)
Checks the existing plugins to see if there are any plugins that need to be installed. |
protected ClassLoader |
createPluginChainingClassloader()
Creates a classloader that will also look for classes under the plugin directories. |
void |
deleteBrokenPlugin(String pluginName)
Removes a plugin that was flagged as broken. |
void |
destroy()
Shuts down all running plugins. |
Map<String,String> |
getBrokenPlugins()
Returns a list of broken plugins, mapped to what the cause of the breakage was. |
Collection<ClassLoader> |
getClassLoaders()
Returns a collection of all plugin classloaders. |
protected Set<String> |
getDevPlugins()
Returns a set of all the plugins that have been specified with -DpluginDirs system property |
static PluginManagerImpl |
getInstance()
This method had to be created in order to perform operations on plugins that must happen before spring initializes inside of the JiveApplicationContextLoader |
Plugin<?> |
getPlugin(String name)
Returns a plugin by name or null if a plugin with that name does not exist. |
protected List<com.jivesoftware.base.plugin.dao.PluginDbBean> |
getPluginBeans()
Returns beans for all the plugins that need to have their spring config loaded with the parent context. |
com.jivesoftware.base.plugin.PluginClassLoader |
getPluginClassloader(Plugin<?> plugin)
Returns the classloader of a plugin. |
protected com.jivesoftware.base.plugin.PluginClassLoader |
getPluginClassloader(String pluginName,
File pluginDir)
|
protected File |
getPluginDirectory()
Returns the directory {jiveHome}/plugins. |
protected File |
getPluginDirectory(Plugin<?> plugin)
Returns the plugin's directory. |
protected Map<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(String name)
Returns meta data associated with the plugin. |
protected JiveProperties<String,String> |
getPluginProperties(String pluginName)
Returns a object for storing and receving property setting for a plugin. |
ResourceBundle |
getPluginResourceBundle(Plugin<?> plugin,
Locale locale)
Acquires a plugins resource bundle which should be stored in /plugin_i18n in the plugin's classloader. |
List<ResourceBundle> |
getPluginResourceBundles(Locale l)
Returns all of the plugin resource bundles that match the specified locale. |
Collection<Plugin<?>> |
getPlugins()
Returns a Collection of all installed plugins. |
protected com.jivesoftware.base.plugin.dao.PluginDAO |
getSpringUnManagedDAO()
|
protected int |
handleUpgradeTasks(File pluginDir,
Plugin<?> p)
If an upgrade.xml was specified in the plugin all upgrade tasks will be performed if the jiveVersion value for the plugin is less than the tasks specified in the upgrade.xml |
void |
init()
Starts plugins and the plugin monitoring service. |
com.jivesoftware.base.plugin.PluginResultList |
installPlugin(File file)
Installs or updates an existing plugin. |
boolean |
isInitialized()
Returns true if the plugin framework has been initialized an is running. |
boolean |
isPluginBroken(String plugin)
Returns true if the specified plugin is flagged as broken during load time. |
boolean |
isPluginDownloaded(String pluginFilename)
Returns true if the specified filename, that belongs to a plugin, exists. |
protected void |
isValidVersion(String pluginName,
org.dom4j.Document pluginXML,
File pluginDir)
Checks to see if the clearspace version is ok to use with this plugin. |
Class<?> |
loadClass(Plugin<?> plugin,
String className)
Loads a class from the classloader of a plugin. |
protected void |
loadDevPlugins()
|
List<com.jivesoftware.base.plugin.ConfiguratorResult> |
loadPlugin(File pluginDir,
com.jivesoftware.base.plugin.dao.PluginDbBean pluginDbBean)
Loads a plug-in module into the container. |
void |
preInit()
|
void |
processSpringConfigs(List<String> springPaths)
Process plugins to configure plugin caches that need to be configured first, and populate plugin's spring paths. |
protected void |
registerPlugin(Plugin<?> plugin,
File pluginDir)
Registers the plugin as an installed plugin. |
void |
removePluginListener(PluginListener listener)
Unregisters a plugin applicationLifeCycleListener. |
void |
setConfigurators(Collection<com.jivesoftware.base.plugin.PluginConfigurator> configurators)
Set the list of plugin configuration objects that will be used to configure the plugins. |
void |
setDispatcher(com.jivesoftware.base.event.v2.EventDispatcher eventDispatcher)
|
void |
setLicenseManager(com.jivesoftware.community.license.ClearspaceLicenseManager licenseManager)
|
void |
setPluginDAO(com.jivesoftware.base.plugin.dao.PluginDAO pluginDAO)
|
void |
setPluginPropertyDAO(com.jivesoftware.base.plugin.dao.PluginPropertyDAO pluginPropertyDAO)
|
void |
setTaskEngine(com.jivesoftware.util.task.TaskEngine taskEngine)
|
void |
setUpgradeManager(com.jivesoftware.community.upgrade.UpgradeManager upgradeManager)
|
com.jivesoftware.base.plugin.PluginResultList |
uninstallPlugin(Plugin<?> plugin)
Removes a plugin from the system. |
com.jivesoftware.base.plugin.PluginResultList |
unloadPlugin(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 File pluginDirectory
protected Map<String,Plugin<?>> plugins
protected Map<String,String> brokenPlugins
protected Map<Object,PluginMetaDataImpl> pluginMeta
protected Map<String,com.jivesoftware.base.plugin.PluginClassLoader> classloaders
protected Map<Plugin<?>,File> pluginDirs
protected Set<String> devPlugins
protected Set<PluginListener> pluginListeners
protected Map<String,JiveProperties<String,String>> pluginProperties
protected Map<Locale,List<ResourceBundle>> bundleCache
protected List<String> customURLMapperList
protected AtomicBoolean initialized
protected com.jivesoftware.community.upgrade.UpgradeManager upgradeManager
protected Collection<com.jivesoftware.base.plugin.PluginConfigurator> configurators
protected com.jivesoftware.util.task.TaskEngine taskEngine
protected com.jivesoftware.community.license.ClearspaceLicenseManager licenseManager
protected com.jivesoftware.base.plugin.dao.PluginPropertyDAO pluginPropertyDAO
protected com.jivesoftware.base.plugin.dao.PluginDAO pluginDAO
protected static final PluginManagerImpl instance
protected com.jivesoftware.base.event.v2.EventDispatcher eventDispatcher
| Constructor Detail |
|---|
protected PluginManagerImpl()
| Method Detail |
|---|
public static PluginManagerImpl getInstance()
JiveApplicationContextLoader
public void init()
public void destroy()
destroy in interface JiveManagerpublic void setConfigurators(Collection<com.jivesoftware.base.plugin.PluginConfigurator> configurators)
configurators - list of PluginConfiguratorspublic boolean isInitialized()
isInitialized in interface com.jivesoftware.base.plugin.PluginManager
public com.jivesoftware.base.plugin.PluginResultList installPlugin(File file)
throws com.jivesoftware.base.plugin.PluginException
installPlugin in interface com.jivesoftware.base.plugin.PluginManagerfile - the input file that contains the new plugin definition.
PluginException - Thrown if there are issues installing the plugin.public boolean isPluginDownloaded(String pluginFilename)
pluginFilename - the filename of the plugin to create or update.
public Collection<Plugin<?>> getPlugins()
getPlugins in interface com.jivesoftware.base.plugin.PluginManagerpublic Collection<ClassLoader> getClassLoaders()
getClassLoaders in interface com.jivesoftware.base.plugin.PluginManagerpublic Plugin<?> getPlugin(String name)
getPlugin in interface com.jivesoftware.base.plugin.PluginManagername - the name of the plugin.
public com.jivesoftware.base.plugin.PluginMetaData getPluginMetaData(String name)
getPluginMetaData in interface com.jivesoftware.base.plugin.PluginManagername - The name of the plugin.
public com.jivesoftware.base.plugin.PluginMetaData getPluginMetaData(Plugin<?> plugin)
getPluginMetaData in interface com.jivesoftware.base.plugin.PluginManagerplugin - The plugin to acquire meta data for
protected File getPluginDirectory(Plugin<?> plugin)
plugin - the plugin.
protected boolean createPluginCacheDirectories(List<com.jivesoftware.base.plugin.dao.PluginDbBean> pluginBeans)
protected File createLocalCache(com.jivesoftware.base.plugin.dao.PluginDbBean bean)
throws IOException
bean - The db bean for the plugin.
IOException - Thrown if there are problems creating the plugin's cache directoryprotected JiveProperties<String,String> getPluginProperties(String pluginName)
pluginName - The name of the plugin to get a properties object for.
public List<ResourceBundle> getPluginResourceBundles(Locale l)
getPluginResourceBundles in interface com.jivesoftware.base.plugin.PluginManagerl - The locale to acquire plugin resource bundles for.
getPluginResourceBundle(com.jivesoftware.base.plugin.Plugin>, java.util.Locale)
public List<com.jivesoftware.base.plugin.ConfiguratorResult> loadPlugin(File pluginDir,
com.jivesoftware.base.plugin.dao.PluginDbBean pluginDbBean)
throws com.jivesoftware.base.plugin.PluginException
pluginDir - the plugin directory.
PluginException - Thrown if there are issues installing the plugin.public com.jivesoftware.base.plugin.PluginResultList unloadPlugin(String pluginName)
This method is called automatically when a plugin's JAR file is deleted.
pluginName - the name of the plugin to unload.
protected void registerPlugin(Plugin<?> plugin,
File pluginDir)
plugin - The plugin object.pluginDir - The directory where the plugin lives.
protected void isValidVersion(String pluginName,
org.dom4j.Document pluginXML,
File pluginDir)
throws com.jivesoftware.base.plugin.PluginException
pluginName - The name of the plugin.pluginXML - The plugin's configuration.pluginDir - The directory where the plugin lives.
PluginException - Thrown if the version of the plugin is illegal.
public ResourceBundle getPluginResourceBundle(Plugin<?> plugin,
Locale locale)
getPluginResourceBundle in interface com.jivesoftware.base.plugin.PluginManagerplugin - The plugin to acquire a resource bundle for.locale - The locale of the resource bundle.
protected int handleUpgradeTasks(File pluginDir,
Plugin<?> p)
pluginDir - The directory where the plugin exists.p - The plugin object.
public void preInit()
throws com.jivesoftware.base.plugin.PluginException
com.jivesoftware.base.plugin.PluginException
public void processSpringConfigs(List<String> springPaths)
throws IOException
springPaths - This path will be populated with all spring plugin paths
IOExceptionprotected ClassLoader createPluginChainingClassloader()
protected List<com.jivesoftware.base.plugin.dao.PluginDbBean> getPluginBeans()
protected com.jivesoftware.base.plugin.dao.PluginDAO getSpringUnManagedDAO()
protected com.jivesoftware.base.plugin.PluginClassLoader getPluginClassloader(String pluginName,
File pluginDir)
protected void loadDevPlugins()
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 com.jivesoftware.base.plugin.PluginClassLoader getPluginClassloader(Plugin<?> plugin)
getPluginClassloader in interface com.jivesoftware.base.plugin.PluginManagerplugin - the plugin.
public void addPluginListener(PluginListener listener)
addPluginListener in interface com.jivesoftware.base.plugin.PluginManagerlistener - The plugin to register.PluginListenerpublic void removePluginListener(PluginListener listener)
removePluginListener in interface com.jivesoftware.base.plugin.PluginManagerlistener - the plugin to remove as a applicationLifeCycleListener.public boolean isPluginBroken(String plugin)
isPluginBroken in interface com.jivesoftware.base.plugin.PluginManagerplugin - Name of plugin to check.
public Map<String,String> getBrokenPlugins()
getBrokenPlugins in interface com.jivesoftware.base.plugin.PluginManagerpublic void deleteBrokenPlugin(String pluginName)
deleteBrokenPlugin in interface com.jivesoftware.base.plugin.PluginManagerpluginName - Name of the plugin to delete. Can be a filename or "short" name of plugin.public com.jivesoftware.base.plugin.PluginResultList uninstallPlugin(Plugin<?> plugin)
uninstallPlugin in interface com.jivesoftware.base.plugin.PluginManagerplugin - The plugin too delete.protected Set<String> getDevPlugins()
protected Map<String,Plugin<?>> getPluginMap()
protected File getPluginDirectory()
public void setUpgradeManager(com.jivesoftware.community.upgrade.UpgradeManager upgradeManager)
public void setTaskEngine(com.jivesoftware.util.task.TaskEngine taskEngine)
public void setLicenseManager(com.jivesoftware.community.license.ClearspaceLicenseManager licenseManager)
public void setPluginPropertyDAO(com.jivesoftware.base.plugin.dao.PluginPropertyDAO pluginPropertyDAO)
public void setPluginDAO(com.jivesoftware.base.plugin.dao.PluginDAO pluginDAO)
public void setDispatcher(com.jivesoftware.base.event.v2.EventDispatcher eventDispatcher)
setDispatcher in interface com.jivesoftware.base.event.v2.EventSource
|
Clearspace Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||