001: /*
002: * Copyright 2005 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: Version.src,v 1.1 2005/07/19 17:32:48 mcnamara Exp $
018: */
019: package org.apache.xml.serializer;
020:
021: /**
022: * Administrative class to keep track of the version number of
023: * the Serializer 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.</P>
027: * @xsl.usage general
028: */
029: public final class Version {
030:
031: /**
032: * Get the basic version string for the current Serializer.
033: * Version String formatted like
034: * <CODE>"<B>Serializer</B> <B>Java</B> v.r[.dd| <B>D</B>nn]"</CODE>.
035: *
036: * Futurework: have this read version info from jar manifest.
037: *
038: * @return String denoting our current version
039: */
040: public static String getVersion() {
041: return getProduct()
042: + " "
043: + getImplementationLanguage()
044: + " "
045: + getMajorVersionNum()
046: + "."
047: + getReleaseVersionNum()
048: + "."
049: + ((getDevelopmentVersionNum() > 0) ? ("D" + getDevelopmentVersionNum())
050: : ("" + getMaintenanceVersionNum()));
051: }
052:
053: /**
054: * Print the processor version to the command line.
055: *
056: * @param argv command line arguments, unused.
057: */
058: public static void main(String argv[]) {
059: System.out.println(getVersion());
060: }
061:
062: /**
063: * Name of product: Serializer.
064: */
065: public static String getProduct() {
066: return "Serializer";
067: }
068:
069: /**
070: * Implementation Language: Java.
071: */
072: public static String getImplementationLanguage() {
073: return "Java";
074: }
075:
076: /**
077: * Major version number.
078: * Version number. This changes only when there is a
079: * significant, externally apparent enhancement from
080: * the previous release. 'n' represents the n'th
081: * version.
082: *
083: * Clients should carefully consider the implications
084: * of new versions as external interfaces and behaviour
085: * may have changed.
086: */
087: public static int getMajorVersionNum() {
088: return 2;
089:
090: }
091:
092: /**
093: * Release Number.
094: * Release number. This changes when:
095: * - a new set of functionality is to be added, eg,
096: * implementation of a new W3C specification.
097: * - API or behaviour change.
098: * - its designated as a reference release.
099: */
100: public static int getReleaseVersionNum() {
101: return 7;
102: }
103:
104: /**
105: * Maintenance Drop Number.
106: * Optional identifier used to designate maintenance
107: * drop applied to a specific release and contains
108: * fixes for defects reported. It maintains compatibility
109: * with the release and contains no API changes.
110: * When missing, it designates the final and complete
111: * development drop for a release.
112: */
113: public static int getMaintenanceVersionNum() {
114: return 0;
115: }
116:
117: /**
118: * Development Drop Number.
119: * Optional identifier designates development drop of
120: * a specific release. D01 is the first development drop
121: * of a new release.
122: *
123: * Development drops are works in progress towards a
124: * compeleted, final release. A specific development drop
125: * may not completely implement all aspects of a new
126: * feature, which may take several development drops to
127: * complete. At the point of the final drop for the
128: * release, the D suffix will be omitted.
129: *
130: * Each 'D' drops can contain functional enhancements as
131: * well as defect fixes. 'D' drops may not be as stable as
132: * the final releases.
133: */
134: public static int getDevelopmentVersionNum() {
135: try {
136: if ((new String("")).length() == 0)
137: return 0;
138: else
139: return Integer.parseInt("");
140: } catch (NumberFormatException nfe) {
141: return 0;
142: }
143: }
144: }
|