KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > AppClientVersion


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.j2ee.sun.share.configbean;
20
21 /**
22  * Enumerated types for Application Client Version
23  *
24  * @author Peter Williams
25  */

26 public final class AppClientVersion extends J2EEBaseVersion {
27     
28     /** Represents application-client version 1.3
29      */

30     public static final AppClientVersion APP_CLIENT_1_3 = new AppClientVersion(
31         "1.3", 1300, // NOI18N
32
"1.3", 1300, // NOI18N
33
DTDRegistryLink.SUN_APPCLIENT_130_DTD_PUBLIC_ID,
34         DTDRegistryLink.SUN_APPCLIENT_130_DTD_SYSTEM_ID);
35
36     /** Represents application-client version 1.4
37      */

38     public static final AppClientVersion APP_CLIENT_1_4 = new AppClientVersion(
39         "1.4", 1400, // NOI18N
40
"1.4", 1400, // NOI18N
41
DTDRegistryLink.SUN_APPCLIENT_140_DTD_PUBLIC_ID,
42         DTDRegistryLink.SUN_APPCLIENT_140_DTD_SYSTEM_ID);
43     
44     /** Represents application-client version 5.0
45      */

46     public static final AppClientVersion APP_CLIENT_5_0 = new AppClientVersion(
47         "5.0", 5000, // NOI18N
48
"5.0", 5000, // NOI18N
49
DTDRegistryLink.SUN_APPCLIENT_500_DTD_PUBLIC_ID,
50         DTDRegistryLink.SUN_APPCLIENT_500_DTD_SYSTEM_ID);
51         
52         
53     /** -----------------------------------------------------------------------
54      * Implementation
55      */

56
57     /** Creates a new instance of AppClientVersion
58      */

59     private AppClientVersion(String JavaDoc version, int nv, String JavaDoc specVersion, int nsv, String JavaDoc pubId, String JavaDoc sysId) {
60         super(version, nv, specVersion, nsv, pubId, sysId);
61     }
62
63     /** Comparator implementation that works only on AppClientVersion objects
64      *
65      * @param obj AppClientVersion to compare with.
66      * @return -1, 0, or 1 if this version is less than, equal to, or greater
67      * than the version passed in as an argument.
68      * @throws ClassCastException if obj is not a AppClientVersion object.
69      */

70     public int compareTo(Object JavaDoc obj) {
71         AppClientVersion target = (AppClientVersion) obj;
72         return numericCompare(target);
73     }
74
75     public static AppClientVersion getAppClientVersion(String JavaDoc version) {
76         AppClientVersion result = APP_CLIENT_5_0;
77
78         if(APP_CLIENT_1_3.toString().equals(version)) {
79             result = APP_CLIENT_1_3;
80         } else if(APP_CLIENT_1_4.toString().equals(version)) {
81             result = APP_CLIENT_1_4;
82         }
83
84         return result;
85     }
86 }
87
Popular Tags