KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > serializer > Version


1 /*
2  * Copyright 2005 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: Version.java,v 1.2 2005/09/28 13:49:09 pvedula Exp $
18  */

19 package com.sun.org.apache.xml.internal.serializer;
20
21 /**
22  * Administrative class to keep track of the version number of
23  * the Serializer 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.</P>
27  * @xsl.usage general
28  */

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

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

54   public static void _main(String JavaDoc argv[])
55   {
56     System.out.println(getVersion());
57   }
58   
59   /**
60    * Name of product: Serializer.
61    */

62   public static String JavaDoc getProduct()
63   {
64     return "Serializer";
65   }
66
67   /**
68    * Implementation Language: Java.
69    */

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

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

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

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

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