Example usage for org.apache.commons.vfs.provider GenericFileName getScheme

List of usage examples for org.apache.commons.vfs.provider GenericFileName getScheme

Introduction

In this page you can find the example usage for org.apache.commons.vfs.provider GenericFileName getScheme.

Prototype

public String getScheme() 

Source Link

Document

Returns the URI scheme of this file.

Usage

From source file:org.pentaho.hdfs.vfs.MapRFileSystem.java

@Override
public org.apache.hadoop.fs.FileSystem getHDFSFileSystem() throws FileSystemException {
    if (fs == null) {
        Configuration conf = new Configuration();
        conf.set("fs.maprfs.impl", MapRFileProvider.FS_MAPR_IMPL);

        GenericFileName rootName = (GenericFileName) getRootName();
        String url = rootName.getScheme() + "://" + rootName.getHostName().trim();
        if (rootName.getPort() != MapRFileNameParser.DEFAULT_PORT) {
            url += ":" + rootName.getPort();
        }//from w w w.  j  av  a  2  s . co  m
        url += "/";
        conf.set("fs.default.name", url);
        setFileSystemOptions(getFileSystemOptions(), conf);
        try {
            fs = org.apache.hadoop.fs.FileSystem.get(conf);
        } catch (Throwable t) {
            throw new FileSystemException("Could not get MapR FileSystem for " + url, t);
        }
    }
    return fs;
}