Class ConfigTransformer
- java.lang.Object
 - 
- org.apache.kafka.common.config.ConfigTransformer
 
 
- 
public class ConfigTransformer extends Object
This class wraps a set ofConfigProviderinstances and uses them to perform transformations.The default variable pattern is of the form
${provider:[path:]key}, where theprovidercorresponds to aConfigProviderinstance, as passed toConfigTransformer(Map). The pattern will extract a set of paths (which are optional) and keys and then pass them toConfigProvider.get(String, Set)to obtain the values with which to replace the variables.For example, if a Map consisting of an entry with a provider name "file" and provider instance
FileConfigProvideris passed to theConfigTransformer(Map), and a Properties file with contentsfileKey=someValue
resides at the path "/tmp/properties.txt", then when a configuration Map which has an entry with a key "someKey" and a value "${file:/tmp/properties.txt:fileKey}" is passed to thetransform(Map)method, then the transformed Map will have an entry with key "someKey" and a value "someValue".This class only depends on
ConfigProvider.get(String, Set)and does not depend on subscription support in aConfigProvider, such as theConfigProvider.subscribe(String, Set, ConfigChangeCallback)andConfigProvider.unsubscribe(String, Set, ConfigChangeCallback)methods. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static PatternDEFAULT_PATTERN 
- 
Constructor Summary
Constructors Constructor Description ConfigTransformer(Map<String,ConfigProvider> configProviders)Creates a ConfigTransformer with the default pattern, of the form${provider:[path:]key}. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigTransformerResulttransform(Map<String,String> configs)Transforms the given configuration data by using theConfigProviderinstances to look up values to replace the variables in the pattern. 
 - 
 
- 
- 
Field Detail
- 
DEFAULT_PATTERN
public static final Pattern DEFAULT_PATTERN
 
 - 
 
- 
Constructor Detail
- 
ConfigTransformer
public ConfigTransformer(Map<String,ConfigProvider> configProviders)
Creates a ConfigTransformer with the default pattern, of the form${provider:[path:]key}.- Parameters:
 configProviders- a Map of provider names andConfigProviderinstances.
 
 - 
 
- 
Method Detail
- 
transform
public ConfigTransformerResult transform(Map<String,String> configs)
Transforms the given configuration data by using theConfigProviderinstances to look up values to replace the variables in the pattern.- Parameters:
 configs- the configuration values to be transformed- Returns:
 - an instance of 
ConfigTransformerResult 
 
 - 
 
 -