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;
}
Aggregations