/** * 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); }
public Config getScopedConfig() { if (this.scope == null) { return ConfigFactory.empty(); } return ConfigUtils.getConfigOrEmpty(this.fullConfig, this.scope.name()); }
/** * 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())); }
throw new RuntimeException(String .format("%s returned an invalid coordinate: scope %s is not available.", factory.getName(), resourceCoordinate.getScope().name()), nsse);
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()));
/** * 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); }
public Config getScopedConfig() { if (this.scope == null) { return ConfigFactory.empty(); } return ConfigUtils.getConfigOrEmpty(this.fullConfig, this.scope.name()); }
/** * 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())); }
throw new RuntimeException(String .format("%s returned an invalid coordinate: scope %s is not available.", factory.getName(), resourceCoordinate.getScope().name()), nsse);
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()));