You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by um...@apache.org on 2014/05/01 19:25:41 UTC
svn commit: r1591716 - in
/hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs:
CHANGES-HDFS-2006.txt src/main/java/org/apache/hadoop/fs/XAttr.java
src/main/java/org/apache/hadoop/hdfs/DFSClient.java
Author: umamahesh
Date: Thu May 1 17:25:41 2014
New Revision: 1591716
URL: http://svn.apache.org/r1591716
Log:
HDFS-6309. Javadocs for Xattrs apis in DFSClient and other minor fixups. Contributed by Charles Lamb.
Modified:
hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-2006.txt
hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/fs/XAttr.java
hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
Modified: hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-2006.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-2006.txt?rev=1591716&r1=1591715&r2=1591716&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-2006.txt (original)
+++ hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-2006.txt Thu May 1 17:25:41 2014
@@ -12,6 +12,8 @@ HDFS-2006 (Unreleased)
HDFS-6302. Implement XAttr as a INode feature. (Yi Liu via umamahesh)
+ HDFS-6309. Javadocs for Xattrs apis in DFSClient and other minor fixups. (Charles Lamb via umamahesh)
+
OPTIMIZATIONS
BUG FIXES
Modified: hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/fs/XAttr.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/fs/XAttr.java?rev=1591716&r1=1591715&r2=1591716&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/fs/XAttr.java (original)
+++ hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/fs/XAttr.java Thu May 1 17:25:41 2014
@@ -20,23 +20,25 @@ package org.apache.hadoop.fs;
import java.util.Arrays;
/**
- * XAttr is POSIX Extended Attribute model, similar to the one in traditional
- * Operating Systems. Extended Attribute consists of a name and associated
- * data, and 4 namespaces are defined: user, trusted, security and system.
+ * XAttr is the POSIX Extended Attribute model similar to that found in
+ * traditional Operating Systems. Extended Attributes consist of one
+ * or more name/value pairs associated with a file or directory. Four
+ * namespaces are defined: user, trusted, security and system.
+ * 1) USER namespace attributes may be used by any user to store
+ * arbitrary information. Access permissions in this namespace are
+ * defined by a file directory's permission bits.
* <br>
- * 1). USER namespace extended attribute may be assigned for storing
- * arbitrary additional information, and its access permissions are
- * defined by file/directory permission bits.
- * <br>
- * 2). TRUSTED namespace extended attribute are visible and accessible
- * only to privilege user (file/directory owner or fs admin), and it is
- * available from both user space (filesystem API) and fs kernel.
- * <br>
- * 3). SYSTEM namespace extended attribute is used by fs kernel to store
- * system objects, and only available in fs kernel. It's not visible to users.
- * <br>
- * 4). SECURITY namespace extended attribute is used by fs kernel for
- * security features, and it's not visible to users.
+ * 2) TRUSTED namespace attributes are only visible and accessible to
+ * privileged users (a file or directory's owner or the fs
+ * admin). This namespace is available from both user space
+ * (filesystem API) and fs kernel.
+ * <br>
+ * 3) SYSTEM namespace attributes are used by the fs kernel to store
+ * system objects. This namespace is only available in the fs
+ * kernel. It is not visible to users.
+ * <br>
+ * 4) SECURITY namespace attributes are used by the fs kernel for
+ * security features. It is not visible to users.
* <p/>
* @see <a href="http://en.wikipedia.org/wiki/Extended_file_attributes">
* http://en.wikipedia.org/wiki/Extended_file_attributes</a>
Modified: hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java?rev=1591716&r1=1591715&r2=1591716&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java (original)
+++ hadoop/common/branches/HDFS-2006/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java Thu May 1 17:25:41 2014
@@ -2771,7 +2771,7 @@ public class DFSClient implements java.i
int prefixIndex = name.indexOf(".");
if (prefixIndex == -1) {
throw new HadoopIllegalArgumentException("XAttr name must be prefixed with" +
- " user/trusted/security/system which followed by '.'");
+ " user/trusted/security/system and followed by '.'");
} else if (prefixIndex == name.length() -1) {
throw new HadoopIllegalArgumentException("XAttr name can not be empty.");
}
@@ -2788,7 +2788,7 @@ public class DFSClient implements java.i
ns = XAttr.NameSpace.SYSTEM;
} else {
throw new HadoopIllegalArgumentException("XAttr name must be prefixed with" +
- " user/trusted/security/system which followed by '.'");
+ " user/trusted/security/system and followed by '.'");
}
XAttr xAttr = (new XAttr.Builder()).setNameSpace(ns).setName(name.
substring(prefixIndex + 1)).setValue(value).build();
@@ -2815,12 +2815,12 @@ public class DFSClient implements java.i
public byte[] getXAttr(String src, String name) throws IOException {
checkOpen();
try {
- XAttr xAttr = buildXAttr(name, null);
- List<XAttr> xAttrs = Lists.newArrayListWithCapacity(1);
+ final XAttr xAttr = buildXAttr(name, null);
+ final List<XAttr> xAttrs = Lists.newArrayListWithCapacity(1);
xAttrs.add(xAttr);
- List<XAttr> result = namenode.getXAttrs(src, xAttrs);
+ final List<XAttr> result = namenode.getXAttrs(src, xAttrs);
byte[] value = null;
- if (result != null && result.size() > 0) {
+ if (result != null && !result.isEmpty()) {
XAttr a = result.get(0);
value = a.getValue();
if (value == null) {