sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cheol...@apache.org
Subject [2/2] git commit: SQOOP-815: Get version for client requires working connection to server
Date Wed, 23 Jan 2013 00:29:49 GMT
Updated Branches:
  refs/heads/sqoop2 acfc0ae02 -> ab1b6f707


SQOOP-815: Get version for client requires working connection to server

(Jarek Jarcec Cecho via Cheolsoo Park)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/ab1b6f70
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/ab1b6f70
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/ab1b6f70

Branch: refs/heads/sqoop2
Commit: ab1b6f707dfece9589858d3c4316960fc2959af8
Parents: f89c8e5
Author: Cheolsoo Park <cheolsoo@apache.org>
Authored: Tue Jan 22 15:44:44 2013 -0800
Committer: Cheolsoo Park <cheolsoo@apache.org>
Committed: Tue Jan 22 15:44:44 2013 -0800

----------------------------------------------------------------------
 .../sqoop/client/shell/ShowVersionFunction.java    |   50 ++++++++++-----
 1 files changed, 33 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/ab1b6f70/client/src/main/java/org/apache/sqoop/client/shell/ShowVersionFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/ShowVersionFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/ShowVersionFunction.java
index a0f3691..0dfc6c8 100644
--- a/client/src/main/java/org/apache/sqoop/client/shell/ShowVersionFunction.java
+++ b/client/src/main/java/org/apache/sqoop/client/shell/ShowVersionFunction.java
@@ -28,6 +28,7 @@ import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.sqoop.client.core.Constants;
 import org.apache.sqoop.client.core.Environment;
 import org.apache.sqoop.client.request.VersionRequest;
+import org.apache.sqoop.common.VersionInfo;
 import org.apache.sqoop.json.VersionBean;
 import org.codehaus.groovy.tools.shell.IO;
 
@@ -101,34 +102,49 @@ public class ShowVersionFunction extends SqoopFunction
   }
 
   private void showVersion(boolean server, boolean client, boolean protocol) {
+
+    // Print out client string if needed
+    String s;
+    if (client) {
+      s = MessageFormat.format(
+        getResource().getString(Constants.RES_SHOW_PROMPT_VERSION_CLIENT_SERVER),
+        Constants.OPT_CLIENT,
+        VersionInfo.getVersion(),
+        VersionInfo.getRevision(),
+        VersionInfo.getUser(),
+        VersionInfo.getDate()
+      );
+      io.out.println(StringEscapeUtils.unescapeJava(s));
+    }
+
+    // If only client version was required we do not need to continue
+    if(!server && !protocol) {
+      return;
+    }
+
     if (versionRequest == null) {
       versionRequest = new VersionRequest();
     }
     VersionBean versionBean =
         versionRequest.doGet(Environment.getServerUrl());
-    MessageFormat msg;
-    String s;
 
     if (server) {
-      s = MessageFormat.format(getResource().getString(Constants
-          .RES_SHOW_PROMPT_VERSION_CLIENT_SERVER), Constants.OPT_SERVER,
-          versionBean.getVersion(), versionBean.getRevision(),
-          versionBean.getUser(), versionBean.getDate());
-      io.out.println(StringEscapeUtils.unescapeJava(s));
-    }
-
-    if (client) {
-      s = MessageFormat.format(getResource().getString(Constants
-          .RES_SHOW_PROMPT_VERSION_CLIENT_SERVER), Constants.OPT_CLIENT,
-          versionBean.getVersion(), versionBean.getRevision(),
-          versionBean.getUser(), versionBean.getDate());
+      s = MessageFormat.format(
+        getResource().getString(Constants.RES_SHOW_PROMPT_VERSION_CLIENT_SERVER),
+        Constants.OPT_SERVER,
+        versionBean.getVersion(),
+        versionBean.getRevision(),
+        versionBean.getUser(),
+        versionBean.getDate()
+      );
       io.out.println(StringEscapeUtils.unescapeJava(s));
     }
 
     if (protocol) {
-      s = MessageFormat.format(getResource().getString(Constants
-          .RES_SHOW_PROMPT_VERSION_PROTOCOL), Arrays.toString(versionBean.
-          getProtocols()));
+      s = MessageFormat.format(
+        getResource().getString(Constants.RES_SHOW_PROMPT_VERSION_PROTOCOL),
+        Arrays.toString(versionBean.getProtocols())
+      );
       io.out.println(StringEscapeUtils.unescapeJava(s));
     }
 


Mime
View raw message