Class ConfigUtils


  • public class ConfigUtils
    extends Object
    Utilities class for configuration of Hadoop and Google Storage.
    • Constructor Detail

      • ConfigUtils

        public ConfigUtils()
    • Method Detail

      • getHadoopConfiguration

        public static org.apache.hadoop.conf.Configuration getHadoopConfiguration​(Configuration flinkConfig,
                                                                                  ConfigUtils.ConfigContext configContext)
        Loads the Hadoop configuration, by loading from a Hadoop conf dir (if one exists) and then overlaying properties derived from the Flink config.
        Parameters:
        flinkConfig - The Flink config
        configContext - The config context.
        Returns:
        The Hadoop config.
      • getStorageCredentials

        public static Optional<com.google.auth.oauth2.GoogleCredentials> getStorageCredentials​(org.apache.hadoop.conf.Configuration hadoopConfig,
                                                                                               ConfigUtils.ConfigContext configContext)
        Creates an (optional) GoogleCredentials instance for the given Hadoop config and environment.
        Parameters:
        hadoopConfig - The Hadoop config.
        configContext - The config context.
        Returns:
        The optional GoogleCredentials instance.
      • getGcsRootUrl

        public static Optional<String> getGcsRootUrl​(org.apache.hadoop.conf.Configuration hadoopConfig)
      • stringifyHadoopConfig

        public static String stringifyHadoopConfig​(org.apache.hadoop.conf.Configuration hadoopConfig)
                                            throws RuntimeException
        Helper to serialize a Hadoop config to a string, for logging.
        Parameters:
        hadoopConfig - The Hadoop config.
        Returns:
        A string with the Hadoop properties.
        Throws:
        RuntimeException - On underlying IO failure