Package io.jenkins.plugins.casc
Interface Configurator<T>
-
- All Known Subinterfaces:
RootElementConfigurator<T>
- All Known Implementing Classes:
AdminWhitelistRuleConfigurator
,BaseConfigurator
,ConfigurableConfigurator
,DataBoundConfigurator
,DescriptorConfigurator
,EnumConfigurator
,ExtensionConfigurator
,GlobalConfigurationCategoryConfigurator
,HeteroDescribableConfigurator
,HudsonPrivateSecurityRealmConfigurator
,JenkinsConfigurator
,JNLPLauncherConfigurator
,LabelAtomConfigurator
,LabelAtomPropertyConfigurator
,MavenConfigurator
,NoneSecurityRealmConfigurator
,PrimitiveConfigurator
,SelfConfigurator
,UnsecuredAuthorizationStrategyConfigurator
,UpdateCenterConfigurator
,UpdateSiteConfigurator
public interface Configurator<T>
Define aConfigurator
which handles a configuration element, identified by name.- Author:
- Nicolas De Loof, Oleg Nenashev
- See Also:
RootElementConfigurator
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
canConfigure(Class clazz)
T
check(CNode config, ConfigurationContext context)
Run the same logic asconfigure(CNode, ConfigurationContext)
in dry-run mode.T
configure(CNode config, ConfigurationContext context)
Configures/creates a Jenkins object based on a tree.Set<Attribute<T,?>>
describe()
Determine the list of Attribute available for configuration of the managed component.default CNode
describe(T instance, ConfigurationContext context)
Describe a component as a Configuration NodesCNode
to be exported as yaml.default CNode
describeStructure(T instance, ConfigurationContext context)
Describe Structure of the attributes, as required by the schema.static Comparator<Object>
extensionOrdinalSort()
static double
extractExtensionOrdinal(Attribute<?,?> attribute)
static double
extractExtensionOrdinal(Class clazz)
static double
extractExtensionOrdinal(Object obj)
default List<Attribute<T,?>>
getAttributes()
default List<Configurator<T>>
getConfigurators(ConfigurationContext context)
default String
getDisplayName()
default Class
getImplementedAPI()
default String
getName()
Get a configurator name.default List<String>
getNames()
Get all possible configurator namesClass<T>
getTarget()
Target type this configurator can handle.static String
normalize(String name)
-
-
-
Method Detail
-
getName
@NonNull default String 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
@NonNull default List<String> 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
default String getDisplayName()
- Returns:
- Human friendly display name for this component, used in generated documentation.
-
canConfigure
default boolean canConfigure(Class clazz)
- Returns:
true
if this configurator can handle typeclazz
. Implementation has to be consistent withgetTarget()
-
getImplementedAPI
@NonNull default Class getImplementedAPI()
- Returns:
- The API implemented by target type, i.e. implemented
ExtensionPoint
for components to implement some jenkins APIs, or raw type for others.
-
getConfigurators
@NonNull default List<Configurator<T>> getConfigurators(ConfigurationContext context)
- Returns:
- list of
Configurator
s to be considered so one can fully configure this component. Typically, configurator for an abstract extension point will return Configurators for available implementations.
-
describe
@NonNull Set<Attribute<T,?>> describe()
Determine the list of Attribute available for configuration of the managed component.- Returns:
- A set of
Attribute
s that describes this object
-
getAttributes
@NonNull default List<Attribute<T,?>> getAttributes()
- Returns:
- Ordered version of
describe()
for documentation generation. Only include non-ignored attribute
-
configure
@NonNull T configure(CNode config, ConfigurationContext context) throws ConfiguratorException
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
-- 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
T check(CNode config, ConfigurationContext context) throws ConfiguratorException
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
-context
-- Throws:
ConfiguratorException
-
describe
@CheckForNull default CNode describe(T instance, ConfigurationContext context) throws Exception
Describe a component as a Configuration NodesCNode
to be exported as yaml. Only export attributes which are not set to default value.- Throws:
Exception
-
describeStructure
@CheckForNull default CNode describeStructure(T instance, ConfigurationContext context)
Describe Structure of the attributes, as required by the schema.- Parameters:
instance
-context
-- Returns:
- CNode describing the attributes.
- Since:
- 1.35
-
extractExtensionOrdinal
static double extractExtensionOrdinal(Object obj)
-
extractExtensionOrdinal
static double extractExtensionOrdinal(Attribute<?,?> attribute)
-
extractExtensionOrdinal
static double extractExtensionOrdinal(Class clazz)
-
extensionOrdinalSort
static Comparator<Object> extensionOrdinalSort()
-
-