/** * Reset a key in the configuration * * @param key The path to unset * @return This ServiceHelper instance */ public ServiceHelper resetConf(String key) { conf = conf.withoutPath(key); return this; }
@Override public Config withoutPath(String path) { return c.withoutPath(path); }
@SuppressWarnings({"unchecked", "rawtypes"}) private static Properties props(final Config config) { Properties props = new Properties(); config.withoutPath("run").entrySet().forEach(prop -> { Object value = prop.getValue().unwrapped(); if (value instanceof List) { value = ((List) value).stream().collect(Collectors.joining(",")); } props.setProperty("flyway." + prop.getKey(), value.toString()); }); return props; }
private Properties toProperties(final Config config) { Properties properties = new Properties(); config.withoutPath("session").entrySet().forEach(prop -> properties.setProperty("hazelcast." + prop.getKey(), prop.getValue().unwrapped().toString())); return properties; }
@VisibleForTesting public DrillConfig(Config config) { super(config); logger.debug("Setting up DrillConfig object."); // we need to exclude sun.java.command config node while logging, because // it contains user password along with other parameters logger.trace("Given Config object is:\n{}", config.withoutPath("password").withoutPath("sun.java.command") .root().render(ConfigRenderOptions.defaults())); RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); this.startupArguments = ImmutableList.copyOf(bean.getInputArguments()); logger.debug("DrillConfig object initialized."); }
private ServerConnector http(final Server server, final Config conf, final String path, final boolean http2) { HttpConfiguration httpConfig = conf(new HttpConfiguration(), conf.withoutPath(CONNECTOR), path); ServerConnector connector; if (http2) { connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig), new HTTP2CServerConnectionFactory(httpConfig)); } else { connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig)); } return conf(connector, conf.getConfig(CONNECTOR), path + "." + CONNECTOR); }
private Kafka09ConsumerClient(Config config) { super(config); Preconditions.checkArgument(config.hasPath(GOBBLIN_CONFIG_VALUE_DESERIALIZER_CLASS_KEY), "Missing required property " + GOBBLIN_CONFIG_VALUE_DESERIALIZER_CLASS_KEY); Properties props = new Properties(); props.put(KAFKA_09_CLIENT_BOOTSTRAP_SERVERS_KEY, Joiner.on(",").join(super.brokers)); props.put(KAFKA_09_CLIENT_SESSION_TIMEOUT_KEY, super.socketTimeoutMillis); // grab all the config under "source.kafka" and add the defaults as fallback. Config baseConfig = ConfigUtils.getConfigOrEmpty(config, CONFIG_NAMESPACE).withFallback(FALLBACK); // get the "source.kafka.consumerConfig" config for extra config to pass along to Kafka with a fallback to the // shared config that start with "gobblin.kafka.sharedConfig" Config specificConfig = ConfigUtils.getConfigOrEmpty(baseConfig, CONSUMER_CONFIG).withFallback( ConfigUtils.getConfigOrEmpty(config, ConfigurationKeys.SHARED_KAFKA_CONFIG_PREFIX)); // The specific config overrides settings in the base config Config scopedConfig = specificConfig.withFallback(baseConfig.withoutPath(CONSUMER_CONFIG)); props.putAll(ConfigUtils.configToProperties(scopedConfig)); this.consumer = new KafkaConsumer<>(props); }
private CacheEventListenerFactoryConfiguration newCacheEventListenerFactory( final String path, final Config config) { CacheEventListenerFactoryConfiguration factory = newFactory(path, config.withoutPath("listenFor"), CacheEventListenerFactoryConfiguration::new); sstr(path, config, "listenFor", factory::listenFor); return factory; }
@Override public String process(String filename, String source, Config conf, ClassLoader loader) { Map<String, String> options = new LinkedHashMap<>(); StringBuilder keys = new StringBuilder(); this.options.withoutPath("excludes").entrySet().forEach(e -> { String key = e.getKey()
public Map<String, Object> options() { return options.withoutPath("excludes").root().unwrapped(); }
Function<Config, Config> without = options -> { for (String path : filter) { options = options.withoutPath(path);
String key = "com.graphaware.module.m" + order; props.put(key + "." + order, type); module.withoutPath("class").root() .forEach((k, v) -> props.put(key + "." + k, v.unwrapped().toString())); });
protected <T extends FactoryConfiguration<?>> T newFactory( final String path, final Config config, final Supplier<T> supplier) { T factory = supplier.get(); sstr(path, config, "class", factory::setClass); String sep = ";"; factory.setProperties(toPropertiesLine(config.withoutPath("class"), sep)); factory.setPropertySeparator(";"); requireNonNull(factory.getFullyQualifiedClassPath(), "No .class found in: " + path); return factory; }
Config filteredConfig = rawConfig.withoutPath(FS_CATALOG_KEY_PREFIX);
private TimeoutBehaviorConfiguration timeout(final Config config) { TimeoutBehaviorConfiguration timeout = new TimeoutBehaviorConfiguration(); String sep = ";"; timeout.setProperties(toPropertiesLine(config.withoutPath("type"), sep)); timeout.setPropertySeparator(sep); timeout.setType(config.getString("type")); return timeout; }
@Override public void configure(final Env env, final Config conf, final Binder binder) { // dump rx.* as system properties conf.getConfig("rx") .withoutPath("schedulers").entrySet() .forEach( e -> System.setProperty("rx." + e.getKey(), e.getValue().unwrapped().toString())); Map<String, Executor> executors = new HashMap<>(); super.configure(env, conf, binder, executors::put); env.router() .map(rx(observable, single, completable)); /** * Side effects of global/evil static state. Hack to turn off some of this errors. */ trySchedulerHook(executors); // shutdown schedulers: silent shutdown in dev mode between app reloads env.onStop(() -> { try { Schedulers.shutdown(); } catch (Throwable ex) { log.debug("Schedulers.shutdown() resulted in error", ex); } }); }
Config userCaches = caches.withoutPath("default");
cprops = conf.getConfig("ebean." + name) .withFallback(cprops) .withoutPath(name);
private ServerConnector https(final Server server, final Config conf, final String path, final SSLContext sslContext, final boolean http2) { HttpConfiguration httpConf = conf(new HttpConfiguration(), conf.withoutPath(CONNECTOR), path); SslContextFactory sslContextFactory = new SslContextFactory(); sslContextFactory.setSslContext(sslContext); sslContextFactory.setIncludeProtocols("TLSv1.2"); sslContextFactory.setIncludeCipherSuites("TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"); HttpConfiguration httpsConf = new HttpConfiguration(httpConf); httpsConf.addCustomizer(new SecureRequestCustomizer()); HttpConnectionFactory https11 = new HttpConnectionFactory(httpsConf); if (http2) { ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory(H2, H2_17, HTTP_1_1); alpn.setDefaultProtocol(HTTP_1_1); HTTP2ServerConnectionFactory https2 = new HTTP2ServerConnectionFactory(httpsConf); ServerConnector connector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "alpn"), alpn, https2, https11); return conf(connector, conf.getConfig(CONNECTOR), path + ".connector"); } else { ServerConnector connector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HTTP_1_1), https11); return conf(connector, conf.getConfig(CONNECTOR), path + ".connector"); } }
config = config.withoutPath(profileKey);