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