Class RedisConfigurationSource
- All Implemented Interfaces:
ConfigurableConfigurationSource<RedisConfigurationSource.RedisConfigurationQuery,
,RedisConfigurationSource.RedisExecutableConfigurationQuery, RedisConfigurationSource.RedisListConfigurationQuery, RedisConfigurationSource.RedisConfigurationUpdate, RedisConfigurationSource.RedisExecutableConfigurationUpdate> ConfigurationSource<RedisConfigurationSource.RedisConfigurationQuery,
,RedisConfigurationSource.RedisExecutableConfigurationQuery, RedisConfigurationSource.RedisListConfigurationQuery> DefaultableConfigurationSource<RedisConfigurationSource.RedisConfigurationQuery,
RedisConfigurationSource.RedisExecutableConfigurationQuery, RedisConfigurationSource.RedisListConfigurationQuery, RedisConfigurationSource>
A configurable configuration source that stores and looks up properties in a Redis data store.
Configuration are stored as string entries, the property key is of the form: keyPrefix ":PROP:" propertyName "[" [ key "=" value [ "," key "=" value ]* "]"
.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The configuration query used by the Redis configuration source.static class
The configuration update used by the Redis configuration source.static class
The executable configuration query used by the Redis configuration source.static class
The executable configuration update used by the Redis configuration source.static class
The list configuration query used by the Redis configuration source. -
Field Summary
Fields inherited from class io.inverno.mod.configuration.AbstractConfigurableConfigurationSource
encoder
Fields inherited from class io.inverno.mod.configuration.AbstractConfigurationSource
decoder
-
Constructor Summary
ConstructorDescriptionRedisConfigurationSource
(RedisClient<String, String> redisClient) Creates a redis configuration source with the specified redis client.RedisConfigurationSource
(RedisClient<String, String> redisClient, JoinablePrimitiveEncoder<String> encoder, SplittablePrimitiveDecoder<String> decoder) Creates a redis configuration source with the specified redis client, string value encoder and decoder. -
Method Summary
Modifier and TypeMethodDescriptionCreates a configuration query to retrieve the specified properties.final String
Returns the prefix that is prepended to configuration property keys.Creates a list configuration query to list configuration properties defined with the specified property name.Creates a configuration update to set the configuration properties extracted from the specified values.final void
setKeyPrefix
(String keyPrefix) Sets the prefix that is prepended to configuration property keys.unwrap()
Returns the original configuration source.withDefaultingStrategy
(DefaultingStrategy defaultingStrategy) Returns a proxy of the defaultable configuration source instance using the specified defaulting strategy.Methods inherited from class io.inverno.mod.configuration.AbstractConfigurableConfigurationSource
getEncoder, setEncoder
Methods inherited from class io.inverno.mod.configuration.AbstractConfigurationSource
getDecoder, setDecoder
-
Field Details
-
DEFAULT_KEY_PREFIX
The default key prefix.- See Also:
-
-
Constructor Details
-
RedisConfigurationSource
Creates a redis configuration source with the specified redis client.
- Parameters:
redisClient
- a redis client
-
RedisConfigurationSource
public RedisConfigurationSource(RedisClient<String, String> redisClient, JoinablePrimitiveEncoder<String> encoder, SplittablePrimitiveDecoder<String> decoder) Creates a redis configuration source with the specified redis client, string value encoder and decoder.
- Parameters:
redisClient
- a redis clientencoder
- a string encoderdecoder
- a string decoder
-
-
Method Details
-
getKeyPrefix
Returns the prefix that is prepended to configuration property keys.
A configuration property key is of the form:
keyPrefix ":PROP:" propertyName "[" [ key "=" value [ "," key "=" value ]* "]"
.- Returns:
- the key prefix
-
setKeyPrefix
Sets the prefix that is prepended to configuration property keys.
A configuration property key is of the form:
keyPrefix ":PROP:" propertyName "[" [ key "=" value [ "," key "=" value ]* "]"
.- Parameters:
keyPrefix
- the key prefix to set
-
withDefaultingStrategy
Description copied from interface:DefaultableConfigurationSource
Returns a proxy of the defaultable configuration source instance using the specified defaulting strategy.
- Specified by:
withDefaultingStrategy
in interfaceDefaultableConfigurationSource<RedisConfigurationSource.RedisConfigurationQuery,
RedisConfigurationSource.RedisExecutableConfigurationQuery, RedisConfigurationSource.RedisListConfigurationQuery, RedisConfigurationSource> - Parameters:
defaultingStrategy
- a defaulting strategy- Returns:
- a new defaultable configuration source
-
unwrap
Description copied from interface:DefaultableConfigurationSource
Returns the original configuration source.
- Specified by:
unwrap
in interfaceDefaultableConfigurationSource<RedisConfigurationSource.RedisConfigurationQuery,
RedisConfigurationSource.RedisExecutableConfigurationQuery, RedisConfigurationSource.RedisListConfigurationQuery, RedisConfigurationSource> - Returns:
- a configuration source
-
get
public RedisConfigurationSource.RedisExecutableConfigurationQuery get(String... names) throws IllegalArgumentException Description copied from interface:ConfigurationSource
Creates a configuration query to retrieve the specified properties.
- Specified by:
get
in interfaceConfigurationSource<RedisConfigurationSource.RedisConfigurationQuery,
RedisConfigurationSource.RedisExecutableConfigurationQuery, RedisConfigurationSource.RedisListConfigurationQuery> - Parameters:
names
- an array of property names- Returns:
- an executable configuration query
- Throws:
IllegalArgumentException
- if the array of names is null or empty
-
list
public RedisConfigurationSource.RedisListConfigurationQuery list(String name) throws IllegalArgumentException Description copied from interface:ConfigurationSource
Creates a list configuration query to list configuration properties defined with the specified property name.
- Specified by:
list
in interfaceConfigurationSource<RedisConfigurationSource.RedisConfigurationQuery,
RedisConfigurationSource.RedisExecutableConfigurationQuery, RedisConfigurationSource.RedisListConfigurationQuery> - Parameters:
name
- a property name- Returns:
- a list configuration query
- Throws:
IllegalArgumentException
- if the name is null or empty
-
set
public RedisConfigurationSource.RedisExecutableConfigurationUpdate set(Map<String, Object> values) throws IllegalArgumentExceptionDescription copied from interface:ConfigurableConfigurationSource
Creates a configuration update to set the configuration properties extracted from the specified values.
- Specified by:
set
in interfaceConfigurableConfigurationSource<RedisConfigurationSource.RedisConfigurationQuery,
RedisConfigurationSource.RedisExecutableConfigurationQuery, RedisConfigurationSource.RedisListConfigurationQuery, RedisConfigurationSource.RedisConfigurationUpdate, RedisConfigurationSource.RedisExecutableConfigurationUpdate> - Parameters:
values
- a map containing properties keys and values to set in the configuration source- Returns:
- an executable configuration update
- Throws:
IllegalArgumentException
- if the map of properties is null or empty
-