KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > Version


1 /*
2
3  * Copyright 2003-2004 The Apache Software Foundation.
4
5  *
6
7  * Licensed under the Apache License, Version 2.0 (the "License");
8
9  * you may not use this file except in compliance with the License.
10
11  * You may obtain a copy of the License at
12
13  *
14
15  * http://www.apache.org/licenses/LICENSE-2.0
16
17  *
18
19  * Unless required by applicable law or agreed to in writing, software
20
21  * distributed under the License is distributed on an "AS IS" BASIS,
22
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
25  * See the License for the specific language governing permissions and
26
27  * limitations under the License.
28
29  */

30
31 /*
32
33  * $Id: Version.java,v 1.12 2004/02/26 04:00:47 zongaro Exp $
34
35  */

36
37 package org.apache.xalan;
38
39
40
41 /**
42
43  * <meta name="usage" content="general"/>
44
45  * Administrative class to keep track of the version number of
46
47  * the Xalan release.
48
49  * <P>This class implements the upcoming standard of having
50
51  * org.apache.project-name.Version.getVersion() be a standard way
52
53  * to get version information. This class will replace the older
54
55  * org.apache.xalan.processor.Version class.</P>
56
57  * <P>See also: org/apache/xalan/res/XSLTInfo.properties for
58
59  * information about the version of the XSLT spec we support.</P>
60
61  */

62
63 public class Version
64
65 {
66
67
68
69   /**
70
71    * Get the basic version string for the current Xalan release.
72
73    * Version String formatted like
74
75    * <CODE>"<B>Xalan</B> <B>Java</B> v.r[.dd| <B>D</B>nn]"</CODE>.
76
77    *
78
79    * Futurework: have this read version info from jar manifest.
80
81    *
82
83    * @return String denoting our current version
84
85    */

86
87   public static String JavaDoc getVersion()
88
89   {
90
91      return getProduct()+" "+getImplementationLanguage()+" "
92
93            +getMajorVersionNum()+"."+getReleaseVersionNum()+"."
94
95            +( (getDevelopmentVersionNum() > 0) ?
96
97                ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum()));
98
99   }
100
101
102
103   /**
104
105    * Print the processor version to the command line.
106
107    *
108
109    * @param argv command line arguments, unused.
110
111    */

112
113   public static void main(String JavaDoc argv[])
114
115   {
116
117     System.out.println(getVersion());
118
119   }
120
121   
122
123   /**
124
125    * Name of product: Xalan.
126
127    */

128
129   public static String JavaDoc getProduct()
130
131   {
132
133     return "Xalan";
134
135   }
136
137
138
139   /**
140
141    * Implementation Language: Java.
142
143    */

144
145   public static String JavaDoc getImplementationLanguage()
146
147   {
148
149     return "Java";
150
151   }
152
153   
154
155   
156
157   /**
158
159    * Major version number.
160
161    * Version number. This changes only when there is a
162
163    * significant, externally apparent enhancement from
164
165    * the previous release. 'n' represents the n'th
166
167    * version.
168
169    *
170
171    * Clients should carefully consider the implications
172
173    * of new versions as external interfaces and behaviour
174
175    * may have changed.
176
177    */

178
179   public static int getMajorVersionNum()
180
181   {
182
183     return 2;
184
185     
186
187   }
188
189
190
191   /**
192
193    * Release Number.
194
195    * Release number. This changes when:
196
197    * - a new set of functionality is to be added, eg,
198
199    * implementation of a new W3C specification.
200
201    * - API or behaviour change.
202
203    * - its designated as a reference release.
204
205    */

206
207   public static int getReleaseVersionNum()
208
209   {
210
211     return 6;
212
213   }
214
215   
216
217   /**
218
219    * Maintenance Drop Number.
220
221    * Optional identifier used to designate maintenance
222
223    * drop applied to a specific release and contains
224
225    * fixes for defects reported. It maintains compatibility
226
227    * with the release and contains no API changes.
228
229    * When missing, it designates the final and complete
230
231    * development drop for a release.
232
233    */

234
235   public static int getMaintenanceVersionNum()
236
237   {
238
239     return 0;
240
241   }
242
243
244
245   /**
246
247    * Development Drop Number.
248
249    * Optional identifier designates development drop of
250
251    * a specific release. D01 is the first development drop
252
253    * of a new release.
254
255    *
256
257    * Development drops are works in progress towards a
258
259    * compeleted, final release. A specific development drop
260
261    * may not completely implement all aspects of a new
262
263    * feature, which may take several development drops to
264
265    * complete. At the point of the final drop for the
266
267    * release, the D suffix will be omitted.
268
269    *
270
271    * Each 'D' drops can contain functional enhancements as
272
273    * well as defect fixes. 'D' drops may not be as stable as
274
275    * the final releases.
276
277    */

278
279   public static int getDevelopmentVersionNum()
280
281   {
282
283     try {
284
285         if ((new String JavaDoc("")).length() == 0)
286
287           return 0;
288
289         else
290
291           return Integer.parseInt("");
292
293     } catch (NumberFormatException JavaDoc nfe) {
294
295            return 0;
296
297     }
298
299   }
300
301 }
302
303
Popular Tags