sb.append("; hasAcl=" + hasAcl()); sb.append("; isEncrypted=" + isEncrypted()); sb.append("; isErasureCoded=" + isErasureCoded());
/** * Constructor * @param stat a file status * @param locations a file's block locations */ public LocatedFileStatus(FileStatus stat, BlockLocation[] locations) { this(stat.getLen(), stat.isDirectory(), stat.getReplication(), stat.getBlockSize(), stat.getModificationTime(), stat.getAccessTime(), stat.getPermission(), stat.getOwner(), stat.getGroup(), null, stat.getPath(), stat.hasAcl(), stat.isEncrypted(), stat.isErasureCoded(), locations); if (stat.isSymlink()) { try { setSymlink(stat.getSymlink()); } catch (IOException e) { throw new RuntimeException("Unexpected exception", e); } } }
String line = String.format(lineFormat, (stat.isDirectory() ? "d" : "-"), stat.getPermission() + (stat.hasAcl() ? "+" : " "), (stat.isFile() ? stat.getReplication() : "-"), stat.getOwner(), String line = String.format(lineFormat, (stat.isDirectory() ? "d" : "-"), stat.getPermission() + (stat.hasAcl() ? "+" : " "), (stat.isFile() ? stat.getReplication() : "-"), stat.getOwner(),
@Override protected void processPath(PathData item) throws IOException { out.println("# file: " + item); out.println("# owner: " + item.stat.getOwner()); out.println("# group: " + item.stat.getGroup()); FsPermission perm = item.stat.getPermission(); if (perm.getStickyBit()) { out.println("# flags: --" + (perm.getOtherAction().implies(FsAction.EXECUTE) ? "t" : "T")); } final AclStatus aclStatus; final List<AclEntry> entries; if (item.stat.hasAcl()) { aclStatus = item.fs.getAclStatus(item.path); entries = aclStatus.getEntries(); } else { aclStatus = null; entries = Collections.<AclEntry> emptyList(); } ScopedAclEntries scopedEntries = new ScopedAclEntries( AclUtil.getAclFromPermAndEntries(perm, entries)); printAclEntriesForSingleScope(aclStatus, perm, scopedEntries.getAccessEntries()); printAclEntriesForSingleScope(aclStatus, perm, scopedEntries.getDefaultEntries()); out.println(); }
setSymlink((other.isSymlink() ? other.getSymlink() : null)); setPath(other.getPath()); attr = attributes(other.hasAcl(), other.isEncrypted(), other.isErasureCoded(), other.isSnapshotEnabled()); assert !(isDirectory() && isSymlink()) : "A directory cannot be a symlink";
if (src.stat.hasAcl()) { FsPermission perm = src.stat.getPermission(); List<AclEntry> srcEntries =
public static FileStatusProto convert(FileStatus stat) throws IOException { FileStatusProto.Builder bld = FileStatusProto.newBuilder(); bld.setPath(stat.getPath().toString()); if (stat.isDirectory()) { bld.setFileType(FileStatusProto.FileType.FT_DIR); } else if (stat.isSymlink()) { bld.setFileType(FileStatusProto.FileType.FT_SYMLINK) .setSymlink(stat.getSymlink().toString()); } else { bld.setFileType(FileStatusProto.FileType.FT_FILE) .setLength(stat.getLen()) .setBlockReplication(stat.getReplication()) .setBlockSize(stat.getBlockSize()); } bld.setAccessTime(stat.getAccessTime()) .setModificationTime(stat.getModificationTime()) .setOwner(stat.getOwner()) .setGroup(stat.getGroup()) .setPermission(convert(stat.getPermission())); int flags = 0; flags |= stat.hasAcl() ? FileStatusProto.Flags.HAS_ACL_VALUE : 0; flags |= stat.isEncrypted() ? FileStatusProto.Flags.HAS_CRYPT_VALUE : 0; flags |= stat.isErasureCoded() ? FileStatusProto.Flags.HAS_EC_VALUE : 0; flags |= stat.isSnapshotEnabled() ? FileStatusProto.Flags .SNAPSHOT_ENABLED_VALUE : 0; bld.setFlags(flags); return bld.build(); }
new CopyListingFileStatus(fileStatus, chunkOffset, chunkLength); if (preserveAcls) { if (fileStatus.hasAcl()) { List<AclEntry> aclEntries = fileSystem.getAclStatus( fileStatus.getPath()).getEntries();