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:com.TersoSolutions.Jetstream.SDK.Application.User.JetstreamServiceClient.java

/**
 * Constructor for the JetstreamServiceClient. This client is the base
 * service for accessing the Jetstream REST endpoints. Reads information
 * from the provided file//from   ww  w .  j  a  v a  2 s.  c om
 * 
 * @param properties
 *            The properties file
 * @throws IllegalArgumentException
 */
public JetstreamServiceClient(File properties) {
    try {
        config = new PropertiesConfiguration(properties);

        String jetstreamAPIUrl = config.getString("jetstream.baseuri");
        String accessKey = config.getString("jetstream.accesskey");

        init(jetstreamAPIUrl, accessKey);

    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}

From source file:com.TersoSolutions.Jetstream.SDK.Application.User.JetstreamServiceClient.java

/**
 * Constructor for the JetstreamServiceClient. This client is the base
 * service for accessing the Jetstream REST endpoints. Reads information
 * from the service.properties file located at the root of the project
 * /*  w  ww.  ja  v a2  s  . c  o m*/
 * @throws IllegalArgumentException
 */

public JetstreamServiceClient() {
    try {
        config = new PropertiesConfiguration("service.properties");

        String jetstreamAPIUrl = config.getString("jetstream.baseuri");
        String accessKey = config.getString("jetstream.accesskey");

        init(jetstreamAPIUrl, accessKey);

    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}

From source file:eu.optimis.mi.monitoring_manager.resources.MonitorManagerQueryResource.java

public MonitorManagerQueryResource() {
    try {//from  w  w w  . j a va2  s.c om
        PropertyConfigurator.configure(ConfigManager.getConfigFilePath(ConfigManager.LOG4J_CONFIG_FILE));
        logger.info("Monitoring Manager is ready");
        PropertiesConfiguration config = ConfigManager
                .getPropertiesConfiguration(ConfigManager.MMANAGER_CONFIG_FILE);
        DB_TABLE_URL = config.getString("db.table.url");
        DB_DRIVER = config.getString("db.driver");
        DB_USERNAME = config.getString("db.username");
        DB_PASSWORD = config.getString("db.password");
    } catch (IOException e) {
        logger.error("couldn't find the configuration file");
        e.printStackTrace();
        throw new RuntimeException(e);
    } catch (ConfigurationException e1) {
        logger.error("couldn't find the properties defined in the configuration file");
        e1.printStackTrace();
        throw new RuntimeException(e1);
    }
}

From source file:com.github.nethad.clustermeister.provisioning.torque.TorqueJPPFTestSetup.java

private void execute() {
    final String configurationFilePath = System.getProperty("user.home") + "/.clustermeister/configuration.yml";
    try {/* w w  w.j a v  a 2 s . c  o m*/
        this.configuration = new FileConfiguration(configurationFilePath);
        torqueNodeManager = new TorqueNodeManager(configuration);
    } catch (ConfigurationException ex) {
        throw new RuntimeException(ex);
    }
    jppfLocalDriver = new JPPFLocalDriver(configuration);
    torqueNodeManager.addPublicIpListener(jppfLocalDriver);

    setupRmi();

    startDriver();
    startNodes();
    try {
        Thread.sleep(200);
    } catch (InterruptedException ex) {
        ex.printStackTrace();
    }

    System.out.print("Press ENTER to shutdown: ");
    try {
        int read = System.in.read();
    } catch (IOException ex) {
        ex.printStackTrace();
    }
    torqueNodeManager.removeAllNodes();
    torqueNodeManager.shutdown();

    torqueNodeManager = null;

    jppfLocalDriver.shutdown();

    System.out.print("Press ENTER to kill the JVM: ");
    try {
        int read = System.in.read();
        System.exit(0);
    } catch (IOException ex) {
        ex.printStackTrace();
    }

    //      for (ListenableFuture<? extends Node> node : nodes) {
    //         torqueNodeManager.removeNode((TorqueNode)node);
    //      }

    //      JPPFManagementByJobsClient client = JPPFConfiguratedComponentFactory.getInstance().createManagementByJobsClient("localhost", 11111);
    //      client.shutdownAllNodes("localhost", 11198);
    //      client.shutdownDriver("localhost", 11198);
}

From source file:ch.epfl.lsir.xin.algorithm.core.ItemBasedCF.java

/**
 * constructor/*www. j  av a2 s.c  o m*/
 * @param: training ratings
 * @param: read a saved model or not
 * @param: file of a saved model 
 * */
public ItemBasedCF(RatingMatrix ratingMatrix, boolean readModel, String file) {
    config.setFile(new File(".//conf//ItemBasedCF.properties"));
    try {
        config.load();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.topN = this.config.getInt("TOP_N_RECOMMENDATION");
    this.similarityCalculation = this.config.getString("SIMILARITY");
    this.ratingMatrix = ratingMatrix;
    this.maxRating = this.config.getInt("MAX_RATING");
    this.minRating = this.config.getInt("MIN_RATING");
    this.similarityMatrix = new double[this.ratingMatrix.getColumn()][this.ratingMatrix.getColumn()];

    if (readModel) {
        readModel(file);
    } else {
        similarityMatrixCalculation();
    }
}

From source file:ch.epfl.lsir.xin.algorithm.core.UserBasedCF.java

/**
 * constructor//from  w  w w  .  j ava 2 s . co m
 * @param training ratings
 * */
public UserBasedCF(RatingMatrix ratingMatrix) {
    //set configuration file for parameter setting.
    config.setFile(new File(".//conf//UserBasedCF.properties"));
    try {
        config.load();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.topN = this.config.getInt("TOP_N_RECOMMENDATION");
    this.similarityCalculation = this.config.getString("SIMILARITY");
    this.ratingMatrix = ratingMatrix;
    this.maxRating = this.config.getInt("MAX_RATING");
    this.minRating = this.config.getInt("MIN_RATING");
    this.similarityMatrix = new double[this.ratingMatrix.getRow()][this.ratingMatrix.getRow()];
}

From source file:ch.epfl.lsir.xin.algorithm.core.UserBasedCF.java

/**
 * constructor/* w w w .  j a v a  2 s .c o m*/
 * @param: training ratings
 * @param: read a saved model or not
 * @param: file of a saved model 
 * */
public UserBasedCF(RatingMatrix ratingMatrix, boolean readModel, String file) {
    //set configuration file for parameter setting.
    config.setFile(new File(".//conf//UserBasedCF.properties"));
    try {
        config.load();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.topN = this.config.getInt("TOP_N_RECOMMENDATION");
    this.similarityCalculation = this.config.getString("SIMILARITY");
    this.ratingMatrix = ratingMatrix;
    this.maxRating = this.config.getInt("MAX_RATING");
    this.minRating = this.config.getInt("MIN_RATING");
    this.similarityMatrix = new double[this.ratingMatrix.getRow()][this.ratingMatrix.getRow()];
    if (readModel) {
        readModel(file);
    }
}

From source file:ch.epfl.lsir.xin.algorithm.core.ItemBasedCF.java

/**
 * constructor/*from   ww w.j av a2  s .  co m*/
 * @param training ratings
 * */
public ItemBasedCF(RatingMatrix ratingMatrix) {
    //set configuration file for parameter setting.
    config.setFile(new File(".//conf//ItemBasedCF.properties"));
    try {
        config.load();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.topN = this.config.getInt("TOP_N_RECOMMENDATION");
    this.similarityCalculation = this.config.getString("SIMILARITY");
    this.ratingMatrix = ratingMatrix;
    this.maxRating = this.config.getInt("MAX_RATING");
    this.minRating = this.config.getInt("MIN_RATING");
    this.similarityMatrix = new double[this.ratingMatrix.getColumn()][this.ratingMatrix.getColumn()];
    similarityMatrixCalculation();

    //display similarity matrix
    //      try {
    //         PrintWriter printer = new PrintWriter("matrix");
    //         for( int i = 0 ; i < this.similarityMatrix.length ; i++ )
    //         {
    //            for( int j = 0 ; j < this.similarityMatrix[i].length ; j++ )
    //            {
    //               printer.print(this.similarityMatrix[i][j] + "  ");
    //            }
    //            printer.println();
    //         }
    //         printer.flush();
    //         printer.close();
    //      } catch (FileNotFoundException e) {
    //         // TODO Auto-generated catch block
    //         e.printStackTrace();
    //      }
}

From source file:hu.ppke.itk.nlpg.purepos.cli.PurePos.java

@Override
public void run() {
    try {//ww w  .j  a v  a2  s.c o  m
        Configuration conf;
        if (options.configFile != null) {
            ConfigurationReader reader = new ConfigurationReader();
            conf = reader.read(new File(options.configFile));
            Util.LEMMA_MAPPER = new StringMapper(conf.getLemmaMappings());
        } else {
            conf = new Configuration();
        }
        Util.CONFIGURATION = conf;

        if (options.command.equals(TRAIN_OPT)) {
            train(options.encoding, options.modelName, options.fromFile, options.tagOrder,
                    options.emissionOrder, options.suffixLength, options.rareFreq);
        } else if (options.command.equals(TAG_OPT)) {
            tag(options.encoding, options.modelName, options.fromFile, options.morphology, options.noStemming,
                    options.maxGuessed, options.maxResultsNumber, options.beamTheta, options.useBeamSearch,
                    options.toFile);
        }
    } catch (ConfigurationException e) {
        System.err.println("Malformed configuration file: " + e.getMessage());
    } catch (ParsingException e) {
        System.err.println(e.getWrappedException().getMessage());
    } catch (Exception e) {
        // System.err.println(e.getMessage());
        e.printStackTrace();

        System.exit(-1);
    }
}

From source file:eu.optimis.mi.monitoring_manager.resources.MonitorManagerQueryResourceHome.java

public MonitorManagerQueryResourceHome() {
    interfaceMap = new HashMap<String, String>();
    // [6] a, b, c
    interfaceMap.put("getReportForAllVirtual", "/type/virtual");
    interfaceMap.put("getReportForAllPhysical", "/type/physical");
    interfaceMap.put("getReportForAllPhysical", "/type/energy");
    // [5][8] a, b, c, d
    interfaceMap.put("getReportForService", "/type/service");
    interfaceMap.put("getReportForVirtual", "/type/virtual");
    interfaceMap.put("getReportForPhysical", "/type/physical");
    interfaceMap.put("getReportForEnergy", "/type/energy");
    interfaceMap.put("getLatestReportForVirtual", "/group/type/virtual");
    interfaceMap.put("getLatestReportForService", "/group/type/service");
    interfaceMap.put("getLatestReportForPhysical", "/group/type/physical");
    interfaceMap.put("getLatestReportForEnergy", "/group/type/energy");
    // [10] a, b, c, d
    interfaceMap.put("getReportForPartService", "/date/type/service");
    interfaceMap.put("getReportForPartVirtual", "/date/type/virtual");
    interfaceMap.put("getReportForPartPhysical", "/date/type/physical");
    interfaceMap.put("getReportForPartEnergy", "/date/type/energy");
    // [11] a, b, c, d
    interfaceMap.put("getReportForPartServiceId", "/date/type/service");
    interfaceMap.put("getReportForPartVirtualId", "/date/type/virtual");
    interfaceMap.put("getReportForPartPhysicalId", "/date/type/physical");
    interfaceMap.put("getReportForPartEnergyId", "/date/type/energy");
    // [7]/*from  w ww. jav a  2s .  com*/
    interfaceMap.put("getReportForMetric", "/type/metric");
    // [12]
    interfaceMap.put("getReportForPartMetricName", "/date/metric");
    // [9]
    interfaceMap.put("getLatestReportForMetricName", "/group/metric");

    // [13] [14] [15] [16]
    interfaceMap.put("getLatestCompleteReportForService", "/group/complete/service");
    interfaceMap.put("getLatestCompleteReportForVirtual", "/group/complete/virtual");
    interfaceMap.put("getLatestCompleteReportForPhysical", "/group/complete/physical");
    interfaceMap.put("getLatestCompleteReportForEnergy", "/group/complete/energy");

    logger.info("Service " + this.getClass().getName());
    // PatternLayout layout = new
    // PatternLayout("%d{ISO8601} %-5p %c{2} [%t,%M:%L] %m%n");
    try {
        PropertyConfigurator.configure(ConfigManager.getConfigFilePath(ConfigManager.LOG4J_CONFIG_FILE));
        logger.info("Monitoring Manager is ready");
        PropertiesConfiguration config = ConfigManager
                .getPropertiesConfiguration(ConfigManager.MMANAGER_CONFIG_FILE);
        DB_TABLE_URL = config.getString("db.table.url");
        DB_DRIVER = config.getString("db.driver");
        DB_USERNAME = config.getString("db.username");
        DB_PASSWORD = config.getString("db.password");
    } catch (IOException e) {
        logger.error("couldn't find the configuration file");
        e.printStackTrace();
        throw new RuntimeException(e);
    } catch (ConfigurationException e1) {
        logger.error("couldn't find the properties defined in the configuration file");
        e1.printStackTrace();
        throw new RuntimeException(e1);
    }
}