1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Copyright 2003-2004 The Apache Software Foundation. 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 /* 21 * $Id: Version.java,v 1.1.2.1 2005/08/01 02:11:19 jeffsuttor Exp $ 22 */ 23 package com.sun.org.apache.xalan.internal; 24 25 /** 26 * Administrative class to keep track of the version number of 27 * the Xalan release. 28 * <P>This class implements the upcoming standard of having 29 * org.apache.project-name.Version.getVersion() be a standard way 30 * to get version information. This class will replace the older 31 * com.sun.org.apache.xalan.internal.processor.Version class.</P> 32 * <P>See also: com/sun/org/apache/xalan/internal/res/XSLTInfo.properties for 33 * information about the version of the XSLT spec we support.</P> 34 * @xsl.usage general 35 */ 36 public class Version 37 { 38 39 /** 40 * Get the basic version string for the current Xalan release. 41 * Version String formatted like 42 * <CODE>"<B>Xalan</B> <B>Java</B> v.r[.dd| <B>D</B>nn]"</CODE>. 43 * 44 * Futurework: have this read version info from jar manifest. 45 * 46 * @return String denoting our current version 47 */ 48 public static String getVersion() 49 { 50 return getProduct()+" "+getImplementationLanguage()+" " 51 +getMajorVersionNum()+"."+getReleaseVersionNum()+"." 52 +( (getDevelopmentVersionNum() > 0) ? 53 ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum())); 54 } 55 56 /** 57 * Print the processor version to the command line. 58 * 59 * @param argv command line arguments, unused. 60 */ 61 public static void _main(String argv[]) 62 { 63 System.out.println(getVersion()); 64 } 65 66 /** 67 * Name of product: Xalan. 68 */ 69 public static String getProduct() 70 { 71 return "Xalan"; 72 } 73 74 /** 75 * Implementation Language: Java. 76 */ 77 public static String getImplementationLanguage() 78 { 79 return "Java"; 80 } 81 82 83 /** 84 * Major version number. 85 * Version number. This changes only when there is a 86 * significant, externally apparent enhancement from 87 * the previous release. 'n' represents the n'th 88 * version. 89 * 90 * Clients should carefully consider the implications 91 * of new versions as external interfaces and behaviour 92 * may have changed. 93 */ 94 public static int getMajorVersionNum() 95 { 96 return 2; 97 98 } 99 100 /** 101 * Release Number. 102 * Release number. This changes when: 103 * - a new set of functionality is to be added, eg, 104 * implementation of a new W3C specification. 105 * - API or behaviour change. 106 * - its designated as a reference release. 107 */ 108 public static int getReleaseVersionNum() 109 { 110 return 7; 111 } 112 113 /** 114 * Maintenance Drop Number. 115 * Optional identifier used to designate maintenance 116 * drop applied to a specific release and contains 117 * fixes for defects reported. It maintains compatibility 118 * with the release and contains no API changes. 119 * When missing, it designates the final and complete 120 * development drop for a release. 121 */ 122 public static int getMaintenanceVersionNum() 123 { 124 return 0; 125 } 126 127 /** 128 * Development Drop Number. 129 * Optional identifier designates development drop of 130 * a specific release. D01 is the first development drop 131 * of a new release. 132 * 133 * Development drops are works in progress towards a 134 * compeleted, final release. A specific development drop 135 * may not completely implement all aspects of a new 136 * feature, which may take several development drops to 137 * complete. At the point of the final drop for the 138 * release, the D suffix will be omitted. 139 * 140 * Each 'D' drops can contain functional enhancements as 141 * well as defect fixes. 'D' drops may not be as stable as 142 * the final releases. 143 */ 144 public static int getDevelopmentVersionNum() 145 { 146 try { 147 if ((new String("")).length() == 0) 148 return 0; 149 else 150 return Integer.parseInt(""); 151 } catch (NumberFormatException nfe) { 152 return 0; 153 } 154 } 155 }