hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r486895 - in /lucene/hadoop/trunk: ./ bin/ src/contrib/streaming/src/test/org/apache/hadoop/streaming/ src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/fs/ src/test/org/apache/hadoop/dfs/ src/webapps/dfs/
Date Wed, 13 Dec 2006 23:57:31 GMT
Author: cutting
Date: Wed Dec 13 15:57:31 2006
New Revision: 486895

URL: http://svn.apache.org/viewvc?view=rev&rev=486895
Log:
HADOOP-824.  Rename DFSShell to be FsShell.

Added:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FsShell.java
      - copied, changed from r486871, lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java
Removed:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java
Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/bin/hadoop
    lucene/hadoop/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestStreamedMerge.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSAdmin.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DatanodeInfo.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java
    lucene/hadoop/trunk/src/webapps/dfs/browseDirectory.jsp
    lucene/hadoop/trunk/src/webapps/dfs/dfshealth.jsp

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=486895&r1=486894&r2=486895
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Dec 13 15:57:31 2006
@@ -99,6 +99,9 @@
     fs.s3.awsAccessKeyId and fs.s3.awsSecretAccessKey.
     (Tom White via cutting)
 
+28. HADOOP-824.  Rename DFSShell to be FsShell, since it applies
+    generically to all FileSystem implementations.  (cutting)
+
 
 Release 0.9.1 - 2006-12-06
 

Modified: lucene/hadoop/trunk/bin/hadoop
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/bin/hadoop?view=diff&rev=486895&r1=486894&r2=486895
==============================================================================
--- lucene/hadoop/trunk/bin/hadoop (original)
+++ lucene/hadoop/trunk/bin/hadoop Wed Dec 13 15:57:31 2006
@@ -29,8 +29,8 @@
   echo "  namenode          run the DFS namenode"
   echo "  datanode          run a DFS datanode"
   echo "  dfsadmin          run a DFS admin client"
-  echo "  dfs               run a DFS user client"
   echo "  fsck              run a DFS filesystem checking utility"
+  echo "  fs                run a generic filesystem user client"
   echo "  jobtracker        run the MapReduce job Tracker node" 
   echo "  tasktracker       run a MapReduce task Tracker node" 
   echo "  job               manipulate MapReduce jobs" 
@@ -137,8 +137,10 @@
   CLASS='org.apache.hadoop.dfs.NameNode'
 elif [ "$COMMAND" = "datanode" ] ; then
   CLASS='org.apache.hadoop.dfs.DataNode'
+elif [ "$COMMAND" = "fs" ] ; then
+  CLASS=org.apache.hadoop.fs.FsShell
 elif [ "$COMMAND" = "dfs" ] ; then
-  CLASS=org.apache.hadoop.dfs.DFSShell
+  CLASS=org.apache.hadoop.fs.FsShell
 elif [ "$COMMAND" = "dfsadmin" ] ; then
   CLASS=org.apache.hadoop.dfs.DFSAdmin
 elif [ "$COMMAND" = "fsck" ] ; then

Modified: lucene/hadoop/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestStreamedMerge.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestStreamedMerge.java?view=diff&rev=486895&r1=486894&r2=486895
==============================================================================
--- lucene/hadoop/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestStreamedMerge.java
(original)
+++ lucene/hadoop/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestStreamedMerge.java
Wed Dec 13 15:57:31 2006
@@ -32,7 +32,7 @@
 import junit.framework.TestCase;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.dfs.DFSShell;
+import org.apache.hadoop.fs.FsShell;
 import org.apache.hadoop.dfs.MiniDFSCluster;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -106,7 +106,7 @@
   void lsr() {
     try {
       System.out.println("lsr /");
-      DFSShell shell = new DFSShell();
+      FsShell shell = new FsShell();
       shell.setConf(conf_);
       shell.init();
       shell.ls("/", true);

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSAdmin.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSAdmin.java?view=diff&rev=486895&r1=486894&r2=486895
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSAdmin.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSAdmin.java Wed Dec 13 15:57:31 2006
@@ -19,6 +19,7 @@
 
 import java.io.IOException;
 
+import org.apache.hadoop.fs.FsShell;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.ipc.RemoteException;
 import org.apache.hadoop.ipc.RPC;
@@ -28,7 +29,7 @@
  *
  * @author Dhruba Borthakur
  */
-public class DFSAdmin extends DFSShell {
+public class DFSAdmin extends FsShell {
 
     /**
      * Construct a DFSAdmin object.

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DatanodeInfo.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DatanodeInfo.java?view=diff&rev=486895&r1=486894&r2=486895
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DatanodeInfo.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DatanodeInfo.java Wed Dec 13 15:57:31
2006
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.util.Date;
 
+import org.apache.hadoop.fs.FsShell;
 import org.apache.hadoop.io.UTF8;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableFactories;
@@ -78,9 +79,9 @@
     long r = getRemaining();
     long u = c - r;
     buffer.append("Name: "+name+"\n");
-    buffer.append("Total raw bytes: "+c+" ("+DFSShell.byteDesc(c)+")"+"\n");
-    buffer.append("Used raw bytes: "+u+" ("+DFSShell.byteDesc(u)+")"+"\n");
-    buffer.append("% used: "+DFSShell.limitDecimal(((1.0*u)/c)*100,2)+"%"+"\n");
+    buffer.append("Total raw bytes: "+c+" ("+FsShell.byteDesc(c)+")"+"\n");
+    buffer.append("Used raw bytes: "+u+" ("+FsShell.byteDesc(u)+")"+"\n");
+    buffer.append("% used: "+FsShell.limitDecimal(((1.0*u)/c)*100,2)+"%"+"\n");
     buffer.append("Last contact: "+new Date(lastUpdate)+"\n");
     return buffer.toString();
   }

Copied: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FsShell.java (from r486871, lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java)
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FsShell.java?view=diff&rev=486895&p1=lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java&r1=486871&p2=lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FsShell.java&r2=486895
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FsShell.java Wed Dec 13 15:57:31 2006
@@ -15,13 +15,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.hadoop.dfs;
+package org.apache.hadoop.fs;
 
 import java.io.*;
 import java.text.*;
 
 import org.apache.hadoop.conf.*;
-import org.apache.hadoop.fs.*;
 import org.apache.hadoop.ipc.*;
 import org.apache.hadoop.util.ToolBase;
 
@@ -30,13 +29,13 @@
  *
  * @author Mike Cafarella
  **************************************************/
-public class DFSShell extends ToolBase {
+public class FsShell extends ToolBase {
 
-    FileSystem fs;
+    protected FileSystem fs;
 
     /**
      */
-    public DFSShell() {
+    public FsShell() {
     }
 
     public void init() throws IOException {
@@ -322,8 +321,8 @@
         } else {
             System.out.println("Found " + items.length + " items");
             for (int i = 0; i < items.length; i++) {
-                DfsPath cur = (DfsPath) items[i];
-                System.out.println(cur + "\t" + cur.getContentsLength());
+              Path cur = items[i];
+              System.out.println(cur + "\t" + fs.getLength(cur));
             }
         }
     }
@@ -345,7 +344,7 @@
         if (items != null) {
           int totalSize=0;
           for(int j=0; j<items.length; j++) {
-            totalSize += ((DfsPath)items[j]).getContentsLength();
+            totalSize += fs.getLength(items[j]);
           }
           String pathStr = paths[i].toString();
           System.out.println(
@@ -563,7 +562,7 @@
     /**
      * Return an abbreviated English-language desc of the byte length
      */
-    static String byteDesc(long len) {
+    public static String byteDesc(long len) {
         double val = 0.0;
         String ending = "";
         if (len < 1024 * 1024) {
@@ -585,7 +584,7 @@
         return limitDecimal(val, 2) + ending;
     }
 
-    static String limitDecimal(double d, int placesAfterDecimal) {
+    public static String limitDecimal(double d, int placesAfterDecimal) {
         String strVal = Double.toString(d);
         int decpt = strVal.indexOf(".");
         if (decpt >= 0) {
@@ -660,42 +659,42 @@
      */
     public void printUsage(String cmd) {
           if ("-fs".equals(cmd)) {
-            System.err.println("Usage: java DFSShell" + 
+            System.err.println("Usage: java FsShell" + 
                 " [-fs <local | namenode:port>]");
           } else if ("-conf".equals(cmd)) {
-            System.err.println("Usage: java DFSShell" + 
+            System.err.println("Usage: java FsShell" + 
                 " [-conf <configuration file>]");
           } else if ("-D".equals(cmd)) {
-            System.err.println("Usage: java DFSShell" + 
+            System.err.println("Usage: java FsShell" + 
                 " [-D <[property=value>]");
           } else if ("-ls".equals(cmd) || "-lsr".equals(cmd) ||
                    "-du".equals(cmd) || "-dus".equals(cmd) || 
                    "-rm".equals(cmd) || "-rmr".equals(cmd) || 
                    "-mkdir".equals(cmd)) {
-            System.err.println("Usage: java DFSShell" + 
+            System.err.println("Usage: java FsShell" + 
                 " [" + cmd + " <path>]");
           } else if ("-mv".equals(cmd) || "-cp".equals(cmd)) {
-            System.err.println("Usage: java DFSShell" + 
+            System.err.println("Usage: java FsShell" + 
                 " [" + cmd + " <src> <dst>]");
           } else if ("-put".equals(cmd) || "-copyFromLocal".equals(cmd) ||
                    "-moveFromLocal".equals(cmd)) {
-            System.err.println("Usage: java DFSShell" + 
+            System.err.println("Usage: java FsShell" + 
                 " [" + cmd + " <localsrc> <dst>]");
           } else if ("-get".equals(cmd) || "-copyToLocal".equals(cmd) ||
                    "-moveToLocal".equals(cmd)) {
-            System.err.println("Usage: java DFSShell" + 
+            System.err.println("Usage: java FsShell" + 
                 " [" + cmd + " [-crc] <src> <localdst>]");
           } else if ("-cat".equals(cmd)) {
-            System.out.println("Usage: java DFSShell" + 
+            System.out.println("Usage: java FsShell" + 
                 " [" + cmd + " <src>]");
           } else if ("-get".equals(cmd)) {
-            System.err.println("Usage: java DFSShell" + 
+            System.err.println("Usage: java FsShell" + 
                 " [" + cmd + " <src> <localdst> [addnl]]");
           } else if ("-setrep".equals(cmd)) {
-            System.err.println("Usage: java DFSShell" + 
+            System.err.println("Usage: java FsShell" + 
                 " [-setrep [-R] <rep> <path/file>]");
           } else {
-            System.err.println("Usage: java DFSShell");
+            System.err.println("Usage: java FsShell");
             System.err.println("           [-fs <local | namenode:port>]");
             System.err.println("           [-conf <configuration file>]");
             System.err.println("           [-D <[property=value>]");
@@ -762,7 +761,7 @@
                 }
         }
 
-        // initialize DFSShell
+        // initialize FsShell
         try {
             init();
         } catch (RPC.VersionMismatch v) { 
@@ -863,7 +862,7 @@
      * main() has some simple utility methods
      */
     public static void main(String argv[]) throws Exception {
-        int res = new DFSShell().doMain(new Configuration(), argv);
+        int res = new FsShell().doMain(new Configuration(), argv);
         System.exit(res);
     }
 }

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java?view=diff&rev=486895&r1=486894&r2=486895
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java Wed Dec 13 15:57:31
2006
@@ -20,6 +20,7 @@
 import junit.framework.TestCase;
 import java.io.*;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FsShell;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 
@@ -46,7 +47,7 @@
     Configuration conf = new Configuration();
     MiniDFSCluster cluster = new MiniDFSCluster(65312, conf, 2, false);
     FileSystem fileSys = cluster.getFileSystem();
-    DFSShell shell = new DFSShell();
+    FsShell shell = new FsShell();
     shell.setConf(conf);
 
     try {

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java?view=diff&rev=486895&r1=486894&r2=486895
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java Wed
Dec 13 15:57:31 2006
@@ -25,7 +25,7 @@
 import junit.framework.TestCase;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.dfs.DFSShell;
+import org.apache.hadoop.fs.FsShell;
 import org.apache.hadoop.dfs.DataNode;
 import org.apache.hadoop.dfs.MiniDFSCluster;
 import org.apache.hadoop.fs.FileSystem;
@@ -96,7 +96,7 @@
     }
     
     private void execute( String [] args, String namenode ) {
-        DFSShell shell=new DFSShell();
+        FsShell shell=new FsShell();
         FileSystem fs=null;
         try {
             shell.doMain(new Configuration(), args);

Modified: lucene/hadoop/trunk/src/webapps/dfs/browseDirectory.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/dfs/browseDirectory.jsp?view=diff&rev=486895&r1=486894&r2=486895
==============================================================================
--- lucene/hadoop/trunk/src/webapps/dfs/browseDirectory.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/dfs/browseDirectory.jsp Wed Dec 13 15:57:31 2006
@@ -5,6 +5,7 @@
   import="java.io.*"
   import="java.util.*"
   import="java.net.*"
+  import="org.apache.hadoop.fs.*"
   import="org.apache.hadoop.dfs.*"
   import="org.apache.hadoop.io.*"
   import="org.apache.hadoop.conf.*"
@@ -97,9 +98,9 @@
         cols[0] = "<a href=\""+datanodeUrl+"\">"+files[i].getName()+"</a>";
         }
         cols[1] = "file";
-        cols[2] = DFSShell.byteDesc(files[i].getLen());
+        cols[2] = FsShell.byteDesc(files[i].getLen());
         cols[3] = Short.toString(files[i].getReplication());
-        cols[4] = DFSShell.byteDesc(files[i].getBlockSize());
+        cols[4] = FsShell.byteDesc(files[i].getBlockSize());
       }
       else {
         String datanodeUrl = req.getRequestURL()+"?dir="+

Modified: lucene/hadoop/trunk/src/webapps/dfs/dfshealth.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/dfs/dfshealth.jsp?view=diff&rev=486895&r1=486894&r2=486895
==============================================================================
--- lucene/hadoop/trunk/src/webapps/dfs/dfshealth.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/dfs/dfshealth.jsp Wed Dec 13 15:57:31 2006
@@ -4,6 +4,7 @@
   import="javax.servlet.http.*"
   import="java.io.*"
   import="java.util.*"
+  import="org.apache.hadoop.fs.*"
   import="org.apache.hadoop.dfs.*"
   import="org.apache.hadoop.util.*"
   import="java.text.DateFormat"
@@ -78,14 +79,14 @@
     
     String percentUsed;
     if (c > 0) 
-      percentUsed = DFSShell.limitDecimal(((1.0 * u)/c)*100, 2);
+      percentUsed = FsShell.limitDecimal(((1.0 * u)/c)*100, 2);
     else
       percentUsed = "100";
     
     out.print("<td class=\"lastcontact\"> " +
               ((currentTime - d.getLastUpdate())/1000) +
 	      "<td class=\"size\">" +
-              DFSShell.limitDecimal(c*1.0/diskBytes, 2) +
+              FsShell.limitDecimal(c*1.0/diskBytes, 2) +
 	      "<td class=\"pcused\">" + percentUsed +
               "<td class=\"blocks\">" + d.numBlocks() + "\n");
   }
@@ -128,11 +129,11 @@
     
     out.print( "<div id=\"dfstable\"> <table>\n" +
 	       rowTxt() + colTxt() + "Capacity" + colTxt() + ":" + colTxt() +
-	       DFSShell.byteDesc( fsn.totalCapacity() ) +
+	       FsShell.byteDesc( fsn.totalCapacity() ) +
 	       rowTxt() + colTxt() + "Remaining" + colTxt() + ":" + colTxt() +
-	       DFSShell.byteDesc( fsn.totalRemaining() ) +
+	       FsShell.byteDesc( fsn.totalRemaining() ) +
 	       rowTxt() + colTxt() + "Used" + colTxt() + ":" + colTxt() +
-	       DFSShell.limitDecimal((fsn.totalCapacity() -
+	       FsShell.limitDecimal((fsn.totalCapacity() -
 				      fsn.totalRemaining())*100.0/
 				     (fsn.totalCapacity() + 1e-10), 2) + " %" +
 	       rowTxt() + colTxt() +



Mime
View raw message