KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > Version


1 /*
2  * FindBugs - Find bugs in Java programs
3  * Copyright (C) 2003-2005 University of Maryland
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.1 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
20 package edu.umd.cs.findbugs;
21
22 import java.text.SimpleDateFormat JavaDoc;
23 import java.util.Date JavaDoc;
24
25 /**
26  * Version number and release date information.
27  */

28 public class Version {
29     /**
30      * Major version number.
31      */

32     public static final int MAJOR = 1;
33
34     /**
35      * Minor version number.
36      */

37     public static final int MINOR = 1;
38
39     /**
40      * Patch level.
41      */

42     public static final int PATCHLEVEL = 3;
43
44     /**
45      * Development version or release candidate?
46      */

47     public static final boolean IS_DEVELOPMENT = true;
48
49     /**
50      * Release candidate number.
51      * "0" indicates that the version is not a release candidate.
52      */

53     public static final int RELEASE_CANDIDATE = 3;
54     
55     /**
56      * Preview release number.
57      * "0" indicates that the version is not a preview release.
58      */

59     public static final int PREVIEW = 0;
60
61     private static final String JavaDoc RELEASE_SUFFIX_WORD =
62         (RELEASE_CANDIDATE > 0
63                 ? "rc" + RELEASE_CANDIDATE
64                 : (PREVIEW > 0 ? "preview" + PREVIEW : "dev"));
65
66     /**
67      * Release version string.
68      */

69     public static final String JavaDoc RELEASE =
70         MAJOR + "." + MINOR + "." + PATCHLEVEL + (IS_DEVELOPMENT ? "-" + RELEASE_SUFFIX_WORD : "");
71
72     static final SimpleDateFormat JavaDoc dateFormat = new SimpleDateFormat JavaDoc("HH:mm:ss z, dd MMMM, yyyy");
73     static final SimpleDateFormat JavaDoc eclipseDateFormat = new SimpleDateFormat JavaDoc("yyyyMMdd");
74     /**
75      * Release date.
76      */

77     public static final String JavaDoc DATE = dateFormat.format(new Date JavaDoc());
78
79     public static final String JavaDoc ECLIPSE_DATE = eclipseDateFormat.format(new Date JavaDoc()) ;
80
81     /**
82      * Version of Eclipse plugin.
83      */

84     public static final String JavaDoc ECLIPSE_UI_VERSION = // same as RELEASE except .vYYYYMMDD before optional -suffix
85
MAJOR + "." + MINOR + "." + PATCHLEVEL + "." + ECLIPSE_DATE;
86
87     /**
88      * FindBugs website.
89      */

90     public static final String JavaDoc WEBSITE = "http://findbugs.sourceforge.net";
91
92     /**
93      * Downloads website.
94      */

95     public static final String JavaDoc DOWNLOADS_WEBSITE = "http://prdownloads.sourceforge.net/findbugs";
96
97     /**
98      * Support email.
99      */

100     public static final String JavaDoc SUPPORT_EMAIL = "http://findbugs.sourceforge.net/reportingBugs.html";
101
102     public static void main(String JavaDoc[] argv) {
103         if (argv.length != 1)
104             usage();
105
106         String JavaDoc arg = argv[0];
107
108         if (arg.equals("-release"))
109             System.out.println(RELEASE);
110         else if (arg.equals("-date"))
111             System.out.println(DATE);
112         else if (arg.equals("-props")) {
113             System.out.println("release.number=" + RELEASE);
114             System.out.println("release.date=" + DATE);
115             System.out.println("eclipse.ui.version=" + ECLIPSE_UI_VERSION);
116             System.out.println("findbugs.website=" + WEBSITE);
117             System.out.println("findbugs.downloads.website=" + DOWNLOADS_WEBSITE);
118         } else {
119             usage();
120             System.exit(1);
121         }
122     }
123
124     private static void usage() {
125         System.err.println("Usage: " + Version.class.getName() +
126                 " (-release|-date|-props)");
127     }
128 }
129
130 // vim:ts=4
131
Popular Tags