Example usage for org.apache.hadoop.fs.aliyun.oss AliyunOSSFileSystem initialize

List of usage examples for org.apache.hadoop.fs.aliyun.oss AliyunOSSFileSystem initialize

Introduction

In this page you can find the example usage for org.apache.hadoop.fs.aliyun.oss AliyunOSSFileSystem initialize.

Prototype

public void initialize(URI name, Configuration conf) throws IOException 

Source Link

Document

Initialize new FileSystem.

Usage

From source file:org.apache.flink.fs.osshadoop.OSSFileSystemFactory.java

License:Apache License

@Override
public FileSystem create(URI fsUri) throws IOException {
    this.hadoopConfig = getHadoopConfiguration();

    final String scheme = fsUri.getScheme();
    final String authority = fsUri.getAuthority();

    if (scheme == null && authority == null) {
        fsUri = org.apache.hadoop.fs.FileSystem.getDefaultUri(hadoopConfig);
    } else if (scheme != null && authority == null) {
        URI defaultUri = org.apache.hadoop.fs.FileSystem.getDefaultUri(hadoopConfig);
        if (scheme.equals(defaultUri.getScheme()) && defaultUri.getAuthority() != null) {
            fsUri = defaultUri;//  w ww  .j a va 2  s  .c  o m
        }
    }

    final AliyunOSSFileSystem fs = new AliyunOSSFileSystem();
    fs.initialize(fsUri, hadoopConfig);
    return new HadoopFileSystem(fs);
}