List of usage examples for org.apache.commons.configuration Configuration getString
String getString(String key);
From source file:com.boozallen.cognition.ingest.storm.bolt.logic.SkipFieldValueBolt.java
@Override public void configure(Configuration conf) { field = conf.getString(FIELD); value = conf.getString(VALUE);// w w w . j a v a2s .c o m Validate.notBlank(field); Validate.notBlank(value); }
From source file:com.yahoo.ads.pb.PistachiosServer.java
public static Producer getKafkaProducerInstance() { try {//from ww w . j ava 2 s. c om if (kafkaProducer == null) { synchronized (logger) { if (kafkaProducer == null) { logger.debug("first time using kafka producer, creating it"); try { Properties props = new Properties(); Configuration conf = ConfigurationManager.getConfiguration(); @SuppressWarnings("unchecked") Iterator<String> iter = conf.getKeys(); while (iter.hasNext()) { String key = iter.next(); if (key.startsWith("kafka.") == true) { String stormSetting = key.substring(6); props.put(stormSetting, conf.getString(key)); logger.info("Strom setting::{}={}", stormSetting, conf.getString(key)); } } ProducerConfig kafkaConf = new ProducerConfig(props); kafkaProducer = new Producer<String, byte[]>(kafkaConf); } catch (Throwable t) { logger.error("Exception in creating Producer:", t); } logger.debug("created kafka producer"); } } } } catch (Throwable t) { logger.error("error creating kafka producer instance", t); } return kafkaProducer; }
From source file:br.gov.frameworkdemoiselle.internal.implementation.ConfigurationStringValueExtractor.java
@Override public Object getValue(String prefix, String key, Field field, Configuration configuration) throws Exception { return configuration.getString(prefix + key); }
From source file:fr.inria.atlanmod.neoemf.data.blueprints.neo4j.config.InternalBlueprintsNeo4jConfiguration.java
@Override public void putDefaultConfiguration(Configuration currentConfiguration, File dbLocation) { if (isNull(currentConfiguration.getString(DIRECTORY))) { currentConfiguration.addProperty(DIRECTORY, dbLocation.getAbsolutePath()); }/*from w w w . ja v a 2s .c o m*/ }
From source file:com.evolveum.midpoint.init.ProtectorConfiguration.java
public ProtectorConfiguration(Configuration configuration) { this.setKeyStorePath(configuration.getString("protectorClass")); this.setKeyStorePath(configuration.getString("keyStorePath")); this.setKeyStorePassword(configuration.getString("keyStorePassword")); this.setEncryptionKeyAlias(configuration.getString("encryptionKeyAlias")); this.setXmlCipher(configuration.getString("xmlCipher")); }
From source file:com.nesscomputing.config.HierarchyConfigTest.java
@Test public void testSuperConfig() { Config ts = Config.getConfig("classpath:/test-config/hierarchy", "test:test_super"); Configuration c = ts.getConfiguration(); Assert.assertEquals("yay", c.getString("hi")); Assert.assertEquals("frob", c.getString("yay")); }
From source file:com.cisco.oss.foundation.message.ConfigurationMessageIdentifier.java
public ConfigurationMessageIdentifier() { Configuration config = ConfigurationFactory.getConfiguration(); identifierProperty = config.getString(MESSAGE_IDENTIFIER_PROPERTY); }
From source file:fr.obeo.sonar.plugin.regexfilefilter.RegexFileFilter.java
private Pattern parseFilter(Configuration conf) { final String regex = conf.getString(RegexFileFilterConstants.FILTER_PROPERTY); try {/*w ww . jav a 2s . co m*/ if (regex == null || regex.length() == 0) { return Pattern.compile(""); } return Pattern.compile(regex); } catch (PatternSyntaxException e) { throw new SonarException("Parameter " + regex + " is not a valid regular expression.", e); } }
From source file:com.wingnest.rexster.config.JpaGraphConfiguration.java
@Override public Graph configureGraphInstance(GraphConfigurationContext confContext) throws GraphConfigurationException { Configuration properties = confContext.getProperties(); String unitName = properties.getString(TOKEN_JPA_GRAPH_UNIT_NAME); Iterator<String> it = properties.getKeys(TOKEN_PROPERTIES); Properties props = new Properties(); while (it.hasNext()) { String key = it.next();//from w w w.ja va2 s.c o m String newkey = key.substring(TOKEN_PROPERTIES.length() + 1).replaceAll("\\.\\.", "."); props.put(newkey, properties.getString(key)); } return new JpaGraph(unitName, props); }
From source file:com.boozallen.cognition.ingest.storm.bolt.logging.AbstractLoggingBolt.java
@Override public void configure(Configuration conf) throws ConfigurationException { level = Level.toLevel(conf.getString(LEVEL), Level.DEBUG); }