Interface PluginController
-
Method Summary
Modifier and TypeMethodDescriptionaddDynamicModule(Plugin plugin, Element module) Add a new module described byelementto the plugin specified.voiddisablePlugin(String key) Disables the plugin with the given key.voiddisablePluginModule(String completeKey) Disable a plugin module by key.voidDisables the plugin with the given key without persisting the disabled state.voidenablePluginModule(String completeKey) Enable a plugin module by key.voidenablePlugins(String... keys) Enable a set of plugins by key.installPlugins(PluginArtifact... pluginArtifacts) Installs multiple plugins and returns the list of plugin keys.voidremoveDynamicModule(Plugin plugin, ModuleDescriptor<?> module) Remove a module that was dynamically added to plugin.voidrevertRestartRequiredChange(String pluginKey) Restores the state of any plugin requiring a restart that had been removed, upgraded, or installed.intSearch all loaders and add any new plugins you find.voidUninstall the plugin, disabling it first.default voiduninstallPlugins(Collection<Plugin> plugins) Uninstall multiple plugin, disabling it first.
-
Method Details
-
enablePlugins
Enable a set of plugins by key. This will implicitly and recursively enable all dependent plugins- Parameters:
keys- The plugin keys. Must not be null.- Since:
- 2.5.0
-
disablePlugin
Disables the plugin with the given key.Calling this method will persist the disabled state so that the plugin will also be disabled on next startup. This would normally be used when a user manually disables a plugin.
If you extend DefaultPluginManager and override this method, you will also need to override
disablePluginWithoutPersisting(String).Mandatory dependent plugins will also be disabled. Optionally dependent plugins will be disabled then enabled. Dynamically dependent plugins will not be disabled.
- Parameters:
key- The plugin key.- See Also:
-
disablePluginWithoutPersisting
Disables the plugin with the given key without persisting the disabled state.Calling this method will NOT persist the disabled state so that the framework will try to enable the plugin on next startup. This is used when a plugin has errors on startup.
If you extend DefaultPluginManager and override
disablePlugin(String), you will also need to override this method.Mandatory dependent plugins will also be disabled. Optionally dependent plugins will be disabled then enabled. Dynamically dependent plugins will not be disabled.
- Parameters:
key- The plugin key.- Since:
- 2.3.0
- See Also:
-
enablePluginModule
Enable a plugin module by key.- Parameters:
completeKey- The "complete key" of the plugin module.
-
disablePluginModule
Disable a plugin module by key.- Parameters:
completeKey- The "complete key" of the plugin module.
-
installPlugins
Installs multiple plugins and returns the list of plugin keys. All plugin artifacts must be for valid plugins or none will be installed.- Parameters:
pluginArtifacts- The list of plugin artifacts to install- Returns:
- A list of plugin keys
- Throws:
PluginParseException- if any plugin is not a valid plugin- Since:
- 2.3.0
-
uninstall
Uninstall the plugin, disabling it first.- Parameters:
plugin- The plugin.- Throws:
PluginException- if there was some problem uninstalling the plugin.
-
uninstallPlugins
Uninstall multiple plugin, disabling it first.- Parameters:
plugins- The plugins to uninstall.- Throws:
PluginException- if there was some problem uninstalling a plugin.
-
revertRestartRequiredChange
Restores the state of any plugin requiring a restart that had been removed, upgraded, or installed. If marked as removed, the mark will be deleted. If marked as upgrade, an attempt to restore the original plugin artifact will be made. If marked as install, the artifact will be deleted.- Parameters:
pluginKey- The plugin key- Throws:
PluginException- if there was some problem reverting the plugin state.IllegalArgumentException- if the plugin key is null or cannot be resolved to a plugin- Since:
- 2.5.0
-
scanForNewPlugins
int scanForNewPlugins()Search all loaders and add any new plugins you find.- Returns:
- The number of new plugins found.
-
addDynamicModule
Add a new module described byelementto the plugin specified.Module will be enabled if the following conditions are met:
ModuleDescriptor.isEnabledByDefault()returnstrue- This module has not been marked as disabled elsewhere, e.g. by user
- Parameters:
plugin- to add the module tomodule- to add- Returns:
- added module
- Since:
- 4.0.0
- See Also:
-
removeDynamicModule
Remove a module that was dynamically added to plugin.- Parameters:
plugin- to remove the module frommodule- to remove- See Also:
-