Package org.apache.hadoop.fs.permission

Examples of org.apache.hadoop.fs.permission.FsAction


    }
    return client.removeDirectory(pathName);
  }

  private FsAction getFsAction(int accessGroup, FTPFile ftpFile) {
    FsAction action = FsAction.NONE;
    if (ftpFile.hasPermission(accessGroup, FTPFile.READ_PERMISSION)) {
      action.or(FsAction.READ);
    }
    if (ftpFile.hasPermission(accessGroup, FTPFile.WRITE_PERMISSION)) {
      action.or(FsAction.WRITE);
    }
    if (ftpFile.hasPermission(accessGroup, FTPFile.EXECUTE_PERMISSION)) {
      action.or(FsAction.EXECUTE);
    }
    return action;
  }
View Full Code Here


    }
    return action;
  }

  private FsPermission getPermissions(FTPFile ftpFile) {
    FsAction user, group, others;
    user = getFsAction(FTPFile.USER_ACCESS, ftpFile);
    group = getFsAction(FTPFile.GROUP_ACCESS, ftpFile);
    others = getFsAction(FTPFile.WORLD_ACCESS, ftpFile);
    return new FsPermission(user, group, others);
  }
View Full Code Here

      // Print default ACL entries.
      if (curEntry != null && curEntry.getScope() == AclEntryScope.DEFAULT) {
        out.println(curEntry);
        // ACL sort order guarantees default mask is the second-to-last entry.
        FsAction maskPerm = entries.get(entries.size() - 2).getPermission();
        while (entryIter.hasNext()) {
          printExtendedAclEntry(entryIter.next(), maskPerm);
        }
      }
    }
View Full Code Here

     * @param entry AclEntry extended ACL entry to print
     * @param maskPerm FsAction permissions in the ACL's mask entry
     */
    private void printExtendedAclEntry(AclEntry entry, FsAction maskPerm) {
      if (entry.getName() != null || entry.getType() == AclEntryType.GROUP) {
        FsAction entryPerm = entry.getPermission();
        FsAction effectivePerm = entryPerm.and(maskPerm);
        if (entryPerm != effectivePerm) {
          out.println(String.format("%s\t#effective:%s", entry,
            effectivePerm.SYMBOL));
        } else {
          out.println(entry);
View Full Code Here

        FileStatus stat = fs.getFileStatus(path);
        FsPermission actual = stat.getPermission();
        if (!stat.isDir())
          throw new DiskErrorException("not a directory: "
                                   + path.toString());
        FsAction user = actual.getUserAction();
        if (!user.implies(FsAction.READ))
          throw new DiskErrorException("directory is not readable: "
                                   + path.toString());
        if (!user.implies(FsAction.WRITE))
          throw new DiskErrorException("directory is not writable: "
                                   + path.toString());
      }

      if (retainTime == 0) {
View Full Code Here

   
    if (!stat.isDir())
      throw new DiskErrorException("not a directory: "
                                   + dir.toString());
           
    FsAction user = actual.getUserAction();
    if (!user.implies(FsAction.READ))
      throw new DiskErrorException("directory is not readable: "
                                   + dir.toString());
           
    if (!user.implies(FsAction.WRITE))
      throw new DiskErrorException("directory is not writable: "
                                   + dir.toString());
  }
View Full Code Here

   * @param permission the new permissions
   * @throws IOException
   */
  public static void setPermission(File f, FsPermission permission
                                   ) throws IOException {
    FsAction user = permission.getUserAction();
    FsAction group = permission.getGroupAction();
    FsAction other = permission.getOtherAction();

    // use the native/fork if the group/other permissions are different
    // or if the native is available   
    if (group != other || NativeIO.isAvailable()) {
      execSetPermission(f, permission);
View Full Code Here

    }
    return client.removeDirectory(pathName);
  }

  private FsAction getFsAction(int accessGroup, FTPFile ftpFile) {
    FsAction action = FsAction.NONE;
    if (ftpFile.hasPermission(accessGroup, FTPFile.READ_PERMISSION)) {
      action.or(FsAction.READ);
    }
    if (ftpFile.hasPermission(accessGroup, FTPFile.WRITE_PERMISSION)) {
      action.or(FsAction.WRITE);
    }
    if (ftpFile.hasPermission(accessGroup, FTPFile.EXECUTE_PERMISSION)) {
      action.or(FsAction.EXECUTE);
    }
    return action;
  }
View Full Code Here

    }
    return action;
  }

  private FsPermission getPermissions(FTPFile ftpFile) {
    FsAction user, group, others;
    user = getFsAction(FTPFile.USER_ACCESS, ftpFile);
    group = getFsAction(FTPFile.GROUP_ACCESS, ftpFile);
    others = getFsAction(FTPFile.WORLD_ACCESS, ftpFile);
    return new FsPermission(user, group, others);
  }
View Full Code Here

    FileStatus stat = fs.getFileStatus(path);
    FsPermission actual = stat.getPermission();
    if (!stat.isDir())
      throw new DiskErrorException(configKey + " - not a directory: "
          + path.toString());
    FsAction user = actual.getUserAction();
    if (!user.implies(FsAction.READ))
      throw new DiskErrorException("bad " + configKey
          + "- directory is not readable: " + path.toString());
    if (!user.implies(FsAction.WRITE))
      throw new DiskErrorException("bad " + configKey
          + "- directory is not writable " + path.toString());
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.fs.permission.FsAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.