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:
- @
javax.inject.Inject into your other
hudson.Extensions (so this does not work
for classes not annotated with
hudson.Extension)
- access it via a call to
ExtensionList.lookupSingleton(.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
#load and your setters call
#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.