Example usage for org.apache.hadoop.hdfs DistributedFileSystem createEncryptionZone

List of usage examples for org.apache.hadoop.hdfs DistributedFileSystem createEncryptionZone

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs DistributedFileSystem createEncryptionZone.

Prototype

public void createEncryptionZone(final Path path, final String keyName) throws IOException 

Source Link

Usage

From source file:org.trustedanalytics.cfbroker.store.hdfs.service.SimpleHdfsClient.java

License:Apache License

@Override
public void createKeyAndEncryptedZone(String keyName, Path path) throws IOException {
    if (fs.exists(path)) {
        try {//from   w  w w .  j ava 2  s .c o  m
            createEncryptionZoneKey(keyName);
        } catch (NoSuchAlgorithmException e) {
            fs.delete(path, true);
            throw new IOException("Error while creating encryption dir: " + path, e);
        }

        DistributedFileSystem dfs = (DistributedFileSystem) fs;
        dfs.createEncryptionZone(path, keyName);
    } else {
        throw new IOException(DIRECTORY_NOT_EXISTS + path);
    }
}