KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > clif > util > Version


1 /*
2 * CLIF is a Load Injection Framework
3 * Copyright (C) 2004 France Telecom R&D
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * CLIF $Name: $
20 *
21 * Contact: clif@objectweb.org
22 */

23
24 package org.objectweb.clif.util;
25
26 import org.objectweb.clif.console.lib.gui.GuiAboutDialog;
27
28 import java.io.BufferedReader JavaDoc;
29 import java.io.InputStreamReader JavaDoc;
30 import java.io.IOException JavaDoc;
31
32
33 /**
34  * Gives CLIF's version (including compilation date and time)
35  * @author Bruno Dillenseger
36  */

37 public class Version
38 {
39     static public final String JavaDoc version_filename = "compile.timestamp";
40     static private String JavaDoc timestamp;
41
42
43     static
44     {
45         BufferedReader JavaDoc reader = null;
46         try
47         {
48             reader = new BufferedReader JavaDoc(
49                 new InputStreamReader JavaDoc(
50                     Version.class.getClassLoader().getResourceAsStream(version_filename)));
51             timestamp = reader.readLine();
52         }
53         catch (IOException JavaDoc ex)
54         {
55             ex.printStackTrace(System.err);
56             timestamp = "(unable to get compilation timestamp)";
57         }
58         if (reader != null)
59         {
60             try
61             {
62                 reader.close();
63             }
64             catch (IOException JavaDoc ex)
65             {
66                 ex.printStackTrace(System.err);
67             }
68         }
69     }
70
71
72     static public String JavaDoc getVersion()
73     {
74         return timestamp;
75     }
76
77
78     static public void main(String JavaDoc[] args)
79     {
80         System.out.println(timestamp);
81     }
82 }
83
Popular Tags