Search in sources :

Example 1 with VersionDoesNotExistException

use of org.apache.gobblin.config.store.api.VersionDoesNotExistException 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;
}
Also used : ConfigClient(org.apache.gobblin.config.client.ConfigClient) VersionDoesNotExistException(org.apache.gobblin.config.store.api.VersionDoesNotExistException) ConfigStoreCreationException(org.apache.gobblin.config.store.api.ConfigStoreCreationException) WorkUnitState(org.apache.gobblin.configuration.WorkUnitState) State(org.apache.gobblin.configuration.State) WorkingState(org.apache.gobblin.configuration.WorkUnitState.WorkingState) SourceState(org.apache.gobblin.configuration.SourceState) ConfigStoreFactoryDoesNotExistsException(org.apache.gobblin.config.client.api.ConfigStoreFactoryDoesNotExistsException)

Aggregations

ConfigClient (org.apache.gobblin.config.client.ConfigClient)1 ConfigStoreFactoryDoesNotExistsException (org.apache.gobblin.config.client.api.ConfigStoreFactoryDoesNotExistsException)1 ConfigStoreCreationException (org.apache.gobblin.config.store.api.ConfigStoreCreationException)1 VersionDoesNotExistException (org.apache.gobblin.config.store.api.VersionDoesNotExistException)1 SourceState (org.apache.gobblin.configuration.SourceState)1 State (org.apache.gobblin.configuration.State)1 WorkUnitState (org.apache.gobblin.configuration.WorkUnitState)1 WorkingState (org.apache.gobblin.configuration.WorkUnitState.WorkingState)1