List of usage examples for org.apache.commons.configuration PropertiesConfiguration PropertiesConfiguration
public PropertiesConfiguration(URL url) throws ConfigurationException
From source file:com.vmware.bdd.security.TestEncryptionGuard.java
@BeforeClass public static void setUp() throws Exception { PropertiesConfiguration config = new PropertiesConfiguration(VC_PROPERTIES_NAME); String fileName = config.getPath(); String path = fileName.substring(0, fileName.length() - VC_PROPERTIES_NAME.length()); String keyFilePath = path + "guard.key"; Configuration.setString("cms.guard_keystore", keyFilePath); }
From source file:club.jmint.crossing.config.Config.java
public static PropertiesConfiguration loadPropertiesConfigFile(String file) { PropertiesConfiguration config = null; try {/*www. jav a2 s .c o m*/ //String fileName = Constants.DIR_CONF+File.separator+file; config = new PropertiesConfiguration(file); //System.out.println(config); } catch (ConfigurationException e) { // TODO Auto-generated catch block CrossLog.printStackTrace(e); } return config; }
From source file:com.carmatech.maven.utils.MergeUtils.java
public static PropertiesConfiguration toProperties(final File propertiesFile) throws IOException { try {/*from ww w .j av a 2 s. c o m*/ return new PropertiesConfiguration(propertiesFile); } catch (ConfigurationException e) { throw new IOException("Unable to load properties file " + propertiesFile, e); } }
From source file:fr.jetoile.hadoopunit.sample.kafka.KafkaStreamsJobTest.java
@BeforeClass public static void setUp() throws ConfigurationException { configuration = new PropertiesConfiguration(HadoopUnitConfig.DEFAULT_PROPS_FILE); }
From source file:fr.jetoile.hadoopunit.sample.kafka.KafkaStreamsJobWithUnitTest.java
@BeforeClass public static void setUp() throws ConfigurationException { configuration = new PropertiesConfiguration(HadoopUnitConfig.DEFAULT_PROPS_FILE); HadoopBootstrap.INSTANCE.startAll(); }
From source file:club.jmint.mifty.config.Config.java
public static PropertiesConfiguration loadPropertiesConfigFile(String file) { PropertiesConfiguration config = null; try {//ww w . j av a2 s . c o m //String fileName = Constants.DIR_CONF+File.separator+file; config = new PropertiesConfiguration(file); //System.out.println(config); } catch (ConfigurationException e) { CrossLog.printStackTrace(e); } return config; }
From source file:europarl.Cfg.java
public static boolean load_config(String filename) { File f = new File(filename); if (!f.exists()) { try {// w ww. jav a2 s . c o m f.createNewFile(); } catch (IOException exc) { log.warn("Can't create the file: " + exc); } } try { cfg = new PropertiesConfiguration(f); cfg.setThrowExceptionOnMissing(false); init_default(); cfg.save(f); return true; } catch (ConfigurationException exc)//error reading: IO, file format... { log.error("Error when loading config: " + exc); return false; } }
From source file:eu.forgetit.middleware.ConfigurationManager.java
public static Configuration getConfiguration() { if (configuration == null) { try {// w w w . ja v a 2s . com configuration = new PropertiesConfiguration(PROPERTY_FILE); } catch (ConfigurationException e) { e.printStackTrace(); } } return configuration; }
From source file:com.thelastcheck.commons.base.utils.Configurations.java
/** * static factory method for building properties files with no checked exception thrown * * @param fileName/* w w w . ja va 2 s. c om*/ * @return */ public static Configuration createConfigFromProperties(String fileName) { try { PropertiesConfiguration.setDefaultListDelimiter('|'); PropertiesConfiguration config = new PropertiesConfiguration(fileName); config.setThrowExceptionOnMissing(true); return config; } catch (ConfigurationException e) { throw Throwables.propagate(e); } }
From source file:fr.jetoile.hadoopunit.HadoopUtils.java
public static void setHadoopHome() { // Set hadoop.home.dir to point to the windows lib dir if (System.getProperty("os.name").startsWith("Windows")) { if (StringUtils.isEmpty(System.getenv("HADOOP_HOME"))) { try { configuration = new PropertiesConfiguration(HadoopUnitConfig.DEFAULT_PROPS_FILE); } catch (ConfigurationException e) { LOG.error("unable to load {}", HadoopUnitConfig.DEFAULT_PROPS_FILE, e); }//from w w w.j a v a 2s .c o m String hadoop_home = configuration.getString("HADOOP_HOME"); LOG.info("Setting hadoop.home.dir: {}", hadoop_home); if (hadoop_home == null) { LOG.error("HADOOP_HOME should be set or informed into hadoop-unit-default.properties"); System.exit(-1); } else { System.setProperty("HADOOP_HOME", hadoop_home); } } else { System.setProperty("HADOOP_HOME", System.getenv("HADOOP_HOME")); } String windowsLibDir = System.getenv("HADOOP_HOME"); LOG.info("WINDOWS: Setting hadoop.home.dir: {}", windowsLibDir); System.setProperty("hadoop.home.dir", windowsLibDir); System.load(new File(windowsLibDir + Path.SEPARATOR + "bin" + Path.SEPARATOR + "hadoop.dll") .getAbsolutePath()); System.load(new File(windowsLibDir + Path.SEPARATOR + "bin" + Path.SEPARATOR + "hdfs.dll") .getAbsolutePath()); } }