KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ws7 > serverresources > beans > WS70JdbcResourceBeanBeanInfo


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  * WS70JdbcResourceBeanBeanInfo.java
22  */

23
24 package org.netbeans.modules.j2ee.sun.ws7.serverresources.beans;
25
26 import java.beans.*;
27 import org.openide.util.NbBundle;
28 import org.netbeans.modules.j2ee.sun.ide.editors.BooleanEditor;
29 import org.netbeans.modules.j2ee.sun.ide.editors.Int0Editor;
30 import org.netbeans.modules.j2ee.sun.ide.editors.LongEditor;
31 import org.netbeans.modules.j2ee.sun.ide.editors.IsolationLevelEditor;
32 import org.netbeans.modules.j2ee.sun.ide.editors.DataSourceTypeEditor;
33 import org.netbeans.modules.j2ee.sun.ide.editors.ValidationMethodEditor;
34
35 /**
36  * @author Administrator
37  */

38 public class WS70JdbcResourceBeanBeanInfo extends SimpleBeanInfo {
39     
40     // Bean descriptor information will be obtained from introspection.//GEN-FIRST:BeanDescriptor
41
private static BeanDescriptor beanDescriptor = null;
42     private static BeanDescriptor getBdescriptor(){
43 //GEN-HEADEREND:BeanDescriptor
44
BeanDescriptor beanDescriptor = new BeanDescriptor(WS70JdbcResourceBean.class, null );
45         // Here you can add code for customizing the BeanDescriptor.
46

47         return beanDescriptor; }//GEN-LAST:BeanDescriptor
48
static private String JavaDoc getLabel(String JavaDoc key){
49         return NbBundle.getMessage(WS70JdbcResourceBean.class,key);
50     }
51     private static final int PROPERTY_jndiName = 0;
52     private static final int PROPERTY_isEnabled = 1;
53     private static final int PROPERTY_description = 2;
54     private static final int PROPERTY_dsClass = 3;
55     private static final int PROPERTY_minConnections = 4;
56     private static final int PROPERTY_maxConnections = 5;
57     
58     private static final int PROPERTY_idleTimeout = 6;
59     private static final int PROPERTY_waitTimeout = 7;
60     private static final int PROPERTY_tranxIsoLevel = 8;
61     private static final int PROPERTY_isIsoLevGuaranteed = 9;
62     private static final int PROPERTY_name = 10;
63     private static final int PROPERTY_connValidation = 11;
64     
65     private static final int PROPERTY_validationTableName = 12;
66     private static final int PROPERTY_failAllConns = 13;
67     
68     // Properties information will be obtained from introspection.//GEN-FIRST:Properties
69
private static PropertyDescriptor[] properties = null;
70     private static PropertyDescriptor[] getPdescriptor(){
71 //GEN-HEADEREND:Properties
72
PropertyDescriptor[] properties = new PropertyDescriptor[14];
73        try {
74             properties[PROPERTY_jndiName] = new PropertyDescriptor ( "jndiName", WS70JdbcResourceBean.class, "getJndiName", "setJndiName" );
75             properties[PROPERTY_jndiName].setDisplayName ( getLabel("LBL_JdbcJndiName") );
76             properties[PROPERTY_jndiName].setShortDescription ( getLabel("DSC_JdbcJndiName") );
77             
78             properties[PROPERTY_description] = new PropertyDescriptor ( "description", WS70JdbcResourceBean.class, "getDescription", "setDescription" );
79             properties[PROPERTY_description].setDisplayName ( getLabel("LBL_Description") );
80             properties[PROPERTY_description].setShortDescription ( getLabel("DSC_Description") );
81        
82             properties[PROPERTY_isEnabled] = new PropertyDescriptor ( "isEnabled", WS70JdbcResourceBean.class, "getIsEnabled", "setIsEnabled" );
83             properties[PROPERTY_isEnabled].setDisplayName ( getLabel("LBL_Enabled") );
84             properties[PROPERTY_isEnabled].setShortDescription ( getLabel("DSC_Enabled") );
85             properties[PROPERTY_isEnabled].setPropertyEditorClass ( BooleanEditor.class );
86             
87
88             properties[PROPERTY_dsClass] = new PropertyDescriptor ( "dsClass", WS70JdbcResourceBean.class, "getDsClass", "setDsClass" );
89             properties[PROPERTY_dsClass].setDisplayName ( getLabel("LBL_DSClassName") );
90             properties[PROPERTY_dsClass].setShortDescription ( getLabel("DSC_DSClassName") );
91       
92             properties[PROPERTY_minConnections] = new PropertyDescriptor ( "minConnections", WS70JdbcResourceBean.class, "getMinConnections", "setMinConnections" );
93             properties[PROPERTY_minConnections].setDisplayName ( getLabel("LBL_min_connections") );
94             properties[PROPERTY_minConnections].setShortDescription ( getLabel("DSC_min_connections") );
95             properties[PROPERTY_minConnections].setPropertyEditorClass ( Int0Editor.class );
96
97             properties[PROPERTY_maxConnections] = new PropertyDescriptor ( "maxConnections", WS70JdbcResourceBean.class, "getMaxConnections", "setMaxConnections" );
98             properties[PROPERTY_maxConnections].setDisplayName ( getLabel("LBL_max_connections") );
99             properties[PROPERTY_maxConnections].setShortDescription ( getLabel("DSC_max_connections") );
100             properties[PROPERTY_maxConnections].setPropertyEditorClass ( Int0Editor.class );
101             
102        
103             
104             properties[PROPERTY_idleTimeout] = new PropertyDescriptor ( "idleTimeout", WS70JdbcResourceBean.class, "getIdleTimeout", "setIdleTimeout" );
105             properties[PROPERTY_idleTimeout].setDisplayName ( getLabel("LBL_connection_idle_timeout") );
106             properties[PROPERTY_idleTimeout].setShortDescription ( getLabel("DSC_connection_idle_timeout") );
107             properties[PROPERTY_idleTimeout].setPropertyEditorClass ( LongEditor.class );
108             
109             properties[PROPERTY_waitTimeout] = new PropertyDescriptor ( "waitTimeout", WS70JdbcResourceBean.class, "getWaitTimeout", "setWaitTimeout" );
110             properties[PROPERTY_waitTimeout].setDisplayName ( getLabel("LBL_connection_wait_timeout") );
111             properties[PROPERTY_waitTimeout].setShortDescription ( getLabel("DSC_connection_wait_timeout") );
112             properties[PROPERTY_waitTimeout].setPropertyEditorClass ( LongEditor.class );
113             
114             properties[PROPERTY_isIsoLevGuaranteed] = new PropertyDescriptor ( "isolationLevelGuaranteed", WS70JdbcResourceBean.class, "getIsolationLevelGuaranteed", "setIsolationLevelGuaranteed" );
115             properties[PROPERTY_isIsoLevGuaranteed].setDisplayName ( getLabel("LBL_is_isolation_level_guaranteed") );
116             properties[PROPERTY_isIsoLevGuaranteed].setShortDescription ( getLabel("DSC_is_isolation_level_guaranteed") );
117             properties[PROPERTY_isIsoLevGuaranteed].setPropertyEditorClass ( BooleanEditor.class );
118            
119             properties[PROPERTY_tranxIsoLevel] = new PropertyDescriptor ( "isolationLevel", WS70JdbcResourceBean.class, "getIsolationLevel", "setIsolationLevel" );
120             properties[PROPERTY_tranxIsoLevel].setDisplayName ( getLabel("LBL_transaction_isolation_level") );
121             properties[PROPERTY_tranxIsoLevel].setShortDescription ( getLabel("DSC_transaction_isolation_level") );
122             properties[PROPERTY_tranxIsoLevel].setPropertyEditorClass ( IsolationLevelEditor.class );
123
124             
125             properties[PROPERTY_name] = new PropertyDescriptor ( "name", WS70JdbcResourceBean.class, "getName", "setName" );
126             properties[PROPERTY_name].setHidden ( true );
127
128             properties[PROPERTY_connValidation] = new PropertyDescriptor ( "connectionValidation", WS70JdbcResourceBean.class, "getConnectionValidation", "setConnectionValidation" );
129             properties[PROPERTY_connValidation].setDisplayName ( getLabel("LBL_conn_valid_method") );
130             properties[PROPERTY_connValidation].setShortDescription ( getLabel("DSC_conn_valid_method") );
131             properties[PROPERTY_connValidation].setPropertyEditorClass ( ValidationMethodEditor.class );
132
133             properties[PROPERTY_validationTableName] = new PropertyDescriptor ( "connectionValidationTablename", WS70JdbcResourceBean.class, "getConnectionValidationTablename", "setConnectionValidationTablename" );
134             properties[PROPERTY_validationTableName].setDisplayName ( getLabel("LBL_validation_table_name") );
135             properties[PROPERTY_validationTableName].setShortDescription ( getLabel("DSC_validation_table_name") );
136             properties[PROPERTY_failAllConns] = new PropertyDescriptor ( "failAllConnections", WS70JdbcResourceBean.class, "getFailAllConnections", "setFailAllConnections" );
137             properties[PROPERTY_failAllConns].setDisplayName ( getLabel("LBL_fail_all_connections") );
138             properties[PROPERTY_failAllConns].setShortDescription ( getLabel("DSC_fail_all_connections") );
139             properties[PROPERTY_failAllConns].setPropertyEditorClass ( BooleanEditor.class );
140         }
141         catch( Exception JavaDoc e){
142             e.printStackTrace();
143         }
144         // Here you can add code for customizing the properties array.
145

146         return properties; }//GEN-LAST:Properties
147

148     // Event set information will be obtained from introspection.//GEN-FIRST:Events
149
private static EventSetDescriptor[] eventSets = null;
150     private static EventSetDescriptor[] getEdescriptor(){
151 //GEN-HEADEREND:Events
152

153         // Here you can add code for customizing the event sets array.
154

155         return eventSets; }//GEN-LAST:Events
156

157     // Method information will be obtained from introspection.//GEN-FIRST:Methods
158
private static MethodDescriptor[] methods = null;
159     private static MethodDescriptor[] getMdescriptor(){
160 //GEN-HEADEREND:Methods
161

162         // Here you can add code for customizing the methods array.
163

164         return methods; }//GEN-LAST:Methods
165

166     
167     private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
168
private static int defaultEventIndex = -1;//GEN-END:Idx
169

170     
171 //GEN-FIRST:Superclass
172

173     // Here you can add code for customizing the Superclass BeanInfo.
174

175 //GEN-LAST:Superclass
176

177     /**
178      * Gets the bean's <code>BeanDescriptor</code>s.
179      *
180      * @return BeanDescriptor describing the editable
181      * properties of this bean. May return null if the
182      * information should be obtained by automatic analysis.
183      */

184     public BeanDescriptor getBeanDescriptor() {
185         return getBdescriptor();
186     }
187     
188     /**
189      * Gets the bean's <code>PropertyDescriptor</code>s.
190      *
191      * @return An array of PropertyDescriptors describing the editable
192      * properties supported by this bean. May return null if the
193      * information should be obtained by automatic analysis.
194      * <p>
195      * If a property is indexed, then its entry in the result array will
196      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
197      * A client of getPropertyDescriptors can use "instanceof" to check
198      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
199      */

200     public PropertyDescriptor[] getPropertyDescriptors() {
201         return getPdescriptor();
202     }
203     
204     /**
205      * Gets the bean's <code>EventSetDescriptor</code>s.
206      *
207      * @return An array of EventSetDescriptors describing the kinds of
208      * events fired by this bean. May return null if the information
209      * should be obtained by automatic analysis.
210      */

211     public EventSetDescriptor[] getEventSetDescriptors() {
212         return getEdescriptor();
213     }
214     
215     /**
216      * Gets the bean's <code>MethodDescriptor</code>s.
217      *
218      * @return An array of MethodDescriptors describing the methods
219      * implemented by this bean. May return null if the information
220      * should be obtained by automatic analysis.
221      */

222     public MethodDescriptor[] getMethodDescriptors() {
223         return getMdescriptor();
224     }
225     
226     /**
227      * A bean may have a "default" property that is the property that will
228      * mostly commonly be initially chosen for update by human's who are
229      * customizing the bean.
230      * @return Index of default property in the PropertyDescriptor array
231      * returned by getPropertyDescriptors.
232      * <P> Returns -1 if there is no default property.
233      */

234     public int getDefaultPropertyIndex() {
235         return defaultPropertyIndex;
236     }
237     
238     /**
239      * A bean may have a "default" event that is the event that will
240      * mostly commonly be used by human's when using the bean.
241      * @return Index of default event in the EventSetDescriptor array
242      * returned by getEventSetDescriptors.
243      * <P> Returns -1 if there is no default event.
244      */

245     public int getDefaultEventIndex() {
246         return defaultEventIndex;
247     }
248 }
249
250
Popular Tags