*** empty log message ***
[IRC.git] / Robust / Transactions / jcarderdstm2version / src / com / enea / jcarder / util / BuildInformation.java
1 /*
2  * JCarder -- cards Java programs to keep threads disentangled
3  *
4  * Copyright (C) 2006-2007 Enea AB
5  * Copyright (C) 2007 Ulrik Svensson
6  * Copyright (C) 2007 Joel Rosdahl
7  *
8  * This program is made available under the GNU GPL version 2, with a special
9  * exception for linking with JUnit. See the accompanying file LICENSE.txt for
10  * details.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.
15  */
16
17 package com.enea.jcarder.util;
18
19 import java.io.IOException;
20 import java.util.Properties;
21
22 public final class BuildInformation {
23
24     private BuildInformation() { }
25
26     public static String getShortInfo() {
27         try {
28             Properties props = loadBuildProperties();
29             return "JCarder ("
30                    + props.getProperty("build.version")
31                    + "/"
32                    + props.getProperty("build.number")
33                    + ")";
34         } catch (IOException e) {
35             e.printStackTrace();
36             return "JCarder";
37         }
38     }
39
40     public static void printLongBuildInformation() {
41         Properties props;
42         try {
43             props = loadBuildProperties();
44         } catch (IOException e) {
45             e.printStackTrace();
46             return;
47         }
48         StringBuffer sb = new StringBuffer();
49         sb.append("JCarder -- cards Java programs to keep threads"
50                   + " disentangled\n");
51         sb.append("\nCopyright (C) 2006-2007 Enea AB\n");
52         sb.append("Copyright (C) 2007 Ulrik Svensson\n");
53         sb.append("Copyright (C) 2007 Joel Rosdahl\n");
54         sb.append("\nVersion: " + props.getProperty("build.version"));
55         sb.append("\nBuild  : " + props.getProperty("build.number"));
56         sb.append("\nAt     : " + props.getProperty("build.timestamp"));
57         sb.append("\nBy     : " + props.getProperty("build.user.name"));
58         sb.append("\nOn     : " + props.getProperty("build.os.name"));
59         System.out.println(sb.toString());
60     }
61
62     private static Properties loadBuildProperties() throws IOException {
63         Properties props = new Properties();
64         ClassLoader classLoader = ClassLoader.getSystemClassLoader();
65         props.load(classLoader.getResourceAsStream("build.properties"));
66        // return null;
67         return props;
68     }
69 }