Refine search
/** Adds the entry listeners settings. */ private void addListeners() { for (String path : merged.getStringList("listeners")) { Config listener = root.getConfig(path); Factory<? extends CacheEntryListener<? super K, ? super V>> listenerFactory = factoryCreator.factoryOf(listener.getString("class")); Factory<? extends CacheEntryEventFilter<? super K, ? super V>> filterFactory = null; if (listener.hasPath("filter")) { filterFactory = factoryCreator.factoryOf(listener.getString("filter")); } boolean oldValueRequired = listener.getBoolean("old-value-required"); boolean synchronous = listener.getBoolean("synchronous"); configuration.addCacheEntryListenerConfiguration( new MutableCacheEntryListenerConfiguration<>( listenerFactory, filterFactory, oldValueRequired, synchronous)); } }
public HOCONInputStreamJobTemplate(Config config, URI uri, JobCatalogWithTemplates catalog) throws SpecNotFoundException, TemplateException { super(uri, config.hasPath(VERSION_KEY) ? config.getString(VERSION_KEY) : DEFAULT_VERSION, config.hasPath(ConfigurationKeys.JOB_DESCRIPTION_KEY) ? config.getString(ConfigurationKeys.JOB_DESCRIPTION_KEY) : "", config, catalog); } }
/** * Check if the given <code>key</code> exists in <code>config</code> and it is not null or empty * Uses {@link StringUtils#isNotBlank(CharSequence)} * @param config which may have the key * @param key to look for in the config * * @return True if key exits and not null or empty. False otherwise */ public static boolean hasNonEmptyPath(Config config, String key) { return config.hasPath(key) && StringUtils.isNotBlank(config.getString(key)); }
private String getJobConfigurationFileExtensionsString() { String propValue = this.cfg.hasPath(ConfigurationKeys.JOB_CONFIG_FILE_EXTENSIONS_KEY) ? this.cfg.getString(ConfigurationKeys.JOB_CONFIG_FILE_EXTENSIONS_KEY).toLowerCase() : ConfigurationKeys.DEFAULT_JOB_CONFIG_FILE_EXTENSIONS; return propValue; } }
public JobConfigurationManager(EventBus eventBus, Config config) { this.eventBus = eventBus; this.config = config; this.jobConfDirPath = config.hasPath(GobblinClusterConfigurationKeys.JOB_CONF_PATH_KEY) ? Optional .of(config.getString(GobblinClusterConfigurationKeys.JOB_CONF_PATH_KEY)) : Optional.<String>absent(); }
public ConfigDrivenMd5SchemaRegistry(Config config) throws IOException, SchemaRegistryException { if (config.hasPath(ConfigurationKeys.SCHEMA_NAME_KEY)) { String name = config.getString(ConfigurationKeys.SCHEMA_NAME_KEY); String value = config.getString(ConfigurationKeys.SCHEMA_VALUE_KEY); Schema schema = new Schema.Parser().parse(value); register(name, schema); } }
/** * Build the {@link FileSystem} for the Application Master. */ private FileSystem buildFileSystem(Config config) throws IOException { return config.hasPath(ConfigurationKeys.FS_URI_KEY) ? FileSystem .get(URI.create(config.getString(ConfigurationKeys.FS_URI_KEY)), new Configuration()) : FileSystem.get(new Configuration()); }
public GobblinInstancePlugin createPlugin(Config sysConfig) { if (!sysConfig.hasPath(PluginStaticKeys.LOGIN_USER_FULL_KEY)) { throw new RuntimeException("Missing required sys config: " + PluginStaticKeys.LOGIN_USER_FULL_KEY); } if (!sysConfig.hasPath(PluginStaticKeys.LOGIN_USER_KEYTAB_FILE_FULL_KEY)) { throw new RuntimeException("Missing required sys config: " + PluginStaticKeys.LOGIN_USER_KEYTAB_FILE_FULL_KEY); } String loginUser = sysConfig.getString(PluginStaticKeys.LOGIN_USER_FULL_KEY); String loginUserKeytabFile = sysConfig.getString(PluginStaticKeys.LOGIN_USER_KEYTAB_FILE_FULL_KEY); return new HadoopKerberosKeytabAuthenticationPlugin(sysConfig, loginUser, loginUserKeytabFile); } }
static Config load() { Config config = ConfigFactory.load();//扫描加载所有可用的配置文件 String custom_conf = "mp.conf";//加载自定义配置, 值来自jvm启动参数指定-Dmp.conf if (config.hasPath(custom_conf)) { File file = new File(config.getString(custom_conf)); if (file.exists()) { Config custom = ConfigFactory.parseFile(file); config = custom.withFallback(config); } } return config; }
@ValidateMe public byte[] getMineExtraData() { byte[] bytes; if (config.hasPath("mine.extraDataHex")) { bytes = Hex.decode(config.getString("mine.extraDataHex")); } else { bytes = config.getString("mine.extraData").getBytes(); } if (bytes.length > 32) throw new RuntimeException("mine.extraData exceed 32 bytes length: " + bytes.length); return bytes; }
public SelectBetweenTimeBasedPolicy(Config conf) { this(conf.hasPath(TIME_BASED_SELECTION_MIN_LOOK_BACK_TIME_KEY) ? Optional.of(getLookBackPeriod(conf .getString(TIME_BASED_SELECTION_MIN_LOOK_BACK_TIME_KEY))) : Optional.<Period> absent(), conf .hasPath(TIME_BASED_SELECTION_MAX_LOOK_BACK_TIME_KEY) ? Optional.of(getLookBackPeriod(conf .getString(TIME_BASED_SELECTION_MAX_LOOK_BACK_TIME_KEY))) : Optional.<Period> absent()); }
private static Period getMaxLookbackTime(Config conf) { Preconditions.checkArgument(conf.hasPath(TIME_BASED_SELECTION_LOOK_BACK_TIME_KEY), String.format("Required property %s is not specified", TIME_BASED_SELECTION_LOOK_BACK_TIME_KEY)); return SelectBetweenTimeBasedPolicy.getLookBackPeriod(conf.getString(TIME_BASED_SELECTION_LOOK_BACK_TIME_KEY)); } }