KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ws7 > j2ee > ResourceType


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
20 /*
21  * ResourceType.java
22  */

23
24 package org.netbeans.modules.j2ee.sun.ws7.j2ee;
25
26 /**
27  *
28  * @author Administrator
29  */

30 public class ResourceType {
31
32     private static final int ENUM_JDBC=1;
33     private static final int ENUM_EXT_JNDI=2;
34     private static final int ENUM_CUSTOM=3;
35     private static final int ENUM_MAIL=4;
36
37     public static final ResourceType JDBC =new ResourceType(ENUM_JDBC);
38     public static final ResourceType JNDI =new ResourceType(ENUM_EXT_JNDI);
39     public static final ResourceType CUSTOM =new ResourceType(ENUM_CUSTOM);
40     public static final ResourceType MAIL =new ResourceType(ENUM_MAIL);
41     
42     private int type;
43     
44     public ResourceType(int type) {
45         this.type = type;
46     }
47     
48     public int getType(){
49         return type;
50     }
51     public boolean eqauls(ResourceType type){
52         if(this.type == type.getType()){
53             return true;
54         }
55         return false;
56     }
57     
58     public String JavaDoc toString(){
59         if(type==ENUM_JDBC){
60             return "jdbc-resource";//No I18N
61
}
62         if(type==ENUM_EXT_JNDI){
63             return "external-jndi-resource";//No I18N
64
}
65         if(type==ENUM_CUSTOM){
66             return "custom-resource";//No I18N
67
}
68         if(type==ENUM_MAIL){
69             return "mail-resource";//No I18N
70
}
71         
72         return "UNKNOWN";//No I18N
73
}
74 }
75
Popular Tags