Example usage for org.apache.commons.configuration.io FileHandler setFile

List of usage examples for org.apache.commons.configuration.io FileHandler setFile

Introduction

In this page you can find the example usage for org.apache.commons.configuration.io FileHandler setFile.

Prototype

public void setFile(File file) 

Source Link

Document

Sets the location of the associated file as a File object.

Usage

From source file:ubic.basecode.util.ConfigUtils.java

/**
 * @param file//from w  ww . j  a v a  2 s  .  co m
 * @return
 * @throws ConfigurationException
 */
public static PropertiesConfiguration loadConfig(File file) throws ConfigurationException {
    if (!file.exists()) {
        try {
            FileTools.touch(file);
        } catch (IOException e) {
            throw new ConfigurationException("Couldn't create the file: " + e.getMessage());
        }
    }
    PropertiesConfiguration pc = new PropertiesConfiguration();
    FileHandler handler = new FileHandler(pc);
    handler.setFile(file);
    handler.load();
    return pc;
}