Example usage for org.apache.commons.configuration.io FileLocatorUtils locate

List of usage examples for org.apache.commons.configuration.io FileLocatorUtils locate

Introduction

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

Prototype

public static URL locate(FileLocator locator) 

Source Link

Document

Locates the provided FileLocator , returning a URL for accessing the referenced file.

Usage

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

/**
 * @param name/*from   w w w . j  av  a2  s  .  c o m*/
 * @return
 * @throws ConfigurationException
 */
private static File locateConfig(String name) throws ConfigurationException {
    File f;
    FileLocator fl = FileLocatorUtils.fileLocator().fileName(name).create();
    URL location = FileLocatorUtils.locate(fl);
    if (location == null) {
        f = new File(name);
        if (f.isAbsolute()) {
            return f;
        }
        return new File(FileUtils.getUserDirectory(), name);
    }
    try {
        return new File(location.toURI());
    } catch (Exception e) {
        throw new ConfigurationException("Couldn't map url to a uri: " + name);
    }
}

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

public static URL locate(String name) {
    FileLocator fl = FileLocatorUtils.fileLocator().fileName(name).create();
    return FileLocatorUtils.locate(fl);
}