001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.connector.deployment.dconfigbean;
017:
018: import java.beans.*;
019: import java.awt.*;
020:
021: /**
022: * @version $Revision: 1.0$
023: */
024: public class ConnectionDefinitionDConfigBeanBeanInfo implements
025: BeanInfo {
026: /**
027: * A bean may have a "default" event that is the event that will
028: * mostly commonly be used by humans when using the bean.
029: *
030: * @return Index of default event in the EventSetDescriptor array
031: * returned by getEventSetDescriptors.
032: * <P> Returns -1 if there is no default event.
033: */
034: public int getDefaultEventIndex() {
035: return -1;
036: }
037:
038: /**
039: * A bean may have a "default" property that is the property that will
040: * mostly commonly be initially chosen for update by human's who are
041: * customizing the bean.
042: *
043: * @return Index of default property in the PropertyDescriptor array
044: * returned by getPropertyDescriptors.
045: * <P> Returns -1 if there is no default property.
046: */
047: public int getDefaultPropertyIndex() {
048: return -1;
049: }
050:
051: /**
052: * This method returns an image object that can be used to
053: * represent the bean in toolboxes, toolbars, etc. Icon images
054: * will typically be GIFs, but may in future include other formats.
055: * <p/>
056: * Beans aren't required to provide icons and may return null from
057: * this method.
058: * <p/>
059: * There are four possible flavors of icons (16x16 color,
060: * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
061: * support a single icon we recommend supporting 16x16 color.
062: * <p/>
063: * We recommend that icons have a "transparent" background
064: * so they can be rendered onto an existing background.
065: *
066: * @param iconKind The kind of icon requested. This should be
067: * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
068: * ICON_MONO_16x16, or ICON_MONO_32x32.
069: * @return An image object representing the requested icon. May
070: * return null if no suitable icon is available.
071: */
072: public Image getIcon(int iconKind) {
073: return null;
074: }
075:
076: /**
077: * Gets the beans <code>BeanDescriptor</code>.
078: *
079: * @return A BeanDescriptor providing overall information about
080: * the bean, such as its displayName, its customizer, etc. May
081: * return null if the information should be obtained by automatic
082: * analysis.
083: */
084: public BeanDescriptor getBeanDescriptor() {
085: BeanDescriptor bd = new BeanDescriptor(
086: ConnectionDefinitionDConfigBean.class);
087: bd.setDisplayName("Connection Definition");
088: bd
089: .setShortDescription("Holds a list of connection instances available for this connector.");
090: return bd;
091: }
092:
093: /**
094: * This method allows a BeanInfo object to return an arbitrary collection
095: * of other BeanInfo objects that provide additional information on the
096: * current bean.
097: * <P>
098: * If there are conflicts or overlaps between the information provided
099: * by different BeanInfo objects, then the current BeanInfo takes precedence
100: * over the getAdditionalBeanInfo objects, and later elements in the array
101: * take precedence over earlier ones.
102: *
103: * @return an array of BeanInfo objects. May return null.
104: */
105: public BeanInfo[] getAdditionalBeanInfo() {
106: return null;
107: }
108:
109: /**
110: * Gets the beans <code>EventSetDescriptor</code>s.
111: *
112: * @return An array of EventSetDescriptors describing the kinds of
113: * events fired by this bean. May return null if the information
114: * should be obtained by automatic analysis.
115: */
116: public EventSetDescriptor[] getEventSetDescriptors() {
117: return null;
118: }
119:
120: /**
121: * Gets the beans <code>MethodDescriptor</code>s.
122: *
123: * @return An array of MethodDescriptors describing the externally
124: * visible methods supported by this bean. May return null if
125: * the information should be obtained by automatic analysis.
126: */
127: public MethodDescriptor[] getMethodDescriptors() {
128: return null;
129: }
130:
131: /**
132: * Gets the beans <code>PropertyDescriptor</code>s.
133: *
134: * @return An array of PropertyDescriptors describing the editable
135: * properties supported by this bean. May return null if the
136: * information should be obtained by automatic analysis.
137: * <p/>
138: * If a property is indexed, then its entry in the result array will
139: * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
140: * A client of getPropertyDescriptors can use "instanceof" to check
141: * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
142: */
143: public PropertyDescriptor[] getPropertyDescriptors() {
144: try {
145: PropertyDescriptor instances = new PropertyDescriptor(
146: "connectionDefinitionInstance",
147: ConnectionDefinitionDConfigBean.class);
148: instances.setDisplayName("Geronimo Connections");
149: instances
150: .setShortDescription("Geronimo allows several connection instances to be configured for the same connection type. For example, there may be connection instances pointing to several databases for a single JDBC instance of a connector.");
151: return new PropertyDescriptor[] { instances };
152: } catch (IntrospectionException e) {
153: throw new RuntimeException("Unable to parse bean", e);
154: }
155: }
156: }
|