- java.lang.Object
-
- io.helidon.config.AbstractSourceBuilder<B,U>
-
- io.helidon.config.AbstractConfigSourceBuilder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>
-
- io.helidon.config.etcd.EtcdConfigSourceBuilder
-
- All Implemented Interfaces:
Builder<EtcdConfigSource>,ParsableSource.Builder<EtcdConfigSourceBuilder>,PollableSource.Builder<EtcdConfigSourceBuilder>,Source.Builder<EtcdConfigSourceBuilder>,WatchableSource.Builder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>,Supplier<EtcdConfigSource>
public final class EtcdConfigSourceBuilder extends AbstractConfigSourceBuilder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint> implements PollableSource.Builder<EtcdConfigSourceBuilder>, WatchableSource.Builder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>, ParsableSource.Builder<EtcdConfigSourceBuilder>, Builder<EtcdConfigSource>
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 setConfigParserinstance to be used to parse the source;
One of
media-typeandparserproperties must be set to be clear how to parse the content. If both of them are set, thenparserhas precedence.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEtcdConfigSourceBuilder.EtcdApiEtcdApidetermines which etcd API version will be used.static classEtcdConfigSourceBuilder.EtcdEndpointEtcd endpoint remote descriptor.
-
Field Summary
Fields Modifier and Type Field Description static URIDEFAULT_URIDefault Etcd endpoint (http://localhost:2379).static EtcdConfigSourceBuilder.EtcdApiDEFAULT_VERSIONDefault Etcd API version (EtcdConfigSourceBuilder.EtcdApi.v2).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EtcdConfigSourceBuilderapi(EtcdConfigSourceBuilder.EtcdApi version)Etcd API version.EtcdConfigSourcebuild()Builds new instance of Etcd ConfigSource.EtcdConfigSourceBuilderchangeWatcher(ChangeWatcher<EtcdConfigSourceBuilder.EtcdEndpoint> changeWatcher)Configure a change watcher.EtcdConfigSourceBuilderconfig(Config metaConfig)Configure builder from meta configuration.EtcdConfigSourceBuilderkey(String key)Etcd key with which the value containing the configuration is associated.EtcdConfigSourceBuildermediaType(String mediaType)Media type if this is aParsableSourceand explicit media type is configured.EtcdConfigSourceBuilderparser(ConfigParser parser)A parser if this is aParsableSourceand explicit parser is configured.EtcdConfigSourceBuilderpollingStrategy(PollingStrategy pollingStrategy)Configure a polling strategy.EtcdConfigSourceBuilderuri(URI... uris)Etcd endpoint remote URI.-
Methods inherited from class io.helidon.config.AbstractConfigSourceBuilder
mediaTypeMapping, parserMapping
-
Methods inherited from class io.helidon.config.AbstractSourceBuilder
optional, retryPolicy
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.config.spi.PollableSource.Builder
pollingStrategy
-
Methods inherited from interface io.helidon.config.spi.Source.Builder
optional, optional, retryPolicy
-
-
-
-
Field Detail
-
DEFAULT_VERSION
public static final EtcdConfigSourceBuilder.EtcdApi DEFAULT_VERSION
Default Etcd API version (EtcdConfigSourceBuilder.EtcdApi.v2).
-
DEFAULT_URI
public static final URI DEFAULT_URI
Default Etcd endpoint (http://localhost:2379).
-
-
Method Detail
-
build
public EtcdConfigSource build()
Builds new instance of Etcd ConfigSource.- Specified by:
buildin interfaceBuilder<EtcdConfigSource>- Returns:
- new instance of Etcd ConfigSource.
-
config
public EtcdConfigSourceBuilder config(Config metaConfig)
Configure builder from meta configuration.The following configuration options are supported:
Optional configuration parameters key default value description optional falseConfigure to trueif this source should not fail configuration setup when underlying data is missing.polling-strategy No polling strategy is added by default Meta configuration of a polling strategy to be used with this source, add configuration to propertiessub node.change-watcher No change watcher is added by default Meta configuration of a change watcher to be used with this source, add configuration to propertiessub node.retry-policy No retry policy is added by default Meta configuration of a retry policy to be used to load this source, add configuration to propertiessub node.Media type and type mapping media-type Media type from loaded data is used by default for parsable config sources Explicit media type to use, such as when a file has invalid suffix, or when we need to explicitly mark the media type. media-type-mapping No media type mapping is done by default A mapping of key to a media type, allowing us to have a key that contains a sub-tree (e.g. a key that contains json data) - when we configure a mapping of the key to application/json, the data would be expanded into config as a proper tree structureuri- typeURI- Etcd instance remote URIkey- typeString- Etcd key the configuration is associated withapi- typeEtcdConfigSourceBuilder.EtcdApi- Etcd API version such asv3
properties: seeconfig(Config).- Overrides:
configin classAbstractConfigSourceBuilder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>- Parameters:
metaConfig- meta-configuration used to update the builder instance from- Returns:
- updated builder instance
- See Also:
config(Config)
-
parser
public EtcdConfigSourceBuilder parser(ConfigParser parser)
Description copied from class:AbstractConfigSourceBuilderA parser if this is aParsableSourceand explicit parser is configured.- Specified by:
parserin interfaceParsableSource.Builder<EtcdConfigSourceBuilder>- Overrides:
parserin classAbstractConfigSourceBuilder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>- Parameters:
parser- parser configured for this source- Returns:
- updated builder instance
-
mediaType
public EtcdConfigSourceBuilder mediaType(String mediaType)
Description copied from class:AbstractConfigSourceBuilderMedia type if this is aParsableSourceand explicit media type is configured.- Specified by:
mediaTypein interfaceParsableSource.Builder<EtcdConfigSourceBuilder>- Overrides:
mediaTypein classAbstractConfigSourceBuilder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>- Parameters:
mediaType- media type configured for this source- Returns:
- updated builder instance
-
pollingStrategy
public EtcdConfigSourceBuilder pollingStrategy(PollingStrategy pollingStrategy)
Description copied from class:AbstractSourceBuilderConfigure a polling strategy. This method must be exposed by builders of sources that support polling. If you see this method as being protected in your builder, the source has removed support for polling, such asClasspathConfigSource.- Specified by:
pollingStrategyin interfacePollableSource.Builder<EtcdConfigSourceBuilder>- Overrides:
pollingStrategyin classAbstractSourceBuilder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>- Parameters:
pollingStrategy- polling strategy to use- Returns:
- updated builder instance
-
changeWatcher
public EtcdConfigSourceBuilder changeWatcher(ChangeWatcher<EtcdConfigSourceBuilder.EtcdEndpoint> changeWatcher)
Description copied from class:AbstractSourceBuilderConfigure a change watcher. This method must be exposed by builders of sources that change watching (WatchableSource). The type of the change watcher must match the type of the target of this source.- Specified by:
changeWatcherin interfaceWatchableSource.Builder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>- Overrides:
changeWatcherin classAbstractSourceBuilder<EtcdConfigSourceBuilder,EtcdConfigSourceBuilder.EtcdEndpoint>- Parameters:
changeWatcher- change watcher to use, such asFileSystemWatcher- Returns:
- updated builder instance
-
uri
public EtcdConfigSourceBuilder uri(URI... uris)
Etcd endpoint remote URI.- Parameters:
uris- endpoint URIs- Returns:
- updated builder instance
-
key
public EtcdConfigSourceBuilder key(String key)
Etcd key with which the value containing the configuration is associated.- Parameters:
key- key- Returns:
- updated builder instance
-
api
public EtcdConfigSourceBuilder api(EtcdConfigSourceBuilder.EtcdApi version)
Etcd API version.- Parameters:
version- version, defaults toEtcdConfigSourceBuilder.EtcdApi.v3- Returns:
- updated builder instance
-
-