public class ConfigurationUtils extends Object
Configuration
related helper functions.Modifier and Type | Method and Description |
---|---|
static String |
assembleDynamicConfigsStr(Map<String,String> config)
Creates a dynamic parameter list
String of the passed configuration map. |
static boolean |
canBePrefixMap(ConfigOption<?> configOption)
Maps can be represented in two ways.
|
static <E extends Enum<?>> |
convertToEnum(Object o,
Class<E> clazz) |
static <T> T |
convertValue(Object rawValue,
Class<?> clazz)
Tries to convert the raw value into the provided type.
|
static Configuration |
createConfiguration(Properties properties)
Creates a new
Configuration from the given Properties . |
static boolean |
filterPrefixMapKey(String key,
String candidate)
Filter condition for prefix map keys.
|
static Map<String,String> |
getPrefixedKeyValuePairs(String prefix,
Configuration configuration)
Extract and parse Flink configuration properties with a given name prefix and return the
result as a Map.
|
static File |
getRandomTempDirectory(Configuration configuration)
Picks a temporary directory randomly from the given configuration.
|
static Time |
getStandaloneClusterStartupPeriodTime(Configuration configuration) |
static Optional<Time> |
getSystemResourceMetricsProbingInterval(Configuration configuration) |
static Map<String,String> |
hideSensitiveValues(Map<String,String> keyValuePairs)
Replaces values whose keys are sensitive according to
GlobalConfiguration.isSensitive(String) with GlobalConfiguration.HIDDEN_CONTENT . |
static Map<String,String> |
parseJvmArgString(String jvmParamsStr) |
static String[] |
parseLocalStateDirectories(Configuration configuration)
Extracts the local state directories as defined by
CheckpointingOptions.LOCAL_RECOVERY_TASK_MANAGER_STATE_ROOT_DIRS . |
static Map<String,String> |
parseMap(String stringSerializedMap)
Parses a string as a map of strings.
|
static String[] |
parseTempDirectories(Configuration configuration)
Extracts the task manager directories for temporary files as defined by
CoreOptions.TMP_DIRS . |
static Map<String,String> |
parseTmResourceDynamicConfigs(String dynamicConfigsStr) |
static String[] |
splitPaths(String separatedPaths) |
public static Optional<Time> getSystemResourceMetricsProbingInterval(Configuration configuration)
MetricOptions.SYSTEM_RESOURCE_METRICS_PROBING_INTERVAL
or Optional.empty()
if MetricOptions.SYSTEM_RESOURCE_METRICS
are disabled.@Nonnull public static String[] parseTempDirectories(Configuration configuration)
CoreOptions.TMP_DIRS
.configuration
- configuration object@Nonnull public static File getRandomTempDirectory(Configuration configuration)
configuration
- to extract the temp directory from@Nonnull public static String[] parseLocalStateDirectories(Configuration configuration)
CheckpointingOptions.LOCAL_RECOVERY_TASK_MANAGER_STATE_ROOT_DIRS
.configuration
- configuration objectpublic static Map<String,String> parseMap(String stringSerializedMap)
key1:value1,key2:value2
Parts of the string can be escaped by wrapping with single or double quotes.
stringSerializedMap
- a string to parsepublic static Time getStandaloneClusterStartupPeriodTime(Configuration configuration)
@Nonnull public static Configuration createConfiguration(Properties properties)
Configuration
from the given Properties
.properties
- to convert into a Configuration
Configuration
which has been populated by the values of the given Properties
@Nonnull public static Map<String,String> hideSensitiveValues(Map<String,String> keyValuePairs)
GlobalConfiguration.isSensitive(String)
with GlobalConfiguration.HIDDEN_CONTENT
.
This can be useful when displaying configuration values.
keyValuePairs
- for which to hide sensitive valuespublic static String assembleDynamicConfigsStr(Map<String,String> config)
String
of the passed configuration map.config
- A Map
containing parameter/value entries that shall be used in the
dynamic parameter list.String
.@VisibleForTesting public static Map<String,String> parseTmResourceDynamicConfigs(String dynamicConfigsStr)
@VisibleForTesting public static Map<String,String> parseJvmArgString(String jvmParamsStr)
public static Map<String,String> getPrefixedKeyValuePairs(String prefix, Configuration configuration)
public static <T> T convertValue(Object rawValue, Class<?> clazz)
T
- type of the resultrawValue
- rawValue to convert into the provided type clazzclazz
- clazz specifying the target typeIllegalArgumentException
- if the rawValue cannot be converted in the specified target
type clazzpublic static boolean canBePrefixMap(ConfigOption<?> configOption)
With constant key space:
avro-confluent.properties = schema: 1, other-prop: 2
Or with variable key space (i.e. prefix notation):
avro-confluent.properties.schema = 1 avro-confluent.properties.other-prop = 2
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.