Exemplo n.º 1
0
    @Override
    public boolean arePathsOnSameEncryptionZone(Path path1, Path path2) throws IOException {
      EncryptionZone zone1, zone2;

      zone1 = hdfsAdmin.getEncryptionZoneForPath(path1);
      zone2 = hdfsAdmin.getEncryptionZoneForPath(path2);

      if (zone1 == null && zone2 == null) {
        return true;
      } else if (zone1 == null || zone2 == null) {
        return false;
      }

      return zone1.equals(zone2);
    }
Exemplo n.º 2
0
    @Override
    public int comparePathKeyStrength(Path path1, Path path2) throws IOException {
      EncryptionZone zone1, zone2;

      zone1 = hdfsAdmin.getEncryptionZoneForPath(path1);
      zone2 = hdfsAdmin.getEncryptionZoneForPath(path2);

      if (zone1 == null && zone2 == null) {
        return 0;
      } else if (zone1 == null) {
        return -1;
      } else if (zone2 == null) {
        return 1;
      }

      return compareKeyStrength(zone1.getKeyName(), zone2.getKeyName());
    }
Exemplo n.º 3
0
 @Override
 public boolean isPathEncrypted(Path path) throws IOException {
   Path fullPath;
   if (path.isAbsolute()) {
     fullPath = path;
   } else {
     fullPath = path.getFileSystem(conf).makeQualified(path);
   }
   if (!"hdfs".equalsIgnoreCase(path.toUri().getScheme())) {
     return false;
   }
   try {
     return (hdfsAdmin.getEncryptionZoneForPath(fullPath) != null);
   } catch (FileNotFoundException fnfe) {
     LOG.debug("Failed to get EZ for non-existent path: " + fullPath, fnfe);
     return false;
   }
 }
Exemplo n.º 4
0
 @Override
 public void createEncryptionZone(Path path, String keyName) throws IOException {
   hdfsAdmin.createEncryptionZone(path, keyName);
 }