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 | 5 | private static final Logger LOG = LoggerFactory.getLogger(VersionLogger.class); |
15 | 5 | private static boolean ourInitialized = false; |
16 | |
private static String ourVersion; |
17 | |
|
18 | |
|
19 | |
|
20 | 0 | private VersionLogger() { |
21 | |
|
22 | 0 | } |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public static String getVersion() { |
28 | 395 | init(); |
29 | 395 | return ourVersion; |
30 | |
} |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
public static void init() { |
36 | 415 | if (!ourInitialized) { |
37 | |
try { |
38 | 5 | InputStream is = VersionLogger.class.getResourceAsStream("/ca/uhn/hl7v2/hoh/hoh-version.properties"); |
39 | 5 | Properties p = new Properties(); |
40 | 5 | p.load(is); |
41 | 5 | ourVersion = p.getProperty("version"); |
42 | 5 | String build = p.getProperty("build"); |
43 | 5 | LOG.info("HL7 over HTTP (HAPI) library version " + ourVersion + " - Build " + build); |
44 | 0 | } catch (Exception e) { |
45 | |
|
46 | 5 | } |
47 | 5 | ourInitialized = true; |
48 | |
} |
49 | 415 | } |
50 | |
|
51 | |
} |