Home | History | Annotate | Download | only in xalan
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one
      3  * or more contributor license agreements. See the NOTICE file
      4  * distributed with this work for additional information
      5  * regarding copyright ownership. The ASF licenses this file
      6  * to you under the Apache License, Version 2.0 (the  "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *     http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  */
     18 /*
     19  * $Id: Version.java 577939 2007-09-20 21:45:37Z minchau $
     20  */
     21 package org.apache.xalan;
     22 
     23 /**
     24  * Administrative class to keep track of the version number of
     25  * the Xalan release.
     26  * <P>This class implements the upcoming standard of having
     27  * org.apache.project-name.Version.getVersion() be a standard way
     28  * to get version information.  This class will replace the older
     29  * org.apache.xalan.processor.Version class.</P>
     30  * <P>See also: org/apache/xalan/res/XSLTInfo.properties for
     31  * information about the version of the XSLT spec we support.</P>
     32  * @xsl.usage general
     33  */
     34 public class Version
     35 {
     36 
     37   /**
     38    * Get the basic version string for the current Xalan release.
     39    * Version String formatted like
     40    * <CODE>"<B>Xalan</B> <B>Java</B> v.r[.dd| <B>D</B>nn]"</CODE>.
     41    *
     42    * Futurework: have this read version info from jar manifest.
     43    *
     44    * @return String denoting our current version
     45    */
     46   public static String getVersion()
     47   {
     48      return getProduct()+" "+getImplementationLanguage()+" "
     49            +getMajorVersionNum()+"."+getReleaseVersionNum()+"."
     50            +( (getDevelopmentVersionNum() > 0) ?
     51                ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum()));
     52   }
     53 
     54   /**
     55    * Print the processor version to the command line.
     56    *
     57    * @param argv command line arguments, unused.
     58    */
     59   public static void main(String argv[])
     60   {
     61     System.out.println(getVersion());
     62   }
     63 
     64   /**
     65    * Name of product: Xalan.
     66    */
     67   public static String getProduct()
     68   {
     69     return "Xalan";
     70   }
     71 
     72   /**
     73    * Implementation Language: Java.
     74    */
     75   public static String getImplementationLanguage()
     76   {
     77     return "Java";
     78   }
     79 
     80 
     81   /**
     82    * Major version number.
     83    * Version number. This changes only when there is a
     84    *          significant, externally apparent enhancement from
     85    *          the previous release. 'n' represents the n'th
     86    *          version.
     87    *
     88    *          Clients should carefully consider the implications
     89    *          of new versions as external interfaces and behaviour
     90    *          may have changed.
     91    */
     92   public static int getMajorVersionNum()
     93   {
     94     return 2;
     95 
     96   }
     97 
     98   /**
     99    * 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 }
    154