Example usage for java.nio.file FileSystemAlreadyExistsException FileSystemAlreadyExistsException

List of usage examples for java.nio.file FileSystemAlreadyExistsException FileSystemAlreadyExistsException

Introduction

In this page you can find the example usage for java.nio.file FileSystemAlreadyExistsException FileSystemAlreadyExistsException.

Prototype

public FileSystemAlreadyExistsException() 

Source Link

Document

Constructs an instance of this class.

Usage

From source file:de.tiqsolutions.hdfs.HadoopFileSystemProvider.java

@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IOException {
    checkURI(uri);/*from w  w  w. ja v  a2s  . c om*/
    String key = getURIKey(uri);
    if (fileSystems.containsKey(key))
        throw new FileSystemAlreadyExistsException();
    Configuration configuration = getConfiguration();

    HadoopFileSystem fs = null;
    if (configuration == null)
        configuration = new Configuration();

    for (Map.Entry<String, ?> entry : env.entrySet())
        configuration.set(entry.getKey(), entry.getValue().toString());
    fs = new HadoopFileSystem(this, uri, configuration);

    fileSystems.put(key, fs);
    return fs;
}

From source file:nextflow.fs.dx.DxFileSystemProvider.java

@Override
public final FileSystem newFileSystem(URI uri, Map<String, ?> env) {

    final String defContextId = getContextIdByMap(env, defaultContextId);
    final PathTokens tokens = resolveUri(uri, defContextId);
    final String dxContextId = tokens.contextId;
    final DxFileSystem result = newFileSystem(dxContextId, tokens.name);

    if (fileSystems.putIfAbsent(dxContextId, result) != null) {
        throw new FileSystemAlreadyExistsException();
    }/*  ww  w .  ja  v  a  2 s  . com*/

    return result;
}