|
Jive API (3.0.13) 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
@Transactional(readOnly=true,
propagation=SUPPORTS)
public class PluginManagerImplLoads 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<String,List<UpgradeTaskException>> |
brokenPluginUpgradeExceptions
|
protected Map<Locale,List<ResourceBundle>> |
bundleCache
|
protected Map<String,PluginClassLoader> |
classloaders
|
protected Collection<PluginConfigurator> |
configurators
|
protected List<String> |
customURLMapperList
|
protected Set<String> |
devPlugins
|
protected EventDispatcher |
eventDispatcher
|
protected AtomicBoolean |
initialized
|
protected static PluginManagerImpl |
instance
|
protected JiveLicenseManager |
licenseManager
|
protected 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 PluginPropertyDAO |
pluginPropertyDAO
|
protected Map<String,Plugin<?>> |
plugins
|
protected TaskEngine |
taskEngine
|
protected UpgradeManager |
upgradeManager
|
| Constructor Summary | |
|---|---|
protected |
PluginManagerImpl()
Constructs a new plugin manager. |
| Method Summary | |
|---|---|
void |
addPluginListener(PluginListener listener)
Registers a plugin applicationLifeCycleListener. |
void |
addUpgradeException(String pluginName,
UpgradeTaskException exception)
Register an encountered plugin upgrade exception. |
protected File |
createLocalCache(PluginDbBean bean)
Pulls the plugin jar file from the database outputs it to the pluginDirectory and expands the jar file. |
protected boolean |
createPluginCacheDirectories(List<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 com.jivesoftware.community.lifecycle.spring.JiveContextLoader |
Plugin<?> |
getPlugin(String name)
Returns a plugin by name or null if a plugin with that name does not exist. |
protected List<PluginDbBean> |
getPluginBeans()
Returns beans for all the plugins that need to have their spring config loaded with the parent context. |
PluginClassLoader |
getPluginClassloader(Plugin<?> plugin)
Returns the classloader of a plugin. |
protected 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. |
PluginMetaData |
getPluginMetaData(Plugin<?> plugin)
Returns meta data assosiated with the 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 PluginDAO |
getSpringUnManagedDAO()
|
List<UpgradeTaskException> |
getUpgradeExceptions(String pluginName)
Return a list of plugin upgrade exceptions for the given plugin. |
void |
handle(ApplicationStateChangeEvent ev)
|
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 |
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<ConfiguratorResult> |
loadPlugin(File pluginDir,
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<PluginConfigurator> configurators)
Set the list of plugin configuration objects that will be used to configure the plugins. |
void |
setDispatcher(EventDispatcher eventDispatcher)
|
void |
setLicenseManager(JiveLicenseManager licenseManager)
|
void |
setPluginDAO(PluginDAO pluginDAO)
|
void |
setPluginPropertyDAO(PluginPropertyDAO pluginPropertyDAO)
|
void |
setTaskEngine(TaskEngine taskEngine)
|
void |
setUpgradeManager(UpgradeManager upgradeManager)
|
PluginResultList |
uninstallPlugin(Plugin<?> plugin)
Removes a plugin from the system. |
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<String,List<UpgradeTaskException>> brokenPluginUpgradeExceptions
protected Map<Object,PluginMetaDataImpl> pluginMeta
protected Map<String,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 UpgradeManager upgradeManager
protected Collection<PluginConfigurator> configurators
protected TaskEngine taskEngine
protected JiveLicenseManager licenseManager
protected PluginPropertyDAO pluginPropertyDAO
protected PluginDAO pluginDAO
protected static final PluginManagerImpl instance
protected EventDispatcher eventDispatcher
| Constructor Detail |
|---|
protected PluginManagerImpl()
| Method Detail |
|---|
public static PluginManagerImpl getInstance()
com.jivesoftware.community.lifecycle.spring.JiveContextLoader
public void destroy()
destroy in interface JiveManagerpublic void setConfigurators(Collection<PluginConfigurator> configurators)
configurators - list of PluginConfiguratorspublic boolean isInitialized()
@Transactional(readOnly=false,
propagation=REQUIRED,
rollbackFor=)
public PluginResultList installPlugin(File file)
throws PluginException
file - 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()
public Collection<ClassLoader> getClassLoaders()
public Plugin<?> getPlugin(String name)
name - the name of the plugin.
public PluginMetaData getPluginMetaData(String name)
name - The name of the plugin.
public PluginMetaData getPluginMetaData(Plugin<?> plugin)
plugin - The plugin to acquire meta data for
protected File getPluginDirectory(Plugin<?> plugin)
plugin - the plugin.
protected boolean createPluginCacheDirectories(List<PluginDbBean> pluginBeans)
protected File createLocalCache(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)
l - The locale to acquire plugin resource bundles for.
getPluginResourceBundle(com.jivesoftware.base.plugin.Plugin>, java.util.Locale)
public List<ConfiguratorResult> loadPlugin(File pluginDir,
PluginDbBean pluginDbBean)
throws PluginException
pluginDir - the plugin directory.
PluginException - Thrown if there are issues installing the plugin.public 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)
throws PluginException
plugin - The plugin object.pluginDir - The directory where the plugin lives.
PluginException
protected void isValidVersion(String pluginName,
org.dom4j.Document pluginXML,
File pluginDir)
throws 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)
plugin - 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 PluginException
PluginException
public void processSpringConfigs(List<String> springPaths)
throws IOException
springPaths - This path will be populated with all spring plugin paths
IOException
protected ClassLoader createPluginChainingClassloader()
throws PluginException
PluginExceptionprotected List<PluginDbBean> getPluginBeans()
protected PluginDAO getSpringUnManagedDAO()
protected 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 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 boolean isPluginBroken(String plugin)
plugin - Name of plugin to check.
public Map<String,String> getBrokenPlugins()
public List<UpgradeTaskException> getUpgradeExceptions(String pluginName)
pluginName -
public void addUpgradeException(String pluginName,
UpgradeTaskException exception)
pluginName - exception -
@Transactional(readOnly=false,
propagation=REQUIRED)
public void deleteBrokenPlugin(String pluginName)
pluginName - Name of the plugin to delete. Can be a filename or "short" name of plugin.
@Transactional(readOnly=false,
propagation=REQUIRED)
public PluginResultList uninstallPlugin(Plugin<?> plugin)
plugin - The plugin too delete.protected Set<String> getDevPlugins()
protected Map<String,Plugin<?>> getPluginMap()
protected File getPluginDirectory()
public void setUpgradeManager(UpgradeManager upgradeManager)
public void setTaskEngine(TaskEngine taskEngine)
public void setLicenseManager(JiveLicenseManager licenseManager)
public void setPluginPropertyDAO(PluginPropertyDAO pluginPropertyDAO)
public void setPluginDAO(PluginDAO pluginDAO)
public void setDispatcher(EventDispatcher eventDispatcher)
public void handle(ApplicationStateChangeEvent ev)
|
Jive Product Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||