1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.util;
20
21 import org.apache.commons.logging.LogFactory;
22 import java.io.PrintWriter;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.hadoop.hbase.Version;
26 import org.apache.hadoop.hbase.classification.InterfaceAudience;
27 import org.apache.hadoop.hbase.classification.InterfaceStability;
28
29
30
31
32 @InterfaceAudience.Public
33 @InterfaceStability.Evolving
34 public class VersionInfo {
35 private static final Log LOG = LogFactory.getLog(VersionInfo.class.getName());
36
37
38
39
40
41 public static String getVersion() {
42 return Version.version;
43 }
44
45
46
47
48
49 public static String getRevision() {
50 return Version.revision;
51 }
52
53
54
55
56
57 public static String getDate() {
58 return Version.date;
59 }
60
61
62
63
64
65 public static String getUser() {
66 return Version.user;
67 }
68
69
70
71
72
73 public static String getUrl() {
74 return Version.url;
75 }
76
77 static String[] versionReport() {
78 return new String[] {
79 "HBase " + getVersion(),
80 "Source code repository " + getUrl() + " revision=" + getRevision(),
81 "Compiled by " + getUser() + " on " + getDate(),
82 "From source with checksum " + getSrcChecksum()
83 };
84 }
85
86
87
88
89
90 public static String getSrcChecksum() {
91 return Version.srcChecksum;
92 }
93
94 public static void writeTo(PrintWriter out) {
95 for (String line : versionReport()) {
96 out.println(line);
97 }
98 }
99
100 public static void logVersion() {
101 for (String line : versionReport()) {
102 LOG.info(line);
103 }
104 }
105
106 public static void main(String[] args) {
107 logVersion();
108 }
109 }