Example usage for org.apache.commons.configuration ConfigurationException printStackTrace

List of usage examples for org.apache.commons.configuration ConfigurationException printStackTrace

Introduction

In this page you can find the example usage for org.apache.commons.configuration ConfigurationException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Usage

From source file:edu.lternet.pasta.portal.ConfigurationListener.java

/**
 * Configure logger and properties applications for non-servlet based
 * execution (e.g., main(String[] args)).
 *//*from w  w  w.j  a  va 2s . c o  m*/
public static void configure() {

    String cwd = System.getProperty("user.dir");

    // Initialize log4j
    String log4jPropertiesPath = cwd + "/WebRoot/WEB-INF/conf/log4j.properties";
    PropertyConfigurator.configureAndWatch(log4jPropertiesPath);

    // Initialize commons configuration
    String appConfigPath = cwd + "/WebRoot/WEB-INF/conf/dataportal.properties";
    try {
        config = new PropertiesConfiguration(appConfigPath);
        config.setProperty("system.cwd", cwd);
        config.save();
    } catch (ConfigurationException e) {
        logger.error(e);
        e.printStackTrace();
    }

}

From source file:edu.lternet.pasta.datapackagemanager.dataserver.ConfigurationListener.java

/**
 * Configure logger and properties applications for non-servlet based
 * execution (e.g., main(String[] args)).
 *///from w  ww .j  av  a  2s .co m
public static void configure() {

    String cwd = System.getProperty("user.dir");

    // Initialize log4j
    String log4jPropertiesPath = cwd + "/WebRoot/WEB-INF/conf/log4j.properties";
    PropertyConfigurator.configureAndWatch(log4jPropertiesPath);

    // Initialize commons configuration
    String appConfigPath = cwd + "/WebRoot/WEB-INF/conf/dataserver.properties";
    try {
        config = new PropertiesConfiguration(appConfigPath);
        config.setProperty("system.cwd", cwd);
        config.save();
    } catch (ConfigurationException e) {
        logger.error(e);
        e.printStackTrace();
    }

}

From source file:eu.optimis.ecoefficiencytool.core.tools.ConfigManager.java

public static PropertiesConfiguration getPropertiesConfiguration(String configFile) {
    String filePath = null;/*www . j  av a 2  s .c om*/
    PropertiesConfiguration config = null;

    try {
        filePath = getConfigFilePath(configFile);
        config = new PropertiesConfiguration(filePath);
    } catch (ConfigurationException ex) {
        log.error("ECO: Error reading " + filePath + " configuration file: " + ex.getMessage());
        ex.printStackTrace();
    }

    return config;
}

From source file:keel.Algorithms.Genetic_Rule_Learning.Bojarczuk_GP.Main.java

/**
 * <p>//ww  w.ja va  2 s .co  m
 * Configure the execution of the algorithm.
 * 
 * @param jobFilename Name of the KEEL file with properties of the execution
 *  </p>                  
 */

private static void configureJob(String jobFilename) {

    Properties props = new Properties();

    try {
        InputStream paramsFile = new FileInputStream(jobFilename);
        props.load(paramsFile);
        paramsFile.close();
    } catch (IOException ioe) {
        ioe.printStackTrace();
        System.exit(0);
    }

    // Files training and test
    String trainFile;
    String testFile;
    StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData"));
    tokenizer.nextToken();
    trainFile = tokenizer.nextToken();
    trainFile = trainFile.substring(1, trainFile.length() - 1);
    testFile = tokenizer.nextToken();
    testFile = testFile.substring(1, testFile.length() - 1);

    tokenizer = new StringTokenizer(props.getProperty("outputData"));
    String reportTrainFile = tokenizer.nextToken();
    reportTrainFile = reportTrainFile.substring(1, reportTrainFile.length() - 1);
    String reportTestFile = tokenizer.nextToken();
    reportTestFile = reportTestFile.substring(1, reportTestFile.length() - 1);
    String reportRulesFile = tokenizer.nextToken();
    reportRulesFile = reportRulesFile.substring(1, reportRulesFile.length() - 1);

    // Algorithm auxiliar configuration
    XMLConfiguration algConf = new XMLConfiguration();
    algConf.setRootElementName("experiment");
    algConf.addProperty("process[@algorithm-type]",
            "net.sourceforge.jclec.problem.classification.freitas.FreitasAlgorithm");
    algConf.addProperty("process.rand-gen-factory[@type]", "net.sourceforge.jclec.util.random.RanecuFactory");
    algConf.addProperty("process.rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed")));
    algConf.addProperty("process.population-size", Integer.parseInt(props.getProperty("population-size")));
    algConf.addProperty("process.max-of-generations", Integer.parseInt(props.getProperty("max-generations")));
    algConf.addProperty("process.max-deriv-size", Integer.parseInt(props.getProperty("max-deriv-size")));
    algConf.addProperty("process.dataset[@type]", "net.sourceforge.jclec.util.dataset.KeelDataSet");
    algConf.addProperty("process.dataset.train-data.file-name", trainFile);
    algConf.addProperty("process.dataset.test-data.file-name", testFile);
    algConf.addProperty("process.species[@type]",
            "net.sourceforge.jclec.problem.classification.freitas.FreitasSyntaxTreeSpecies");
    algConf.addProperty("process.evaluator[@type]",
            "net.sourceforge.jclec.problem.classification.freitas.FreitasEvaluator");
    algConf.addProperty("process.provider[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeCreator");
    algConf.addProperty("process.parents-selector[@type]", "net.sourceforge.jclec.selector.RouletteSelector");
    algConf.addProperty("process.recombinator[@type]",
            "net.sourceforge.jclec.syntaxtree.SyntaxTreeRecombinator");
    algConf.addProperty("process.recombinator[@rec-prob]", Double.parseDouble(props.getProperty("rec-prob")));
    algConf.addProperty("process.recombinator.base-op[@type]",
            "net.sourceforge.jclec.problem.classification.freitas.FreitasCrossover");
    algConf.addProperty("process.copy-prob", Double.parseDouble(props.getProperty("copy-prob")));
    algConf.addProperty("process.listener[@type]",
            "net.sourceforge.jclec.problem.classification.freitas.KeelFreitasPopulationReport");
    algConf.addProperty("process.listener.report-dir-name", "./");
    algConf.addProperty("process.listener.train-report-file", reportTrainFile);
    algConf.addProperty("process.listener.test-report-file", reportTestFile);
    algConf.addProperty("process.listener.rules-report-file", reportRulesFile);
    algConf.addProperty("process.listener.global-report-name", "resumen");
    algConf.addProperty("process.listener.report-frequency", 50);

    try {
        algConf.save(new File("configure.txt"));
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    net.sourceforge.jclec.RunExperiment.main(new String[] { "configure.txt" });
}

From source file:eu.optimis.infrastructureproviderriskassessmenttool.core.configration.ConfigManager.java

public static PropertiesConfiguration getPropertiesConfiguration(String configFile) {
    String filePath = null;/*from w  w  w  .  ja  v a2s .com*/
    PropertiesConfiguration config = null;

    try {
        filePath = getConfigFilePath(configFile);
        config = new PropertiesConfiguration(filePath);
    } catch (ConfigurationException ex) {
        log.error("IPRA: Error reading " + filePath + " configuration file: " + ex.getMessage());
        ex.printStackTrace();
    }

    return config;
}

From source file:eu.optimis.serviceproviderriskassessmenttool.core.configration.ConfigManager.java

public static PropertiesConfiguration getPropertiesConfiguration(String configFile) {
    String filePath = null;/* w w  w.  j a v a2 s.  c om*/
    PropertiesConfiguration config = null;

    try {
        filePath = getConfigFilePath(configFile);
        config = new PropertiesConfiguration(filePath);
    } catch (ConfigurationException ex) {
        log.error("SPRA: Error reading " + filePath + " configuration file: " + ex.getMessage());
        ex.printStackTrace();
    }

    return config;
}

From source file:keel.Algorithms.Genetic_Rule_Learning.Falco_GP.Main.java

/**
 * <p>/* w  w  w .j a v a2  s.  co m*/
 * Configure the execution of the algorithm.
 * 
 * @param jobFilename Name of the KEEL file with properties of the
 *                    execution
 *  </p>                  
 */

private static void configureJob(String jobFilename) {

    Properties props = new Properties();

    try {
        InputStream paramsFile = new FileInputStream(jobFilename);
        props.load(paramsFile);
        paramsFile.close();
    } catch (IOException ioe) {
        ioe.printStackTrace();
        System.exit(0);
    }

    // Files training and test
    String trainFile;
    String testFile;
    StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData"));
    tokenizer.nextToken();
    trainFile = tokenizer.nextToken();
    trainFile = trainFile.substring(1, trainFile.length() - 1);
    testFile = tokenizer.nextToken();
    testFile = testFile.substring(1, testFile.length() - 1);

    tokenizer = new StringTokenizer(props.getProperty("outputData"));
    String reportTrainFile = tokenizer.nextToken();
    reportTrainFile = reportTrainFile.substring(1, reportTrainFile.length() - 1);
    String reportTestFile = tokenizer.nextToken();
    reportTestFile = reportTestFile.substring(1, reportTestFile.length() - 1);
    String reportRulesFile = tokenizer.nextToken();
    reportRulesFile = reportRulesFile.substring(1, reportRulesFile.length() - 1);

    // Algorithm auxiliar configuration
    XMLConfiguration algConf = new XMLConfiguration();
    algConf.setRootElementName("experiment");
    algConf.addProperty("process[@algorithm-type]",
            "net.sourceforge.jclec.problem.classification.falco.FalcoAlgorithm");
    algConf.addProperty("process.rand-gen-factory[@type]", "net.sourceforge.jclec.util.random.RanecuFactory");
    algConf.addProperty("process.rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed")));
    algConf.addProperty("process.population-size", Integer.parseInt(props.getProperty("population-size")));
    algConf.addProperty("process.max-of-generations", Integer.parseInt(props.getProperty("max-generations")));
    algConf.addProperty("process.max-deriv-size", Integer.parseInt(props.getProperty("max-deriv-size")));
    algConf.addProperty("process.dataset[@type]", "net.sourceforge.jclec.util.dataset.KeelDataSet");
    algConf.addProperty("process.dataset.train-data.file-name", trainFile);
    algConf.addProperty("process.dataset.test-data.file-name", testFile);
    algConf.addProperty("process.species[@type]",
            "net.sourceforge.jclec.problem.classification.falco.FalcoSyntaxTreeSpecies");
    algConf.addProperty("process.evaluator[@type]",
            "net.sourceforge.jclec.problem.classification.falco.FalcoEvaluator");
    algConf.addProperty("process.evaluator.alpha", Double.parseDouble(props.getProperty("alpha")));
    algConf.addProperty("process.provider[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeCreator");
    algConf.addProperty("process.parents-selector[@type]", "net.sourceforge.jclec.selector.RouletteSelector");
    algConf.addProperty("process.recombinator[@type]",
            "net.sourceforge.jclec.syntaxtree.SyntaxTreeRecombinator");
    algConf.addProperty("process.recombinator[@rec-prob]", Double.parseDouble(props.getProperty("rec-prob")));
    algConf.addProperty("process.recombinator.base-op[@type]",
            "net.sourceforge.jclec.problem.classification.falco.FalcoCrossover");
    algConf.addProperty("process.mutator[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeMutator");
    algConf.addProperty("process.mutator[@mut-prob]", Double.parseDouble(props.getProperty("mut-prob")));
    algConf.addProperty("process.mutator.base-op[@type]",
            "net.sourceforge.jclec.problem.classification.falco.FalcoMutator");
    algConf.addProperty("process.copy-prob", Double.parseDouble(props.getProperty("copy-prob")));
    algConf.addProperty("process.listener[@type]",
            "net.sourceforge.jclec.problem.classification.falco.KeelFalcoPopulationReport");
    algConf.addProperty("process.listener.report-dir-name", "./");
    algConf.addProperty("process.listener.train-report-file", reportTrainFile);
    algConf.addProperty("process.listener.test-report-file", reportTestFile);
    algConf.addProperty("process.listener.rules-report-file", reportRulesFile);
    algConf.addProperty("process.listener.global-report-name", "resumen");
    algConf.addProperty("process.listener.report-frequency", 50);

    try {
        algConf.save(new File("configure.txt"));
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    net.sourceforge.jclec.RunExperiment.main(new String[] { "configure.txt" });
}

From source file:keel.Algorithms.Genetic_Rule_Learning.Tan_GP.Main.java

/**
 * <p>// www.jav  a 2 s  . c o  m
 * Configure the execution of the algorithm.
 * 
 * @param jobFilename Name of the KEEL file with properties of the
 *                    execution
 *  </p>                  
 */

private static void configureJob(String jobFilename) {

    Properties props = new Properties();

    try {
        InputStream paramsFile = new FileInputStream(jobFilename);
        props.load(paramsFile);
        paramsFile.close();
    } catch (IOException ioe) {
        ioe.printStackTrace();
        System.exit(0);
    }

    // Files training and test
    String trainFile;
    String testFile;
    StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData"));
    tokenizer.nextToken();
    trainFile = tokenizer.nextToken();
    trainFile = trainFile.substring(1, trainFile.length() - 1);
    testFile = tokenizer.nextToken();
    testFile = testFile.substring(1, testFile.length() - 1);

    tokenizer = new StringTokenizer(props.getProperty("outputData"));
    String reportTrainFile = tokenizer.nextToken();
    reportTrainFile = reportTrainFile.substring(1, reportTrainFile.length() - 1);
    String reportTestFile = tokenizer.nextToken();
    reportTestFile = reportTestFile.substring(1, reportTestFile.length() - 1);
    String reportRulesFile = tokenizer.nextToken();
    reportRulesFile = reportRulesFile.substring(1, reportRulesFile.length() - 1);

    // Algorithm auxiliar configuration
    XMLConfiguration algConf = new XMLConfiguration();
    algConf.setRootElementName("experiment");
    algConf.addProperty("process[@algorithm-type]",
            "net.sourceforge.jclec.problem.classification.tan.TanAlgorithm");
    algConf.addProperty("process.rand-gen-factory[@type]", "net.sourceforge.jclec.util.random.RanecuFactory");
    algConf.addProperty("process.rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed")));
    algConf.addProperty("process.population-size", Integer.parseInt(props.getProperty("population-size")));
    algConf.addProperty("process.max-of-generations", Integer.parseInt(props.getProperty("max-generations")));
    algConf.addProperty("process.max-deriv-size", Integer.parseInt(props.getProperty("max-deriv-size")));
    algConf.addProperty("process.dataset[@type]", "net.sourceforge.jclec.util.dataset.KeelDataSet");
    algConf.addProperty("process.dataset.train-data.file-name", trainFile);
    algConf.addProperty("process.dataset.test-data.file-name", testFile);
    algConf.addProperty("process.species[@type]",
            "net.sourceforge.jclec.problem.classification.tan.TanSyntaxTreeSpecies");
    algConf.addProperty("process.evaluator[@type]",
            "net.sourceforge.jclec.problem.classification.tan.TanEvaluator");
    algConf.addProperty("process.evaluator.w1", Double.parseDouble(props.getProperty("w1")));
    algConf.addProperty("process.evaluator.w2", Double.parseDouble(props.getProperty("w2")));
    algConf.addProperty("process.provider[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeCreator");
    algConf.addProperty("process.parents-selector[@type]", "net.sourceforge.jclec.selector.RouletteSelector");
    algConf.addProperty("process.recombinator[@type]",
            "net.sourceforge.jclec.syntaxtree.SyntaxTreeRecombinator");
    algConf.addProperty("process.recombinator[@rec-prob]", Double.parseDouble(props.getProperty("rec-prob")));
    algConf.addProperty("process.recombinator.base-op[@type]",
            "net.sourceforge.jclec.problem.classification.tan.TanCrossover");
    algConf.addProperty("process.mutator[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeMutator");
    algConf.addProperty("process.mutator[@mut-prob]", Double.parseDouble(props.getProperty("mut-prob")));
    algConf.addProperty("process.mutator.base-op[@type]",
            "net.sourceforge.jclec.problem.classification.tan.TanMutator");
    algConf.addProperty("process.copy-prob", Double.parseDouble(props.getProperty("copy-prob")));
    algConf.addProperty("process.elitist-prob", Double.parseDouble(props.getProperty("elitist-prob")));
    algConf.addProperty("process.support", Double.parseDouble(props.getProperty("support")));
    algConf.addProperty("process.listener[@type]",
            "net.sourceforge.jclec.problem.classification.tan.KeelTanPopulationReport");
    algConf.addProperty("process.listener.report-dir-name", "./");
    algConf.addProperty("process.listener.train-report-file", reportTrainFile);
    algConf.addProperty("process.listener.test-report-file", reportTestFile);
    algConf.addProperty("process.listener.rules-report-file", reportRulesFile);
    algConf.addProperty("process.listener.global-report-name", "resumen");
    algConf.addProperty("process.listener.report-frequency", 50);

    try {
        algConf.save(new File("configure.txt"));
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    net.sourceforge.jclec.RunExperiment.main(new String[] { "configure.txt" });
}

From source file:com.weibo.datasys.common.conf.ConfigFactory.java

/**
 * ??/*  w  w w  . j a  va 2 s. co  m*/
 */
public static void save() {
    try {
        config.save();
    } catch (ConfigurationException e) {
        e.printStackTrace();

    }
}

From source file:de.unibremen.swp.stundenplan.config.Config.java

/**
 * Methode setzt den Integer fuer den gegebenen Key auf den gegebenen Integer.
 * //  w  w w .ja  v  a 2s  .c o m
 * @param pKey
 *       der Key bei dem der Wert gesetzt werden soll
 * @param pValue
 *       der Integer-Wert, der den alten ersetzen soll
 */
public static void setIntValue(final String pKey, final int pValue) {
    if ((pKey == null || pKey.length() == 0))
        throw new IllegalArgumentException("There must be a key");
    if (pKey.equals(TIMESLOT_LENGTH_STRING) && pValue <= 0)
        throw new IllegalArgumentException("Value of timeslot must be greater than zero");
    propertiesConfig.setProperty(pKey, pValue);
    try {
        propertiesConfig.save();
    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}