1 package ca.uhn.hl7v2.hoh.util;
2
3 import java.io.InputStream;
4 import java.util.Properties;
5
6 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory;
8
9
10
11
12 public class VersionLogger {
13
14 private static final Logger LOG = LoggerFactory.getLogger(VersionLogger.class);
15 private static boolean ourInitialized = false;
16 private static String ourVersion;
17
18
19
20 private VersionLogger() {
21
22 }
23
24
25
26
27 public static String getVersion() {
28 init();
29 return ourVersion;
30 }
31
32
33
34
35 public static void init() {
36 if (!ourInitialized) {
37 try {
38 InputStream is = VersionLogger.class.getResourceAsStream("/ca/uhn/hl7v2/hoh/hoh-version.properties");
39 Properties p = new Properties();
40 p.load(is);
41 ourVersion = p.getProperty("version");
42 String build = p.getProperty("build");
43 LOG.info("HL7 over HTTP (HAPI) library version " + ourVersion + " - Build " + build);
44 } catch (Exception e) {
45
46 }
47 ourInitialized = true;
48 }
49 }
50
51 }