Repository: hbase Updated Branches: refs/heads/branch-1.3 82aee4ba3 -> af9de6ed8
HBASE-18939 Backport HBASE-16538 to branch-1.3 Signed-off-by: Ashish Singhi <ashishsin...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/af9de6ed Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/af9de6ed Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/af9de6ed Branch: refs/heads/branch-1.3 Commit: af9de6ed8b3b33d0f87103d98b194bd7e9ddb5d5 Parents: 82aee4b Author: Ashish Singhi <ashishsin...@apache.org> Authored: Thu Oct 5 21:47:35 2017 +0530 Committer: Ashish Singhi <ashishsin...@apache.org> Committed: Thu Oct 5 21:47:35 2017 +0530 ---------------------------------------------------------------------- .../apache/hadoop/hbase/VersionAnnotation.java | 66 -------------------- .../apache/hadoop/hbase/util/VersionInfo.java | 32 +++------- hbase-common/src/saveVersion.sh | 14 +++-- 3 files changed, 18 insertions(+), 94 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/af9de6ed/hbase-common/src/main/java/org/apache/hadoop/hbase/VersionAnnotation.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/VersionAnnotation.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/VersionAnnotation.java deleted file mode 100644 index f3137ae..0000000 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/VersionAnnotation.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.hbase; - -import java.lang.annotation.*; - -import org.apache.hadoop.hbase.classification.InterfaceAudience; - -/** - * A package attribute that captures the version of hbase that was compiled. - * Copied down from hadoop. All is same except name of interface. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.PACKAGE) -@InterfaceAudience.Private -public @interface VersionAnnotation { - - /** - * Get the Hadoop version - * @return the version string "0.6.3-dev" - */ - String version(); - - /** - * Get the username that compiled Hadoop. - */ - String user(); - - /** - * Get the date when Hadoop was compiled. - * @return the date in unix 'date' format - */ - String date(); - - /** - * Get the url for the subversion repository. - */ - String url(); - - /** - * Get the subversion revision. - * @return the revision number as a string (eg. "451451") - */ - String revision(); - - /** - * Get a checksum of the source files from which HBase was compiled. - * @return a string that uniquely identifies the source - **/ - String srcChecksum(); -} http://git-wip-us.apache.org/repos/asf/hbase/blob/af9de6ed/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java index 8061b4d..dc242d0 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java @@ -24,39 +24,23 @@ import java.io.PrintWriter; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceStability; -import org.apache.hadoop.hbase.VersionAnnotation; +import org.apache.hadoop.hbase.Version; import org.apache.commons.logging.Log; /** - * This class finds the package info for hbase and the VersionAnnotation - * information. Taken from hadoop. Only name of annotation is different. + * This class finds the Version information for HBase. */ @InterfaceAudience.Public @InterfaceStability.Evolving public class VersionInfo { private static final Log LOG = LogFactory.getLog(VersionInfo.class.getName()); - private static Package myPackage; - private static VersionAnnotation version; - - static { - myPackage = VersionAnnotation.class.getPackage(); - version = myPackage.getAnnotation(VersionAnnotation.class); - } - - /** - * Get the meta-data for the hbase package. - * @return package - */ - static Package getPackage() { - return myPackage; - } /** * Get the hbase version. * @return the hbase version string, eg. "0.6.3-dev" */ public static String getVersion() { - return version != null ? version.version() : "Unknown"; + return Version.version; } /** @@ -64,7 +48,7 @@ public class VersionInfo { * @return the revision number, eg. "451451" */ public static String getRevision() { - return version != null ? version.revision() : "Unknown"; + return Version.revision; } /** @@ -72,7 +56,7 @@ public class VersionInfo { * @return the compilation date in unix date format */ public static String getDate() { - return version != null ? version.date() : "Unknown"; + return Version.date; } /** @@ -80,7 +64,7 @@ public class VersionInfo { * @return the username of the user */ public static String getUser() { - return version != null ? version.user() : "Unknown"; + return Version.user; } /** @@ -88,7 +72,7 @@ public class VersionInfo { * @return the url */ public static String getUrl() { - return version != null ? version.url() : "Unknown"; + return Version.url; } static String[] versionReport() { @@ -105,7 +89,7 @@ public class VersionInfo { * @return a string that uniquely identifies the source **/ public static String getSrcChecksum() { - return version != null ? version.srcChecksum() : "Unknown"; + return Version.srcChecksum; } public static void writeTo(PrintWriter out) { http://git-wip-us.apache.org/repos/asf/hbase/blob/af9de6ed/hbase-common/src/saveVersion.sh ---------------------------------------------------------------------- diff --git a/hbase-common/src/saveVersion.sh b/hbase-common/src/saveVersion.sh index a080b4f..afc4542 100644 --- a/hbase-common/src/saveVersion.sh +++ b/hbase-common/src/saveVersion.sh @@ -59,13 +59,19 @@ fi popd mkdir -p "$outputDirectory/org/apache/hadoop/hbase" -cat >"$outputDirectory/org/apache/hadoop/hbase/package-info.java" <<EOF +cat >"$outputDirectory/org/apache/hadoop/hbase/Version.java" <<EOF /* * Generated by src/saveVersion.sh */ -@VersionAnnotation(version="$version", revision="$revision", - user="$user", date="$date", url="$url", - srcChecksum="$srcChecksum") package org.apache.hadoop.hbase; + +public class Version { + public static final String version = "$version"; + public static final String revision = "$revision"; + public static final String user = "$user"; + public static final String date = "$date"; + public static final String url = "$url"; + public static final String srcChecksum = "$srcChecksum"; +} EOF