Class ConfigUtil

java.lang.Object
io.strimzi.kafka.oauth.common.ConfigUtil

public class ConfigUtil extends Object
The helper class with methods used in multiple places.
  • Constructor Details

    • ConfigUtil

      public ConfigUtil()
  • Method Details

    • createSSLFactory

      public static SSLSocketFactory createSSLFactory(Config config)
      Create the javax.net.ssl.SSLSocketFactory from configuration in the passed Config object.
      Parameters:
      config - The Config object containing the configuration
      Returns:
      The javax.net.ssl.SSLSocketFactory based on the passed configuration
    • createHostnameVerifier

      public static HostnameVerifier createHostnameVerifier(Config config)
      Create the HostnameVerifier from configuration in the passed Config object.
      Parameters:
      config - The Config object containing the configuration
      Returns:
      The javax.net.ssl.HostnameVerifier based on the passed configuration
    • putIfNotNull

      public static void putIfNotNull(Properties p, String key, Object value)
      Helper method that puts the key-value pair into the passed java.util.Properties only if the value is not null.
      Parameters:
      p - Destination Properties object
      key - The key
      value - The value
    • getConnectTimeout

      public static int getConnectTimeout(Config config)
      Resolve the value of the Config.OAUTH_CONNECT_TIMEOUT_SECONDS configuration
      Parameters:
      config - the Config object
      Returns:
      Configured value as int
    • getReadTimeout

      public static int getReadTimeout(Config config)
      Resolve the value of the Config.OAUTH_READ_TIMEOUT_SECONDS configuration
      Parameters:
      config - the Config object
      Returns:
      Configured value as int
    • getTimeoutAppendingWarnings

      public static int getTimeoutAppendingWarnings(Config c, String key, List<String> warnings)
      Resolve the configuration value for the key as a timeout in seconds with the default value of 60
      Parameters:
      c - the Config object
      key - the configuration key
      warnings - 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 object
      key - the configuration key
      fallbackKey - the fallback key
      warnings - a warnings list where any warnings should be added, and will later be logged as WARN
      Returns:
      Configured value as int
    • getConfigWithFallbackLookup

      public static String getConfigWithFallbackLookup(Config c, String key, String fallbackKey)
      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 object
      key - the configuration key
      fallbackKey - 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 object
      key - the configuration key
      fallbackKey - the fallback key
      defautValue - the default value
      Returns:
      Configured value as String