Просмотр исходного кода

HADOOP-3018. Fix the eclipse plug-in contrib wrt removed deprecated methods (taton)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.17@645766 13f79535-47bb-0310-9956-ffa450edef68
Christophe Taton 17 лет назад
Родитель
Сommit
7a0127934f

+ 3 - 0
CHANGES.txt

@@ -523,6 +523,9 @@ Release 0.17.0 - Unreleased
     HADOOP-3157. Fix path handling in DistributedCache and TestMiniMRLocalFS.
     (Doug Cutting via rangadi) 
 
+    HADOOP-3018. Fix the eclipse plug-in contrib wrt removed deprecated
+    methods (taton)
+
 Release 0.16.3 - Unreleased
 
   BUG FIXES

+ 5 - 20
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java

@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.logging.Logger;
 
 import org.apache.hadoop.eclipse.server.HadoopServer;
+import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.Path;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -57,33 +58,17 @@ public class DFSFolder extends DFSPath implements DFSContent {
   protected void loadDFSFolderChildren() throws IOException {
     List<DFSPath> list = new ArrayList<DFSPath>();
 
-    for (Path path : getDFS().listPaths(this.getPath())) {
-      if (getDFS().isDirectory(path)) {
-        list.add(new DFSFolder(this, path));
+    for (FileStatus status : getDFS().listStatus(this.getPath())) {
+      if (status.isDir()) {
+        list.add(new DFSFolder(this, status.getPath()));
       } else {
-        list.add(new DFSFile(this, path));
+        list.add(new DFSFile(this, status.getPath()));
       }
     }
 
     this.children = list.toArray(new DFSContent[list.size()]);
   }
 
-  /**
-   * Does a recursive delete of the remote directory tree at this node.
-   */
-  @Override
-  public void delete() {
-
-    try {
-      getDFS().delete(this.path);
-
-    } catch (IOException e) {
-      e.printStackTrace();
-      MessageDialog.openWarning(null, "Delete file",
-          "Unable to delete file \"" + this.path + "\"\n" + e);
-    }
-  }
-
   /**
    * Upload the given file or directory into this DfsFolder
    * 

+ 1 - 2
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSLocationsRoot.java

@@ -26,7 +26,6 @@ import org.apache.hadoop.eclipse.server.HadoopServer;
 import org.apache.hadoop.eclipse.servers.IHadoopServerListener;
 import org.apache.hadoop.eclipse.servers.ServerRegistry;
 import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.ipc.RPC;
 
 /**
  * Representation of the root element containing all DFS servers. This
@@ -138,6 +137,7 @@ public class DFSLocationsRoot implements DFSContent, IHadoopServerListener {
       }
     };
 
+    // Wait 5 seconds for the connections to be closed
     closeThread.start();
     try {
       closeThread.join(5000);
@@ -145,7 +145,6 @@ public class DFSLocationsRoot implements DFSContent, IHadoopServerListener {
     } catch (InterruptedException ie) {
       // Ignore
     }
-    RPC.stopClient();
   }
 
 }

+ 4 - 1
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java

@@ -96,9 +96,12 @@ public abstract class DFSPath implements DFSContent {
     }
   }
 
+  /**
+   * Does a recursive delete of the remote directory tree at this node.
+   */
   public void delete() {
     try {
-      dfs.delete(this.path);
+      getDFS().delete(this.path, true);
 
     } catch (IOException e) {
       e.printStackTrace();