Package hudson

Interface PluginStrategy

  • All Superinterfaces:
    ExtensionPoint
    All Known Implementing Classes:
    ClassicPluginStrategy

    public interface PluginStrategy
    extends ExtensionPoint
    Pluggability point for how to create PluginWrapper.

    This extension point was added to allow plugins to be loaded into a different environment (such as loading it in an existing DI container like Plexus.) A plugin strategy is a singleton instance, and as such this feature is primarily meant for OEM. See PluginManager.createPluginStrategy() for how this instance is created.

    • Method Detail

      • createPluginWrapper

        PluginWrapper createPluginWrapper​(File archive)
                                   throws IOException
        Creates a plugin wrapper, which provides a management interface for the plugin
        Parameters:
        archive - Either a directory that points to a pre-exploded plugin, or an jpi file, or an jpl file.
        Throws:
        IOException
      • load

        void load​(PluginWrapper wrapper)
           throws IOException
        Loads the plugin and starts it.

        This should be done after all the classloaders are constructed for all the plugins, so that dependencies can be properly loaded by plugins.

        Throws:
        IOException
      • initializeComponents

        void initializeComponents​(PluginWrapper plugin)
        Optionally start services provided by the plugin. Should be called when all plugins are loaded.
      • findComponents

        <T> List<ExtensionComponent<T>> findComponents​(Class<T> type,
                                                       Hudson hudson)
        Find components of the given type using the assigned strategy.
        Parameters:
        type - The component type
        hudson - The Hudson scope
        Returns:
        Sequence of components
        Since:
        1.400
      • updateDependency

        default void updateDependency​(PluginWrapper depender,
                                      PluginWrapper dependee)
        Called when a plugin is installed, but there was already a plugin installed which optionally depended on that plugin. The class loader of the existing depending plugin should be updated to load classes from the newly installed plugin.
        Parameters:
        depender - plugin depending on dependee.
        dependee - newly loaded plugin.
        Since:
        1.557