public static Configuration getHBaseConfiguration()

in flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/util/HBaseConfigurationUtil.java [45:85]


    public static Configuration getHBaseConfiguration() {

        // Instantiate an HBaseConfiguration to load the hbase-default.xml and hbase-site.xml from
        // the classpath.
        Configuration result = HBaseConfiguration.create();
        boolean foundHBaseConfiguration = false;

        // We need to load both hbase-default.xml and hbase-site.xml to the hbase configuration
        // The properties of a newly added resource will override the ones in previous resources, so
        // a configuration
        // file with higher priority should be added later.

        // Approach 1: HBASE_HOME environment variables
        String possibleHBaseConfPath = null;

        final String hbaseHome = System.getenv("HBASE_HOME");
        if (hbaseHome != null) {
            LOG.debug("Searching HBase configuration files in HBASE_HOME: {}", hbaseHome);
            possibleHBaseConfPath = hbaseHome + "/conf";
        }

        if (possibleHBaseConfPath != null) {
            foundHBaseConfiguration = addHBaseConfIfFound(result, possibleHBaseConfPath);
        }

        // Approach 2: HBASE_CONF_DIR environment variable
        String hbaseConfDir = System.getenv("HBASE_CONF_DIR");
        if (hbaseConfDir != null) {
            LOG.debug("Searching HBase configuration files in HBASE_CONF_DIR: {}", hbaseConfDir);
            foundHBaseConfiguration =
                    addHBaseConfIfFound(result, hbaseConfDir) || foundHBaseConfiguration;
        }

        if (!foundHBaseConfiguration) {
            LOG.warn(
                    "Could not find HBase configuration via any of the supported methods "
                            + "(Flink configuration, environment variables).");
        }

        return result;
    }