Package jenkins.model

Class GlobalConfiguration

All Implemented Interfaces:
ExtensionPoint, Describable<GlobalConfiguration>, Saveable, Loadable, OnMaster
Direct Known Subclasses:
AdministrativeMonitorsConfiguration, ApiTokenPropertyConfiguration, ArtifactManagerConfiguration, ConsoleUrlProviderGlobalConfiguration, EnvVarsFilterGlobalConfiguration, GlobalBuildDiscarderConfiguration, GlobalComputerRetentionCheckIntervalConfiguration, GlobalCrumbIssuerConfiguration, GlobalDefaultViewConfiguration, GlobalFingerprintConfiguration, GlobalMavenConfig, GlobalNodePropertiesConfiguration, GlobalPluginConfiguration, GlobalProjectNamingStrategyConfiguration, GlobalQuietPeriodConfiguration, GlobalSCMRetryCountConfiguration, JenkinsLocationConfiguration, MasterBuildConfiguration, MyViewsTabBar.GlobalConfigurationImpl, ProxyConfigurationManager, QueueItemAuthenticatorConfiguration, ResourceDomainConfiguration, UpdateSiteWarningsConfiguration, ViewsTabBar.GlobalConfigurationImpl

public abstract class GlobalConfiguration extends Descriptor<GlobalConfiguration> implements ExtensionPoint, Describable<GlobalConfiguration>
Convenient base class for extensions that contributes to the system configuration page but nothing else, or to manage the global configuration of a plugin implementing several extension points.

All Descriptors are capable of contributing fragment to the system config page. If you are implementing other extension points that need to expose some global configuration, you can do so with global.groovy or global.jelly from your Descriptor instance. However each global.* file will appear as its own section in the global configuration page.

An option to present a single section for your plugin in the Jenkins global configuration page is to use this class to manage the configuration for your plugin and its extension points. To access properties defined in your GlobalConfiguration subclass, here are two possibilities:

  • @Inject into your other Extensions (so this does not work for classes not annotated with Extension)
  • access it via a call to ExtensionList.lookupSingleton(<your GlobalConfiguration subclass>.class)

While an implementation might store its actual configuration data in various ways, meaning configure(StaplerRequest, JSONObject) must be overridden, in the normal case you would simply define persistable fields with getters and setters. The config view would use data-bound controls like f:entry. Then make sure your constructor calls Descriptor.load() and your setters call Descriptor.save().

Views

Subtypes of this class should define a config.groovy file or config.jelly file that gets pulled into the system configuration page. Typically its contents should be wrapped in an f:section.

Since:
1.425
Author:
Kohsuke Kawaguchi