KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xalan > internal > Version


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

16 /*
17  * $Id$
18  */

19 package com.sun.org.apache.xalan.internal;
20
21 /**
22  * Administrative class to keep track of the version number of
23  * the Xalan release.
24  * <P>This class implements the upcoming standard of having
25  * org.apache.project-name.Version.getVersion() be a standard way
26  * to get version information. This class will replace the older
27  * com.sun.org.apache.xalan.internal.processor.Version class.</P>
28  * <P>See also: com/sun/org/apache/xalan/internal/res/XSLTInfo.properties for
29  * information about the version of the XSLT spec we support.</P>
30  * @xsl.usage general
31  */

32 public class Version
33 {
34
35   /**
36    * Get the basic version string for the current Xalan release.
37    * Version String formatted like
38    * <CODE>"<B>Xalan</B> <B>Java</B> v.r[.dd| <B>D</B>nn]"</CODE>.
39    *
40    * Futurework: have this read version info from jar manifest.
41    *
42    * @return String denoting our current version
43    */

44   public static String JavaDoc getVersion()
45   {
46      return getProduct()+" "+getImplementationLanguage()+" "
47            +getMajorVersionNum()+"."+getReleaseVersionNum()+"."
48            +( (getDevelopmentVersionNum() > 0) ?
49                ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum()));
50   }
51
52   /**
53    * Print the processor version to the command line.
54    *
55    * @param argv command line arguments, unused.
56    */

57   public static void _main(String JavaDoc argv[])
58   {
59     System.out.println(getVersion());
60   }
61   
62   /**
63    * Name of product: Xalan.
64    */

65   public static String JavaDoc getProduct()
66   {
67     return "Xalan";
68   }
69
70   /**
71    * Implementation Language: Java.
72    */

73   public static String JavaDoc getImplementationLanguage()
74   {
75     return "Java";
76   }
77   
78   
79   /**
80    * Major version number.
81    * Version number. This changes only when there is a
82    * significant, externally apparent enhancement from
83    * the previous release. 'n' represents the n'th
84    * version.
85    *
86    * Clients should carefully consider the implications
87    * of new versions as external interfaces and behaviour
88    * may have changed.
89    */

90   public static int getMajorVersionNum()
91   {
92     return 2;
93     
94   }
95
96   /**
97    * Release Number.
98    * Release number. This changes when:
99    * - a new set of functionality is to be added, eg,
100    * implementation of a new W3C specification.
101    * - API or behaviour change.
102    * - its designated as a reference release.
103    */

104   public static int getReleaseVersionNum()
105   {
106     return 6;
107   }
108   
109   /**
110    * Maintenance Drop Number.
111    * Optional identifier used to designate maintenance
112    * drop applied to a specific release and contains
113    * fixes for defects reported. It maintains compatibility
114    * with the release and contains no API changes.
115    * When missing, it designates the final and complete
116    * development drop for a release.
117    */

118   public static int getMaintenanceVersionNum()
119   {
120     return 0;
121   }
122
123   /**
124    * Development Drop Number.
125    * Optional identifier designates development drop of
126    * a specific release. D01 is the first development drop
127    * of a new release.
128    *
129    * Development drops are works in progress towards a
130    * compeleted, final release. A specific development drop
131    * may not completely implement all aspects of a new
132    * feature, which may take several development drops to
133    * complete. At the point of the final drop for the
134    * release, the D suffix will be omitted.
135    *
136    * Each 'D' drops can contain functional enhancements as
137    * well as defect fixes. 'D' drops may not be as stable as
138    * the final releases.
139    */

140   public static int getDevelopmentVersionNum()
141   {
142     try {
143         if ((new String JavaDoc("")).length() == 0)
144           return 0;
145         else
146           return Integer.parseInt("");
147     } catch (NumberFormatException JavaDoc nfe) {
148            return 0;
149     }
150   }
151 }
152
Popular Tags