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