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

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

Introduction

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

Prototype

public void setFileName(String fileName) 

Source Link

Document

Set the name of the file.

Usage

From source file:ubic.basecode.util.r.RServeClient.java

/**
 * @return//from w ww  .ja va 2 s.  c  om
 * @throws ConfigurationException
 */
protected static String findRserveCommand() throws ConfigurationException {
    URL userSpecificConfigFileLocation = ConfigUtils.locate("local.properties");

    PropertiesConfiguration userConfig = null;
    if (userSpecificConfigFileLocation != null) {
        userConfig = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(userConfig);
        handler.setFileName("local.properties");
        handler.load();
    }
    String rserveExecutable = null;
    if (userConfig != null) {
        rserveExecutable = userConfig.getString("rserve.start.command");
    }
    if (StringUtils.isBlank(rserveExecutable)) {
        log.info("Rserve command not configured? Trying fallbacks");
        if (os.startsWith("windows")) { // lower cased
            rserveExecutable = System.getenv("R_HOME") + File.separator + "library" + File.separator + "Rserve"
                    + File.separator + "Rserve.exe";
        } else {
            rserveExecutable = "R CMD Rserve";
        }
    }
    return rserveExecutable;
}