Class ConfigContextResolver

java.lang.Object
org.jenkinsci.plugins.configfiles.ConfigContextResolver
All Implemented Interfaces:
ExtensionPoint

public abstract class ConfigContextResolver extends Object implements ExtensionPoint
ConfigContextResolver provides a way for a plugin to specify the context (ItemGroup) used to retrieve configuration files from for classes deriving from ItemGroup it defines.
  • Constructor Details

    • ConfigContextResolver

      public ConfigContextResolver()
  • Method Details

    • all

      public static ExtensionList<ConfigContextResolver> all()
    • getConfigContext

      public abstract ItemGroup getConfigContext(ItemGroup itemGroup)
      Optionally provides the ItemGroup from which configuration files should be retrieved for the provided one.

      Examples of expected usage:

      In promoted-builds-plugin, the itemGroup used as context for a promotion run is a hudson.plugins.promoted_builds.JobPropertyImpl which is not supported by the configuration file retrieval logic in ConfigFiles.getByIdOrNull(ItemGroup, String).

      However, as the hudson.plugins.promoted_builds.JobPropertyImpl has an owner property containing the promoted build, it is possible for the promoted-builds-plugin to implement this extension by returning the owner's parent when the itemGroup provided to the getConfigContext(ItemGroup) method is an instance of hudson.plugins.promoted_builds.JobPropertyImpl, and null if it is of any other type.

      This will allow for the configuration file retrieval code to revert to the standard logic from the owner's parent starting point.

      Parameters:
      itemGroup - the source ItemGroup
      Returns:
      an ItemGroup to use to retrieve configuration, or null.