Home | History | Annotate | Download | only in serializer
      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.src 468654 2006-10-28 07:09:23Z minchau $
     20  */
     21 package org.apache.xml.serializer;
     22 
     23 /**
     24  * Administrative class to keep track of the version number of
     25  * the Serializer 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.</P>
     29  * @xsl.usage general
     30  */
     31 public final class Version
     32 {
     33 
     34   /**
     35    * Get the basic version string for the current Serializer.
     36    * Version String formatted like
     37    * <CODE>"<B>Serializer</B> <B>Java</B> v.r[.dd| <B>D</B>nn]"</CODE>.
     38    *
     39    * Futurework: have this read version info from jar manifest.
     40    *
     41    * @return String denoting our current version
     42    */
     43   public static String getVersion()
     44   {
     45      return getProduct()+" "+getImplementationLanguage()+" "
     46            +getMajorVersionNum()+"."+getReleaseVersionNum()+"."
     47            +( (getDevelopmentVersionNum() > 0) ?
     48                ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum()));
     49   }
     50 
     51   /**
     52    * Print the processor version to the command line.
     53    *
     54    * @param argv command line arguments, unused.
     55    */
     56   public static void main(String argv[])
     57   {
     58     System.out.println(getVersion());
     59   }
     60 
     61   /**
     62    * Name of product: Serializer.
     63    */
     64   public static String getProduct()
     65   {
     66     return "Serializer";
     67   }
     68 
     69   /**
     70    * Implementation Language: Java.
     71    */
     72   public static String getImplementationLanguage()
     73   {
     74     return "Java";
     75   }
     76 
     77 
     78   /**
     79    * Major version number.
     80    * Version number. This changes only when there is a
     81    *          significant, externally apparent enhancement from
     82    *          the previous release. 'n' represents the n'th
     83    *          version.
     84    *
     85    *          Clients should carefully consider the implications
     86    *          of new versions as external interfaces and behaviour
     87    *          may have changed.
     88    */
     89   public static int getMajorVersionNum()
     90   {
     91     return @version.VERSION@;
     92 
     93   }
     94 
     95   /**
     96    * Release Number.
     97    * Release number. This changes when:
     98    *            -  a new set of functionality is to be added, eg,
     99    *               implementation of a new W3C specification.
    100    *            -  API or behaviour change.
    101    *            -  its designated as a reference release.
    102    */
    103   public static int getReleaseVersionNum()
    104   {
    105     return @version.RELEASE@;
    106   }
    107 
    108   /**
    109    * Maintenance Drop Number.
    110    * Optional identifier used to designate maintenance
    111    *          drop applied to a specific release and contains
    112    *          fixes for defects reported. It maintains compatibility
    113    *          with the release and contains no API changes.
    114    *          When missing, it designates the final and complete
    115    *          development drop for a release.
    116    */
    117   public static int getMaintenanceVersionNum()
    118   {
    119     return @version.MINOR@;
    120   }
    121 
    122   /**
    123    * Development Drop Number.
    124    * Optional identifier designates development drop of
    125    *          a specific release. D01 is the first development drop
    126    *          of a new release.
    127    *
    128    *          Development drops are works in progress towards a
    129    *          compeleted, final release. A specific development drop
    130    *          may not completely implement all aspects of a new
    131    *          feature, which may take several development drops to
    132    *          complete. At the point of the final drop for the
    133    *          release, the D suffix will be omitted.
    134    *
    135    *          Each 'D' drops can contain functional enhancements as
    136    *          well as defect fixes. 'D' drops may not be as stable as
    137    *          the final releases.
    138    */
    139   public static int getDevelopmentVersionNum()
    140   {
    141     try {
    142         if ((new String("@version.DEVELOPER@")).length() == 0)
    143           return 0;
    144         else
    145           return Integer.parseInt("@version.DEVELOPER@");
    146     } catch (NumberFormatException nfe) {
    147            return 0;
    148     }
    149   }
    150 }
    151