From 8331b6001ca2b597f345f84d2bb4ea84748e2ba0 Mon Sep 17 00:00:00 2001 From: Hyunsik Choi Date: Sat, 25 Oct 2014 12:52:20 -0700 Subject: [PATCH] TAJO-1132: More detailed version info in tsql. --- .../org/apache/tajo/cli/VersionCommand.java | 4 +-- .../org/apache/tajo/util/VersionInfo.java | 28 ++++++++++++++----- .../org/apache/tajo/master/TajoMaster.java | 2 +- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/tajo-client/src/main/java/org/apache/tajo/cli/VersionCommand.java b/tajo-client/src/main/java/org/apache/tajo/cli/VersionCommand.java index c3a1f75b5c..e92a8d418b 100644 --- a/tajo-client/src/main/java/org/apache/tajo/cli/VersionCommand.java +++ b/tajo-client/src/main/java/org/apache/tajo/cli/VersionCommand.java @@ -33,7 +33,7 @@ public String getCommand() { @Override public void invoke(String[] cmd) throws Exception { - context.getOutput().println(VersionInfo.getVersion()); + context.getOutput().println(VersionInfo.getDisplayVersion()); } @Override @@ -43,6 +43,6 @@ public String getUsage() { @Override public String getDescription() { - return "show Apache License 2.0"; + return "show Tajo version"; } } diff --git a/tajo-common/src/main/java/org/apache/tajo/util/VersionInfo.java b/tajo-common/src/main/java/org/apache/tajo/util/VersionInfo.java index 39e0f543db..ce438dc54b 100644 --- a/tajo-common/src/main/java/org/apache/tajo/util/VersionInfo.java +++ b/tajo-common/src/main/java/org/apache/tajo/util/VersionInfo.java @@ -29,7 +29,7 @@ import java.util.Properties; /** - * This class returns build information about Hadoop components. + * This class returns build information about Tajo components. */ @InterfaceAudience.Private @InterfaceStability.Unstable @@ -95,8 +95,8 @@ protected String _getProtocVersion() { private static VersionInfo TAJO_VERSION_INFO = new VersionInfo("tajo"); /** - * Get the Hadoop version. - * @return the Hadoop version string, eg. "0.6.3-dev" + * Get the Tajo version. + * @return the Tajo version string, eg. "0.9.0-SNAPSHOT" */ public static String getVersion() { return TAJO_VERSION_INFO._getVersion(); @@ -119,7 +119,7 @@ public static String getBranch() { } /** - * The date that Hadoop was compiled. + * The date that Tajo was compiled. * @return the compilation date in unix date format */ public static String getDate() { @@ -127,7 +127,7 @@ public static String getDate() { } /** - * The user that compiled Hadoop. + * The user that compiled Tajo. * @return the username of the user */ public static String getUser() { @@ -135,14 +135,14 @@ public static String getUser() { } /** - * Get the subversion URL for the root Hadoop directory. + * Get the git repository URL for the root Tajo directory. */ public static String getUrl() { return TAJO_VERSION_INFO._getUrl(); } /** - * Get the checksum of the source files from which Hadoop was + * Get the checksum of the source files from which Tajo was * built. **/ public static String getSrcChecksum() { @@ -164,6 +164,20 @@ public static String getProtocVersion(){ return TAJO_VERSION_INFO._getProtocVersion(); } + /** + * Returns the display version including all information. + * @return + */ + public static String getDisplayVersion() { + StringBuilder displayVersion = new StringBuilder("Tajo ") + .append(VersionInfo.getVersion()).append(" (") + .append("rev. " + VersionInfo.getRevision().substring(0, 7)) + .append(" source checksum ").append(VersionInfo.getSrcChecksum().substring(0, 7)) + .append(" compiled by ").append(VersionInfo.getUser()).append(" ") + .append(VersionInfo.getDate()).append(")"); + return displayVersion.toString(); + } + public static void main(String[] args) { LOG.debug("version: "+ getVersion()); System.out.println("Tajo " + getVersion()); diff --git a/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java b/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java index 8d4a41f8b7..25e1be5f73 100644 --- a/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java +++ b/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java @@ -134,7 +134,7 @@ public String getMasterName() { } public String getVersion() { - return VersionInfo.getVersion(); + return VersionInfo.getDisplayVersion(); } public TajoMasterClientService getTajoMasterClientService() {