KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > connector > deployment > dconfigbean > ConnectionDefinitionInstanceBeanInfo


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.connector.deployment.dconfigbean;
18
19 import java.beans.*;
20 import java.awt.*;
21
22 /**
23  * @version $Revision: 1.0$
24  */

25 public class ConnectionDefinitionInstanceBeanInfo implements BeanInfo {
26     /**
27      * A bean may have a "default" event that is the event that will
28      * mostly commonly be used by humans when using the bean.
29      *
30      * @return Index of default event in the EventSetDescriptor array
31      * returned by getEventSetDescriptors.
32      * <P> Returns -1 if there is no default event.
33      */

34     public int getDefaultEventIndex() {
35         return -1;
36     }
37
38     /**
39      * A bean may have a "default" property that is the property that will
40      * mostly commonly be initially chosen for update by human's who are
41      * customizing the bean.
42      *
43      * @return Index of default property in the PropertyDescriptor array
44      * returned by getPropertyDescriptors.
45      * <P> Returns -1 if there is no default property.
46      */

47     public int getDefaultPropertyIndex() {
48         return -1;
49     }
50
51     /**
52      * This method returns an image object that can be used to
53      * represent the bean in toolboxes, toolbars, etc. Icon images
54      * will typically be GIFs, but may in future include other formats.
55      * <p/>
56      * Beans aren't required to provide icons and may return null from
57      * this method.
58      * <p/>
59      * There are four possible flavors of icons (16x16 color,
60      * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
61      * support a single icon we recommend supporting 16x16 color.
62      * <p/>
63      * We recommend that icons have a "transparent" background
64      * so they can be rendered onto an existing background.
65      *
66      * @param iconKind The kind of icon requested. This should be
67      * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
68      * ICON_MONO_16x16, or ICON_MONO_32x32.
69      * @return An image object representing the requested icon. May
70      * return null if no suitable icon is available.
71      */

72     public Image getIcon(int iconKind) {
73         return null;
74     }
75
76     /**
77      * Gets the beans <code>BeanDescriptor</code>.
78      *
79      * @return A BeanDescriptor providing overall information about
80      * the bean, such as its displayName, its customizer, etc. May
81      * return null if the information should be obtained by automatic
82      * analysis.
83      */

84     public BeanDescriptor getBeanDescriptor() {
85         BeanDescriptor bd = new BeanDescriptor(ConnectionDefinitionInstance.class);
86         bd.setDisplayName("Geronimo Connection Configurations");
87         bd.setShortDescription("The Resource Adapter defines what type of connections may be made (e.g. to a database, or to JMS). These entries configure a specific connection instance (to a specific database or JMS server). This is done primarily by setting appropriate config properties.");
88         return bd;
89     }
90
91     /**
92      * This method allows a BeanInfo object to return an arbitrary collection
93      * of other BeanInfo objects that provide additional information on the
94      * current bean.
95      * <P>
96      * If there are conflicts or overlaps between the information provided
97      * by different BeanInfo objects, then the current BeanInfo takes precedence
98      * over the getAdditionalBeanInfo objects, and later elements in the array
99      * take precedence over earlier ones.
100      *
101      * @return an array of BeanInfo objects. May return null.
102      */

103     public BeanInfo[] getAdditionalBeanInfo() {
104         return null;
105     }
106
107     /**
108      * Gets the beans <code>EventSetDescriptor</code>s.
109      *
110      * @return An array of EventSetDescriptors describing the kinds of
111      * events fired by this bean. May return null if the information
112      * should be obtained by automatic analysis.
113      */

114     public EventSetDescriptor[] getEventSetDescriptors() {
115         return null;
116     }
117
118     /**
119      * Gets the beans <code>MethodDescriptor</code>s.
120      *
121      * @return An array of MethodDescriptors describing the externally
122      * visible methods supported by this bean. May return null if
123      * the information should be obtained by automatic analysis.
124      */

125     public MethodDescriptor[] getMethodDescriptors() {
126         return new MethodDescriptor[0];
127     }
128
129     /**
130      * Gets the beans <code>PropertyDescriptor</code>s.
131      *
132      * @return An array of PropertyDescriptors describing the editable
133      * properties supported by this bean. May return null if the
134      * information should be obtained by automatic analysis.
135      * <p/>
136      * If a property is indexed, then its entry in the result array will
137      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
138      * A client of getPropertyDescriptors can use "instanceof" to check
139      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
140      */

141     public PropertyDescriptor[] getPropertyDescriptors() {
142         try {
143             PropertyDescriptor name = new PropertyDescriptor("name", ConnectionDefinitionInstance.class);
144             name.setDisplayName("Connection Name");
145             name.setShortDescription("A name that identifies this connection. It will be used by application resource references to map to this connection.");
146             PropertyDescriptor jndiName = new PropertyDescriptor("globalJNDIName", ConnectionDefinitionInstance.class);
147             jndiName.setDisplayName("Global JNDI Name");
148             jndiName.setShortDescription("Where to register this connection in the global JNDI tree. This is only necessary for non-J2EE application clients; it is not used for nornal resource references.");
149             PropertyDescriptor configs = new PropertyDescriptor("configProperty", ConnectionDefinitionInstance.class, "getConfigProperty", null);
150             configs.setDisplayName("Configuration Properties");
151             configs.setShortDescription("The configuration properties that point this connection instance to a particular destination (database, JMS server, etc.).");
152             return new PropertyDescriptor[]{
153                 name, jndiName, configs
154             };
155         } catch (IntrospectionException e) {
156             throw new RuntimeException JavaDoc("Unable to configure bean properties", e);
157         }
158     }
159 }
160
Popular Tags