@Override public S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, FileSystemKey> config) { return broker.selfScope().getType().rootScope(); } }
/** * Get a {@link org.apache.gobblin.broker.iface.ConfigView} for the input scope, key, and factory. */ public <K extends SharedResourceKey> KeyedScopedConfigViewImpl<S, K> getConfigView(S scope, K key, String factoryName) { Config config = ConfigFactory.empty(); for (ScopedConfig<S> scopedConfig : this.scopedConfigs) { if (scopedConfig.getScopeType().equals(scopedConfig.getScopeType().rootScope())) { config = ConfigUtils.getConfigOrEmpty(scopedConfig.getConfig(), factoryName).withFallback(config); } else if (scope != null && SharedResourcesBrokerUtils.isScopeTypeAncestor(scope, scopedConfig.getScopeType())) { Config tmpConfig = ConfigUtils.getConfigOrEmpty(scopedConfig.getConfig(), factoryName); tmpConfig = ConfigUtils.getConfigOrEmpty(tmpConfig, scope.name()); config = tmpConfig.atKey(scope.name()).withFallback(config); } } return new KeyedScopedConfigViewImpl<>(scope, key, factoryName, config); }
/** * Determine if a {@link ScopeType} is an ancestor of another {@link ScopeType}. */ public static <S extends ScopeType<S>> boolean isScopeTypeAncestor(S scopeType, S possibleAncestor) { Queue<S> ancestors = new LinkedList<>(); ancestors.add(scopeType); while (true) { if (ancestors.isEmpty()) { return false; } if (ancestors.peek().equals(possibleAncestor)) { return true; } Collection<S> parentScopes = ancestors.poll().parentScopes(); if (parentScopes != null) { ancestors.addAll(parentScopes); } } }
public Config getScopedConfig() { if (this.scope == null) { return ConfigFactory.empty(); } return ConfigUtils.getConfigOrEmpty(this.fullConfig, this.scope.name()); }
Collection<S> parents = config.getScope().parentScopes(); if (parents != null && !parents.isEmpty()) { S parentScope = parents.iterator().next(); config.getScope().name() + "_" + UUID.randomUUID().toString() : broker.selfScope().getScopeId(); builder.addTag(new Tag<>(config.getScope().name(), broker.getScope(config.getScope()).getScopeId())); for (Map.Entry<String, ConfigValue> entry : ConfigUtils.getConfigOrEmpty(config.getConfig(), TAG_KEY).entrySet()) { builder.addTag(new Tag<>(entry.getKey(), entry.getValue().unwrapped()));
if (!configView.getScope().isLocal() && !globalLimiterPolicy.equals(SharedLimiterKey.GlobalLimiterPolicy.LOCAL_ONLY)) { try { Class<?> klazz = Class.forName("org.apache.gobblin.util.limiter.RestliLimiterFactory"); Collection<S> parentScopes = scope.parentScopes(); if (parentScopes != null) { try {
/** * Generate a {@link org.apache.gobblin.broker.iface.SharedResourcesBroker} configuration key for a particular {@link SharedResourceFactory}, * {@link SharedResourceKey} and {@link ScopeType}. * * Example: * If the broker configuration contains a key-value pair with key: * generateKey(myFactory, myKey, myScopeType, "sample.key") * when requesting a resource created by myFactory, with the provided key and scope, the factory will be able to see * the key-value pair specified. * * Note: * {@link SharedResourceKey} and {@link ScopeType} may be null. In this case, the key-value pair will be visible to * the factory regardless of the key and scope requested by the user. */ @Builder public static String generateKey(@Nonnull SharedResourceFactory factory, SharedResourceKey key, ScopeType scopeType, @Nonnull String configKey) { return JOINER.join(BrokerConstants.GOBBLIN_BROKER_CONFIG_PREFIX, factory.getName(), scopeType == null ? null : scopeType.name(), key == null ? null : key.toConfigurationKey(), configKey); }
Collection<S> parents = config.getScope().parentScopes(); if (parents != null && !parents.isEmpty()) { S parentScope = parents.iterator().next(); config.getScope().name() + "_" + UUID.randomUUID().toString() : broker.selfScope().getScopeId(); builder.addTag(new Tag<>(config.getScope().name(), broker.getScope(config.getScope()).getScopeId())); for (Map.Entry<String, ConfigValue> entry : ConfigUtils.getConfigOrEmpty(config.getConfig(), TAG_KEY).entrySet()) { builder.addTag(new Tag<>(entry.getKey(), entry.getValue().unwrapped()));
if (!configView.getScope().isLocal() && !globalLimiterPolicy.equals(SharedLimiterKey.GlobalLimiterPolicy.LOCAL_ONLY)) { try { Class<?> klazz = Class.forName("org.apache.gobblin.util.limiter.RestliLimiterFactory"); Collection<S> parentScopes = scope.parentScopes(); if (parentScopes != null) { try {
@Override public S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, SharedRestClientKey> config) { return broker.selfScope().getType().rootScope(); } }
/** * Get a {@link org.apache.gobblin.broker.iface.ConfigView} for the input scope, key, and factory. */ public <K extends SharedResourceKey> KeyedScopedConfigViewImpl<S, K> getConfigView(S scope, K key, String factoryName) { Config config = ConfigFactory.empty(); for (ScopedConfig<S> scopedConfig : this.scopedConfigs) { if (scopedConfig.getScopeType().equals(scopedConfig.getScopeType().rootScope())) { config = ConfigUtils.getConfigOrEmpty(scopedConfig.getConfig(), factoryName).withFallback(config); } else if (scope != null && SharedResourcesBrokerUtils.isScopeTypeAncestor(scope, scopedConfig.getScopeType())) { Config tmpConfig = ConfigUtils.getConfigOrEmpty(scopedConfig.getConfig(), factoryName); tmpConfig = ConfigUtils.getConfigOrEmpty(tmpConfig, scope.name()); config = tmpConfig.atKey(scope.name()).withFallback(config); } } return new KeyedScopedConfigViewImpl<>(scope, key, factoryName, config); }
public Config getKeyedScopedConfig() { if (this.scope == null || this.key.toConfigurationKey() == null) { return ConfigFactory.empty(); } return ConfigUtils.getConfigOrEmpty(this.fullConfig, chainConfigKeys(this.scope.name(), this.key.toConfigurationKey())); }
/** * Determine if a {@link ScopeType} is an ancestor of another {@link ScopeType}. */ public static <S extends ScopeType<S>> boolean isScopeTypeAncestor(S scopeType, S possibleAncestor) { Queue<S> ancestors = new LinkedList<>(); ancestors.add(scopeType); while (true) { if (ancestors.isEmpty()) { return false; } if (ancestors.peek().equals(possibleAncestor)) { return true; } Collection<S> parentScopes = ancestors.poll().parentScopes(); if (parentScopes != null) { ancestors.addAll(parentScopes); } } }
@Override public S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, SharedLimiterKey> config) { return broker.selfScope().getType().rootScope(); } }
throw new RuntimeException(String .format("%s returned an invalid coordinate: scope %s is not available.", factory.getName(), resourceCoordinate.getScope().name()), nsse);
@Override public S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, MysqlDataSourceKey> config) { return broker.selfScope().getType().rootScope(); } }
/** * Generate a {@link org.apache.gobblin.broker.iface.SharedResourcesBroker} configuration key for a particular {@link SharedResourceFactory}, * {@link SharedResourceKey} and {@link ScopeType}. * * Example: * If the broker configuration contains a key-value pair with key: * generateKey(myFactory, myKey, myScopeType, "sample.key") * when requesting a resource created by myFactory, with the provided key and scope, the factory will be able to see * the key-value pair specified. * * Note: * {@link SharedResourceKey} and {@link ScopeType} may be null. In this case, the key-value pair will be visible to * the factory regardless of the key and scope requested by the user. */ @Builder public static String generateKey(@Nonnull SharedResourceFactory factory, SharedResourceKey key, ScopeType scopeType, @Nonnull String configKey) { return JOINER.join(BrokerConstants.GOBBLIN_BROKER_CONFIG_PREFIX, factory.getName(), scopeType == null ? null : scopeType.name(), key == null ? null : key.toConfigurationKey(), configKey); }
@Override public S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, SharedHiveConfKey> config) { return broker.selfScope().getType().rootScope(); } }
public Config getScopedConfig() { if (this.scope == null) { return ConfigFactory.empty(); } return ConfigUtils.getConfigOrEmpty(this.fullConfig, this.scope.name()); }
@Override public S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, SharedRestClientKey> config) { return broker.selfScope().getType().rootScope(); }