List of usage examples for org.apache.commons.configuration Configuration getString
String getString(String key);
From source file:com.boozallen.cognition.ingest.accumulo.storm.AccumuloEventStorageBolt.java
@Override void configureAccumuloBolt(Configuration conf) { eventTable = conf.getString(EVENT_TABLE); uuidPrefix = conf.getString(UUID_PREFIX, UUID_PREFIX_DEFAULT); splits = conf.getInt(SPLITS, SPLITS_DEFAULT); visibility = conf.getString(VISIBILITY); visibilityByField = conf.getString(VISIBILITY_BY_FIELD); Validate.notBlank(eventTable);//from ww w . j av a 2 s . c o m }
From source file:com.netflix.client.config.DefaultClientConfigImpl.java
/** * This is to workaround the issue that {@link AbstractConfiguration} by default * automatically convert comma delimited string to array *//*from www . j a va 2 s . c o m*/ protected static String getStringValue(Configuration config, String key) { try { String values[] = config.getStringArray(key); if (values == null) { return null; } if (values.length == 0) { return config.getString(key); } else if (values.length == 1) { return values[0]; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < values.length; i++) { sb.append(values[i]); if (i != values.length - 1) { sb.append(","); } } return sb.toString(); } catch (Exception e) { Object v = config.getProperty(key); if (v != null) { return String.valueOf(v); } else { return null; } } }
From source file:com.appeligo.captions.DeleteOldProgramsThread.java
private DeleteOldProgramsThread() { Configuration config = ConfigUtils.getSystemConfig(); liveIndexLocation = config.getString("luceneLiveIndex"); liveLineup = config.getString("liveLineup"); }
From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.mutation.EvolutionaryStrategyMutation.java
@Override public void configure(Configuration conf) { try {// w ww . j a va 2 s . c om this.operator = (MutationOperator) Class.forName(conf.getString("Operator")).newInstance(); this.operator.configure(conf); } catch (Exception ex) { throw new ConfigurationException(this.getClass(), ex); } }
From source file:com.brunomcustodio.dojo.keycloak.auth.AuthServiceEndpointsImpl.java
public AuthServiceEndpointsImpl() throws ConfigurationException { Configuration config = new PropertiesConfiguration("auth.properties"); bauth = BasicAuth.createHeader(config.getString("keycloak.client"), config.getString("keycloak.secret")); realm = config.getString("keycloak.realm"); Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); RestAdapter.Builder builder = new RestAdapter.Builder(); builder.setConverter(new GsonConverter(gson)); builder.setEndpoint(config.getString("keycloak.root")); RestAdapter ra = builder.build();//from w w w. j a v a 2 s . com client = ra.create(KeycloakClient.class); }
From source file:com.denimgroup.threadfix.cli.HttpRestUtilsTests.java
@Test public void testSetUrl() { PropertiesManager utils = new PropertiesManager(); utils.setUrl(TestPropertiesManager.URL); try {// w ww . j a va 2 s .co m Configuration properties = new PropertiesConfiguration("threadfix.properties"); assertEquals(TestPropertiesManager.URL, properties.getString("url")); } catch (ConfigurationException e) { assertFalse(true); } }
From source file:com.impetus.kundera.ycsb.runner.MongoRunner.java
public MongoRunner(final String propertyFile, final Configuration config) { super(propertyFile, config); this.startMongoServerCommand = config.getString("server.location"); operationUtils = new MongoDBOperationUtils(); url = "mongodb://" + host + ":" + port; }
From source file:com.evolveum.midpoint.init.ConfigurationLoadTest.java
@Test(enabled = false) public void t03complexConfigTest() { LOGGER.info("---------------- complexConfigTest -----------------"); System.setProperty("midpoint.home", "target/midPointHome/"); StartupConfiguration sc = new StartupConfiguration(); assertNotNull(sc);//from w w w .j av a 2s . c om sc.init(); Configuration c = sc.getConfiguration("midpoint"); assertEquals(c.getString("repository.repositoryServiceFactoryClass"), "com.evolveum.midpoint.repo.xml.XmlRepositoryServiceFactory"); @SuppressWarnings("unchecked") Iterator<String> i = c.getKeys(); while (i.hasNext()) { String key = i.next(); LOGGER.info(" " + key + " = " + c.getString(key)); } assertEquals(c.getString("repository.serverPath"), "target/midPointHome/"); //cleanup System.clearProperty("midpoint.home"); }
From source file:com.denimgroup.threadfix.cli.HttpRestUtilsTests.java
@Test public void testSetKey() { PropertiesManager utils = new PropertiesManager(); utils.setKey(TestPropertiesManager.API_KEY); try {/*from w w w.ja v a2 s.co m*/ Configuration properties = new PropertiesConfiguration("threadfix.properties"); assertEquals(TestPropertiesManager.API_KEY, properties.getString("key")); } catch (ConfigurationException e) { assertFalse(true); } }
From source file:com.evolveum.midpoint.init.TestConfigurationLoad.java
@Test public void test010SimpleConfigTest() { LOGGER.info("---------------- test010SimpleConfigTest -----------------"); System.clearProperty("midpoint.home"); LOGGER.info("midpoint.home => " + System.getProperty("midpoint.home")); assertNull(System.getProperty("midpoint.home"), "midpoint.home"); StartupConfiguration sc = new StartupConfiguration(); assertNotNull(sc);/*ww w.j ava 2 s . c om*/ sc.init(); Configuration c = sc.getConfiguration("midpoint.repository"); assertEquals(c.getString("repositoryServiceFactoryClass"), "com.evolveum.midpoint.repo.sql.SqlRepositoryFactory"); LOGGER.info(sc.toString()); @SuppressWarnings("unchecked") Iterator<String> i = c.getKeys(); while (i.hasNext()) { String key = i.next(); LOGGER.info(" " + key + " = " + c.getString(key)); } assertEquals(c.getBoolean("asServer"), true); assertEquals(c.getString("baseDir"), System.getProperty("midpoint.home")); }