Package io.helidon.config.etcd
Class EtcdConfigSourceBuilder
- java.lang.Object
-
- io.helidon.config.spi.AbstractSource.Builder<B,T,ConfigSource>
-
- io.helidon.config.spi.AbstractConfigSource.Builder<B,T>
-
- io.helidon.config.spi.AbstractParsableConfigSource.Builder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>
-
- io.helidon.config.etcd.EtcdConfigSourceBuilder
-
- All Implemented Interfaces:
Builder<ConfigSource>
,Supplier<ConfigSource>
public final class EtcdConfigSourceBuilder extends AbstractParsableConfigSource.Builder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>
Etcd ConfigSource builder.It allows to configure following properties:
uri
- etcd endpointkey
- an etcd key that is associated to value with configurationversion
- an etcd API versionmandatory
- is existence of configuration resource mandatory (by default) or isoptional
?media-type
- configuration content media type to be used to look for appropriateConfigParser
;parser
- or directly setConfigParser
instance to be used to parse the source;
If the Etcd ConfigSource is
mandatory
and auri
is not responsive orkey
does not exist thenSource.load()
throwsConfigException
.One of
media-type
andparser
properties must be set to be clear how to parse the content. If both of them are set, thenparser
has precedence.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EtcdConfigSourceBuilder.EtcdApi
EtcdApi
determines which etcd API version will be used.static class
EtcdConfigSourceBuilder.EtcdEndpoint
Etcd endpoint remote descriptor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EtcdConfigSource
build()
Builds new instance of Etcd ConfigSource.static EtcdConfigSourceBuilder
create(Config metaConfig)
Initializes config source instance from meta configuration properties, seeConfigSources.load(Config)
.static EtcdConfigSourceBuilder
create(URI uri, String key, EtcdConfigSourceBuilder.EtcdApi api)
Create new instance of builder with specified mandatory Etcd endpoint remote descriptor.protected EtcdConfigSourceBuilder
init(Config metaConfig)
Initialize builder from specified configuration properties.protected EtcdConfigSourceBuilder.EtcdEndpoint
target()
Returns key source attributes (target).-
Methods inherited from class io.helidon.config.spi.AbstractParsableConfigSource.Builder
mediaType, mediaType, parser, parser
-
Methods inherited from class io.helidon.config.spi.AbstractConfigSource.Builder
get, mediaTypeMapping, mediaTypeMapping, parserMapping, parserMapping
-
Methods inherited from class io.helidon.config.spi.AbstractSource.Builder
changesExecutor, changesExecutor, changesMaxBuffer, changesMaxBuffer, isMandatory, optional, pollingStrategy, pollingStrategy, pollingStrategy, retryPolicy, retryPolicy, thisBuilder
-
-
-
-
Method Detail
-
create
public static EtcdConfigSourceBuilder create(URI uri, String key, EtcdConfigSourceBuilder.EtcdApi api)
Create new instance of builder with specified mandatory Etcd endpoint remote descriptor.- Parameters:
uri
- an Etcd endpoint remote URI.key
- an Etcd key with which the value containing the configuration is associated.api
- an Etcd API version.- Returns:
- new instance of builder
- See Also:
create(Config)
-
create
public static EtcdConfigSourceBuilder create(Config metaConfig) throws ConfigMappingException, MissingValueException
Initializes config source instance from meta configuration properties, seeConfigSources.load(Config)
.Mandatory
properties
, seecreate(URI, String, EtcdApi)
:uri
- typeURI
key
- typeString
api
- typeEtcdConfigSourceBuilder.EtcdApi
, e.g.v3
properties
: seeinit(Config)
.- Parameters:
metaConfig
- meta-configuration used to initialize returned config source builder instance from.- Returns:
- new instance of config source builder described by
metaConfig
- Throws:
MissingValueException
- in case the configuration tree does not contain all expected sub-nodes required by the mapper implementation to provide instance of Java type.ConfigMappingException
- in case the mapper fails to map the (existing) configuration tree represented by the supplied configuration node to an instance of a given Java type.- See Also:
create(URI, String, EtcdApi)
,init(Config)
-
init
protected EtcdConfigSourceBuilder init(Config metaConfig)
Description copied from class:AbstractParsableConfigSource.Builder
Initialize builder from specified configuration properties.Supported configuration
properties
:optional
- typeboolean
, seeAbstractSource.Builder.optional()
polling-strategy
- seePollingStrategy
for details about configuration format, seeAbstractSource.Builder.pollingStrategy(Supplier)
orAbstractSource.Builder.pollingStrategy(Function)
media-type-mapping
- typeMap
- key to media type, seeAbstractConfigSource.Builder.mediaTypeMapping(Function)
media-type
- typeString
, seeAbstractParsableConfigSource.Builder.mediaType(String)
- Overrides:
init
in classAbstractParsableConfigSource.Builder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>
- Parameters:
metaConfig
- configuration properties used to initialize a builder instance.- Returns:
- modified builder instance
-
target
protected EtcdConfigSourceBuilder.EtcdEndpoint target()
Description copied from class:AbstractSource.Builder
Returns key source attributes (target).- Overrides:
target
in classAbstractSource.Builder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint,ConfigSource>
- Returns:
- key source attributes (target).
-
build
public EtcdConfigSource build()
Builds new instance of Etcd ConfigSource.If the Etcd ConfigSource is
mandatory
and auri
is not responsive orkey
does not exist thenSource.load()
throwsConfigException
.- Specified by:
build
in interfaceBuilder<ConfigSource>
- Specified by:
build
in classAbstractSource.Builder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint,ConfigSource>
- Returns:
- new instance of Etcd ConfigSource.
-
-