|
@@ -2046,16 +2046,59 @@ public class DistributedFileSystem extends FileSystem {
|
|
|
}
|
|
|
|
|
|
/* HDFS only */
|
|
|
- public void createEncryptionZone(Path path, String keyName)
|
|
|
+ public void createEncryptionZone(final Path path, final String keyName)
|
|
|
throws IOException {
|
|
|
- dfs.createEncryptionZone(getPathName(path), keyName);
|
|
|
+ Path absF = fixRelativePart(path);
|
|
|
+ new FileSystemLinkResolver<Void>() {
|
|
|
+ @Override
|
|
|
+ public Void doCall(final Path p) throws IOException,
|
|
|
+ UnresolvedLinkException {
|
|
|
+ dfs.createEncryptionZone(getPathName(p), keyName);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Void next(final FileSystem fs, final Path p) throws IOException {
|
|
|
+ if (fs instanceof DistributedFileSystem) {
|
|
|
+ DistributedFileSystem myDfs = (DistributedFileSystem) fs;
|
|
|
+ myDfs.createEncryptionZone(p, keyName);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ throw new UnsupportedOperationException(
|
|
|
+ "Cannot call createEncryptionZone"
|
|
|
+ + " on a symlink to a non-DistributedFileSystem: " + path
|
|
|
+ + " -> " + p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.resolve(this, absF);
|
|
|
}
|
|
|
|
|
|
/* HDFS only */
|
|
|
- public EncryptionZone getEZForPath(Path path)
|
|
|
+ public EncryptionZone getEZForPath(final Path path)
|
|
|
throws IOException {
|
|
|
Preconditions.checkNotNull(path);
|
|
|
- return dfs.getEZForPath(getPathName(path));
|
|
|
+ Path absF = fixRelativePart(path);
|
|
|
+ return new FileSystemLinkResolver<EncryptionZone>() {
|
|
|
+ @Override
|
|
|
+ public EncryptionZone doCall(final Path p) throws IOException,
|
|
|
+ UnresolvedLinkException {
|
|
|
+ return dfs.getEZForPath(getPathName(p));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public EncryptionZone next(final FileSystem fs, final Path p)
|
|
|
+ throws IOException {
|
|
|
+ if (fs instanceof DistributedFileSystem) {
|
|
|
+ DistributedFileSystem myDfs = (DistributedFileSystem) fs;
|
|
|
+ return myDfs.getEZForPath(p);
|
|
|
+ } else {
|
|
|
+ throw new UnsupportedOperationException(
|
|
|
+ "Cannot call getEZForPath"
|
|
|
+ + " on a symlink to a non-DistributedFileSystem: " + path
|
|
|
+ + " -> " + p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.resolve(this, absF);
|
|
|
}
|
|
|
|
|
|
/* HDFS only */
|