Interface PluginManager
- All Known Implementing Classes:
OsgiPluginManager
public interface PluginManager
Interface used to manage plugins and their artifacts.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deletePluginArtifactFromHome
(Plugin plugin) Deletes plugin artifact if present in the home directory.disablePlugin
(Plugin plugin) Disables the plugin and stores this state persistently - plugin won't be enabled after instance restart.disablePlugin
(Plugin plugin, boolean storeState) Disables the plugin and if required - stores this state persistently.enablePlugin
(Plugin plugin) Enables the previously installed plugin as well as its dependencies storing this state persistently.Get the installed plugins with passed key.initializePlugin
(Plugin plugin) Checks the recently saved state and either disables or enables the plugin if installed.installPlugin
(PluginArtifact artifact, boolean storeState) Installs plugin in the system and if required stores the state if the installation went correctly.Returns a list consisting of all installed plugins.void
purgePlugin
(Plugin plugin) Deletes all plugin data (db tables, resources, etc.) and disables the plugin.restartPlugin
(Plugin plugin) Disables and enables the plugin.savePluginArtifactToHome
(PluginArtifact artifact) Saves an artifact in 'home'/plugins directory and returns an object representing the saved artifact.void
Removes the plugin from the system and removes the artifact from home if there was any.void
validatePluginArtifact
(PluginArtifact pluginArtifact) Validates correctness of the passed artifact.
-
Method Details
-
savePluginArtifactToHome
PluginArtifact savePluginArtifactToHome(PluginArtifact artifact) throws PluginException, IOException Saves an artifact in 'home'/plugins directory and returns an object representing the saved artifact.- Parameters:
artifact
- artifact to be saved in home directory.- Returns:
- artifact pointing at the resource in home directory.
- Throws:
PluginException
- if the artifact is not a valid plugin.IOException
- if something goes wrong when saving the artifact in the filesystem.
-
deletePluginArtifactFromHome
Deletes plugin artifact if present in the home directory.- Parameters:
plugin
- plugin which artifact should be deleted.
-
validatePluginArtifact
Validates correctness of the passed artifact.- Parameters:
pluginArtifact
- artifact to be validated.- Throws:
PluginException
- if passed artifact is not a valid plugin.IOException
- if there are problems accessing the artifact's resource.
-
installPlugin
Plugin installPlugin(PluginArtifact artifact, boolean storeState) throws IOException, PluginException Installs plugin in the system and if required stores the state if the installation went correctly. Doesn't save the plugin artifact in home directory.- Parameters:
artifact
- artifact to install the plugin from.storeState
- should the state be stored after installation.- Returns:
Plugin
referencing installed plugin.- Throws:
IOException
- if there are problems accessing the artifact's resource.PluginException
- if the artifact is invalid or the installation fails.
-
initializePlugin
Checks the recently saved state and either disables or enables the plugin if installed. Useful e.g. on instance startup.- Parameters:
plugin
- plugin to initialize.- Returns:
- plugin that was enabled or disabled.
- Throws:
PluginException
- if enabling or disabling the plugin fails.
-
uninstall
Removes the plugin from the system and removes the artifact from home if there was any.- Parameters:
plugin
- plugin to be uninstalled.- Throws:
PluginException
- if the plugin is in use or uninstallation wasn't successful.
-
enablePlugin
Enables the previously installed plugin as well as its dependencies storing this state persistently.- Parameters:
plugin
- plugin to be enabled.- Returns:
- the enabled plugin.
- Throws:
PluginException
- if plugin is not installed or there are problems enabling the plugin or its dependencies.
-
restartPlugin
Disables and enables the plugin.- Parameters:
plugin
- plugin to be restarted.- Returns:
- restarted plugin.
- Throws:
PluginException
- if there are problems during restart.
-
disablePlugin
Disables the plugin and stores this state persistently - plugin won't be enabled after instance restart.- Parameters:
plugin
- plugin to be disabled.- Returns:
- disabled plugin.
- Throws:
PluginException
- if the plugin is not installed or there are problems disabling the plugin.
-
disablePlugin
Disables the plugin and if required - stores this state persistently.- Parameters:
plugin
- plugin to be disabled.storeState
- should the store be saved after disabling the plugin.- Returns:
- disabled plugin.
- Throws:
PluginException
- if the plugin is not installed or there are problems disabling the plugin.
-
listPlugins
Collection<Plugin> listPlugins()Returns a list consisting of all installed plugins.- Returns:
- a list of installed plugins.
-
getPlugin
Get the installed plugins with passed key.- Parameters:
key
- key of the plugin to get.- Returns:
- installed plugin with given key.
-
purgePlugin
Deletes all plugin data (db tables, resources, etc.) and disables the plugin.- Parameters:
plugin
- plugin to be purged.- Throws:
PluginException
- if the plugin is not installed or there were problems purging the plugin.
-