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 cu...@apache.org on 2007/08/17 00:56:38 UTC

svn commit: r566879 - in /lucene/hadoop/trunk: ./ src/contrib/eclipse-plugin/ src/contrib/eclipse-plugin/META-INF/ src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/ src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/

Author: cutting
Date: Thu Aug 16 15:56:37 2007
New Revision: 566879

URL: http://svn.apache.org/viewvc?view=rev&rev=566879
Log:
HADOOP-1437.  Updates to Eclipse plugin, also move it to 0.14.0 release.  Contributed by Christophe Taton.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/contrib/eclipse-plugin/.classpath
    lucene/hadoop/trunk/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF
    lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.xml
    lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/SWTUserInfo.java
    lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=566879&r1=566878&r2=566879
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Thu Aug 16 15:56:37 2007
@@ -28,9 +28,6 @@
     HADOOP-1610.  Add metrics for failed tasks.
     (Devaraj Das via tomwhite)
 
-    HADOOP-1437.  Add Eclipse plugin in contrib.
-    (Eugene Hung and Christophe Taton via cutting)
-
   OPTIMIZATIONS
 
     HADOOP-1565.  Reduce memory usage of NameNode by replacing 
@@ -592,6 +589,9 @@
 
 158. HADOOP-1717.  Fix TestDFSUpgradeFromImage to work on Solaris.
      (nigel via cutting)
+
+159. HADOOP-1437.  Add Eclipse plugin in contrib.
+     (Eugene Hung and Christophe Taton via cutting)
 
 
 Release 0.13.0 - 2007-06-08

Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/.classpath
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/.classpath?view=diff&rev=566879&r1=566878&r2=566879
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/.classpath (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/.classpath Thu Aug 16 15:56:37 2007
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="src/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="output" path="bin"/>

Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF?view=diff&rev=566879&r1=566878&r2=566879
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF Thu Aug 16 15:56:37 2007
@@ -24,5 +24,5 @@
  org.eclipse.team.cvs.ssh2,
  com.jcraft.jsch
 Eclipse-LazyStart: true
-Bundle-ClassPath: bin/
+Bundle-ClassPath: classes/
 Bundle-Vendor: Apache Hadoop

Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.xml
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.xml?view=diff&rev=566879&r1=566878&r2=566879
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.xml (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.xml Thu Aug 16 15:56:37 2007
@@ -36,9 +36,10 @@
   <target name="jar" depends="compile" unless="skip.contrib">
     <jar
       jarfile="${build.dir}/hadoop-${name}.jar"
-      basedir="${build.classes}"
-      manifest="META-INF/MANIFEST.MF"
-    />
+      manifest="${root}/META-INF/MANIFEST.MF">
+      <fileset dir="${build.dir}" includes="classes/"/>
+      <fileset dir="${root}" includes="resources/ plugin.xml"/>
+    </jar>
   </target>
 
 </project>

Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/SWTUserInfo.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/SWTUserInfo.java?view=diff&rev=566879&r1=566878&r2=566879
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/SWTUserInfo.java (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/SWTUserInfo.java Thu Aug 16 15:56:37 2007
@@ -34,17 +34,26 @@
 import com.jcraft.jsch.UserInfo;
 
 /**
- * Data structure for retaining user login information
+ * SWT Forms to prompt for passwords or for keyboard interactive
+ * authentication
  */
 public abstract class SWTUserInfo implements UserInfo, UIKeyboardInteractive {
 
+  /**
+   * Password that was last tried; this to prevent sending many times the
+   * "saved" password if it does not work
+   */
+  private String triedPassword = null;
+
   public SWTUserInfo() {
   }
 
+  /* @inheritDoc */
   public String getPassphrase() {
     return this.getPassword();
   }
 
+  /* @inheritDoc */
   public abstract String getPassword();
 
   public abstract void setPassword(String pass);
@@ -53,6 +62,7 @@
     this.setPassword(pass);
   }
 
+  /* @inheritDoc */
   public boolean promptPassphrase(final String arg0) {
     Display.getDefault().syncExec(new Runnable() {
       public void run() {
@@ -64,37 +74,46 @@
   }
 
   public boolean promptPassword(final String arg0) {
-    // check if password is already set to prevent the second session from
-    // querying again -- eyhung
-    // how to prevent bad passwords?
-    if (this.getPassword() == null) {
+    /*
+     * Ask the user for the password if we don't know it, or if we now it but
+     * already tried it
+     */
+    if ((this.getPassword() == null)
+        || this.getPassword().equals(this.triedPassword)) {
       Display.getDefault().syncExec(new Runnable() {
         public void run() {
           Shell parent = Display.getDefault().getActiveShell();
           String password = new PasswordDialog(parent).prompt(arg0);
+          SWTUserInfo.this.triedPassword = password;
           SWTUserInfo.this.setPassword(password);
         }
       });
     }
+
     return this.getPassword() != null;
   }
 
-  private boolean result;
+  /**
+   * To store the result of the Yes/No message dialog
+   */
+  private boolean yesNoResult;
 
+  /* @inheritDoc */
   public boolean promptYesNo(final String arg0) {
 
     Display.getDefault().syncExec(new Runnable() {
       public void run() {
-        result =
+        yesNoResult =
             MessageDialog.openQuestion(
                 Display.getDefault().getActiveShell(),
                 "SSH Question Dialog", arg0);
       }
     });
 
-    return result;
+    return yesNoResult;
   }
 
+  /* @inheritDoc */
   public void showMessage(final String arg0) {
     Display.getDefault().syncExec(new Runnable() {
       public void run() {
@@ -103,6 +122,9 @@
     });
   }
 
+  /**
+   * To store the answers from the keyboard interactive dialog
+   */
   private String[] interactiveAnswers;
 
   /* @inheritDoc */
@@ -124,12 +146,11 @@
    * Simple password prompting dialog
    */
   public static class PasswordDialog extends Dialog {
+
     private Text text;
 
     private String password;
 
-    private Label title;
-
     private String message;
 
     protected PasswordDialog(Shell parentShell) {
@@ -159,7 +180,7 @@
       panel.setLayout(new GridLayout(2, false));
       panel.setLayoutData(new GridData(GridData.FILL_BOTH));
 
-      title = new Label(panel, SWT.NONE);
+      Label title = new Label(panel, SWT.NONE);
       GridData span2 = new GridData(GridData.FILL_HORIZONTAL);
       span2.horizontalSpan = 2;
       title.setLayoutData(span2);

Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java?view=diff&rev=566879&r1=566878&r2=566879
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java Thu Aug 16 15:56:37 2007
@@ -101,8 +101,6 @@
    */
   private String name;
 
-  // the machine that we are tunneling through to get to the Hadoop server
-
   /**
    * Host name of the tunneling machine
    */
@@ -169,7 +167,7 @@
       session.setUserInfo(new SWTUserInfo() {
         @Override
         public String getPassword() {
-          return password;
+          return HadoopServer.this.password;
         }
 
         @Override
@@ -182,6 +180,7 @@
         try {
           session.connect();
         } catch (JSchException jse) {
+          // Reset password in case the authentication failed
           if (jse.getMessage().equals("Auth fail"))
             this.password = null;
           throw jse;
@@ -210,6 +209,7 @@
         try {
           session.connect();
         } catch (JSchException jse) {
+          // Reset password in case the authentication failed
           if (jse.getMessage().equals("Auth fail"))
             this.password = null;
           throw jse;
@@ -246,20 +246,23 @@
             tunnelHostName, 22);
     tunnel.setTimeout(0);
     tunnel.setPortForwardingL(tunnelPort, hostName, port);
+
     tunnel.setUserInfo(new SWTUserInfo() {
       @Override
       public String getPassword() {
-        return tunnelPassword;
+        return HadoopServer.this.tunnelPassword;
       }
 
       @Override
       public void setPassword(String password) {
-        tunnelPassword = password;
+        HadoopServer.this.tunnelPassword = password;
       }
     });
+
     try {
       tunnel.connect();
     } catch (JSchException jse) {
+      // Reset password in case the authentication failed
       if (jse.getMessage().equals("Auth fail"))
         this.tunnelPassword = null;
       throw jse;
@@ -282,12 +285,22 @@
     }
   }
 
-  public String getHostName() {
+  /**
+   * Return the effective host name to use to contact the server. The
+   * effective host name might be "localhost" if we setup a tunnel.
+   * 
+   * @return the effective host name to use contact the server
+   */
+  public String getEffectiveHostName() {
     if ((tunnelHostName != null) && (tunnelHostName.length() > 0)) {
       return "localhost";
     }
 
-    return hostName;
+    return this.hostName;
+  }
+  
+  public String getHostName() {
+    return this.hostName;
   }
 
   public void setHostname(String hostname) {
@@ -346,8 +359,8 @@
    */
   public URL getJobTrackerUrl() throws MalformedURLException {
     if (tunnelHostName == null) {
-      return new URL("http://" + getHostName() + ":" + JOB_TRACKER_PORT
-          + "/jobtracker.jsp");
+      return new URL("http://" + getEffectiveHostName() + ":"
+          + JOB_TRACKER_PORT + "/jobtracker.jsp");
     } else {
       try {
         createHttpTunnel(JOB_TRACKER_PORT);
@@ -461,7 +474,7 @@
       // jar.buildJar(monitor).toString());
 
       copy.setAttribute("hadoop.jarrable", jar.toMemento());
-      copy.setAttribute("hadoop.host", this.getHostName());
+      copy.setAttribute("hadoop.host", this.getEffectiveHostName());
       copy.setAttribute("hadoop.user", this.getUserName());
       copy.setAttribute("hadoop.serverid", this.id);
       copy.setAttribute("hadoop.path", this.getInstallPath());