You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ji...@apache.org on 2013/09/11 23:32:20 UTC

svn commit: r1522055 - in /hadoop/common/branches/branch-1: CHANGES.txt src/core/org/apache/hadoop/fs/FileStatus.java src/core/org/apache/hadoop/fs/FileSystem.java src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

Author: jing9
Date: Wed Sep 11 21:32:20 2013
New Revision: 1522055

URL: http://svn.apache.org/r1522055
Log:
HDFS-5038. Backport several branch-2 APIs (FileSystem#newInstance, DFSClient#getNamenode, and FileStatus#isDirectory) to branch-1. Contributed by Jing Zhao.

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/core/org/apache/hadoop/fs/FileStatus.java
    hadoop/common/branches/branch-1/src/core/org/apache/hadoop/fs/FileSystem.java
    hadoop/common/branches/branch-1/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1522055&r1=1522054&r2=1522055&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Wed Sep 11 21:32:20 2013
@@ -37,6 +37,9 @@ Release 1.3.0 - unreleased
     HADOOP-9855. Backport HADOOP-6578 to branch-1.
     (James Kinley via harsh)
 
+    HDFS-5038. Backport several branch-2 APIs (FileSystem#newInstance, 
+    DFSClient#getNamenode, and FileStatus#isDirectory) to branch-1. (jing9)
+
   BUG FIXES
 
     HADOOP-9863. Backport HADOOP-8686 to support BigEndian on ppc64. 

Modified: hadoop/common/branches/branch-1/src/core/org/apache/hadoop/fs/FileStatus.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/core/org/apache/hadoop/fs/FileStatus.java?rev=1522055&r1=1522054&r2=1522055&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/core/org/apache/hadoop/fs/FileStatus.java (original)
+++ hadoop/common/branches/branch-1/src/core/org/apache/hadoop/fs/FileStatus.java Wed Sep 11 21:32:20 2013
@@ -81,6 +81,14 @@ public class FileStatus implements Writa
   public boolean isDir() {
     return isdir;
   }
+  
+  /**
+   * Is this a directory?
+   * @return true if this is a directory
+   */
+  public boolean isDirectory() {
+    return isdir;
+  }
 
   /**
    * Get the block size of the file.

Modified: hadoop/common/branches/branch-1/src/core/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/core/org/apache/hadoop/fs/FileSystem.java?rev=1522055&r1=1522054&r2=1522055&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/core/org/apache/hadoop/fs/FileSystem.java (original)
+++ hadoop/common/branches/branch-1/src/core/org/apache/hadoop/fs/FileSystem.java Wed Sep 11 21:32:20 2013
@@ -124,6 +124,11 @@ public abstract class FileSystem extends
     return get(getDefaultUri(conf), conf);
   }
   
+  /** Returns the configured filesystem implementation.*/
+  public static FileSystem newInstance(Configuration conf) throws IOException {
+    return get(getDefaultUri(conf), conf);
+  }
+  
   /** Get the default filesystem URI from a configuration.
    * @param conf the configuration to access
    * @return the uri of the default filesystem

Modified: hadoop/common/branches/branch-1/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java?rev=1522055&r1=1522054&r2=1522055&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java (original)
+++ hadoop/common/branches/branch-1/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java Wed Sep 11 21:32:20 2013
@@ -734,6 +734,14 @@ public class DFSClient implements FSCons
     //    Get block info from namenode
     return new DFSInputStream(src, buffersize, verifyChecksum);
   }
+  
+  /**
+   * Get the namenode associated with this DFSClient object
+   * @return the namenode associated with this DFSClient object
+   */
+  public ClientProtocol getNamenode() {
+    return namenode;
+  }
 
   /**
    * Create a new dfs file and return an output stream for writing into it.