001: /*
002: * Copyright 2001-2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: /*
017: * $Id$
018: */
019: package org.apache.xalan;
020:
021: /**
022: * Administrative class to keep track of the version number of
023: * the Xalan release.
024: * <P>This class implements the upcoming standard of having
025: * org.apache.project-name.Version.getVersion() be a standard way
026: * to get version information. This class will replace the older
027: * org.apache.xalan.processor.Version class.</P>
028: * <P>See also: org/apache/xalan/res/XSLTInfo.properties for
029: * information about the version of the XSLT spec we support.</P>
030: * @xsl.usage general
031: */
032: public class Version {
033:
034: /**
035: * Get the basic version string for the current Xalan release.
036: * Version String formatted like
037: * <CODE>"<B>Xalan</B> <B>Java</B> v.r[.dd| <B>D</B>nn]"</CODE>.
038: *
039: * Futurework: have this read version info from jar manifest.
040: *
041: * @return String denoting our current version
042: */
043: public static String getVersion() {
044: return getProduct()
045: + " "
046: + getImplementationLanguage()
047: + " "
048: + getMajorVersionNum()
049: + "."
050: + getReleaseVersionNum()
051: + "."
052: + ((getDevelopmentVersionNum() > 0) ? ("D" + getDevelopmentVersionNum())
053: : ("" + getMaintenanceVersionNum()));
054: }
055:
056: /**
057: * Print the processor version to the command line.
058: *
059: * @param argv command line arguments, unused.
060: */
061: public static void main(String argv[]) {
062: System.out.println(getVersion());
063: }
064:
065: /**
066: * Name of product: Xalan.
067: */
068: public static String getProduct() {
069: return "Xalan";
070: }
071:
072: /**
073: * Implementation Language: Java.
074: */
075: public static String getImplementationLanguage() {
076: return "Java";
077: }
078:
079: /**
080: * Major version number.
081: * Version number. This changes only when there is a
082: * significant, externally apparent enhancement from
083: * the previous release. 'n' represents the n'th
084: * version.
085: *
086: * Clients should carefully consider the implications
087: * of new versions as external interfaces and behaviour
088: * may have changed.
089: */
090: public static int getMajorVersionNum() {
091: return 2;
092:
093: }
094:
095: /**
096: * Release Number.
097: * Release number. This changes when:
098: * - a new set of functionality is to be added, eg,
099: * implementation of a new W3C specification.
100: * - API or behaviour change.
101: * - its designated as a reference release.
102: */
103: public static int getReleaseVersionNum() {
104: return 7;
105: }
106:
107: /**
108: * Maintenance Drop Number.
109: * Optional identifier used to designate maintenance
110: * drop applied to a specific release and contains
111: * fixes for defects reported. It maintains compatibility
112: * with the release and contains no API changes.
113: * When missing, it designates the final and complete
114: * development drop for a release.
115: */
116: public static int getMaintenanceVersionNum() {
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: try {
139: if ((new String("")).length() == 0)
140: return 0;
141: else
142: return Integer.parseInt("");
143: } catch (NumberFormatException nfe) {
144: return 0;
145: }
146: }
147: }
|