KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > misc > Version


1 /* Version.java
2  *
3  * Authors:
4  * Stefanovic Nenad chupo@iis.ns.ac.yu
5  * Bojanic Sasa sasaboy@neobee.net
6  * Puskas Vladimir vpuskas@eunet.yu
7  *
8  */

9
10 package org.enhydra.jawe.misc;
11
12 import java.io.InputStream JavaDoc;
13 import java.util.PropertyResourceBundle JavaDoc;
14 import java.util.ResourceBundle JavaDoc;
15
16 /**
17  * Reads the Version from the file version.properies
18  */

19 public class Version {
20
21    private static ResourceBundle JavaDoc versionResource;
22
23    private static String JavaDoc version = "";
24
25    static {
26       try {
27          String JavaDoc vp="org/enhydra/jawe/resources/version.properties";
28          InputStream JavaDoc is=Version.class.getClassLoader().getResourceAsStream(vp);
29          if (is != null) {
30             versionResource = new PropertyResourceBundle JavaDoc(is);
31             String JavaDoc stat = versionResource.getString("version.status");
32             //System.out.println(stat);
33
if (stat.equals("")){
34                version =
35                   versionResource.getString("version.number.major")
36                      + "."
37                      + versionResource.getString("version.number.minor")
38                      + " (build "
39                      + versionResource.getString("version.build")
40                      + ")";
41                      //+ versionResource.getString("version.date")+ ")";
42
} else{
43                version =
44                   versionResource.getString("version.number.major")
45                      + "."
46                      + versionResource.getString("version.number.minor")
47                      + "-" + stat + " (build "
48                      + versionResource.getString("version.build")
49                      + ")";
50             }
51          }
52       } catch (java.io.IOException JavaDoc e) {
53          System.err.println(e.getMessage());
54          version = "{File version.properties not available.}";
55       }
56    }
57
58    /** Returns the current version number
59     */

60    public static String JavaDoc getVersion() {
61       return version;
62    }
63
64 }
65
Popular Tags