/* Class_Generated_From_VersionTemplate.java
 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * This file is not checked in to CVS. So no CVS information.
 * 1. This java class is generated from a template. Please do not modify it
 * by hand.
 * 2. The template used is VersionTemplate in the same package.
 * 3. The creation of this Java Source File is done by the build.
 */
package com.sun.enterprise.admin.jmx.remote.protocol;

import java.io.Serializable;

/**
* This is the generated Version for the JSR 160 implementation in S1AS.
* This class is generated during the build process.
* @version 1.0
*/
public class @CLASS_NAME@ implements Version {

    /* serialVersionUID is not defined in this class because
       we do not want serialization to be affected by that. The basic
       API of the class should not change whatsoever. The additional
       data for future product releases should be packed in the array
       of Strings - upgradeData. Note that it is expected that the API
       or any non-transient metadata of this class is NEVER changed.
       Hopefully the "value" of upgradeData is the only thing that is expected
       to change and that will keep the serialized version unchanged. (I have done
       some basic testing by initializing various values in the upgradeData 
       array and then calculating the value with the serialver command in
       JDK 1.4.2_03).
    */

    /**
    * Version strings populated during build.
    */
    private final int majorVersion          = @MAJOR_VERSION@;
    private final int minorVersion          = @MINOR_VERSION@; 
    private final String description        = "@DESCRIPTION@";
    /** The upgrade data. The only change being made to this class should
    be the "value" of this variable. Currently empty as of Version 1.0. */
    private final String[] upgradeData      = new String[] {@UPGRADE_DATA@};
    
    /**
     * Returns version information as a String.
     */
    public String toString() {
        return (
            new StringBuffer(description).
            append(":").append(majorVersion).append(".").append(minorVersion).
            append(":").append(upgradeData2String()).toString()
            );
    }
    
    private String upgradeData2String() {
        final StringBuffer sb = new StringBuffer();
        for (int i = 0 ; i < upgradeData.length ; i++) {
            sb.append(upgradeData[i]);
            sb.append(":");
        }
        return ( sb.toString() );
    }
    /**
     * Returns Major Version as an int.
     */ 
    public int getMajorVersion() {
    	return majorVersion;
    }

    /**
     * Returns Minor Version as an int.
     */
    public int getMinorVersion() {
    	return minorVersion;
    }

    /** 
     * Returns the Upgrade Data as a String[]. The Strings packed in this array
     * are processed by the Server in a particular manner.
     */
    public String[] getUpgradeData() {
        return ( (String[])upgradeData.clone() );
    }
}