hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cnaur...@apache.org
Subject svn commit: r1550256 - in /hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src: main/java/org/apache/hadoop/fs/ main/java/org/apache/hadoop/fs/permission/ main/java/org/apache/hadoop/fs/viewfs/ test/java/org/apache/hadoop/fs/ test/...
Date Wed, 11 Dec 2013 20:54:47 GMT
Author: cnauroth
Date: Wed Dec 11 20:54:46 2013
New Revision: 1550256

URL: http://svn.apache.org/r1550256
Log:
HDFS-5650. Remove AclReadFlag and AclWriteFlag in FileSystem API. Contributed by Haohui Mai.

Removed:
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/Acl.java
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclReadFlag.java
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclWriteFlag.java
Modified:
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclStatus.java
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestAcl.java
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
    hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemDelegation.java

Modified: hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java?rev=1550256&r1=1550255&r2=1550256&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
(original)
+++ hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
Wed Dec 11 20:54:46 2013
@@ -49,9 +49,7 @@ import org.apache.hadoop.conf.Configured
 import org.apache.hadoop.fs.Options.ChecksumOpt;
 import org.apache.hadoop.fs.Options.Rename;
 import org.apache.hadoop.fs.permission.AclEntry;
-import org.apache.hadoop.fs.permission.AclReadFlag;
 import org.apache.hadoop.fs.permission.AclStatus;
-import org.apache.hadoop.fs.permission.AclWriteFlag;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.io.MultipleIOException;
 import org.apache.hadoop.io.Text;
@@ -2278,11 +2276,9 @@ public abstract class FileSystem extends
    *
    * @param path Path to modify
    * @param aclSpec List<AclEntry> describing modifications
-   * @param flags EnumSet<AclWriteFlag> containing flags (such as recursive)
    * @throws IOException if an ACL could not be modified
    */
-  public void modifyAclEntries(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
+  public void modifyAclEntries(Path path, Iterable<AclEntry> aclSpec) throws IOException
{
     throw new UnsupportedOperationException(getClass().getSimpleName()
         + " doesn't support modifyAclEntries");
   }
@@ -2293,11 +2289,9 @@ public abstract class FileSystem extends
    *
    * @param path Path to modify
    * @param aclSpec List<AclEntry> describing entries to remove
-   * @param flags EnumSet<AclWriteFlag> containing flags (such as recursive)
    * @throws IOException if an ACL could not be modified
    */
-  public void removeAclEntries(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
+  public void removeAclEntries(Path path, Iterable<AclEntry> aclSpec) throws IOException
{
     throw new UnsupportedOperationException(getClass().getSimpleName()
         + " doesn't support removeAclEntries");
   }
@@ -2306,10 +2300,9 @@ public abstract class FileSystem extends
    * Removes all default ACL entries from files and directories.
    *
    * @param path Path to modify
-   * @param flags EnumSet<AclWriteFlag> containing flags (such as recursive)
    * @throws IOException if an ACL could not be modified
    */
-  public void removeDefaultAcl(Path path, EnumSet<AclWriteFlag> flags)
+  public void removeDefaultAcl(Path path)
       throws IOException {
     throw new UnsupportedOperationException(getClass().getSimpleName()
         + " doesn't support removeDefaultAcl");
@@ -2321,10 +2314,9 @@ public abstract class FileSystem extends
    * bits.
    *
    * @param path Path to modify
-   * @param flags EnumSet<AclWriteFlag> containing flags (such as recursive)
    * @throws IOException if an ACL could not be removed
    */
-  public void removeAcl(Path path, EnumSet<AclWriteFlag> flags)
+  public void removeAcl(Path path)
       throws IOException {
     throw new UnsupportedOperationException(getClass().getSimpleName()
         + " doesn't support removeAcl");
@@ -2337,11 +2329,9 @@ public abstract class FileSystem extends
    * @param path Path to modify
    * @param aclSpec List<AclEntry> describing modifications, must include entries
    *   for user, group, and others for compatibility with permission bits.
-   * @param flags EnumSet<AclWriteFlag> containing flags (such as recursive)
    * @throws IOException if an ACL could not be modified
    */
-  public void setAcl(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
+  public void setAcl(Path path, Iterable<AclEntry> aclSpec) throws IOException {
     throw new UnsupportedOperationException(getClass().getSimpleName()
         + " doesn't support setAcl");
   }
@@ -2350,14 +2340,12 @@ public abstract class FileSystem extends
    * Gets the ACLs of files and directories.
    *
    * @param path Path to get
-   * @param flags EnumSet<AclReadFlag> containing flags (such as recursive)
    * @return RemoteIterator<AclStatus> which returns each AclStatus
    * @throws IOException if an ACL could not be read
    */
-  public RemoteIterator<AclStatus> listAclStatus(Path path,
-      EnumSet<AclReadFlag> flags) throws IOException {
+  public AclStatus getAclStatus(Path path) throws IOException {
     throw new UnsupportedOperationException(getClass().getSimpleName()
-        + " doesn't support listAclStatus");
+        + " doesn't support getAclStatus");
   }
 
   // making it volatile to be able to do a double checked locking

Modified: hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java?rev=1550256&r1=1550255&r2=1550256&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
(original)
+++ hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
Wed Dec 11 20:54:46 2013
@@ -22,14 +22,12 @@ import java.io.*;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.EnumSet;
-import java.util.List;
+
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.permission.AclEntry;
-import org.apache.hadoop.fs.permission.AclReadFlag;
 import org.apache.hadoop.fs.permission.AclStatus;
-import org.apache.hadoop.fs.permission.AclWriteFlag;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.fs.ContentSummary;
 import org.apache.hadoop.fs.Options.ChecksumOpt;
@@ -514,38 +512,34 @@ public class FilterFileSystem extends Fi
   }
 
   @Override
-  public void modifyAclEntries(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
-    fs.modifyAclEntries(path, aclSpec, flags);
+  public void modifyAclEntries(Path path, Iterable<AclEntry> aclSpec) throws IOException
{
+    fs.modifyAclEntries(path, aclSpec);
   }
 
   @Override
-  public void removeAclEntries(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
-    fs.removeAclEntries(path, aclSpec, flags);
+  public void removeAclEntries(Path path, Iterable<AclEntry> aclSpec) throws IOException
{
+    fs.removeAclEntries(path, aclSpec);
   }
 
   @Override
-  public void removeDefaultAcl(Path path, EnumSet<AclWriteFlag> flags)
+  public void removeDefaultAcl(Path path)
       throws IOException {
-    fs.removeDefaultAcl(path, flags);
+    fs.removeDefaultAcl(path);
   }
 
   @Override
-  public void removeAcl(Path path, EnumSet<AclWriteFlag> flags)
+  public void removeAcl(Path path)
       throws IOException {
-    fs.removeAcl(path, flags);
+    fs.removeAcl(path);
   }
 
   @Override
-  public void setAcl(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
-    fs.setAcl(path, aclSpec, flags);
+  public void setAcl(Path path, Iterable<AclEntry> aclSpec) throws IOException {
+    fs.setAcl(path, aclSpec);
   }
 
   @Override
-  public RemoteIterator<AclStatus> listAclStatus(Path path,
-      EnumSet<AclReadFlag> flags) throws IOException {
-    return fs.listAclStatus(path, flags);
+  public AclStatus getAclStatus(Path path) throws IOException {
+    return fs.getAclStatus(path);
   }
 }

Modified: hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclStatus.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclStatus.java?rev=1550256&r1=1550255&r2=1550256&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclStatus.java
(original)
+++ hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/AclStatus.java
Wed Dec 11 20:54:46 2013
@@ -17,33 +17,26 @@
  */
 package org.apache.hadoop.fs.permission;
 
-import com.google.common.base.Objects;
+import java.util.Collections;
+import java.util.List;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.fs.Path;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.Lists;
 
 /**
- * An AclStatus represents an association of a specific file {@link Path} with
- * an {@link Acl}.  AclStatus instances are immutable.  Use a {@link Builder} to
- * create a new instance.
+ * An AclStatus contains the ACL information of a specific file. AclStatus
+ * instances are immutable. Use a {@link Builder} to create a new instance.
  */
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public class AclStatus {
-  private final Path file;
   private final String owner;
   private final String group;
-  private final Acl acl;
-
-  /**
-   * Returns the file associated to this ACL.
-   *
-   * @return Path file associated to this ACL
-   */
-  public Path getFile() {
-    return file;
-  }
+  private final boolean stickyBit;
+  private final Iterable<AclEntry> entries;
 
   /**
    * Returns the file owner.
@@ -64,12 +57,21 @@ public class AclStatus {
   }
 
   /**
-   * Returns the ACL.
+   * Returns the sticky bit.
+   * 
+   * @return boolean sticky bit
+   */
+  public boolean isStickyBit() {
+    return stickyBit;
+  }
+
+  /**
+   * Returns the list of all ACL entries, ordered by their natural ordering.
    *
-   * @return Acl the ACL
+   * @return Iterable<AclEntry> unmodifiable ordered list of all ACL entries
    */
-  public Acl getAcl() {
-    return acl;
+  public Iterable<AclEntry> getEntries() {
+    return entries;
   }
 
   @Override
@@ -81,24 +83,26 @@ public class AclStatus {
       return false;
     }
     AclStatus other = (AclStatus)o;
-    return Objects.equal(file, other.file) &&
-      Objects.equal(owner, other.owner) &&
-      Objects.equal(group, other.group) &&
-      Objects.equal(acl, other.acl);
+    return Objects.equal(owner, other.owner)
+        && Objects.equal(group, other.group)
+        && stickyBit == other.stickyBit
+        && Objects.equal(entries, other.entries);
   }
 
   @Override
   public int hashCode() {
-    return Objects.hashCode(file, owner, group, acl);
+    return Objects.hashCode(owner, group, stickyBit, entries);
   }
 
   @Override
   public String toString() {
     return new StringBuilder()
-      .append("file: ").append(file)
-      .append(", owner: ").append(owner)
+      .append("owner: ").append(owner)
       .append(", group: ").append(group)
-      .append(", acl: {").append(acl).append('}')
+      .append(", acl: {")
+      .append("entries: ").append(entries)
+      .append(", stickyBit: ").append(stickyBit)
+      .append('}')
       .toString();
   }
 
@@ -106,62 +110,76 @@ public class AclStatus {
    * Builder for creating new Acl instances.
    */
   public static class Builder {
-    private Path file;
     private String owner;
     private String group;
-    private Acl acl;
+    private boolean stickyBit;
+    private List<AclEntry> entries = Lists.newArrayList();
 
     /**
-     * Sets the file associated to this ACL.
+     * Sets the file owner.
      *
-     * @param file Path file associated to this ACL
+     * @param owner String file owner
      * @return Builder this builder, for call chaining
      */
-    public Builder setFile(Path file) {
-      this.file = file;
+    public Builder owner(String owner) {
+      this.owner = owner;
       return this;
     }
 
     /**
-     * Sets the file owner.
+     * Sets the file group.
      *
-     * @param owner String file owner
+     * @param group String file group
      * @return Builder this builder, for call chaining
      */
-    public Builder setOwner(String owner) {
-      this.owner = owner;
+    public Builder group(String group) {
+      this.group = group;
       return this;
     }
 
     /**
-     * Sets the file group.
+     * Adds an ACL entry.
      *
-     * @param group String file group
+     * @param e AclEntry entry to add
      * @return Builder this builder, for call chaining
      */
-    public Builder setGroup(String group) {
-      this.group = group;
+    public Builder addEntry(AclEntry e) {
+      this.entries.add(e);
+      return this;
+    }
+
+    /**
+     * Adds a list of ACL entries.
+     *
+     * @param entries AclEntry entries to add
+     * @return Builder this builder, for call chaining
+     */
+    public Builder addEntries(Iterable<AclEntry> entries) {
+      for (AclEntry e : entries)
+        this.entries.add(e);
       return this;
     }
 
     /**
-     * Sets the ACL.
+     * Sets sticky bit. If this method is not called, then the builder assumes
+     * false.
      *
-     * @param acl Acl the ACL
+     * @param stickyBit
+     *          boolean sticky bit
      * @return Builder this builder, for call chaining
      */
-    public Builder setAcl(Acl acl) {
-      this.acl = acl;
+    public Builder stickyBit(boolean stickyBit) {
+      this.stickyBit = stickyBit;
       return this;
     }
 
     /**
-     * Builds a new Acl populated with the set properties.
+     * Builds a new AclStatus populated with the set properties.
      *
-     * @return Acl new Acl
+     * @return AclStatus new AclStatus
      */
     public AclStatus build() {
-      return new AclStatus(file, owner, group, acl);
+      return new AclStatus(owner, group, stickyBit, entries);
     }
   }
 
@@ -171,12 +189,16 @@ public class AclStatus {
    * @param file Path file associated to this ACL
    * @param owner String file owner
    * @param group String file group
-   * @param acl Acl the ACL
+   * @param stickyBit the sticky bit
+   * @param entries the ACL entries
    */
-  private AclStatus(Path file, String owner, String group, Acl acl) {
-    this.file = file;
+  private AclStatus(String owner, String group, boolean stickyBit,
+      Iterable<AclEntry> entries) {
     this.owner = owner;
     this.group = group;
-    this.acl = acl;
+    this.stickyBit = stickyBit;
+    List<AclEntry> entriesCopy = Lists.newArrayList(entries);
+    Collections.sort(entriesCopy);
+    this.entries = entriesCopy;
   }
 }

Modified: hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java?rev=1550256&r1=1550255&r2=1550256&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
(original)
+++ hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
Wed Dec 11 20:54:46 2013
@@ -20,7 +20,6 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URI;
 import java.util.EnumSet;
-import java.util.List;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
@@ -37,11 +36,8 @@ import org.apache.hadoop.fs.FilterFileSy
 import org.apache.hadoop.fs.FsServerDefaults;
 import org.apache.hadoop.fs.FsStatus;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.RemoteIterator;
 import org.apache.hadoop.fs.permission.AclEntry;
-import org.apache.hadoop.fs.permission.AclReadFlag;
 import org.apache.hadoop.fs.permission.AclStatus;
-import org.apache.hadoop.fs.permission.AclWriteFlag;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.util.Progressable;
 
@@ -285,39 +281,35 @@ class ChRootedFileSystem extends FilterF
   }
   
   @Override
-  public void modifyAclEntries(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
-    super.modifyAclEntries(fullPath(path), aclSpec, flags);
+  public void modifyAclEntries(Path path, Iterable<AclEntry> aclSpec) throws IOException
{
+    super.modifyAclEntries(fullPath(path), aclSpec);
   }
 
   @Override
-  public void removeAclEntries(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
-    super.removeAclEntries(fullPath(path), aclSpec, flags);
+  public void removeAclEntries(Path path, Iterable<AclEntry> aclSpec) throws IOException
{
+    super.removeAclEntries(fullPath(path), aclSpec);
   }
 
   @Override
-  public void removeDefaultAcl(Path path, EnumSet<AclWriteFlag> flags)
+  public void removeDefaultAcl(Path path)
       throws IOException {
-    super.removeDefaultAcl(fullPath(path), flags);
+    super.removeDefaultAcl(fullPath(path));
   }
 
   @Override
-  public void removeAcl(Path path, EnumSet<AclWriteFlag> flags)
+  public void removeAcl(Path path)
       throws IOException {
-    super.removeAcl(fullPath(path), flags);
+    super.removeAcl(fullPath(path));
   }
 
   @Override
-  public void setAcl(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
-    super.setAcl(fullPath(path), aclSpec, flags);
+  public void setAcl(Path path, Iterable<AclEntry> aclSpec) throws IOException {
+    super.setAcl(fullPath(path), aclSpec);
   }
 
   @Override
-  public RemoteIterator<AclStatus> listAclStatus(Path path,
-      EnumSet<AclReadFlag> flags) throws IOException {
-    return super.listAclStatus(fullPath(path), flags);
+  public AclStatus getAclStatus(Path path) throws IOException {
+    return super.getAclStatus(fullPath(path));
   }
 
   @Override

Modified: hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java?rev=1550256&r1=1550255&r2=1550256&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
(original)
+++ hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
Wed Dec 11 20:54:46 2013
@@ -28,7 +28,6 @@ import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.StringTokenizer;
 import java.util.Map.Entry;
 
 import org.apache.hadoop.classification.InterfaceAudience;
@@ -45,14 +44,10 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FsConstants;
 import org.apache.hadoop.fs.FsServerDefaults;
-import org.apache.hadoop.fs.InvalidPathException;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.RemoteIterator;
 import org.apache.hadoop.fs.UnsupportedFileSystemException;
 import org.apache.hadoop.fs.permission.AclEntry;
-import org.apache.hadoop.fs.permission.AclReadFlag;
 import org.apache.hadoop.fs.permission.AclStatus;
-import org.apache.hadoop.fs.permission.AclWriteFlag;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.fs.viewfs.InodeTree.INode;
 import org.apache.hadoop.fs.viewfs.InodeTree.INodeLink;
@@ -479,51 +474,47 @@ public class ViewFileSystem extends File
   }
 
   @Override
-  public void modifyAclEntries(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
+  public void modifyAclEntries(Path path, Iterable<AclEntry> aclSpec) throws IOException
{
     InodeTree.ResolveResult<FileSystem> res =
       fsState.resolve(getUriPath(path), true);
-    res.targetFileSystem.modifyAclEntries(res.remainingPath, aclSpec, flags);
+    res.targetFileSystem.modifyAclEntries(res.remainingPath, aclSpec);
   }
 
   @Override
-  public void removeAclEntries(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
+  public void removeAclEntries(Path path, Iterable<AclEntry> aclSpec) throws IOException
{
     InodeTree.ResolveResult<FileSystem> res =
       fsState.resolve(getUriPath(path), true);
-    res.targetFileSystem.removeAclEntries(res.remainingPath, aclSpec, flags);
+    res.targetFileSystem.removeAclEntries(res.remainingPath, aclSpec);
   }
 
   @Override
-  public void removeDefaultAcl(Path path, EnumSet<AclWriteFlag> flags)
+  public void removeDefaultAcl(Path path)
       throws IOException {
     InodeTree.ResolveResult<FileSystem> res =
       fsState.resolve(getUriPath(path), true);
-    res.targetFileSystem.removeDefaultAcl(res.remainingPath, flags);
+    res.targetFileSystem.removeDefaultAcl(res.remainingPath);
   }
 
   @Override
-  public void removeAcl(Path path, EnumSet<AclWriteFlag> flags)
+  public void removeAcl(Path path)
       throws IOException {
     InodeTree.ResolveResult<FileSystem> res =
       fsState.resolve(getUriPath(path), true);
-    res.targetFileSystem.removeAcl(res.remainingPath, flags);
+    res.targetFileSystem.removeAcl(res.remainingPath);
   }
 
   @Override
-  public void setAcl(Path path, List<AclEntry> aclSpec,
-      EnumSet<AclWriteFlag> flags) throws IOException {
+  public void setAcl(Path path, Iterable<AclEntry> aclSpec) throws IOException {
     InodeTree.ResolveResult<FileSystem> res =
       fsState.resolve(getUriPath(path), true);
-    res.targetFileSystem.setAcl(res.remainingPath, aclSpec, flags);
+    res.targetFileSystem.setAcl(res.remainingPath, aclSpec);
   }
 
   @Override
-  public RemoteIterator<AclStatus> listAclStatus(Path path,
-      EnumSet<AclReadFlag> flags) throws IOException {
+  public AclStatus getAclStatus(Path path) throws IOException {
     InodeTree.ResolveResult<FileSystem> res =
       fsState.resolve(getUriPath(path), true);
-    return res.targetFileSystem.listAclStatus(res.remainingPath, flags);
+    return res.targetFileSystem.getAclStatus(res.remainingPath);
   }
 
   @Override

Modified: hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java?rev=1550256&r1=1550255&r2=1550256&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java
(original)
+++ hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java
Wed Dec 11 20:54:46 2013
@@ -22,9 +22,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.permission.AclEntry;
-import org.apache.hadoop.fs.permission.AclReadFlag;
 import org.apache.hadoop.fs.permission.AclStatus;
-import org.apache.hadoop.fs.permission.AclWriteFlag;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.token.Token;
@@ -37,7 +35,6 @@ import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.EnumSet;
 import java.util.Iterator;
-import java.util.List;
 
 import static org.apache.hadoop.fs.Options.ChecksumOpt;
 import static org.apache.hadoop.fs.Options.CreateOpts;
@@ -170,18 +167,12 @@ public class TestHarFileSystem {
         String snapshotNewName) throws IOException;
     public void deleteSnapshot(Path path, String snapshotName)
         throws IOException;
-    public void modifyAclEntries(Path path, List<AclEntry> aclSpec,
-        EnumSet<AclWriteFlag> flags) throws IOException;
-    public void removeAclEntries(Path path, List<AclEntry> aclSpec,
-        EnumSet<AclWriteFlag> flags) throws IOException;
-    public void removeDefaultAcl(Path path, EnumSet<AclWriteFlag> flags)
-        throws IOException;
-    public void removeAcl(Path path, EnumSet<AclWriteFlag> flags)
-        throws IOException;
-    public void setAcl(Path path, List<AclEntry> aclSpec,
-        EnumSet<AclWriteFlag> flags) throws IOException;
-    public RemoteIterator<AclStatus> listAclStatus(Path path,
-        EnumSet<AclReadFlag> flags) throws IOException;
+    public void modifyAclEntries(Path path, Iterable<AclEntry> aclSpec) throws IOException;
+    public void removeAclEntries(Path path, Iterable<AclEntry> aclSpec) throws IOException;
+    public void removeDefaultAcl(Path path) throws IOException;
+    public void removeAcl(Path path) throws IOException;
+    public void setAcl(Path path, Iterable<AclEntry> aclSpec) throws IOException;
+    public AclStatus getAclStatus(Path path) throws IOException;
   }
 
   @Test

Modified: hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestAcl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestAcl.java?rev=1550256&r1=1550255&r2=1550256&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestAcl.java
(original)
+++ hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestAcl.java
Wed Dec 11 20:54:46 2013
@@ -21,20 +21,21 @@ import static org.junit.Assert.*;
 
 import java.util.List;
 
+import org.junit.BeforeClass;
 import org.junit.Test;
 
-import org.apache.hadoop.fs.Path;
+import com.google.common.collect.Lists;
 
 /**
  * Tests covering basic functionality of the ACL objects.
  */
 public class TestAcl {
-  private static final Acl ACL1, ACL2, ACL3, ACL4;
-  private static final AclEntry ENTRY1, ENTRY2, ENTRY3, ENTRY4, ENTRY5, ENTRY6,
+  private static AclEntry ENTRY1, ENTRY2, ENTRY3, ENTRY4, ENTRY5, ENTRY6,
     ENTRY7, ENTRY8, ENTRY9, ENTRY10, ENTRY11, ENTRY12, ENTRY13;
-  private static final AclStatus STATUS1, STATUS2, STATUS3;
+  private static AclStatus STATUS1, STATUS2, STATUS3, STATUS4;
 
-  static {
+  @BeforeClass
+  public static void setUp() {
     // named user
     AclEntry.Builder aclEntryBuilder = new AclEntry.Builder()
       .setType(AclEntryType.USER)
@@ -107,31 +108,21 @@ public class TestAcl {
       .setScope(AclEntryScope.DEFAULT)
       .build();
 
-    Acl.Builder aclBuilder = new Acl.Builder()
+    AclStatus.Builder aclStatusBuilder = new AclStatus.Builder()
+      .owner("owner1")
+      .group("group1")
       .addEntry(ENTRY1)
       .addEntry(ENTRY3)
       .addEntry(ENTRY4);
-    ACL1 = aclBuilder.build();
-    ACL2 = aclBuilder.build();
-    ACL3 = new Acl.Builder()
-      .setStickyBit(true)
-      .build();
-
-    AclStatus.Builder aclStatusBuilder = new AclStatus.Builder()
-      .setFile(new Path("file1"))
-      .setOwner("owner1")
-      .setGroup("group1")
-      .setAcl(ACL1);
     STATUS1 = aclStatusBuilder.build();
     STATUS2 = aclStatusBuilder.build();
     STATUS3 = new AclStatus.Builder()
-      .setFile(new Path("file2"))
-      .setOwner("owner2")
-      .setGroup("group2")
-      .setAcl(ACL3)
+      .owner("owner2")
+      .group("group2")
+      .stickyBit(true)
       .build();
 
-    ACL4 = new Acl.Builder()
+    STATUS4 = new AclStatus.Builder()
       .addEntry(ENTRY1)
       .addEntry(ENTRY3)
       .addEntry(ENTRY4)
@@ -148,39 +139,6 @@ public class TestAcl {
   }
 
   @Test
-  public void testAclEquals() {
-    assertNotSame(ACL1, ACL2);
-    assertNotSame(ACL1, ACL3);
-    assertNotSame(ACL2, ACL3);
-    assertEquals(ACL1, ACL1);
-    assertEquals(ACL2, ACL2);
-    assertEquals(ACL1, ACL2);
-    assertEquals(ACL2, ACL1);
-    assertFalse(ACL1.equals(ACL3));
-    assertFalse(ACL2.equals(ACL3));
-    assertFalse(ACL1.equals(null));
-    assertFalse(ACL1.equals(new Object()));
-  }
-
-  @Test
-  public void testAclHashCode() {
-    assertEquals(ACL1.hashCode(), ACL2.hashCode());
-    assertFalse(ACL1.hashCode() == ACL3.hashCode());
-  }
-
-  @Test
-  public void testAclEntriesImmutable() {
-    AclEntry entry = new AclEntry.Builder().build();
-    List<AclEntry> entries = ACL1.getEntries();
-    try {
-      entries.add(entry);
-      fail("expected adding ACL entry to fail");
-    } catch (UnsupportedOperationException e) {
-      // expected
-    }
-  }
-
-  @Test
   public void testEntryEquals() {
     assertNotSame(ENTRY1, ENTRY2);
     assertNotSame(ENTRY1, ENTRY3);
@@ -223,7 +181,7 @@ public class TestAcl {
       ENTRY10, // default mask
       ENTRY4   // default other
     };
-    List<AclEntry> actual = ACL4.getEntries();
+    List<AclEntry> actual = Lists.newArrayList(STATUS4.getEntries());
     assertNotNull(actual);
     assertEquals(expected.length, actual.size());
     for (int i = 0; i < expected.length; ++i) {
@@ -267,25 +225,19 @@ public class TestAcl {
 
   @Test
   public void testToString() {
-    assertEquals(
-      "entries: [user:user1:rwx, group:group2:rw-, default:other::---], stickyBit: false",
-      ACL1.toString());
-    assertEquals(
-      "entries: [user:user1:rwx, group:group2:rw-, default:other::---], stickyBit: false",
-      ACL2.toString());
-    assertEquals("entries: [], stickyBit: true", ACL3.toString());
     assertEquals("user:user1:rwx", ENTRY1.toString());
     assertEquals("user:user1:rwx", ENTRY2.toString());
     assertEquals("group:group2:rw-", ENTRY3.toString());
     assertEquals("default:other::---", ENTRY4.toString());
+
     assertEquals(
-      "file: file1, owner: owner1, group: group1, acl: {entries: [user:user1:rwx, group:group2:rw-,
default:other::---], stickyBit: false}",
+      "owner: owner1, group: group1, acl: {entries: [user:user1:rwx, group:group2:rw-, default:other::---],
stickyBit: false}",
       STATUS1.toString());
     assertEquals(
-      "file: file1, owner: owner1, group: group1, acl: {entries: [user:user1:rwx, group:group2:rw-,
default:other::---], stickyBit: false}",
+      "owner: owner1, group: group1, acl: {entries: [user:user1:rwx, group:group2:rw-, default:other::---],
stickyBit: false}",
       STATUS2.toString());
     assertEquals(
-      "file: file2, owner: owner2, group: group2, acl: {entries: [], stickyBit: true}",
+      "owner: owner2, group: group2, acl: {entries: [], stickyBit: true}",
       STATUS3.toString());
   }
 }

Modified: hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java?rev=1550256&r1=1550255&r2=1550256&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
(original)
+++ hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
Wed Dec 11 20:54:46 2013
@@ -21,7 +21,6 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URI;
 import java.util.Collections;
-import java.util.EnumSet;
 import java.util.List;
 
 import org.apache.hadoop.conf.Configuration;
@@ -33,8 +32,6 @@ import org.apache.hadoop.fs.FilterFileSy
 import org.apache.hadoop.fs.FsConstants;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.AclEntry;
-import org.apache.hadoop.fs.permission.AclReadFlag;
-import org.apache.hadoop.fs.permission.AclWriteFlag;
 import org.apache.hadoop.fs.viewfs.ChRootedFileSystem;
 import org.junit.After;
 import org.junit.Assert;
@@ -378,26 +375,24 @@ public class TestChRootedFileSystem {
     Path chrootPath = new Path("/c");
     Path rawPath = new Path("/a/b/c");
     List<AclEntry> entries = Collections.emptyList();
-    EnumSet<AclWriteFlag> writeFlags = EnumSet.noneOf(AclWriteFlag.class);
-    EnumSet<AclReadFlag> readFlags = EnumSet.noneOf(AclReadFlag.class);
 
-    chrootFs.modifyAclEntries(chrootPath, entries, writeFlags);
-    verify(mockFs).modifyAclEntries(rawPath, entries, writeFlags);
+    chrootFs.modifyAclEntries(chrootPath, entries);
+    verify(mockFs).modifyAclEntries(rawPath, entries);
 
-    chrootFs.removeAclEntries(chrootPath, entries, writeFlags);
-    verify(mockFs).removeAclEntries(rawPath, entries, writeFlags);
+    chrootFs.removeAclEntries(chrootPath, entries);
+    verify(mockFs).removeAclEntries(rawPath, entries);
 
-    chrootFs.removeDefaultAcl(chrootPath, writeFlags);
-    verify(mockFs).removeDefaultAcl(rawPath, writeFlags);
+    chrootFs.removeDefaultAcl(chrootPath);
+    verify(mockFs).removeDefaultAcl(rawPath);
 
-    chrootFs.removeAcl(chrootPath, writeFlags);
-    verify(mockFs).removeAcl(rawPath, writeFlags);
+    chrootFs.removeAcl(chrootPath);
+    verify(mockFs).removeAcl(rawPath);
 
-    chrootFs.setAcl(chrootPath, entries, writeFlags);
-    verify(mockFs).setAcl(rawPath, entries, writeFlags);
+    chrootFs.setAcl(chrootPath, entries);
+    verify(mockFs).setAcl(rawPath, entries);
 
-    chrootFs.listAclStatus(chrootPath, readFlags);
-    verify(mockFs).listAclStatus(rawPath, readFlags);
+    chrootFs.getAclStatus(chrootPath);
+    verify(mockFs).getAclStatus(rawPath);
   }
 
   static class MockFileSystem extends FilterFileSystem {

Modified: hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemDelegation.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemDelegation.java?rev=1550256&r1=1550255&r2=1550256&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemDelegation.java
(original)
+++ hadoop/common/branches/HDFS-4685/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemDelegation.java
Wed Dec 11 20:54:46 2013
@@ -21,7 +21,6 @@ package org.apache.hadoop.fs.viewfs;
 import java.io.IOException;
 import java.net.URI;
 import java.util.Collections;
-import java.util.EnumSet;
 import java.util.List;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
@@ -30,8 +29,6 @@ import org.apache.hadoop.fs.FsConstants;
 import org.apache.hadoop.fs.LocalFileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.AclEntry;
-import org.apache.hadoop.fs.permission.AclReadFlag;
-import org.apache.hadoop.fs.permission.AclWriteFlag;
 import org.apache.hadoop.fs.viewfs.TestChRootedFileSystem.MockFileSystem;
 import org.junit.*;
 import static org.junit.Assert.*;
@@ -103,38 +100,36 @@ public class TestViewFileSystemDelegatio
     Path viewFsPath2 = new Path("/mounts/mockfs2/d/e/f");
     Path mockFsPath2 = new Path("/d/e/f");
     List<AclEntry> entries = Collections.emptyList();
-    EnumSet<AclWriteFlag> writeFlags = EnumSet.noneOf(AclWriteFlag.class);
-    EnumSet<AclReadFlag> readFlags = EnumSet.noneOf(AclReadFlag.class);
 
-    viewFs.modifyAclEntries(viewFsPath1, entries, writeFlags);
-    verify(mockFs1).modifyAclEntries(mockFsPath1, entries, writeFlags);
-    viewFs.modifyAclEntries(viewFsPath2, entries, writeFlags);
-    verify(mockFs2).modifyAclEntries(mockFsPath2, entries, writeFlags);
-
-    viewFs.removeAclEntries(viewFsPath1, entries, writeFlags);
-    verify(mockFs1).removeAclEntries(mockFsPath1, entries, writeFlags);
-    viewFs.removeAclEntries(viewFsPath2, entries, writeFlags);
-    verify(mockFs2).removeAclEntries(mockFsPath2, entries, writeFlags);
-
-    viewFs.removeDefaultAcl(viewFsPath1, writeFlags);
-    verify(mockFs1).removeDefaultAcl(mockFsPath1, writeFlags);
-    viewFs.removeDefaultAcl(viewFsPath2, writeFlags);
-    verify(mockFs2).removeDefaultAcl(mockFsPath2, writeFlags);
-
-    viewFs.removeAcl(viewFsPath1, writeFlags);
-    verify(mockFs1).removeAcl(mockFsPath1, writeFlags);
-    viewFs.removeAcl(viewFsPath2, writeFlags);
-    verify(mockFs2).removeAcl(mockFsPath2, writeFlags);
-
-    viewFs.setAcl(viewFsPath1, entries, writeFlags);
-    verify(mockFs1).setAcl(mockFsPath1, entries, writeFlags);
-    viewFs.setAcl(viewFsPath2, entries, writeFlags);
-    verify(mockFs2).setAcl(mockFsPath2, entries, writeFlags);
-
-    viewFs.listAclStatus(viewFsPath1, readFlags);
-    verify(mockFs1).listAclStatus(mockFsPath1, readFlags);
-    viewFs.listAclStatus(viewFsPath2, readFlags);
-    verify(mockFs2).listAclStatus(mockFsPath2, readFlags);
+    viewFs.modifyAclEntries(viewFsPath1, entries);
+    verify(mockFs1).modifyAclEntries(mockFsPath1, entries);
+    viewFs.modifyAclEntries(viewFsPath2, entries);
+    verify(mockFs2).modifyAclEntries(mockFsPath2, entries);
+
+    viewFs.removeAclEntries(viewFsPath1, entries);
+    verify(mockFs1).removeAclEntries(mockFsPath1, entries);
+    viewFs.removeAclEntries(viewFsPath2, entries);
+    verify(mockFs2).removeAclEntries(mockFsPath2, entries);
+
+    viewFs.removeDefaultAcl(viewFsPath1);
+    verify(mockFs1).removeDefaultAcl(mockFsPath1);
+    viewFs.removeDefaultAcl(viewFsPath2);
+    verify(mockFs2).removeDefaultAcl(mockFsPath2);
+
+    viewFs.removeAcl(viewFsPath1);
+    verify(mockFs1).removeAcl(mockFsPath1);
+    viewFs.removeAcl(viewFsPath2);
+    verify(mockFs2).removeAcl(mockFsPath2);
+
+    viewFs.setAcl(viewFsPath1, entries);
+    verify(mockFs1).setAcl(mockFsPath1, entries);
+    viewFs.setAcl(viewFsPath2, entries);
+    verify(mockFs2).setAcl(mockFsPath2, entries);
+
+    viewFs.getAclStatus(viewFsPath1);
+    verify(mockFs1).getAclStatus(mockFsPath1);
+    viewFs.getAclStatus(viewFsPath2);
+    verify(mockFs2).getAclStatus(mockFsPath2);
   }
 
   void checkVerifyChecksum(boolean flag) {



Mime
View raw message