Search in sources :

Example 1 with ConfigStoreWithResolution

use of org.apache.gobblin.config.store.api.ConfigStoreWithResolution in project incubator-gobblin by apache.

the class ConfigStoreBackedValueInspector method getResolvedConfigRecursive.

private Config getResolvedConfigRecursive(ConfigKeyPath configKey, Set<String> alreadyLoadedPaths, Optional<Config> runtimeConfig) {
    if (this.cs instanceof ConfigStoreWithResolution) {
        return ((ConfigStoreWithResolution) this.cs).getResolvedConfig(configKey, this.version);
    }
    if (!alreadyLoadedPaths.add(configKey.getAbsolutePathString())) {
        return ConfigFactory.empty();
    }
    Config initialConfig = this.getOwnConfig(configKey);
    if (configKey.isRootPath()) {
        return initialConfig;
    }
    List<ConfigKeyPath> ownImports = this.topology.getOwnImports(configKey, runtimeConfig);
    // merge with other configs from imports
    if (ownImports != null) {
        for (ConfigKeyPath p : ownImports) {
            initialConfig = initialConfig.withFallback(this.getResolvedConfigRecursive(p, alreadyLoadedPaths, runtimeConfig));
        }
    }
    // merge with configs from parent for Non root
    initialConfig = initialConfig.withFallback(this.getResolvedConfigRecursive(configKey.getParent(), alreadyLoadedPaths, runtimeConfig));
    return initialConfig;
}
Also used : ConfigStoreWithResolution(org.apache.gobblin.config.store.api.ConfigStoreWithResolution) Config(com.typesafe.config.Config) ConfigKeyPath(org.apache.gobblin.config.store.api.ConfigKeyPath)

Aggregations

Config (com.typesafe.config.Config)1 ConfigKeyPath (org.apache.gobblin.config.store.api.ConfigKeyPath)1 ConfigStoreWithResolution (org.apache.gobblin.config.store.api.ConfigStoreWithResolution)1