Example usage for org.apache.commons.vfs FileName getRoot

List of usage examples for org.apache.commons.vfs FileName getRoot

Introduction

In this page you can find the example usage for org.apache.commons.vfs FileName getRoot.

Prototype

public FileName getRoot();

Source Link

Document

find the root of the filesystem

Usage

From source file:com.newatlanta.appengine.vfs.provider.GaeFileNameParser.java

public static String getRootPath(FileName baseName) throws FileSystemException {
    FileName rootName = baseName.getRoot();
    if (rootName instanceof GaeFileName) {
        return ((GaeFileName) rootName).getRootPath();
    } else {/*  w ww .j av a  2s .  c o  m*/
        StringBuffer rootPath = new StringBuffer();
        UriParser.extractScheme(baseName.getURI(), rootPath);
        UriParser.normalisePath(rootPath);
        return rootPath.toString().intern();
    }
}

From source file:com.jaspersoft.jasperserver.api.metadata.common.util.RepositoryFileProvider.java

public FileObject findFile(final FileObject baseFile, final String uri,
        final FileSystemOptions fileSystemOptions) throws FileSystemException {

    final FileName rootName = new RepositoryFileName(getScheme(), null, FileType.FOLDER);
    FileSystem fs = findFileSystem(rootName.getRoot(), fileSystemOptions);

    if (fs == null) {
        fs = new RepositoryFileSystem(getScheme(), rootName, fileSystemOptions);
        addFileSystem(rootName.getRoot(), fs);
    }/*from   w ww  .jav  a 2 s . com*/

    FileObject result = fs.resolveFile(uri);
    return result;
}