Interface PluginController


public interface PluginController
Interface to control the state of the plugin system
  • Method Details

    • enablePlugins

      void enablePlugins(String... keys)
      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

      void disablePlugin(String key)
      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

      void disablePluginWithoutPersisting(String key)
      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

      void enablePluginModule(String completeKey)
      Enable a plugin module by key.
      Parameters:
      completeKey - The "complete key" of the plugin module.
    • disablePluginModule

      void disablePluginModule(String completeKey)
      Disable a plugin module by key.
      Parameters:
      completeKey - The "complete key" of the plugin module.
    • installPlugins

      Set<String> installPlugins(PluginArtifact... pluginArtifacts)
      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

      void uninstall(Plugin plugin)
      Uninstall the plugin, disabling it first.
      Parameters:
      plugin - The plugin.
      Throws:
      PluginException - if there was some problem uninstalling the plugin.
    • uninstallPlugins

      default void uninstallPlugins(Collection<Plugin> plugins)
      Uninstall multiple plugin, disabling it first.
      Parameters:
      plugins - The plugins to uninstall.
      Throws:
      PluginException - if there was some problem uninstalling a plugin.
    • revertRestartRequiredChange

      void revertRestartRequiredChange(String pluginKey)
      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

      ModuleDescriptor<?> addDynamicModule(Plugin plugin, Element module)
      Add a new module described by element to the plugin specified.

      Module will be enabled if the following conditions are met:

      Parameters:
      plugin - to add the module to
      module - to add
      Returns:
      added module
      Since:
      4.0.0
      See Also:
    • removeDynamicModule

      void removeDynamicModule(Plugin plugin, ModuleDescriptor<?> module)
      Remove a module that was dynamically added to plugin.
      Parameters:
      plugin - to remove the module from
      module - to remove
      See Also: