Package io.jenkins.plugins.casc
Interface Configurator<T>
- All Known Subinterfaces:
ItemConfigurator<T>,RootElementConfigurator<T>
- All Known Implementing Classes:
AdminWhitelistRuleConfigurator,BaseConfigurator,ConfigurableConfigurator,DataBoundConfigurator,DescriptorConfigurator,DumbSlaveConfigurator,EnumConfigurator,ExtensionConfigurator,FreestyleItemConfigurator,GlobalConfigurationCategoryConfigurator,GlobalNodePropertiesConfigurator,HeteroDescribableConfigurator,HudsonPrivateSecurityRealmConfigurator,ItemsRootConfigurator,JenkinsConfigurator,JNLPLauncherConfigurator,LabelAtomConfigurator,LabelAtomPropertyConfigurator,MavenConfigurator,NoneSecurityRealmConfigurator,PrimitiveConfigurator,SelfConfigurator,UnsecuredAuthorizationStrategyConfigurator,UpdateCenterConfigurator,UpdateSiteConfigurator
public interface Configurator<T>
Define a
Configurator which handles a configuration element, identified by name.- Author:
- Nicolas De Loof, Oleg Nenashev
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanConfigure(Class clazz) check(CNode config, ConfigurationContext context) Run the same logic asconfigure(CNode, ConfigurationContext)in dry-run mode.configure(CNode config, ConfigurationContext context) Configures/creates a Jenkins object based on a tree.describe()Determine the list of Attribute available for configuration of the managed component.default CNodedescribe(T instance, ConfigurationContext context) Describe a component as a Configuration NodesCNodeto be exported as yaml.default CNodedescribeStructure(T instance, ConfigurationContext context) Describe Structure of the attributes, as required by the schema.static Comparator<Object> static doubleextractExtensionOrdinal(Attribute<?, ?> attribute) static doubleextractExtensionOrdinal(Class clazz) static doubledefault List<Configurator<T>> getConfigurators(ConfigurationContext context) default Stringdefault Classdefault StringgetName()Get a configurator name.getNames()Get all possible configurator namesTarget type this configurator can handle.default voidmerge(org.yaml.snakeyaml.nodes.Node root, ConfigurationContext context) Optional hook to allow configurators to customize or merge YAML nodes during the configuration merge process.static String
-
Method Details
-
normalize
-
getName
Get a configurator name. This should return the default name for the configurator, used for exporting yaml seegetNames()for all possible names which will be considered when configuring.- Returns:
- short name for this component when used in a configuration.yaml file
-
getNames
Get all possible configurator names- Returns:
- a list of all possible short names for this component when used in a configuration.yaml file
-
getDisplayName
- Returns:
- Human friendly display name for this component, used in generated documentation.
-
getTarget
Target type this configurator can handle. -
canConfigure
- Returns:
trueif this configurator can handle typeclazz. Implementation has to be consistent withgetTarget()
-
getImplementedAPI
- Returns:
- The API implemented by target type, i.e. implemented
ExtensionPointfor components to implement some jenkins APIs, or raw type for others.
-
getConfigurators
- Returns:
- list of
Configurators to be considered so one can fully configure this component. Typically, configurator for an abstract extension point will return Configurators for available implementations.
-
describe
Determine the list of Attribute available for configuration of the managed component.- Returns:
- A set of
Attributes that describes this object
-
getAttributes
- Returns:
- Ordered version of
describe()for documentation generation. Only include non-ignored attribute
-
configure
Configures/creates a Jenkins object based on a tree.- Parameters:
config- Map/List/primitive objects (think YAML) that represents the configuration from which a Jenkins object is configured.context- Fully configured Jenkins object used as the starting point for this configuration.- Returns:
- Fully configured Jenkins object that results from this configuration. if no new objects got created, but some existing objects may have been modified, return updated target object.
- Throws:
ConfiguratorException- if something went wrong, depends on the concrete implementation
-
check
Run the same logic asconfigure(CNode, ConfigurationContext)in dry-run mode. Used to verify configuration is fine before being actually applied to a live jenkins controller.- Parameters:
config- Map/List/primitive objects (think YAML) that represents the configuration from which a Jenkins object is configured.context- Fully configured Jenkins object used as the starting point for this configuration.- Throws:
ConfiguratorException- on configuration error
-
merge
default void merge(org.yaml.snakeyaml.nodes.Node root, ConfigurationContext context) throws ConfiguratorException Optional hook to allow configurators to customize or merge YAML nodes during the configuration merge process.- Parameters:
root- the merged root YAML nodecontext- configuration context- Throws:
ConfiguratorException- if merge fails
-
describe
Describe a component as a Configuration NodesCNodeto be exported as yaml. Only export attributes which are not set to default value.- Throws:
Exception
-
describeStructure
Describe Structure of the attributes, as required by the schema.- Parameters:
instance- Object whose attributes will be described.context- Fully configured Jenkins object used as the starting point for this configuration.- Returns:
- CNode describing the attributes.
- Since:
- 1.35
-
extractExtensionOrdinal
-
extractExtensionOrdinal
-
extractExtensionOrdinal
-
extensionOrdinalSort
-