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 477252 2006-11-20 16:52:00Z minchau $
020     */
021    package org.apache.xml.serializer;
022    
023    /**
024     * Administrative class to keep track of the version number of
025     * the Serializer 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.</P> 
029     * @xsl.usage general
030     */
031    public final class Version
032    {
033    
034      /**
035       * Get the basic version string for the current Serializer.
036       * Version String formatted like 
037       * <CODE>"<B>Serializer</B> <B>Java</B> v.r[.dd| <B>D</B>nn]"</CODE>.
038       *
039       * Futurework: have this read version info from jar manifest.
040       *
041       * @return String denoting our current version
042       */
043      public static String getVersion()
044      {
045         return getProduct()+" "+getImplementationLanguage()+" "
046               +getMajorVersionNum()+"."+getReleaseVersionNum()+"."
047               +( (getDevelopmentVersionNum() > 0) ? 
048                   ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum()));  
049      }
050    
051      /**
052       * Print the processor version to the command line.
053       *
054       * @param argv command line arguments, unused.
055       */
056      public static void main(String argv[])
057      {
058        System.out.println(getVersion());
059      }
060      
061      /**
062       * Name of product: Serializer.
063       */
064      public static String getProduct()
065      {
066        return "Serializer";
067      }
068    
069      /**
070       * Implementation Language: Java.
071       */
072      public static String getImplementationLanguage()
073      {
074        return "Java";
075      }
076      
077      
078      /**
079       * Major version number.
080       * Version number. This changes only when there is a
081       *          significant, externally apparent enhancement from
082       *          the previous release. 'n' represents the n'th
083       *          version.
084       *
085       *          Clients should carefully consider the implications
086       *          of new versions as external interfaces and behaviour
087       *          may have changed.
088       */
089      public static int getMajorVersionNum()
090      {
091        return 2;
092        
093      }  
094    
095      /**
096       * Release Number.
097       * Release number. This changes when:
098       *            -  a new set of functionality is to be added, eg,
099       *               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 7;
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 1;
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("")).length() == 0)
143              return 0;
144            else  
145              return Integer.parseInt("");
146        } catch (NumberFormatException nfe) {
147               return 0;
148        }    
149      }      
150    }