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:io.s4.example.twittertopiccount.Module.java

private void loadProperties(Binder binder) {

    try {//from w  w w.  jav a 2s.co m
        InputStream is = this.getClass().getResourceAsStream("/s4-example-twittertopiccount.properties");
        config = new PropertiesConfiguration();
        config.load(is);

        System.out.println(ConfigurationUtils.toString(config));
        // TODO - validate properties.

        /* Make all properties injectable. Do we need this? */
        Names.bindProperties(binder, ConfigurationConverter.getProperties(config));
    } catch (ConfigurationException e) {
        binder.addError(e);
        e.printStackTrace();
    }
}

From source file:edu.hawaii.soest.pacioos.text.TextSourceFactoryTest.java

/**
 * Test getting a file text source driver
 *//*from   w ww. ja va2 s .  c o m*/
@Test
public void testGetFileTextSource() {
    String configLocation = testResourcesDirectory
            + "edu/hawaii/soest/pacioos/text/mock-file-instrument-config.xml";
    SimpleTextSource fileTextSource = null;
    try {
        fileTextSource = TextSourceFactory.getSimpleTextSource(configLocation);
        assertNotNull(fileTextSource);

        String connectionType = fileTextSource.getConnectionType();
        assertEquals("file", connectionType);

    } catch (ConfigurationException e) {
        fail("Couldn't configure a driver using " + configLocation);
        e.printStackTrace();
    }
}

From source file:edu.hawaii.soest.pacioos.text.TextSourceFactoryTest.java

/**
 * Test getting a socket text source driver
 *//*from w w  w . j  a va2 s  .c o m*/
@Test
public void testGetSocketTextSource() {
    String configLocation = testResourcesDirectory
            + "edu/hawaii/soest/pacioos/text/mock-socket-instrument-config.xml";
    SimpleTextSource socketTextSource = null;
    try {
        socketTextSource = TextSourceFactory.getSimpleTextSource(configLocation);
        assertNotNull(socketTextSource);

        String connectionType = socketTextSource.getConnectionType();
        assertEquals("socket", connectionType);

    } catch (ConfigurationException e) {
        fail("Couldn't configure a driver using " + configLocation);
        e.printStackTrace();
    }
}

From source file:edu.hawaii.soest.pacioos.text.TextSourceFactoryTest.java

/**
 * Test getting a serial text source driver
 *//*from   w  w  w.ja  v  a 2 s  . c  o m*/
@Test
public void testGetSerialTextSource() {
    String configLocation = testResourcesDirectory
            + "edu/hawaii/soest/pacioos/text/mock-serial-instrument-config.xml";
    SimpleTextSource serialTextSource = null;
    try {
        serialTextSource = TextSourceFactory.getSimpleTextSource(configLocation);
        assertNotNull(serialTextSource);

        String connectionType = serialTextSource.getConnectionType();
        assertEquals("serial", connectionType);

    } catch (ConfigurationException e) {
        fail("Couldn't configure a driver using " + configLocation);
        e.printStackTrace();
    }
}

From source file:ch.epfl.lsir.xin.algorithm.baseline.ItemAverage.java

/**
 * constructor/*from   w  ww.j  a v a  2s  .  co m*/
 * @param: input dataset
 * */
public ItemAverage(RatingMatrix ratingMatrix) {
    //set configuration file for parameter setting.
    config.setFile(new File(".//conf//ItemAverage.properties"));
    try {
        config.load();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.ratingMatrix = ratingMatrix;
}

From source file:ch.epfl.lsir.xin.algorithm.baseline.UserAverage.java

/**
 * constructor//from   w w  w.j  a  v  a 2  s  .  c  o m
 * @param: input dataset
 * */
public UserAverage(RatingMatrix ratingMatrix) {
    //set configuration file for parameter setting.
    config.setFile(new File(".//conf//UserAverage.properties"));
    try {
        config.load();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.ratingMatrix = ratingMatrix;
}

From source file:com.github.technosf.posterer.transports.commons.CommonsConfiguratorPropertiesImpl.java

/**
 * Save the file/*from  w  w w  .  j  av  a 2  s  .c o m*/
 */
private void save() {
    try {
        config.save();
    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}

From source file:ch.epfl.lsir.xin.algorithm.baseline.GlobalAverage.java

/**
 * constructor//  w w  w.  j  a va  2 s .c o  m
 * @param: training ratings
 * */
public GlobalAverage(RatingMatrix ratingMatrix) {
    //set configuration file for parameter setting.
    config.setFile(new File(".//conf//GlobalMean.properties"));
    try {
        config.load();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.ratingMatrix = ratingMatrix;
}

From source file:ch.epfl.lsir.xin.algorithm.baseline.ItemAverage.java

/**
 * constructor//from w  ww .ja va 2 s .c o m
 * @param: training ratings
 * @param: read a saved model or not
 * @param: file of a saved model 
 * */
public ItemAverage(RatingMatrix ratingMatrix, boolean readModel, String file) {
    //set configuration file for parameter setting.
    config.setFile(new File(".//conf//ItemAverage.properties"));
    try {
        config.load();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.ratingMatrix = ratingMatrix;
    if (readModel)//read model from a local file
    {
        readModel(file);
    }
}

From source file:ch.epfl.lsir.xin.algorithm.baseline.UserAverage.java

/**
 * constructor/*from   w  w  w  .j  av a2  s  .c o m*/
 * @param: training ratings
 * @param: read a saved model or not
 * @param: file of a saved model 
 * */
public UserAverage(RatingMatrix ratingMatrix, boolean readModel, String file) {
    //set configuration file for parameter setting.
    config.setFile(new File(".//conf//UserAverage.properties"));
    try {
        config.load();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.ratingMatrix = ratingMatrix;
    if (readModel)//read model from a local file
    {
        readModel(file);
    }
}