use of org.apache.gobblin.config.client.api.ConfigStoreFactoryDoesNotExistsException in project incubator-gobblin by apache.
the class ConfigClientBasedPolicyFactory method createPolicy.
@Override
public ThrottlingPolicy createPolicy(SharedLimiterKey key, SharedResourcesBroker<ThrottlingServerScopes> broker, Config config) {
try {
Config resourceConfig = getConfigClient().getConfig(new URI(config.getString(CONFIG_KEY_URI_PREFIX_KEY) + key.getResourceLimitedPath()));
ThrottlingPolicyFactory.SpecificPolicyFactory factory = ThrottlingPolicyFactory.POLICY_CLASS_RESOLVER.resolveClass(resourceConfig.getString(POLICY_KEY)).newInstance();
return factory.createPolicy(key, broker, ConfigUtils.getConfigOrEmpty(resourceConfig, THROTTLING_CONFIG_PREFIX));
} catch (URISyntaxException | ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException | ReflectiveOperationException exc) {
throw new RuntimeException(exc);
}
}
use of org.apache.gobblin.config.client.api.ConfigStoreFactoryDoesNotExistsException in project incubator-gobblin by apache.
the class QueryBasedSource method getTableSpecificPropsFromConfigStore.
private static Map<SourceEntity, State> getTableSpecificPropsFromConfigStore(Collection<SourceEntity> tables, State state) {
ConfigClient client = ConfigClientCache.getClient(VersionStabilityPolicy.STRONG_LOCAL_STABILITY);
String configStoreUri = state.getProp(ConfigurationKeys.CONFIG_MANAGEMENT_STORE_URI);
Preconditions.checkNotNull(configStoreUri);
Map<SourceEntity, State> result = Maps.newHashMap();
for (SourceEntity table : tables) {
try {
result.put(table, ConfigUtils.configToState(client.getConfig(PathUtils.combinePaths(configStoreUri, QUERY_BASED_SOURCE, table.getDatasetName()).toUri())));
} catch (VersionDoesNotExistException | ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException e) {
throw new RuntimeException("Unable to get table config for " + table, e);
}
}
return result;
}
Aggregations