Package io.strimzi.kafka.oauth.common
Class ConfigUtil
java.lang.Object
io.strimzi.kafka.oauth.common.ConfigUtil
The helper class with methods used in multiple places.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HostnameVerifiercreateHostnameVerifier(Config config) Create the HostnameVerifier from configuration in the passedConfigobject.static SSLSocketFactorycreateSSLFactory(Config config) Create thejavax.net.ssl.SSLSocketFactoryfrom configuration in the passedConfigobject.static StringgetConfigWithFallbackLookup(Config c, String key, String fallbackKey) Resolve the configuration value for the key as a string.static intgetConnectTimeout(Config config) Resolve the value of theConfig.OAUTH_CONNECT_TIMEOUT_SECONDSconfigurationstatic BooleangetDefaultBooleanConfigWithFallbackLookup(Config c, String key, String fallbackKey, boolean defautValue) Resolve the configuration value for the key as a string.static intgetReadTimeout(Config config) Resolve the value of theConfig.OAUTH_READ_TIMEOUT_SECONDSconfigurationstatic intgetTimeoutAppendingWarnings(Config c, String key, List<String> warnings) Resolve the configuration value for the key as a timeout in seconds with the default value of 60static intResolve the configuration value for the key as a timeout in seconds with the default value of 60.static voidputIfNotNull(Properties p, String key, Object value) Helper method that puts the key-value pair into the passedjava.util.Propertiesonly if the value is not null.
-
Constructor Details
-
ConfigUtil
public ConfigUtil()
-
-
Method Details
-
createSSLFactory
Create thejavax.net.ssl.SSLSocketFactoryfrom configuration in the passedConfigobject.- Parameters:
config- The Config object containing the configuration- Returns:
- The
javax.net.ssl.SSLSocketFactorybased on the passed configuration
-
createHostnameVerifier
Create the HostnameVerifier from configuration in the passedConfigobject.- Parameters:
config- The Config object containing the configuration- Returns:
- The
javax.net.ssl.HostnameVerifierbased on the passed configuration
-
putIfNotNull
Helper method that puts the key-value pair into the passedjava.util.Propertiesonly if the value is not null.- Parameters:
p- Destination Properties objectkey- The keyvalue- The value
-
getConnectTimeout
Resolve the value of theConfig.OAUTH_CONNECT_TIMEOUT_SECONDSconfiguration- Parameters:
config- the Config object- Returns:
- Configured value as int
-
getReadTimeout
Resolve the value of theConfig.OAUTH_READ_TIMEOUT_SECONDSconfiguration- Parameters:
config- the Config object- Returns:
- Configured value as int
-
getTimeoutAppendingWarnings
Resolve the configuration value for the key as a timeout in seconds with the default value of 60- Parameters:
c- the Config objectkey- the configuration keywarnings- a warnings list where any warnings should be added, and will later be logged as WARN- Returns:
- Configured value as int
-
getTimeoutConfigWithFallbackLookup
public static int getTimeoutConfigWithFallbackLookup(Config c, String key, String fallbackKey, List<String> warnings) Resolve the configuration value for the key as a timeout in seconds with the default value of 60. If the key is not present, fallback to using a secondary key.- Parameters:
c- the Config objectkey- the configuration keyfallbackKey- the fallback keywarnings- a warnings list where any warnings should be added, and will later be logged as WARN- Returns:
- Configured value as int
-
getConfigWithFallbackLookup
Resolve the configuration value for the key as a string. If the key is not present, fallback to using a secondary key.- Parameters:
c- the Config objectkey- the configuration keyfallbackKey- the fallback key- Returns:
- Configured value as String
-
getDefaultBooleanConfigWithFallbackLookup
public static Boolean getDefaultBooleanConfigWithFallbackLookup(Config c, String key, String fallbackKey, boolean defautValue) Resolve the configuration value for the key as a string. If the key is not present, fallback to using a secondary key.- Parameters:
c- the Config objectkey- the configuration keyfallbackKey- the fallback keydefautValue- the default value- Returns:
- Configured value as String
-