Class PluginManager


  • public class PluginManager
    extends Object
    • Method Detail

      • addPlugin

        public Optional<Plugin> addPlugin​(String nameOrLocation)
        Adds the Plugin with the specified name or location to the installed plugins. Plugins that have been detected as installable may be added by name. Remote plugins, that are not detected can be added by the location (e.g. url or maven coordinates).
        Parameters:
        nameOrLocation - The name or location of the plugin.
        Returns:
        the pugin that was added wrapped in Optional, or empty if no plugin was added.
      • addPlugin

        public Optional<Plugin> addPlugin​(String nameOrLocation,
                                          boolean userCatalog,
                                          Optional<String> description)
        Adds the Plugin with the specified name or location to the installed plugins. Plugins that have been detected as installable may be added by name. Remote plugins, that are not detected can be added by the location (e.g. url or maven coordinates).
        Parameters:
        nameOrLocation - The name or location of the plugin.
        userCatalog - Flag to only use the user catalog.
        description - An optional description to add to the plugin.
        Returns:
        The pugin that was added wrapped in Optional, or empty if no plugin was added.
      • addPlugin

        public Optional<Plugin> addPlugin​(Plugin plugin)
        Adds the Plugin with the specified name or location to the installed plugins. Plugins that have been detected as installable may be added by name. Remote plugins, that are not detected can be added by the location (e.g. url or maven coordinates).
        Parameters:
        plugin - The plugin.
        Returns:
        The pugin that was added wrapped in Optional, or empty if no plugin was added.
      • addPlugin

        public Optional<Plugin> addPlugin​(Plugin plugin,
                                          boolean userCatalog)
        Adds the Plugin with the specified name or location to the installed plugins. Plugins that have been detected as installable may be added by name. Remote plugins, that are not detected can be added by the location (e.g. url or maven coordinates).
        Parameters:
        plugin - The plugin.
        userCatalog - Flag to only use the user catalog.
        Returns:
        The pugin that was added wrapped in Optional, or empty if no plugin was added.
      • removePlugin

        public Optional<Plugin> removePlugin​(String name)
        Removes a Plugin by name. The catalog from which the plugin will be removed is selected based on where the plugin is found. If plugin is found in both catalogs the project catalog is prefered.
        Parameters:
        name - The name of the plugin to remove.
        Returns:
        The removed plugin wrapped in Optional, empty if no plugin was removed.
      • removePlugin

        public Optional<Plugin> removePlugin​(String name,
                                             boolean userCatalog)
        Removes a Plugin by name. The catalog from which the plugin will be removed is selected based on where the plugin is found. If plugin is found in both catalogs the project catalog is prefered.
        Parameters:
        name - The name of the plugin to remove.
        userCatalog - Flag to only use the user catalog.
        Returns:
        The removed plugin wrapped in Optional, empty if no plugin was removed.
      • removePlugin

        public Optional<Plugin> removePlugin​(Plugin plugin)
        Removes a Plugin by name. The catalog from which the plugin will be removed is selected based on where the plugin is found. If plugin is found in both catalogs the project catalog is prefered.
        Parameters:
        plugin - The plugin to remove
        Returns:
        The removed plugin wrapped in Optional, empty if no plugin was removed.
      • removePlugin

        public Optional<Plugin> removePlugin​(Plugin plugin,
                                             boolean userCatalog)
        Removes a Plugin by name. The catalog from which the plugin will be removed is selected based on where the plugin is found. If plugin is found in both catalogs the project catalog is prefered.
        Parameters:
        plugin - The plugin to remove
        userCatalog - Flag to only use the user catalog.
        Returns:
        The removed plugin wrapped in Optional, empty if no plugin was removed.
      • reconcile

        public boolean reconcile()
        Check that the installed plugins are still available in the environment.
        Returns:
        true if any catalog was changed.
      • sync

        public boolean sync()
        Remove unavailable plugins, add extension plugins if available.
        Returns:
        true if changes any catalog was modified.
      • syncIfNeeded

        public boolean syncIfNeeded()
        Optionally sync if needed. Sync happens weekly or when project files are updated.
      • getInstalledPlugins

        public Map<String,​Plugin> getInstalledPlugins​(boolean userCatalog)
      • getInstallablePlugins

        public Map<String,​Plugin> getInstallablePlugins()