You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ky...@apache.org on 2004/12/01 20:33:42 UTC

svn commit: r109374 - in incubator/beehive/trunk/controls: src/api/org/apache/beehive/controls/api/events src/api/org/apache/beehive/controls/api/packaging src/api/org/apache/beehive/controls/api/properties src/runtime/org/apache/beehive/controls/runtime/bean src/runtime/org/apache/beehive/controls/runtime/generator src/runtime/org/apache/beehive/controls/runtime/generator/apt test test/src/controls/org/apache/beehive/controls/test/controls/beaninfo test/src/controls/org/apache/beehive/controls/test/controls/util test/src/units/org/apache/beehive/controls/test/java/beaninfo

Author: kylem
Date: Wed Dec  1 11:33:41 2004
New Revision: 109374

URL: http://svn.apache.org/viewcvs?view=rev&rev=109374
Log:
Implemented full support for providing custom BeanInfo data via JSR-175 annotations.  Annotation 
types now exist for all of the various java.beans.*Descriptor classes in the 
org.apache.beehive.controls.api.packaging package. These annotations are used in the generation
of custom BeanInfo.   Providing custom BeanInfo data is now supported for bean type (interface and
extension), bean methods (and their parameters), bean properties, bean event sets (and event 
methods and their parameters).  The controls test suite has a util class
(org.apache.beehive.test.controls.util.ControlIntrospector) that will introspect and dump
BeanInfo data in an XML format and a test case that uses BeanInfo annotations and validates
them against expected results.  Still remaining is a mechanism where annotations can contain
string data that indirects to a resource bundle (to support localization).

Did some fairly major cleanup of the controls codegen support in 
org.apache.beehive.runtime.generator.*.   Refactored and removed a vestigial layer of
abstraction that was just making things more complicated than necessary.

Fixed JIRA issue: (BEEHIVE-97) Event notifiers aren't registered for Control extensions


Added:
   incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventDispatcherRemote.java
   incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/BeanInfo.java
   incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/EventSetInfo.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptAnnotationHelper.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptClientField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptContextField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEvent.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventHandler.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventSet.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethod.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethodSet.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptOperation.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptProperty.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptPropertySet.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptType.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/Generator.java
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/util/ControlIntrospector.java
   incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/beaninfo/
   incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/beaninfo/BeanInfoTest.java
   incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/beaninfo/InfoTestBean.beaninfo
Removed:
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ContextField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlClient.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlEvent.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlEventHandler.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlEventSet.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlImpl.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlInterface.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlOperation.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlProperty.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlPropertySet.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/EventField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/GenField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/GenMethod.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/SimpleFiler.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptAnnotationHelper.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptClientField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptContextField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlClient.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlField.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlImplementation.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptEvent.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptEventHandler.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptEventSet.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptFieldHelper.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptMethodHelper.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptOperation.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptProperty.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptPropertySet.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptUtils.java
Modified:
   incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventRef.java
   incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/PropertyInfo.java
   incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/BeanPropertyMap.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/EventAdaptor.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/VelocityGenerator.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessor.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java
   incubator/beehive/trunk/controls/test/build.xml
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTest.java
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTestImpl.jcs

Added: incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventDispatcherRemote.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventDispatcherRemote.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventDispatcherRemote.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,41 @@
+package org.apache.beehive.controls.api.events;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.rmi.RemoteException;
+
+import org.apache.beehive.controls.api.context.ControlHandle;
+
+/**
+ * The EventDispatcherRemote interface defines the event dispatch signature when event
+ * dispatching is happening via RMI.
+ *
+ * @see org.apache.beehive.controls.api.events.EventDispatcher
+ */
+public interface EventDispatcherRemote
+{
+    /**
+     * Dispatches a Control event to a target control.
+     * @param target the target control
+     * @param event the event to deliver to the control
+     * @param args the parameters to the control event
+     * @throws RemoteException wraps any exception thrown during event dispatch
+     */ 
+    public Object dispatchEvent(ControlHandle target, EventRef event, Object [] args)
+                  throws RemoteException;
+}

Modified: incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventRef.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventRef.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventRef.java&r1=109373&p2=incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventRef.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventRef.java	(original)
+++ incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/events/EventRef.java	Wed Dec  1 11:33:41 2004
@@ -238,6 +238,11 @@
         return _descriptor.equals(((EventRef)obj)._descriptor);
     }
 
+    public String toString()
+    {
+        return "EventRef: " + _descriptor;
+    }
+
     //
     // OPTIMIZE: A more efficient internal representation for serialization/wire purposes
     // would be to compute a hash of the descriptor string (ala RMI opnums), that could be

Added: incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/BeanInfo.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/BeanInfo.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/BeanInfo.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,44 @@
+package org.apache.beehive.controls.api.packaging;
+
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+/**
+ * The FeatureInfo annotation type defines a JSR-175 syntax for annotating a Control to
+ * provide BeanInfo FeatureDescriptor information for the bean, its properties, methods,
+ * or events.
+ * <p>
+ * The elements of FeatureInfo correspond 1-to-1 with the information exposed by the
+ * <code>java.beans.FeatureDescriptor</code> class.
+ * 
+ * @see java.beans.FeatureDescriptor
+ */
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface BeanInfo
+{
+    /** 
+     * The NoCustomizer class can be used as the value of the customizerClass attribute to 
+     *  indicate that the bean has no customizer.
+     */
+    static public class NoCustomizer {}
+
+    public Class customizerClass() default NoCustomizer.class;
+}

Added: incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/EventSetInfo.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/EventSetInfo.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/EventSetInfo.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,39 @@
+package org.apache.beehive.controls.api.packaging;
+
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+/**
+ * The EventSetInfo annotation type defines a JSR-175 syntax for annotating a Control 
+ * property declaration to provide java.beans.EventSetDescriptor information.  Generic
+ * feature information is defined using the <code>FeatureInfo</code> annotation type
+ * <p>
+ * The elements of EventStInfo correspond 1-to-1 with the information exposed by the
+ * <code>java.beans.EventSetDescriptor</code> class.
+ * 
+ * @see java.beans.EventSetDescriptor
+ */
+@Target({ElementType.TYPE})   // appears on EventSet interface declaration
+public @interface EventSetInfo
+{
+    public boolean isUnicast() default false;           // single listener model
+    public boolean isDefault() default true;            // is the default event set
+}

Modified: incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/PropertyInfo.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/PropertyInfo.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/PropertyInfo.java&r1=109373&p2=incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/PropertyInfo.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/PropertyInfo.java	(original)
+++ incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/packaging/PropertyInfo.java	Wed Dec  1 11:33:41 2004
@@ -21,6 +21,8 @@
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Target;
 
+import java.beans.PropertyEditor;
+
 /**
  * The PropertyInfo annotation type defines a JSR-175 syntax for annotating a Control 
  * property declaration to provide java.beans.PropertyDescriptor information.  Generic
@@ -34,6 +36,13 @@
 @Target({ElementType.METHOD})   // appears on PropertySet method declaration (i.e. properties)
 public @interface PropertyInfo
 {
-    public boolean bound() default false;         // Sends PropertyChange events
-    public boolean constrained() default false;   // Sends VetoableChange events
+    /** 
+     * The NoEditor class can be used as the value of the editorClass attribute to 
+     *  indicate that the property has no editor
+     */
+    static public class NoEditor {};
+
+    public boolean bound() default false;                       // Sends PropertyChange events
+    public boolean constrained() default false;                 // Sends VetoableChange events
+    public Class editorClass() default NoEditor.class;          // default == no editor
 }

Modified: incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/BeanPropertyMap.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/BeanPropertyMap.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/BeanPropertyMap.java&r1=109373&p2=incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/BeanPropertyMap.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/BeanPropertyMap.java	(original)
+++ incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/BeanPropertyMap.java	Wed Dec  1 11:33:41 2004
@@ -43,6 +43,7 @@
         _primToObject.put(Integer.TYPE, Integer.class);
         _primToObject.put(Long.TYPE, Long.class);
         _primToObject.put(Short.TYPE, Short.class);
+        _primToObject.put(Byte.TYPE, Byte.class);
         _primToObject.put(Float.TYPE, Float.class);
         _primToObject.put(Double.TYPE, Double.class);
         _primToObject.put(Character.TYPE, Character.class);

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java&r1=109373&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java	Wed Dec  1 11:33:41 2004
@@ -435,7 +435,7 @@
         return _notifierMap.get(eventSet);
     }
 
-    private Vector<InvokeListener> getInvokeListeners()
+    /* package */ Vector<InvokeListener> getInvokeListeners()
     {
         if (_invokeListeners == null)
             _invokeListeners = new Vector<InvokeListener>();
@@ -445,7 +445,7 @@
     /**
      * Registers a new InvokeListener for this ControlBean.
      */
-    public void addInvokeListener(InvokeListener invokeListener)
+    /* package */ void addInvokeListener(InvokeListener invokeListener)
     {
         getInvokeListeners().addElement(invokeListener);
     }
@@ -453,7 +453,7 @@
     /**
      * Deregisters an existing InvokeListener for this ControlBean.
      */
-    public void removeInvokeListener(InvokeListener invokeListener)
+    /* package */ void removeInvokeListener(InvokeListener invokeListener)
     {
         getInvokeListeners().removeElement(invokeListener);
     }

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptAnnotationHelper.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptAnnotationHelper.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptAnnotationHelper.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,87 @@
+package org.apache.beehive.controls.runtime.generator;
+
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.sun.mirror.declaration.AnnotationMirror;
+import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
+import com.sun.mirror.declaration.AnnotationValue;
+
+/**
+ * The AptAnnotationHelper class is a helper class that aids in the reading of annotation
+ * values using APT metadata
+ */
+public class AptAnnotationHelper
+{
+    /**
+     * Initialize a new helper instance based upon a specific annotation declaration.
+     * @param  annot The annotation value declaration
+     */
+    public AptAnnotationHelper(AnnotationMirror annot)
+    {
+        //
+        // Build maps from the element name to its declaration and values
+        //
+        Map <AnnotationTypeElementDeclaration,AnnotationValue> elemValues = 
+            annot.getElementValues();
+
+        for (AnnotationTypeElementDeclaration ated : elemValues.keySet())
+        {
+            _elementMap.put(ated.getSimpleName(), ated);
+            _valueMap.put(ated.getSimpleName(), elemValues.get(ated));
+        }
+    };
+
+    /**
+     * Returns the AnnotationTypeElementDeclaration for a particular element
+     */
+    public AnnotationTypeElementDeclaration getElementDeclaration(String elemName)
+    {
+        if (_elementMap.containsKey(elemName))
+            return _elementMap.get(elemName);
+        return null;
+    }
+
+    /**
+     * Returns the value of a particular element as a String
+     */
+    public String getStringValue(String elemName)
+    {
+        if (_valueMap.containsKey(elemName))
+            return _valueMap.get(elemName).toString();
+        return null;
+    }
+
+    /**
+     * Returns the value of a particular element as an Object
+     */
+    public Object getObjectValue(String elemName)
+    {
+        if (_valueMap.containsKey(elemName))
+            return _valueMap.get(elemName).getValue();
+        return null;
+    }
+
+    private HashMap<String,AnnotationTypeElementDeclaration> _elementMap = 
+                new HashMap<String,AnnotationTypeElementDeclaration>();
+    private HashMap<String,AnnotationValue> _valueMap = 
+                new HashMap<String,AnnotationValue>();
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptClientField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptClientField.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptClientField.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,47 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.ArrayList;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.FieldDeclaration;
+
+/**
+ * The AptClientField class describes a reference to a client callback notifier within an
+ * AptControlImplementation class.
+ */
+public class AptClientField extends AptField
+{
+    /**
+     * Base constructor, protected so only a custom subclass can invoke
+     * @param controlImpl the declaring AptControlImplementation
+     */
+    public AptClientField(AptControlImplementation controlImpl, FieldDeclaration fieldDecl,
+                          AnnotationProcessorEnvironment env) 
+    {
+        super(fieldDecl);
+        _controlImpl = controlImpl;
+        _fieldDecl = fieldDecl;
+        _env = env;
+    };
+
+    private FieldDeclaration _fieldDecl;
+    private AptControlImplementation _controlImpl;
+    private AnnotationProcessorEnvironment _env;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptContextField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptContextField.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptContextField.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,72 @@
+package org.apache.beehive.controls.runtime.generator;
+
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.ArrayList;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.FieldDeclaration;
+import com.sun.mirror.type.InterfaceType;
+import com.sun.mirror.type.TypeMirror;
+
+/**
+ * The AptContextField class contains information about a field referring to a contextual
+ * service with an AptControlImplementation class.
+ */
+public class AptContextField extends AptEventField
+{
+    /**
+     * Base constructor, protected so only a custom subclass can invoke
+     * @param controlImpl the declaring ControlImplementation
+     */
+    public AptContextField(AptControlImplementation controlImpl, FieldDeclaration fieldDecl, 
+                           AnnotationProcessorEnvironment env) 
+    {
+        super(fieldDecl);
+        _controlImpl = controlImpl;
+        _fieldDecl = fieldDecl;
+        _env = env;
+    };
+
+    /**
+     * Initializes a ControlInterface associated with this context field.  Because
+     * contextual services can expose both APIs and events, they are similar to controls.
+     */
+    protected AptControlInterface initControlInterface()
+    {
+        TypeMirror fieldType = _fieldDecl.getType();        
+        if (! (fieldType instanceof InterfaceType))
+        {
+            _env.getMessager().printError(_fieldDecl.getPosition(),
+                                          "@Context field type must be an interface");
+            return null;
+        }
+
+        //
+        // For contextual services, the declared type of the field is always the public
+        // interface for the contextual service.
+        //
+        return new AptControlInterface(((InterfaceType)_fieldDecl.getType()).getDeclaration(), 
+                                       _env);
+    }
+
+    private FieldDeclaration _fieldDecl;
+    private AptControlImplementation _controlImpl;
+    private AnnotationProcessorEnvironment _env;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,311 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.io.IOException;
+import java.io.Writer;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Filer;
+import com.sun.mirror.declaration.*;
+import com.sun.mirror.type.TypeMirror;
+import com.sun.mirror.type.ClassType;
+
+import org.apache.beehive.controls.api.events.EventHandler;
+
+/**
+ * The AptControlClient class contains metadata about a class that contains nested control
+ * references (AptControlField).
+ */
+public class AptControlClient extends AptType implements Generator
+{
+    /**
+     * Constructs a new ControlClient instance where information is derived
+     * from APT metadata
+     * @param decl the annotated declaration
+     */
+    public AptControlClient(Declaration decl, AnnotationProcessorEnvironment env)
+    {
+        _env = env;
+        if (! (decl instanceof ClassDeclaration))
+        {
+            env.getMessager().printError(decl.getPosition(),
+              "The Control annotation may only be used in a Java class");
+            return;
+        }
+        _clientDecl = (ClassDeclaration)decl;
+        setDeclaration(_clientDecl);
+
+        _controls = initControls();
+        initEventAdaptors();
+
+        //
+        // Construct a new initializer class from this implementation class
+        //
+        _init = new ClientInitializer(this);       
+    }
+
+    /**
+     * Returns the list of ControlFields declared directly by this ControlImpl
+     */
+    public ArrayList<AptControlField> getControls() { return _controls; }
+
+    /**
+     * Returns true if the implemenation class contains any nested controls
+     */
+    public boolean hasControls() { return _controls.size() != 0; }
+
+    /**
+     * Returns true if the control client needs field initialization support
+     */
+    public boolean needsFieldInit()
+    {
+        return hasControls();
+    }
+
+    /**
+     * Returns the field with the specified name
+     */
+    public AptField getField(String name)
+    {
+        for (AptField field : _controls)
+            if (field.getName().equals(name))
+                return field;
+
+        return null;
+    }
+
+    /**
+     * Returns the list of fully qualified class names for types that are derived
+     * from this Generator
+     */
+    public String [] getGeneratedTypes()
+    {
+        return new String [] { _init.getClassName() };
+    }
+
+    /**
+     * Returns the information necessary to generate a ImplInitializer from this
+     * ControlImplementation.
+     */
+    public List<GeneratorOutput> getCheckOutput(Filer filer) throws IOException
+    {
+        return null;
+    }
+
+    /**
+     * Returns the information necessary to generate a ClientInitializer from this control
+     */
+    public List<GeneratorOutput> getGenerateOutput(Filer filer) throws IOException
+    {
+        HashMap<String,Object> map = new HashMap<String,Object>();
+        map.put("client", this);                                // control client
+        map.put("init", _init);                                 // control client initializer
+
+        Writer writer = new IndentingWriter(filer.createSourceFile(_init.getClassName()));
+        GeneratorOutput genOut =
+            new GeneratorOutput(writer,"org/apache/beehive/controls/runtime/generator/ClientInitializer.vm",
+                                map);
+        ArrayList<GeneratorOutput> genList = new ArrayList<GeneratorOutput>(1);
+        genList.add(genOut);
+        return genList;
+    }
+
+    /**
+     * Initializes the list of ControlFields declared directly by this ControlClient
+     */
+    protected ArrayList<AptControlField> initControls()
+    {
+        ArrayList<AptControlField> controls = new ArrayList<AptControlField>();
+
+        if ( _clientDecl == null || _clientDecl.getFields() == null )
+            return controls;
+
+        Collection<FieldDeclaration> declaredFields = _clientDecl.getFields();
+        for (FieldDeclaration fieldDecl : declaredFields)
+        {
+            if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
+                controls.add(new AptControlField(this, fieldDecl, _env));
+        }
+        return controls;
+    }
+
+    protected boolean hasSuperClient()
+    {
+        return ( getSuperClientName() != null );
+    }
+
+    /**
+     * Returns the fully qualified classname of the closest control client in the inheritance chain.
+     * @return
+     */
+    protected String getSuperClientName()
+    {
+        ClassType superType = _clientDecl.getSuperclass();
+        ClassDeclaration superDecl = superType.getDeclaration();
+
+        while ( superType != null )
+        {
+            Collection<FieldDeclaration> declaredFields = superDecl.getFields();
+            for (FieldDeclaration fieldDecl : declaredFields)
+            {
+                if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
+                {
+                    // Found an @control annotated field, so return this class name
+                    return superDecl.getQualifiedName();
+                }
+            }
+
+            superType = superType.getSuperclass();
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns the super class for this class
+     */
+    public AptControlClient getSuperClass() { return null; }
+
+    /**
+     * Initializes the list of EventAdaptors for this ControlImpl
+     */
+    protected void initEventAdaptors()
+    {
+        if ( _clientDecl == null || _clientDecl.getMethods() == null )
+            return;
+        
+        for (MethodDeclaration clientMethod : _clientDecl.getMethods())
+        {
+            //
+            // Do a quick check for the presence of the EventHandler annotation on methods
+            //
+            if (clientMethod.getAnnotation(EventHandler.class) == null)
+                continue;
+
+            //
+            // If found, we must actually read the value using an AnnotationMirror, since it
+            // contains a Class element (eventSet) that cannot be loaded
+            //
+            AnnotationMirror handlerMirror = null;
+            for (AnnotationMirror annot : clientMethod.getAnnotationMirrors())
+            {
+                if ( annot == null ||
+                    annot.getAnnotationType() == null ||
+                    annot.getAnnotationType().getDeclaration() == null ||
+                    annot.getAnnotationType().getDeclaration().getQualifiedName() == null )
+                    return;
+
+                if ( annot.getAnnotationType().getDeclaration().getQualifiedName().equals(
+                        "org.apache.beehive.controls.api.events.EventHandler"))
+                {
+                    handlerMirror = annot;
+                    break;
+                }
+            }
+            if (handlerMirror == null)
+            {
+                throw new CodeGenerationException("Unable to find EventHandler annotation on " +
+                                                  clientMethod);
+            }
+
+            AptAnnotationHelper handlerAnnot = new AptAnnotationHelper(handlerMirror);
+
+            //
+            // Locate the EventField based upon the field element value
+            //
+            String fieldName = (String)handlerAnnot.getObjectValue("field");
+            AptEventField eventField = (AptEventField)getField(fieldName);
+            if (eventField == null)
+            {
+                // Deliberately not issuing a diagnostic if an event handler specifies
+                // a field that isn't a control.  Other annotation processors also
+                // handle event handlers, so delegate diagnostic responsibility to them.
+                continue;
+            }
+
+            //
+            // Locate the EventSet based upon the eventSet element value
+            //
+            TypeMirror tm = (TypeMirror)( handlerAnnot.getObjectValue("eventSet") );
+            if ( tm == null )
+                continue;
+            String setName = tm.toString();
+
+            AptControlInterface controlIntf = eventField.getControlInterface();
+            AptEventSet eventSet = controlIntf.getEventSet(setName);
+            if (eventSet == null)
+            {                
+                _env.getMessager().printError(clientMethod.getPosition(),
+                    "Cannot find EventSet interface: " + setName);
+                continue;
+            }
+
+            //
+            // Register a new EventAdaptor for the EventSet, if none exists already
+            //
+            EventAdaptor adaptor = eventField.getEventAdaptor(eventSet);
+            if (adaptor == null)
+            {
+                adaptor = new EventAdaptor(eventField, eventSet);
+                eventField.addEventAdaptor(eventSet, adaptor);
+            }
+
+            //
+            // Locate the EventSet method based upon the eventName element value.  Once
+            // found, add a new AptEventHandler to the adaptor for this event.
+            //
+            boolean found = false;
+            String eventName = (String)handlerAnnot.getObjectValue("eventName");
+            AptMethod handlerMethod = new AptMethod(clientMethod);
+            for (AptEvent controlEvent : eventSet.getEvents())
+            {
+                if (controlEvent == null || 
+                    controlEvent.getName() == null || 
+                    !controlEvent.getName().equals(eventName))
+                    continue;
+
+                if ( controlEvent.getArgTypes() == null )
+                    continue;
+
+                if (controlEvent.getArgTypes().equals(handlerMethod.getArgTypes()))
+                {
+                    adaptor.addHandler(controlEvent, 
+                                       new AptEventHandler(controlEvent, clientMethod, _env));
+                    found = true;
+                    break;
+                }
+            }
+            if (!found)
+            {
+                _env.getMessager().printError(clientMethod.getPosition(),
+                    "No event method with matching name and signature found on EventSet: " +
+                    setName);
+            }
+        } 
+    }
+
+    ClassDeclaration _clientDecl;
+    AnnotationProcessorEnvironment _env;
+    ArrayList<AptControlField> _controls;
+    ClientInitializer _init;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlField.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlField.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,126 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.FieldDeclaration;
+import com.sun.mirror.declaration.InterfaceDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.type.DeclaredType;
+import com.sun.mirror.type.InterfaceType;
+import com.sun.mirror.type.TypeMirror;
+
+import org.apache.beehive.controls.api.bean.ControlExtension;
+import org.apache.beehive.controls.api.bean.ControlInterface;
+
+/**
+ * The AptControlField class contains information about a field that refers to a nested control.
+ */
+public class AptControlField extends AptEventField
+{
+    /**
+     * Base constructor, protected so only a custom subclass can invoke
+     * @param controlClient the declaring AptType
+     */
+    public AptControlField(AptType controlClient, FieldDeclaration controlDecl,
+                           AnnotationProcessorEnvironment env) 
+    {
+        super( controlDecl );
+        _controlClient = controlClient;
+        _controlDecl = controlDecl;
+        _env = env;
+        _controlBean = new ControlBean(getControlInterface());
+    };
+
+    /**
+     * Initializes the ControlInterface associated with this ControlField
+     */
+    protected AptControlInterface initControlInterface()
+    {
+        TypeMirror controlType = _controlDecl.getType();
+        if (! (controlType instanceof DeclaredType))
+        {
+            _env.getMessager().printError(_controlDecl.getPosition(),
+                "@Control field type must be a valid ControlBean class or control interface");
+            return null;
+        }
+
+        //
+        // The field can either be declared as the bean type or the public interface type.
+        // If it is the bean type, then we need to reflect to find the public interface
+        // type it implements.
+        //
+        TypeDeclaration typeDecl = ((DeclaredType)controlType).getDeclaration();
+
+        if ( typeDecl == null )
+            return null;
+        
+        InterfaceDeclaration controlIntf = null;
+        if (typeDecl instanceof ClassDeclaration)
+        {
+            Collection<InterfaceType> implIntfs = ((ClassDeclaration)typeDecl).getSuperinterfaces();
+            for (InterfaceType intfType : implIntfs)
+            {
+                InterfaceDeclaration intfDecl = intfType.getDeclaration();
+
+                if ( intfDecl == null )
+                    return null;
+                
+                if (intfDecl.getAnnotation(ControlInterface.class) != null||
+                    intfDecl.getAnnotation(ControlExtension.class) != null)
+                {
+                    controlIntf = intfDecl;
+                    break;
+                }
+            }
+
+            if (controlIntf == null)
+            {
+                _env.getMessager().printError(_controlDecl.getPosition(), 
+                                              "Unable to identify control type of field");
+                return null; 
+            }
+        }
+        else if (typeDecl instanceof InterfaceDeclaration)
+        {
+            controlIntf = (InterfaceDeclaration)typeDecl;
+        }
+        else
+        {
+            _env.getMessager().printError(_controlDecl.getPosition(),
+                                          "Control field is not a valid type");
+            return null;
+        }
+
+        return new AptControlInterface(controlIntf, _env);
+    }
+
+    /**
+     * Returns the ControlBean associated with this ControlField
+     */
+    public ControlBean getControlBean() { return _controlBean; }
+
+    private FieldDeclaration _controlDecl;
+    private AnnotationProcessorEnvironment _env;
+    private AptType _controlClient;
+    private ControlBean _controlBean;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,401 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Filer;
+import com.sun.mirror.declaration.AnnotationMirror;
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.Declaration;
+import com.sun.mirror.declaration.FieldDeclaration;
+import com.sun.mirror.declaration.InterfaceDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.type.InterfaceType;
+import com.sun.mirror.type.TypeMirror;
+
+import org.apache.beehive.controls.api.events.Client;
+import org.apache.beehive.controls.api.events.EventHandler;
+
+/**
+ * The AptControlImplementation class provides validation and metadata management when
+ * processing a ControlImplementation class.
+ */
+public class AptControlImplementation extends AptType implements Generator
+{
+    /**
+     * Constructs a new AptControlImplementation instance where information is derived
+     * from APT metadata
+     * @param decl the annotated declaration
+     */
+    public AptControlImplementation(Declaration decl, AnnotationProcessorEnvironment env)
+    {
+        _env = env;
+        if (! (decl instanceof ClassDeclaration))
+        {
+            env.getMessager().printError(decl.getPosition(),
+              "The ControlImplementation annotation may only be used on a Java class");
+            return;
+        }
+        _implDecl = (ClassDeclaration)decl;
+        setDeclaration(_implDecl);
+
+        _superClass = initSuperClass();
+
+        _contexts = initContexts();
+
+        _controls = initControls();
+
+        _clients = initClients();
+
+        initEventAdaptors();
+
+        //
+        // Construct a new initializer class from this implementation class
+        //
+        _init = new ImplInitializer(this);
+
+        if ( getControlInterface() == null )
+        {
+            env.getMessager().printError(decl.getPosition(),
+              "Control implementations must implement a control interface");
+            return;
+        }
+    }
+
+    /**
+     * Initializes the super interface that this ControlImpl extends (or null if a
+     * base class)
+     */
+    private AptControlImplementation initSuperClass()
+    {
+        if ( _implDecl == null || _implDecl.getSuperclass() == null )
+            return null;
+        
+        ClassDeclaration superDecl = _implDecl.getSuperclass().getDeclaration();
+        if (superDecl != null && 
+            superDecl.getAnnotation(org.apache.beehive.controls.api.bean.ControlImplementation.class) != null)
+        { 
+            return new AptControlImplementation(superDecl, _env);
+        }
+        
+        return null; 
+    }
+
+    /**
+     * Returns the super interface for this interface
+     */
+    public AptControlImplementation getSuperClass() { return _superClass; }
+
+    /**
+     * Initializes the list of ContextField declared directly by this ControlImpl
+     */
+    private ArrayList<AptContextField> initContexts()
+    {
+        ArrayList<AptContextField> contexts = new ArrayList<AptContextField>();
+        
+        if ( _implDecl == null || _implDecl.getFields() == null )
+            return contexts;
+
+        Collection<FieldDeclaration> declaredFields = _implDecl.getFields();
+        for (FieldDeclaration fieldDecl : declaredFields)
+        {
+            if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.context.Context.class) != null)
+                contexts.add(new AptContextField(this, fieldDecl, _env));
+        }
+        return contexts;
+    }
+
+    /**
+     * Returns the list of ContextFields declared directly by this ControlImplementation
+     */
+    public ArrayList<AptContextField> getContexts() { return _contexts; }
+
+    /**
+     * Returns true if the implemenation class contains any nested services
+     */
+    public boolean hasContexts() { return _contexts.size() != 0; }
+
+    /**
+     * Initializes the list of ControlFields for this ControlImpl
+     */
+    private ArrayList<AptControlField> initControls()
+    {
+        ArrayList<AptControlField> fields = new ArrayList<AptControlField>();
+
+        if ( _implDecl == null || _implDecl.getFields() == null )
+            return fields;
+
+        Collection<FieldDeclaration> declaredFields = _implDecl.getFields();
+        for (FieldDeclaration fieldDecl : declaredFields)
+        {
+            if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
+                fields.add(new AptControlField(this, fieldDecl, _env));
+        }
+        return fields;
+    }
+
+    /**
+     * Returns true if the implemenation class contains any nested controls
+     */
+    public boolean hasControls() { return _controls.size() != 0; }
+
+    /**
+     * Initializes the list of ClientFields declared directly by this ControlImpl
+     */
+    protected ArrayList<AptClientField> initClients()
+    {
+        ArrayList<AptClientField> clients = new ArrayList<AptClientField>();
+        
+        if ( _implDecl == null || _implDecl.getFields() == null )
+            return clients;
+
+        Collection<FieldDeclaration> declaredFields = _implDecl.getFields();
+        for (FieldDeclaration fieldDecl : declaredFields)
+        {
+            if (fieldDecl.getAnnotation(Client.class) != null)
+                clients.add(new AptClientField(this, fieldDecl, _env));
+        }
+        return clients;
+    }
+
+    /**
+     * Returns the list of ClientFields declared directly by this ControlImplementation
+     */
+    public ArrayList<AptClientField> getClients() { return _clients; }
+
+    /**
+     * Returns true if the implemenation class contains any nested event proxies
+     */
+    public boolean hasClients() { return _clients.size() != 0; }
+
+    /**
+     * Returns the field with the specified name
+     */
+    public AptField getField(String name)
+    {
+        for (AptField genField : _contexts)
+            if (genField.getName().equals(name))
+                return genField;
+        for (AptField genField : _clients)
+            if (genField.getName().equals(name))
+                return genField;
+
+        return null;
+    }
+
+    public AptEventField getControlField(String name)
+    {
+        for (AptControlField controlField : _controls)
+            if (controlField.getName().equals(name))
+                return controlField;
+        
+        return null;
+    }
+
+    /**
+     * Returns the list of fully qualified class names for types that are derived
+     * from this Generator
+     */
+    public String [] getGeneratedTypes()
+    {
+        return new String [] { _init.getClassName() };
+    }
+
+    /**
+     * Returns the information necessary to generate a ImplInitializer from this
+     * ControlImplementation.
+     */
+    public List<GeneratorOutput> getCheckOutput(Filer filer) throws IOException
+    {
+        HashMap<String,Object> map = new HashMap<String,Object>();
+        map.put("impl", this);                                  // control implementation
+        map.put("init", _init);                                  // control impl initializer
+
+        Writer writer = new IndentingWriter(filer.createSourceFile(_init.getClassName()));
+        GeneratorOutput genOut = 
+            new GeneratorOutput(writer,"org/apache/beehive/controls/runtime/generator/ImplInitializer.vm",
+                                map);
+        ArrayList<GeneratorOutput> genList = new ArrayList<GeneratorOutput>(1);
+        genList.add(genOut);
+        return genList;
+    }
+
+    /**
+     * Returns the list of generated files derived from this Generator during the
+     * generate phase of annotation processing.
+     */
+    public List<GeneratorOutput> getGenerateOutput(Filer filer) throws IOException
+    {
+        return null;
+    }
+
+    /**
+     * Returns the ControlInterface implemented by this ControlImpl.
+     */
+    public AptControlInterface getControlInterface()
+    {
+        if ( _implDecl == null || _implDecl.getSuperinterfaces() == null )
+            return null;
+        
+        Collection<InterfaceType> superInterfaces = _implDecl.getSuperinterfaces();
+        for (InterfaceType intfType : superInterfaces)
+        {
+            InterfaceDeclaration intfDecl = intfType.getDeclaration();
+            if (intfDecl != null &&
+                intfDecl.getAnnotation(org.apache.beehive.controls.api.bean.ControlInterface.class) != null)
+                return new AptControlInterface(intfDecl, _env);
+        }
+
+        return null;
+    }
+
+    /**
+     * Initializes the list of EventAdaptors for this ControlImpl
+     */
+    protected void initEventAdaptors()
+    {
+        if ( _implDecl == null || _implDecl.getMethods() == null )
+            return;
+        
+        for (MethodDeclaration implMethod : _implDecl.getMethods())
+        {
+            //
+            // Do a quick check for the presence of the EventHandler annotation on methods
+            //
+            if (implMethod.getAnnotation(EventHandler.class) == null)
+                continue;
+
+            //
+            // If found, we must actually read the value using an AnnotationMirror, since it
+            // contains a Class element (eventSet) that cannot be loaded
+            //
+            AnnotationMirror handlerMirror = null;
+            for (AnnotationMirror annot : implMethod.getAnnotationMirrors())
+            {
+                if ( annot == null ||
+                    annot.getAnnotationType() == null ||
+                    annot.getAnnotationType().getDeclaration() == null ||
+                    annot.getAnnotationType().getDeclaration().getQualifiedName() == null )
+                    return;
+
+                if ( annot.getAnnotationType().getDeclaration().getQualifiedName().equals(
+                        "org.apache.beehive.controls.api.events.EventHandler"))
+                {
+                    handlerMirror = annot;
+                    break;
+                }
+            }
+            if (handlerMirror == null)
+            {
+                throw new CodeGenerationException("Unable to find EventHandler annotation on " +
+                                                  implMethod);
+            }
+
+            AptAnnotationHelper handlerAnnot = new AptAnnotationHelper(handlerMirror);
+
+            //
+            // Locate the EventField based upon the field element value
+            //
+            String fieldName = (String)handlerAnnot.getObjectValue("field");
+            AptEventField eventField = (AptEventField)getField(fieldName);
+            if (eventField == null)
+            {
+                // eventField == null means this field isn't interesting for the purposes
+                // of this processor (control impls).  However, only emit an error message
+                // if the field isn't on a nested control
+                if ( getControlField(fieldName) == null )
+                    _env.getMessager().printError(implMethod.getPosition(),
+                        "Cannot find event source field: " + fieldName);
+                continue;
+            }
+
+            //
+            // Locate the EventSet based upon the eventSet element value
+            //
+            TypeMirror tm = (TypeMirror)( handlerAnnot.getObjectValue("eventSet") );
+            if ( tm == null )
+                continue;
+            String setName = tm.toString();
+
+            AptControlInterface controlIntf = eventField.getControlInterface();
+            AptEventSet eventSet = controlIntf.getEventSet(setName);
+            if (eventSet == null)
+            {                
+                _env.getMessager().printError(implMethod.getPosition(),
+                    "Cannot find EventSet interface: " + setName);
+                continue;
+            }
+
+            //
+            // Register a new EventAdaptor for the EventSet, if none exists already
+            //
+            EventAdaptor adaptor = eventField.getEventAdaptor(eventSet);
+            if (adaptor == null)
+            {
+                adaptor = new EventAdaptor(eventField, eventSet);
+                eventField.addEventAdaptor(eventSet, adaptor);
+            }
+
+            //
+            // Locate the EventSet method based upon the eventName element value.  Once
+            // found, add a new AptEventHandler to the adaptor for this event.
+            //
+            boolean found = false;
+            String eventName = (String)handlerAnnot.getObjectValue("eventName");
+            AptMethod handlerMethod = new AptMethod(implMethod);
+            for (AptEvent controlEvent : eventSet.getEvents())
+            {
+                if (controlEvent == null || controlEvent.getName() == null || 
+                    !controlEvent.getName().equals(eventName))
+                    continue;
+                if ( controlEvent.getArgTypes() == null )
+                    continue;
+
+                if (controlEvent.getArgTypes().equals(handlerMethod.getArgTypes()))
+                {
+                    adaptor.addHandler(controlEvent, 
+                                       new AptEventHandler(controlEvent, implMethod, _env));
+                    found = true;
+                    break;
+                }
+            }
+            if (!found)
+            {
+                _env.getMessager().printError(implMethod.getPosition(),
+                    "No event method with matching name and signature found on EventSet: " +
+                    setName);
+            }
+        } 
+    }
+
+    ClassDeclaration _implDecl;
+    AnnotationProcessorEnvironment _env;
+    AptControlImplementation    _superClass;
+    ArrayList<AptContextField>  _contexts;
+    ArrayList<AptClientField>   _clients;
+    ArrayList<AptControlField>  _controls;
+    ImplInitializer _init;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,618 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.lang.annotation.*;
+import java.net.*;
+import java.util.*;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Filer;
+import com.sun.mirror.declaration.AnnotationMirror;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import com.sun.mirror.declaration.Declaration;
+import com.sun.mirror.declaration.InterfaceDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.type.DeclaredType;
+import com.sun.mirror.type.InterfaceType;
+
+import org.apache.beehive.controls.api.bean.ControlChecker;
+import org.apache.beehive.controls.api.bean.ControlExtension;
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.events.EventSet;
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+import org.apache.beehive.controls.api.packaging.ManifestAttribute;
+import org.apache.beehive.controls.api.packaging.ManifestAttributes;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+/*
+ * REVIEW: does it make sense to define AptControlExtension and/or ControlExtension?
+ */
+
+/**
+ * The AptControlInterface provides validation and metadata management for a ControlInterface
+ * or ControlExtension class during APT processing.
+ */
+public class AptControlInterface extends AptType implements Generator
+{
+    /**
+     * Constructs a new AptControlInterface instance where interface information is derived
+     * from an APT interface declaration
+     * @param decl the annotated Declaration
+     * @param env the APT environment
+     */
+    public AptControlInterface(Declaration decl, AnnotationProcessorEnvironment env)
+    {
+        _env = env;
+        if (! (decl instanceof InterfaceDeclaration))
+        {
+            env.getMessager().printError(decl.getPosition(),
+              "The ControlInterface or ControlExtension annotation may only be used on a Java interface");
+            return;
+        }
+
+        _intfDecl = (InterfaceDeclaration)decl;
+        setDeclaration(_intfDecl);
+
+        _superClass = initSuperClass();
+
+        _operations = initOperations();
+
+        _propertySets = initPropertySets();
+
+        _eventSets = initEventSets();
+
+        _featureInfo = initFeatureInfo();
+
+        //
+        // Construct a bean instance for this interface
+        //
+        _bean = new ControlBean(this);
+
+        //
+        // If this is an control extension, run the control-author-specified
+        // checker class to perform additional validation.
+        //
+
+        if (isExtension())
+            check();
+    }
+
+    /**
+     * Initializes the super interface that this ControlInterface extends (or sets it to null
+     * if a base interface)
+     */
+    private AptControlInterface initSuperClass()
+    {
+        //
+        // Look for a super interface that is either a control interface or extension.
+        // If found, return it.
+        //
+        if ( _intfDecl.getSuperinterfaces() == null )
+            return null;
+
+        for (InterfaceType intfType : _intfDecl.getSuperinterfaces())
+        {
+            InterfaceDeclaration superDecl = intfType.getDeclaration();
+            if ( superDecl != null )
+            {
+                if (superDecl.getAnnotation(ControlExtension.class) != null ||
+                    superDecl.getAnnotation(ControlInterface.class) != null)
+                {
+                    _superDecl = superDecl;
+                    return new AptControlInterface(_superDecl, _env);
+                }
+            }
+        }
+
+        // At this point, we're processing the root of the interface heirarchy,
+        // which is not permitted to be a ControlExtension (that would imply a
+        // ControlExtension that wasn't actually extending a ControlInterface).
+        if ( isExtension() )
+        {
+            _env.getMessager().printError(_intfDecl.getPosition(),
+              "Interfaces annotated with ControlExtension must extend an interface annotated with " +
+              "ControlInterface");
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Returns the super interface for this interface
+     */
+    public AptControlInterface getSuperClass() { return _superClass; }
+
+    /**
+     * Initializes the list of operations declared by this AptControlInterface
+     */
+    private AptMethodSet<AptOperation> initOperations()
+    {
+        AptMethodSet<AptOperation> operList = new AptMethodSet<AptOperation>();
+
+        if ( _intfDecl == null )
+            return operList;
+
+        //
+        // Add the methods from the current interface and all super interfaces *other*
+        // than the one from which control inheritance or extension is defined.  These
+        // exceptions are handled on the super ControlInterface (the return value
+        // of AptControlInterface.initSuperClass())
+        //
+        // Do this by:
+        //  - initially populate the check vector with the control interface
+        //  - iterate through the check vector, examining each interface to:
+        //      * ignore the super interface
+        //      * add all declared interface methods to the operations list
+        //      * add any super interfaces to the Vector (avoiding recursion)
+        //  - the iteration continues until all superinterfaces have been processed
+        //
+        Vector<InterfaceDeclaration> checkIntfs = new Vector<InterfaceDeclaration>();
+        checkIntfs.add(_intfDecl);
+
+        for (int i = 0; i < checkIntfs.size(); i++)
+        {
+            InterfaceDeclaration intfDecl = checkIntfs.elementAt(i);
+            if (intfDecl.equals(_superDecl))
+                continue;
+
+            if ( intfDecl.getMethods() == null )
+                continue;
+
+            for (MethodDeclaration methodDecl : intfDecl.getMethods())
+                operList.add(new AptOperation(this, methodDecl, _env));
+
+            if ( intfDecl.getSuperinterfaces() == null )
+                continue;
+
+            for (InterfaceType superType : intfDecl.getSuperinterfaces())
+            {
+                InterfaceDeclaration superDecl = superType.getDeclaration();
+                if (superDecl != null && !checkIntfs.contains(superDecl))
+                    checkIntfs.add(superDecl);
+            }
+        }
+
+        return operList;
+    }
+
+    /**
+     * Returns the list of ControlOperations declared directly by this AptControlInterface
+     */
+    public Collection<AptOperation> getOperations() { return _operations.getMethods(); }
+
+    /**
+     * Initializes the list of PropertySets declared by this AptControlInterface
+     */
+    private ArrayList<AptPropertySet> initPropertySets()
+    {
+        ArrayList<AptPropertySet> propSets = new ArrayList<AptPropertySet>();
+
+        if ( _intfDecl == null || _intfDecl.getNestedTypes() == null )
+            return propSets;
+
+        // TODO: enforce presence of prefixes when multiple property sets w/ the same
+        // property name exist
+
+        for (TypeDeclaration innerDecl : _intfDecl.getNestedTypes())
+        {
+            boolean fError = false;
+
+            // HACKHACK: There appear to be mirror API bugs where calling getAnnotation()
+            // on certain entity types will result in an endless loop.  For now, work around
+            // this by a priori filtering... but this mechanism will drop errors that appear
+            // on an inapropriate type (see check below)
+            if (! (innerDecl instanceof AnnotationTypeDeclaration))
+                continue;
+
+            if (innerDecl.getAnnotation(PropertySet.class) != null)
+            {
+                if (! (innerDecl instanceof AnnotationTypeDeclaration))
+                {
+                    _env.getMessager().printError(innerDecl.getPosition(),
+                        "The PropertySet annotation must be on an Annotation type");
+                    fError = true;
+                }
+
+                Retention ret = innerDecl.getAnnotation(Retention.class);
+                if (ret == null || ret.value() != RetentionPolicy.RUNTIME)
+                {
+                    _env.getMessager().printError(innerDecl.getPosition(),
+                        "The PropertySet annotation must be used in conjuction with @Retention(RetentionPolicy.RUNTIME)");
+                    fError = true;
+                }
+
+                if ( !fError )
+                    propSets.add(
+                        new AptPropertySet(this, (AnnotationTypeDeclaration)innerDecl, _env));
+            }
+        }
+        return propSets;
+    }
+
+    /**
+     * Returns the list of PropertySets declared directly by this AptControlInterface
+     */
+    public ArrayList<AptPropertySet> getPropertySets() { return _propertySets; }
+
+    /**
+     * Returns the total number of properties for this control interface
+     */
+    public int getPropertyCount()
+    {
+        int count = 0;
+        for (AptPropertySet propertySet : _propertySets)
+            for (AptProperty property : propertySet.getProperties())
+                count++;
+        return count;
+    }
+
+    /**
+     * Returns true if the control BeanInfo needs a customized set of PropertyDescriptors
+     * code generated or false if standard introspection via reflection is ok.
+     */
+    public boolean needsCustomPropertyDescriptors()
+    {
+        //
+        // The algorithm here is pretty simple.. if any individual property needs a customized
+        // descriptor, then you have to generate them all.  Reflection-driven introspection is
+        // an all-or-nothing deal as implemented by java.beans.Introspector.
+        //
+        for (AptPropertySet propertySet : _propertySets)
+        {
+            for (AptProperty property : propertySet.getProperties())
+            {
+                if (property.needsCustomPropertyDescriptor())
+                    return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Initializes the list of EventSets declared by this AptControlInterface
+     */
+    private ArrayList<AptEventSet> initEventSets()
+    {
+        ArrayList<AptEventSet> eventSets = new ArrayList<AptEventSet>();
+
+        if ( _intfDecl == null || _intfDecl.getNestedTypes() == null )
+            return eventSets;
+
+        for (TypeDeclaration innerDecl : _intfDecl.getNestedTypes())
+        {
+            // HACKHACK: There appear to be mirror API bugs where calling getAnnotation()
+            // on certain entity types will result in an endless loop.  For now, work around
+            // this by a priori filtering... but this mechanism will drop errors that appear
+            // on an inapropriate type (see check below)
+            if (! (innerDecl instanceof InterfaceDeclaration))
+                continue;
+
+            if (innerDecl.getAnnotation(EventSet.class) != null)
+            {
+
+                if (! (innerDecl instanceof InterfaceDeclaration))
+                {
+                    _env.getMessager().printError(innerDecl.getPosition(),
+                        "The EventSet annotation must be on an interface declaration");
+                }
+                else
+                {
+                    eventSets.add(
+                        new AptEventSet(this, (InterfaceDeclaration)innerDecl, _env));
+                }
+            }
+        }
+        return eventSets;
+    }
+
+    /**
+     * Returns the list of AptEventSet declared directly by this AptControlInterface
+     */
+    public ArrayList<AptEventSet> getEventSets() { return _eventSets; }
+
+    /**
+     * Returns the AptEventSet with the specified name
+     */
+    public AptEventSet getEventSet(String name)
+    {
+        for (AptEventSet eventSet: getEventSets())
+            if (eventSet.getName().equals(name))
+                return eventSet;
+        return null;
+    }
+
+    /**
+     * Returns the FeatureInfo attributes for this control interface
+     */
+    public FeatureInfo getFeatureInfo() { return _featureInfo; }
+
+    /**
+     * Returns the list of fully qualified class names for types that are derived
+     * from this Generator
+     */
+    public String [] getGeneratedTypes()
+    {
+        return new String [] { _bean.getClassName() };
+    }
+
+    /**
+     * Returns the information necessary to generate a ControlBean from this AptControlInterface
+     */
+    public List<GeneratorOutput> getCheckOutput(Filer filer) throws IOException
+    {
+        HashMap<String,Object> map = new HashMap<String,Object>();
+
+        map.put("intf", this);                  // the control interface
+        map.put("bean", _bean);
+
+        ArrayList<GeneratorOutput> genList = new ArrayList();
+
+        //
+        // the ControlBean class
+        //
+        Writer beanWriter = new IndentingWriter(filer.createSourceFile(_bean.getClassName()));
+        GeneratorOutput beanSource = 
+            new GeneratorOutput(beanWriter, 
+                               "org/apache/beehive/controls/runtime/generator/ControlBean.vm", map);
+        genList.add(beanSource);
+
+        //
+        // the ControlBean BeanInfo class
+        //
+        Writer beanInfoWriter = new IndentingWriter(filer.createSourceFile(_bean.getBeanInfoName()));
+        GeneratorOutput beanInfoSource = 
+            new GeneratorOutput(beanInfoWriter, 
+                "org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm", map);
+        genList.add(beanInfoSource);
+
+        return genList;
+    }
+
+    /**
+     * Returns the information necessary to generate a packaging information from this 
+     * AptControlInterface.  Since this information is not needed during type validation,
+     * it can be delated until the generate phase.
+     */
+    public List<GeneratorOutput> getGenerateOutput(Filer filer) throws IOException
+    {
+        HashMap<String,Object> map = new HashMap<String,Object>();
+
+        map.put("intf", this);                  // the control interface
+        map.put("bean", _bean);
+
+        ArrayList<GeneratorOutput> genList = new ArrayList();
+
+        //
+        // the ControlBean MANIFEST.MF section
+        //
+        Writer manifestWriter = filer.createTextFile(Filer.Location.CLASS_TREE, _bean.getPackage(),
+                                          new File(_bean.getShortName() + ".class.manifest"), 
+                                          null);
+        GeneratorOutput beanManifest =
+            new GeneratorOutput(manifestWriter,
+                                "org/apache/beehive/controls/runtime/generator/ControlManifest.vm", 
+                                map);
+        genList.add(beanManifest);
+
+        return genList;
+    }
+
+    /**
+     * Returns true if this interface is a ControlExtension (jcx) interface, false
+     * otherwise.
+     */
+    public boolean isExtension()
+    {
+        if ( _intfDecl == null )
+            return false;
+
+        return _intfDecl.getAnnotation(ControlExtension.class) != null;
+    }
+
+    /**
+     * Returns the most-derived interface in the inheritance chain that is annotated
+     * with @ControlInterface.  It represents the point in the inheritance chain
+     * where @ControlInterface becomes @ControlExtension (i.e., anything interface derived from
+     * the 'most-derived interface' is annotated with @ControlExtension).  May return
+     * null if the inheritance chain is malformed.
+     */
+    public AptControlInterface getMostDerivedInterface()
+    {
+        //
+        // Walk up ControlInterface chain looking for the 1st instance annotated
+        // w/ @ControlInterface (as opposed to @ControlExtension)
+        //
+        // REVIEW: TBD rules for inheritance of @ControlInterface will affect this.
+        // Probably need to keep walking and examine each @ControlInterface in the chain.
+        // Run all checkers in chain?  Make checkers responsible for invoking their base
+        // class-defined checkers?
+        //
+
+        AptControlInterface ancestor = getSuperClass();
+        while (ancestor != null)
+        {
+            if (!ancestor.isExtension())
+                break;
+
+            ancestor = ancestor.getSuperClass();
+        }
+
+        return ancestor;
+    }
+
+    /**
+     * Returns a classloader that can be used to load external classes
+     */
+    public ClassLoader getExternalClassLoader()
+    {
+        Map<String,String> opts = _env.getOptions();
+        String classpath = opts.get("-classpath");
+
+        if ( classpath != null )
+        {
+            String [] cpEntries = classpath.split( File.pathSeparator );
+            ArrayList a = new ArrayList();
+            for ( String e : cpEntries )
+            {
+                try
+                {
+                    File f = (new File(e)).getCanonicalFile();
+                    URL u = f.toURL();
+                    a.add(u);
+                }
+                catch (Exception ex)
+                {
+                    ex.printStackTrace();
+                }
+            }
+            URL [] urls = new URL[a.size()];
+            urls = (URL[]) a.toArray(urls);
+
+            return new URLClassLoader( urls, ControlChecker.class.getClassLoader() );
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns the array of ManifestAttributes associated with the AptControlInterface
+     */
+    public HashMap<String, String> getManifestAttributes()
+    {
+        HashMap<String,String> attributes = new HashMap<String,String>();
+
+        if ( _intfDecl == null )
+            return attributes;
+
+        try
+        {
+            ManifestAttributes annotAttrs =_intfDecl.getAnnotation(ManifestAttributes.class);
+            if (annotAttrs != null)
+            {
+                ManifestAttribute [] attrs = (ManifestAttribute [])annotAttrs.value();
+                for (int i = 0; i < attrs.length; i++)
+                    attributes.put(attrs[i].name(), attrs[i].value());
+            }
+            ManifestAttribute annotAttr =_intfDecl.getAnnotation(ManifestAttribute.class);
+            if (annotAttr != null)
+            {
+                attributes.put(annotAttr.name(), annotAttr.value());
+            }
+            return attributes;
+        }
+        catch (Exception e) { e.printStackTrace(); return attributes; }
+    }
+
+    /**
+     * Returns the FeatureInfo annotation for this control interface, or null if there is none.
+     */
+    public FeatureInfo initFeatureInfo()
+    {
+        if ( _intfDecl == null )
+            return null;
+        return _intfDecl.getAnnotation(FeatureInfo.class);
+    }
+
+    /**
+     * Runs control-specific checker class (if specified)
+     */
+    public void check()
+    {
+        //
+        // Find the nearest @ControlInterface, which is where the relevant control checker
+        // annotation will be found.
+        //
+
+        AptControlInterface mostDerived = (AptControlInterface) getMostDerivedInterface();
+        if ( mostDerived == null )
+            return;
+
+        InterfaceDeclaration intfDecl = mostDerived._intfDecl;
+
+        if ( intfDecl == null )
+            return;
+
+        AnnotationMirror controlMirror = null;
+
+        for (AnnotationMirror annot : intfDecl.getAnnotationMirrors())
+        {
+            if (annot.getAnnotationType().getDeclaration().getQualifiedName().equals(
+                    "org.apache.beehive.controls.api.bean.ControlInterface"))
+            {
+                controlMirror = annot;
+                break;
+            }
+        }
+
+        assert ( controlMirror != null ) : "Found a control interface that isn't annotated properly: " + intfDecl;
+
+        AptAnnotationHelper controlAnnot = new AptAnnotationHelper(controlMirror);
+
+        //
+        // Read the name of the checker class from the @ControlInterface annotation,
+        // dynamically load and run it.
+        //
+
+        DeclaredType checkerMirror = (DeclaredType)controlAnnot.getObjectValue("checkerClass");
+        if ( checkerMirror != null && checkerMirror.getDeclaration() != null )
+        {
+            // TODO: optimize to not invoke default checker?
+            String checkerName = checkerMirror.toString();
+
+            try
+            {
+                ClassLoader loader = getExternalClassLoader();
+
+                Class checkerClass = loader.loadClass( checkerName );
+                if ( !ControlChecker.class.isAssignableFrom(checkerClass) )
+                {
+                    _env.getMessager().printError( intfDecl.getPosition(),
+                            "Control interface " + intfDecl + " specifies a checker class " +
+                            checkerName + " that doesn't implement ControlChecker." );
+                }
+                else
+                {
+
+                    Constructor ctor = checkerClass.getConstructor();
+
+                    ControlChecker checker = (ControlChecker) ctor.newInstance();
+                    checker.check( _intfDecl, _env );
+                }
+            }
+            catch ( Exception e )
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private AptControlInterface    _superClass;
+    AptMethodSet<AptOperation>     _operations;
+    ArrayList<AptPropertySet>      _propertySets;
+    ArrayList<AptEventSet>         _eventSets;
+    ControlBean                    _bean;
+    FeatureInfo                    _featureInfo;
+    InterfaceDeclaration           _intfDecl;
+    InterfaceDeclaration           _superDecl;
+    AnnotationProcessorEnvironment _env;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEvent.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEvent.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEvent.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,77 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.ArrayList;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.MethodDeclaration;
+
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+
+/**
+ * The AptEvent class represents a control Property where the event attributes
+ * are derived using APT metadata
+ */
+public class AptEvent extends AptMethod
+{
+    /**
+     * Constructs a new AptEvent instance from APT metadata
+     * @param eventSet the declaring EventSet
+     * @param eventDecl the event annotation type element declaration
+     * @param env the annotation processing environment
+     */
+    public AptEvent(AptEventSet eventSet, MethodDeclaration eventDecl, 
+                    AnnotationProcessorEnvironment env)
+    {
+        super(eventDecl);
+        _eventSet = eventSet;
+        _eventDecl = eventDecl;
+        _env = env;
+    }
+
+    /**
+     * Returns the name of the static field that holds the name of this method.
+     */
+    public String getMethodField()
+    {
+        //
+        // Both the event set and event name must be used for the generated field to avoid
+        // conflicts between same-named events in different event sets.
+        //
+        StringBuffer sb = new StringBuffer();
+        sb.append("_");
+        sb.append(_eventSet.getShortName());
+        sb.append("_");
+        sb.append(getName());
+        int methodIndex = getIndex();
+        if (methodIndex != -1)
+            sb.append(methodIndex);
+        sb.append("Event");
+        return sb.toString();
+    }
+
+    /**
+     * Returns the EventSet associated with the event
+     */
+    public AptEventSet getEventSet() { return _eventSet; }
+
+    MethodDeclaration _eventDecl;
+    private AptEventSet _eventSet;
+    AnnotationProcessorEnvironment _env;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventField.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventField.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,81 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.Collection;
+import java.util.HashMap;
+
+import com.sun.mirror.declaration.FieldDeclaration;
+
+/**
+ * The AptEventField class represents a field type that is also an event source
+ */
+abstract public class AptEventField extends AptField
+{
+    public AptEventField(FieldDeclaration fieldDecl)
+    {
+        super(fieldDecl);
+    }
+
+    /**
+     * Inits the ControlInterface associated with this event field. The public interface
+     * for controls and contextual services, and their associated events can be modeled in the
+     * same way.  Subclasses will override this to assign an appropriate interface.
+     */
+    abstract protected AptControlInterface initControlInterface();
+
+    /**
+     * Returns the ControlInterface associated with this event field
+     */
+    public AptControlInterface getControlInterface()
+    {
+        if (_controlIntf == null)
+            _controlIntf = initControlInterface();
+        return _controlIntf;
+    }
+
+    /**
+     * Gets the EventAdaptor for a particular EventSet
+     */
+    public EventAdaptor getEventAdaptor(AptEventSet eventSet)
+    {
+        return _eventAdaptors.get(eventSet);
+    }
+
+    /**
+     * Adds a EventAdaptor for a particular EventSet
+     */
+    public void addEventAdaptor(AptEventSet eventSet, EventAdaptor eventAdaptor)
+    {
+        assert !_eventAdaptors.containsKey(eventSet);
+        _eventAdaptors.put(eventSet, eventAdaptor);
+    }
+
+    /**
+     *  Returns all EventAdaptors for this EventField
+     */
+    public Collection<EventAdaptor> getEventAdaptors()
+    {
+        return _eventAdaptors.values();
+    }
+
+    HashMap<AptEventSet, EventAdaptor> _eventAdaptors = 
+        new HashMap<AptEventSet, EventAdaptor>();
+
+    private AptControlInterface _controlIntf;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventHandler.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventHandler.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventHandler.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,58 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.MethodDeclaration;
+
+import org.apache.beehive.controls.runtime.generator.AptEvent;
+
+/**
+ * The AptEventHandler class represents a control EventHandler where the event attributes
+ * are derived using APT metadata
+ */
+public class AptEventHandler extends AptMethod
+{
+    /**
+     * Constructs a new AptEventHandler instance
+     * from APT metadata
+     * @param event the handled ControlEvent
+     * @param handlerDecl the handler method declaration
+     * @param env the annotation processing environment
+     */
+    public AptEventHandler(AptEvent event, MethodDeclaration handlerDecl,
+                           AnnotationProcessorEnvironment env)
+    {
+        super(handlerDecl);
+        _event = event;
+        _handlerDecl = handlerDecl;
+        _env = env;
+    }
+
+    /**
+     * Returns the ControlEvent associated with the ControlEventHandler
+     */
+    public AptEvent getEvent() { return _event; }
+
+    MethodDeclaration _handlerDecl;
+    private AptEvent _event;
+    AnnotationProcessorEnvironment _env;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventSet.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventSet.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptEventSet.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,174 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.InterfaceDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+
+import org.apache.beehive.controls.api.packaging.EventSetInfo;
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+import org.apache.beehive.controls.runtime.generator.AptControlInterface;
+
+import org.apache.beehive.controls.runtime.generator.apt.*;
+
+/**
+ * The AptEventSet class represents a control EventSet where the events
+ * are derived using APT metadata.
+ */
+public class AptEventSet
+{
+    /**
+     * Constructs a new AptEventSet instance from APT metadata
+     * @param controlIntf the declaring control interface
+     * @param eventSet the EventSet class
+     * @param env the associated AnnotationProcessorEnvironment
+     */
+    public AptEventSet(AptControlInterface controlIntf, InterfaceDeclaration eventSet,
+                       AnnotationProcessorEnvironment env)
+    {
+        _controlIntf = controlIntf;
+        _eventSet = eventSet;
+        _env = env;
+
+        _events = initEvents();
+    }
+
+    /**
+     * Initializes the list of Events associated with this EventSet
+     */
+    protected AptMethodSet<AptEvent> initEvents()
+    {
+        AptMethodSet<AptEvent> events = new AptMethodSet<AptEvent>();
+        if ( _eventSet == null || _eventSet.getMethods() == null )
+            return events;
+
+        //
+        // Add all event methods to the event list
+        //
+        for (MethodDeclaration methodDecl : _eventSet.getMethods())
+            events.add(new AptEvent(this, methodDecl, _env));
+
+        return events;
+    }
+
+    /**
+     * Returns the list of Events associated with this EventSet
+     */
+    public Collection<AptEvent> getEvents() { return _events.getMethods(); }
+
+    /**
+     * Returns the fully qualified EventSet name
+     */
+    public String getName()
+    {
+        if ( _eventSet == null )
+            return "";
+        return _eventSet.getQualifiedName();
+    }
+
+    /**
+     * Returns the unqualified class name for this event set
+     */
+    public String getShortName()
+    {
+        String eventSetName = getName();
+        int lastDot = eventSetName.lastIndexOf('.');
+        return eventSetName.substring(lastDot + 1);
+    }
+
+    /**
+     * Returns the programmatic descriptor name to be returned by the EventDescriptor
+     * for the event set.
+     */
+    public String getDescriptorName()
+    {
+        //
+        // The javadocs for java.beans.EventSetDescriptor suggest that the programmatic name
+        // should start w/ a lowercase letter.   So we use the unqualified event set interface
+        // name w/ the first character lowercased.
+        //
+        String name = getShortName();
+        return Character.toLowerCase(name.charAt(0)) + name.substring(1);
+    }
+
+    /**
+     * Returns the name of the generated notifier class for this ControlEventSet
+     */
+    public String getNotifierClass()
+    {
+        return getShortName() + "Notifier";
+    }
+
+    /**
+     * Returns any 'extends' clause that should be placed on the generated notifier class
+     */
+    public String getNotifierExtends()
+    {
+        //
+        // TODO: Add a model for how one event set can extend another
+        // return superClass().getNotifierClass();
+        //
+        return "extends org.apache.beehive.controls.runtime.bean.EventNotifier";
+    }
+
+    /**
+     * Returns the name of the method used to register a new EventSet listener
+     */
+    public String getAddListenerMethod()
+    {
+        return "add" + getShortName() + "Listener";
+    }
+
+    /**
+     * Returns the name of the method used to register a new EventSet listener
+     */
+    public String getRemoveListenerMethod()
+    {
+        return "remove" + getShortName() + "Listener";
+    }
+
+    /**
+     * Returns the FeatureInfo annotation for this event set, or null if there is none.
+     */
+    public FeatureInfo getFeatureInfo()
+    {
+        if ( _eventSet == null )
+            return null;
+        return _eventSet.getAnnotation(FeatureInfo.class);
+    }
+
+    /**
+     * Returns any EventSetInfo associated with the event set (or null if none)
+     */ 
+    public EventSetInfo getEventSetInfo()
+    {
+        if ( _eventSet == null )
+            return null;
+        
+        return _eventSet.getAnnotation(EventSetInfo.class);
+    }
+
+    private AnnotationProcessorEnvironment  _env;
+    private InterfaceDeclaration            _eventSet;
+    private AptControlInterface             _controlIntf;
+    private AptMethodSet<AptEvent>          _events;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptField.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptField.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,89 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+import java.util.Collection;
+
+import com.sun.mirror.declaration.FieldDeclaration;
+import com.sun.mirror.declaration.Modifier;
+
+/**
+ * The AptField class is a helper class that knows how to generate useful information
+ * about a Field using APT metadata
+ */
+public class AptField
+{
+    AptField(FieldDeclaration fieldDecl)
+    {
+        _fieldDecl = fieldDecl;
+    }
+
+    /**
+     * Returns the name of the method
+     */
+    public String getName()
+    {
+        if ( _fieldDecl == null )
+            return "";
+        return _fieldDecl.getSimpleName();
+    }
+
+    /**
+     * Returns a local variable used when setting the field value
+     */
+    public String getLocalName() { return "_" + getName(); }
+
+    /**
+     * Returns the type of the field
+     */
+    public String getType()
+    {
+        if ( _fieldDecl == null || _fieldDecl.getType() == null )
+            return "";
+        
+        return _fieldDecl.getType().toString();
+    }
+
+    /**
+     * Returns the access modifier associated with the field
+     */
+    public String getAccessModifier()
+    {
+        if ( _fieldDecl == null )
+            return "";
+        
+        Collection<Modifier> modifiers = _fieldDecl.getModifiers();
+        if (modifiers.contains(Modifier.PRIVATE))
+            return "private";
+        if (modifiers.contains(Modifier.PROTECTED))
+            return "protected";
+        if (modifiers.contains(Modifier.PUBLIC))
+            return "public";
+
+        return "";
+    }
+
+    /**
+     * Returns the name of a static local field using to refer to this Field
+     */
+    public String getReflectField()
+    {
+        return "_" + getName() + "Field";
+    }
+
+    FieldDeclaration _fieldDecl;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethod.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethod.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethod.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,279 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.declaration.ParameterDeclaration;
+import com.sun.mirror.type.ClassType;
+import com.sun.mirror.type.PrimitiveType;
+import com.sun.mirror.type.ReferenceType;
+import com.sun.mirror.type.TypeMirror;
+
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+
+
+/**
+ * The AptMethod class defines a base set of utility methods for acessing method attributes
+ * based upon an APT method declaration.
+ */ 
+public class AptMethod
+{
+    //
+    // Maps primitive type names to a default value string
+    //
+    private static HashMap<String, String> _defaultReturnValues = new HashMap<String,String>();
+
+    static final HashMap<PrimitiveType.Kind,String> _primToObject = 
+                        new HashMap<PrimitiveType.Kind,String>();
+
+    static
+    {
+        _defaultReturnValues.put("void", ""); 
+        _defaultReturnValues.put("boolean", "false"); 
+        _defaultReturnValues.put("char", "'\0'"); 
+        _defaultReturnValues.put("byte", "0");
+        _defaultReturnValues.put("short", "0");
+        _defaultReturnValues.put("int", "0");
+        _defaultReturnValues.put("long", "0");
+        _defaultReturnValues.put("float", "0.0");
+        _defaultReturnValues.put("double", "0.0");
+
+        _primToObject.put(PrimitiveType.Kind.BOOLEAN, "Boolean");
+        _primToObject.put(PrimitiveType.Kind.BYTE, "Byte");
+        _primToObject.put(PrimitiveType.Kind.CHAR, "Character");
+        _primToObject.put(PrimitiveType.Kind.DOUBLE, "Double");
+        _primToObject.put(PrimitiveType.Kind.FLOAT, "Float");
+        _primToObject.put(PrimitiveType.Kind.INT, "Integer");
+        _primToObject.put(PrimitiveType.Kind.LONG, "Long");
+        _primToObject.put(PrimitiveType.Kind.SHORT, "Short");
+    }
+
+
+    /**
+     * Constructs a new AptMethod instance associated with a specific method declaration
+     */
+    public AptMethod(MethodDeclaration methodDecl)
+    {
+        _methodDecl = methodDecl;
+    }
+
+    /**
+     * Returns the name of the method
+     */
+    public String getName()
+    {
+        if ( _methodDecl == null )
+            return "";
+        
+        return _methodDecl.getSimpleName();
+    }
+
+    /**
+     * Returns the argument declaration of the method
+     */
+    public String getArgDecl()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        if ( _methodDecl.getParameters() == null )
+            return "";
+        
+        int i = 0;
+        for (ParameterDeclaration paramDecl : _methodDecl.getParameters())
+        {
+            if ( paramDecl.getType() == null )
+                return "";
+                
+            if (i != 0)
+                sb.append(", ");
+            
+            sb.append(paramDecl.getType().toString());
+            sb.append(' ');
+
+            // BUGBUG: when the MethodDeclaration is derived from Reflection, this seems
+            // to return 'arg0' for all arguments!
+            String argName = paramDecl.getSimpleName();
+            if (argName.equals("arg0"))
+                sb.append("arg" + i);
+            else
+                sb.append(argName);
+
+            i++;
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Returns the the method argument names, in a comma separated list
+     */
+    public String getArgList(boolean quoteDelimit)
+    {
+        StringBuffer sb = new StringBuffer();
+        int i = 0;
+
+        if ( _methodDecl.getParameters() == null )
+            return "";
+        
+        for (ParameterDeclaration paramDecl : _methodDecl.getParameters())
+        {
+            if (i != 0)
+                sb.append(", ");
+
+            // BUGBUG: when the MethodDeclaration is derived from Reflection, this seems
+            // to return 'arg0' for all arguments!
+            String argName = paramDecl.getSimpleName();
+            if (quoteDelimit) sb.append('"');
+            if (argName.equals("arg0"))
+                sb.append("arg" + i);
+            else
+                sb.append(argName);
+            if (quoteDelimit) sb.append('"');
+            i++;
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Default form of getArgList, that does not quote delimit arguments
+     */
+    public String getArgList() { return getArgList(false); }
+
+    /**
+     * Returns the the method argument classes, in a comma separated list
+     */
+    public String getArgTypes()
+    {
+        StringBuffer sb = new StringBuffer();
+        int i = 0;
+
+        if ( _methodDecl == null || _methodDecl.getParameters() == null )
+            return "";
+        
+        for (ParameterDeclaration paramDecl : _methodDecl.getParameters())
+        {
+            if ( paramDecl.getType() == null )
+                return "";
+            
+            if (i++ != 0)
+                sb.append(", ");
+            sb.append(paramDecl.getType().toString());
+            sb.append(".class");
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Returns the method return type
+     */
+    public String getReturnType()
+    {
+        if ( _methodDecl == null || _methodDecl.getReturnType() == null )
+            return "";
+        
+        return _methodDecl.getReturnType().toString();
+    }
+
+    /**
+     * Returns the throws clause of the operation
+     */
+    public String getThrowsClause()
+    {
+        if ( _methodDecl == null || _methodDecl.getThrownTypes() == null )
+            return "";
+        
+        Collection<ReferenceType> thrownTypes = _methodDecl.getThrownTypes();
+        if (thrownTypes.size() == 0)
+            return "";
+
+        StringBuffer sb = new StringBuffer("throws ");
+        int i = 0;
+        for (ReferenceType exceptType : thrownTypes)
+        {
+            if (i++ != 0)
+                sb.append(", ");
+            sb.append(exceptType.toString());
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Returns an ArrayList of thrown exceptions
+     */
+    public ArrayList getThrowsList()
+    {
+        ArrayList throwsList = new ArrayList();
+
+        if ( _methodDecl == null ||
+             _methodDecl.getThrownTypes() == null ||
+             _methodDecl.getThrownTypes().size() == 0 )
+            return throwsList;
+        
+        Collection<ReferenceType> thrownTypes = _methodDecl.getThrownTypes();
+        for (ReferenceType exceptType : thrownTypes)
+            throwsList.add(exceptType.toString());
+
+        return throwsList;
+    }
+
+    /**
+     * Returns a default return value string for the method, based upon return type
+     */
+    public String getDefaultReturnValue()
+    {
+        String returnType = getReturnType();
+        if (_defaultReturnValues.containsKey(returnType))
+            return _defaultReturnValues.get(returnType);
+        return "null";
+    }
+
+    /**
+     * Returns any FeatureInfo associated with the method (or null if none)
+     */ 
+    public FeatureInfo getFeatureInfo()
+    {
+        if ( _methodDecl == null )
+            return null;
+        
+        return _methodDecl.getAnnotation(FeatureInfo.class);
+    }
+
+    /**
+     *  Sets the unique index value for this method.  If a particular method is overloaded,
+     * then each associated AptMethod will have a unique index;  otherwise, the index is -1.
+     */
+    public void setIndex(int index)
+    {
+        _index = index;
+    }
+
+    /**
+     * Returns the unique index value for this method.
+     */
+    public int getIndex() { return _index; }
+
+    MethodDeclaration _methodDecl;
+    int _index = -1;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethodSet.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethodSet.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethodSet.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,87 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Collection;
+
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.declaration.ParameterDeclaration;
+import com.sun.mirror.type.ClassType;
+import com.sun.mirror.type.PrimitiveType;
+import com.sun.mirror.type.ReferenceType;
+import com.sun.mirror.type.TypeMirror;
+
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+
+
+/**
+ * The AptMethodSet method represents a collection of AptMethod objects.  It contains special
+ * support for method overloading, to ensure that overloaded method objects contained within
+ * the set will each have a unique index value.
+ *
+ * @see org.apache.beehive.controls.runtime.generator.AptMethod#setIndex
+ */ 
+public class AptMethodSet<T extends AptMethod>
+{
+    /**
+     * Adds a new method to the list.  Also detects overloaded methods and ensures that they
+     * will receive a unique index value.
+     */
+    public void add(T method)
+    {
+        // Add to the list of managed methods
+        _methods.add(method);
+
+        // Ensure that all added methods have a unique index
+        Object nameValue = _nameMap.get(method.getName());
+        if (nameValue == null)
+        {
+            // first method with this name, considered unique (for now)
+            _nameMap.put(method.getName(), method);
+        }
+        else
+        {
+            int nextIndex;
+            if (nameValue instanceof AptMethod)
+            {
+                // 2nd method with this name, add index to original and start indexing
+                ((AptMethod)nameValue).setIndex(0);
+                nextIndex = 1;
+            }
+            else
+            {
+                // 3rd (or later) method with this name, continue indexing
+                nextIndex = ((Integer)nameValue).intValue();
+            }
+
+            method.setIndex(nextIndex++);
+            _nameMap.put(method.getName(), nextIndex);
+        }
+    }
+
+    public Collection<T> getMethods()
+    {
+        return _methods;
+    }
+        
+    HashMap _nameMap = new HashMap();   // method name -> a single (unique) AptMethod or next index
+    ArrayList<T> _methods = new ArrayList<T>();
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptOperation.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptOperation.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptOperation.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,73 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.MethodDeclaration;
+
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+
+/**
+ * The AptOperation class represents a control operation where the operation attributes
+ * are derived using APT metadata.
+ */
+public class AptOperation extends AptMethod
+{
+    /**
+     * Constructs a new ControlOperation instance where interface information is derived
+     * from APT metadata
+     * @param controlIntf the declaring ControlInterface
+     * @param operMethod the Method associated with the operation
+     */
+    public AptOperation(AptControlInterface controlIntf, MethodDeclaration methodDecl,
+                        AnnotationProcessorEnvironment env)
+    {
+        super(methodDecl);
+        _controlIntf = controlIntf;
+        _operDecl = methodDecl;
+        _env = env;
+    }
+
+    /**
+     * Returns the name of the static field that holds the name of this method.
+     */
+    public String getMethodField()
+    {
+        StringBuffer sb = new StringBuffer();
+        sb.append("_");
+        sb.append(getName());
+        int methodIndex = getIndex();
+        if (methodIndex != -1)
+            sb.append(methodIndex);
+        sb.append("Method");
+        return sb.toString();
+    }
+
+
+    /**
+     * Returns the AptControlInterface associated with this ControlOperation
+     */
+    public AptControlInterface getControlInterface() { return _controlIntf; }
+
+    MethodDeclaration _operDecl;
+    AnnotationProcessorEnvironment _env;
+    AptControlInterface _controlIntf;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptProperty.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptProperty.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptProperty.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,202 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+import java.util.Collection;
+import java.util.Map;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
+import com.sun.mirror.declaration.AnnotationMirror;
+import com.sun.mirror.declaration.AnnotationValue;
+import com.sun.mirror.type.AnnotationType;
+import com.sun.mirror.type.PrimitiveType;
+
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+import org.apache.beehive.controls.api.packaging.PropertyInfo;
+
+/**
+ * The AptProperty class represents a control Property where the property attributes
+ * are derived using APT metadata
+ */
+public class AptProperty
+{
+    /**
+     * Constructs a new AptProperty instance
+     * from APT metadata
+     * @param propertySet the declaring PropertySet
+     * @param propDecl the declration of the property annotation type element
+     */
+    public AptProperty(AptPropertySet propertySet, AnnotationTypeElementDeclaration propDecl,
+                       AnnotationProcessorEnvironment env)
+    {
+        _propertySet = propertySet;
+        _propDecl = propDecl;
+        _env = env;
+
+        //
+        // Primitive properties must specify a default value, to provide consistent semantics
+        // in cases where no value has been set by annotation, client, or configuration.  Object
+        // typed properties have an optional default, and 'null' in this context means that the
+        // property value has not been set.
+        //
+        if (propDecl.getReturnType() instanceof PrimitiveType &&
+            propDecl.getDefaultValue() == null)
+        {
+            env.getMessager().printError(propDecl.getPosition(),
+                "Primitive property " + propDecl.getSimpleName() + " must specify a default value");
+        }
+    }
+
+    /**
+     * Returns the PropertySet associated with the Property
+     */
+    public AptPropertySet getPropertySet() { return _propertySet; }
+
+    /**
+     * Returns the base property name. The associated accessor methods will have the
+     * form set{name} and get{name}
+     */
+    public String getName()
+    {
+        StringBuffer sb = new StringBuffer();
+        sb.append(_propertySet.getPrefix());
+    
+        String memberName = getMemberName();
+        sb.append(Character.toUpperCase(memberName.charAt(0)));
+        if (memberName.length() > 0)
+            sb.append(memberName.substring(1));
+        return sb.toString();
+    }
+
+    /**
+     * Returns the member name associated with this Property in the PropertySet
+     */
+    public String getMemberName()
+    {
+        if ( _propDecl == null )
+            return "";
+
+        return _propDecl.getSimpleName();
+    }
+
+    /**
+     * Returns the static final field name containing the key for this Property
+     */
+    public String getKeyName()
+    {
+        return getName() + "Key";
+    }
+
+    /**
+     * Returns true if the property needs a custom-generated PropertyDescriptor, false otherwise
+     */
+    public boolean needsCustomPropertyDescriptor()
+    {
+        return getPropertyInfo() != null || getFeatureInfo() != null;
+    }
+
+    /**
+     * Returns the type of the Property
+     */
+    public String getType()
+    {
+        if ( _propDecl == null || _propDecl.getReturnType() == null )
+            return "";
+        
+        return _propDecl.getReturnType().toString();
+    }
+
+    /**
+     * Returns true if the property is an annotation type, false otherwise
+     */
+    public boolean isAnnotation()
+    {
+        if ( _propDecl == null )
+            return false;
+
+        return _propDecl.getReturnType() instanceof AnnotationType;
+    }
+
+    /**
+     * Returns any PropertyInfo associated with the property (or null if none)
+     */ 
+    public PropertyInfo getPropertyInfo()
+    {
+        if ( _propDecl == null )
+            return null;
+        
+        return _propDecl.getAnnotation(PropertyInfo.class);
+    }
+
+    /**
+     * Returns the class name of the property editor class, or null
+     */
+    public String getEditorClass()
+    {
+        PropertyInfo pi = getPropertyInfo();
+        if (pi == null)
+            return null;
+
+        //
+        // This is trickier, because APT doesn't allow access to Class-valued annotations,
+        // because the type may not yet have been compiled.
+        //
+        Collection<AnnotationMirror> annotMirrors = _propDecl.getAnnotationMirrors();
+        for (AnnotationMirror am: annotMirrors)
+        {
+            if (am.getAnnotationType().toString().equals(
+                    "org.apache.beehive.controls.api.packaging.PropertyInfo"))
+            {
+                Map<AnnotationTypeElementDeclaration,AnnotationValue> avs =
+                    am.getElementValues();
+                for (AnnotationTypeElementDeclaration ated: avs.keySet())
+                {
+                    if (ated.toString().equals("editorClass()"))
+                    {
+                        //
+                        // Get the annotation value, and ignore the default value which implies
+                        // no editor class (because 'null' cannot be a default value)
+                        //
+                        String editorClass = avs.get(ated).getValue().toString();
+                        if (editorClass.equals("org.apache.beehive.controls.api.packaging.PropertyInfo.NoEditor.class"))
+                            return null;
+
+                        return editorClass;
+                    }
+                }
+                break;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns any FeatureInfo associated with the property (or null if none)
+     */ 
+    public FeatureInfo getFeatureInfo()
+    {
+        if ( _propDecl == null )
+            return null;
+        
+        return _propDecl.getAnnotation(FeatureInfo.class);
+    }
+
+    AnnotationTypeElementDeclaration _propDecl;
+    private AptPropertySet _propertySet;
+    AnnotationProcessorEnvironment _env;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptPropertySet.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptPropertySet.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptPropertySet.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,121 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+/**
+ * The AptPropertySet class represents a control PropertySet where the property list
+ * is derived using APT metadata
+ */
+public class AptPropertySet
+{
+    /**
+     * Constructs a new AptPropertySet instance from APT metadata
+     * @param controlIntf the declaring bean interface
+     * @param propertySet the PropertySet declaration
+     * @param env the AnnotationProcessorEnvironment
+     */
+    public AptPropertySet(AptControlInterface controlIntf, AnnotationTypeDeclaration propertySet,
+                          AnnotationProcessorEnvironment env)
+    {
+        _controlIntf = controlIntf;
+        _propertySet = propertySet;
+        _env = env;
+        _properties = initProperties();
+    }
+
+    /**
+     * Initializes the list of ControlProperties associated with this ControlPropertySet
+     */
+    protected ArrayList<AptProperty> initProperties()
+    {
+        ArrayList<AptProperty> properties = new ArrayList<AptProperty>();
+
+        if (_propertySet == null || _propertySet.getMethods() == null )
+            return properties;
+        
+        for (MethodDeclaration methodDecl : _propertySet.getMethods())
+            properties.add(new AptProperty(this,(AnnotationTypeElementDeclaration)methodDecl,_env));
+
+        return properties;
+    }
+
+    /**
+     * Returns the list of ControlProperties associated with this ControlPropertySet
+     */
+    public ArrayList<AptProperty> getProperties() { return _properties; }
+
+    /**
+     * Returns the fully qualified package name of this property set
+     */
+    public String getPackage()
+    {
+        if (_propertySet == null || _propertySet.getPackage() == null )
+            return "";
+        
+        return _propertySet.getPackage().getQualifiedName();
+    }
+
+    /**
+     * Returns the unqualified classname of this property set
+     */
+    public String getShortName()
+    {
+        if (_propertySet == null )
+            return "";
+        
+        return _propertySet.getSimpleName();
+    }
+
+    /**
+     * Returns the fully qualified class name of the property set
+     */
+    public String getClassName()
+    {
+        if (_propertySet == null )
+            return "";
+
+        return _propertySet.getQualifiedName();
+    }
+
+    /**
+     * Returns the property name prefix for properties in this PropertySet
+     */
+    public String getPrefix()
+    {
+        if (_propertySet == null || _propertySet.getAnnotation(PropertySet.class) == null )
+            return "";
+        
+        return _propertySet.getAnnotation(PropertySet.class).prefix();
+    }
+
+    private AnnotationTypeDeclaration _propertySet;
+    private AptControlInterface _controlIntf;
+    private ArrayList<AptProperty> _properties;
+    private AnnotationProcessorEnvironment _env;
+}

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptType.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptType.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptType.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,75 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+
+import com.sun.mirror.apt.Filer;
+import com.sun.mirror.declaration.TypeDeclaration;
+
+/**
+ * The AptType abstract class defines a base set of methods that are generally available
+ * for template usage on type declaration objects
+ */
+public class AptType
+{
+    /**
+     * Sets the TypeDeclaration associated with this AptType.
+     */
+    protected void setDeclaration(TypeDeclaration typeDecl)
+    {
+        _typeDecl = typeDecl;
+    }
+
+    /**
+     * Returns the fully qualified classname of this AptType
+     */
+    public String getClassName()
+    {
+        if ( _typeDecl == null)
+            return "";
+
+        return _typeDecl.getQualifiedName();
+    }
+
+    /**
+     * Returns the base package name associated with the AptType
+     */
+    public String getPackage()
+    {
+        if ( _typeDecl == null)
+            return "";
+
+        return _typeDecl.getPackage().getQualifiedName();
+    }
+
+    /**
+     * Returns the unqualified class name associated with the AptType
+     */
+    public String getShortName()
+    {
+        if ( _typeDecl == null )
+            return "";
+        
+        return _typeDecl.getSimpleName();
+    }
+
+    TypeDeclaration _typeDecl;
+}

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientField.java?view=auto&rev=109373
==============================================================================

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.java&r1=109373&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.java	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.java	Wed Dec  1 11:33:41 2004
@@ -25,13 +25,13 @@
  * necessary to initialize a client that uses controls declaratively (via Control and
  * EventHandler annotations).
  */
-public class ClientInitializer extends GenClass
+public class ClientInitializer
 {
     /**
      * Constructs a new ClientInitializer class
      * @param controlClient the control client this initializer will target
      */
-    protected ClientInitializer(ControlClient controlClient)
+    protected ClientInitializer(AptControlClient controlClient)
     {
         super();
 
@@ -47,8 +47,8 @@
         // done unconditionally for all @Control fields (to support PropertyMap initialization)
         //
 
-        _reflectFields = new ArrayList<GenField>();
-        for (GenField genField : _controlClient.getControls())
+        _reflectFields = new ArrayList<AptField>();
+        for (AptField genField : _controlClient.getControls())
             _reflectFields.add(genField);
     }
 
@@ -75,7 +75,7 @@
     /**
      * Returns the ControlBean implementation instance
      */
-    public ControlClient getControlClient() { return _controlClient; }
+    public AptControlClient getControlClient() { return _controlClient; }
 
     public ClientInitializer getSuperClass() { return null; }
 
@@ -83,7 +83,7 @@
      * Returns true if the initializer will use Reflection to initialize the field, false
      * otherwise.
      */
-    static public boolean needsReflection(GenField genField)
+    static public boolean needsReflection(AptField genField)
     {
         //
         // Since initializers are generated into the same package as the initialized class,
@@ -99,7 +99,7 @@
     /**
      * Returns the list of impl class fields that must be initialized using Reflection
      */
-    public ArrayList<GenField> getReflectFields()
+    public ArrayList<AptField> getReflectFields()
     {
         return _reflectFields;
     }
@@ -107,6 +107,6 @@
     String _packageName;
     String _shortName;
     String _className;
-    ControlClient _controlClient;
-    ArrayList<GenField> _reflectFields;
+    AptControlClient _controlClient;
+    ArrayList<AptField> _reflectFields;
 }

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ContextField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ContextField.java?view=auto&rev=109373
==============================================================================

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.java&r1=109373&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.java	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.java	Wed Dec  1 11:33:41 2004
@@ -22,13 +22,13 @@
  * control implementation types associated with a particular control public or extension
  * interface.
  */
-public class ControlBean extends GenClass
+public class ControlBean
 {
     /**
      * Constructs a new ControlBean class supporting a particular bean interface
      * @param controlIntf the public interface associated with the bean
      */
-    protected ControlBean(ControlInterface controlIntf)
+    protected ControlBean(AptControlInterface controlIntf)
     {
         super();
         _controlIntf = controlIntf;
@@ -79,7 +79,7 @@
     /**
      * Returns the public or extension interface associated with the ControlBean
      */
-    public ControlInterface getControlInterface() { return _controlIntf; }
+    public AptControlInterface getControlInterface() { return _controlIntf; }
 
     /**
      * Returns the super class for this ControlBean
@@ -89,6 +89,6 @@
     String _packageName;
     String _shortName;
     String _className;
-    ControlInterface _controlIntf;
+    AptControlInterface _controlIntf;
     ControlBean _superClass;
 }

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm&r1=109373&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm	Wed Dec  1 11:33:41 2004
@@ -25,50 +25,7 @@
 ## The actual class template apears at the end of this file, and is preceded by a number of
 ## supporting macros that define elements of the template.
 ##
-## SUPPORTING MACROS
-##
-## A simple helper macro that converts a primitive type to the equivalent object
-##
-#macro (toObject $type)#if ($type == "int")Integer#elseif ($type == "long")Long#elseif ($type == "boolean")Boolean#elseif ($type == "byte")Byte#elseif ($type == "short")Short#elseif ($type == "char")Character#elseif ($type == "float")Float#elseif ($type == "double")Double#else${type}#end#end
-##
-## A simple helper macro that converts a object type to the equivalent primitive
-##
-## This macro provides the template for declaring the static final Method fields that
-## are associated with all declared operations
-##
-#macro (declareMethodStatics)
-    #foreach ($operation in $intf.operations)
-        static final Method $operation.methodField;
-    #end
-
-    //
-    // This HashMap will map from a Method to the array of names for parameters of the
-    // method.  This is necessary because parameter name data isn't carried along in the
-    // class file, but if available can enable ease of use by referencing parameters by
-    // the declared name (vs. by index).
-    //
-    // This map should be read-only after its initialization in the static block, hence
-    // using a plain HashMap is thread-safe.
-    //
-    static HashMap<Method, String []> _methodParamMap = new HashMap<Method, String []>();
-#end
-##
-## This macros provides the template for initializing the static final Method fields that
-## are associated with declared operations
-##
-#macro (initMethodStatics)
-    try
-    {
-        #foreach ($operation in $intf.operations)
-            $operation.methodField = ${intf.className}.class.getMethod("${operation.name}", new Class [] {$operation.argTypes});
-            _methodParamMap.put($operation.methodField, new String [] { $operation.getArgList(true) });
-        #end
-    }
-    catch (NoSuchMethodException nsme)
-    {
-        throw new ExceptionInInitializerError(nsme);
-    }
-#end
+## LOCAL SUPPORTING MACROS
 ##
 ## This macro declares the template for defining bean constructors
 ##
@@ -82,16 +39,7 @@
      */
     public ${bean.shortName}(ControlBeanContext context, String id, PropertyMap props)
     {
-        super(context, id, props, ${intf.className}.class);
-
-        #foreach ($eventSet in $intf.eventSets)
-        #if ($velocityCount == 1)
-        //
-        // Register event notifier instances for any EventSets
-        //
-        #end
-        setEventNotifier(${eventSet.shortName}.class, new ${eventSet.notifierClass}());
-        #end
+        this(context, id, props, ${intf.className}.class);
     }
 
     /**
@@ -110,6 +58,15 @@
                                 Class controlClass)
     {
         super(context, id, props, controlClass);
+
+        #foreach ($eventSet in $intf.eventSets)
+        #if ($velocityCount == 1)
+        //
+        // Register event notifier instances for any EventSets
+        //
+        #end
+        setEventNotifier(${eventSet.shortName}.class, new ${eventSet.notifierClass}());
+        #end
     }
 
 #end

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm&r1=109373&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm	Wed Dec  1 11:33:41 2004
@@ -53,12 +53,28 @@
 package $bean.package;
 
 import java.beans.BeanDescriptor;
+import java.beans.EventSetDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.MethodDescriptor;
+import java.beans.ParameterDescriptor;
 import java.beans.PropertyDescriptor;
+import java.beans.PropertyEditor;
+import java.lang.reflect.Method;
+import java.util.HashMap;
 
 import org.apache.beehive.controls.api.ControlException;
 
 public class ${bean.shortName}BeanInfo extends java.beans.SimpleBeanInfo
 {
+    #if ($intf.operations.size() != 0)
+    #declareMethodStatics()
+
+    static
+    {
+        #initMethodStatics()
+    }
+    #end
+
     public BeanDescriptor getBeanDescriptor()
     {
         BeanDescriptor bd = new BeanDescriptor(${bean.className}.class);
@@ -75,7 +91,7 @@
     #if ($intf.needsCustomPropertyDescriptors())
     public PropertyDescriptor [] getPropertyDescriptors()
     {
-        PropertyDescriptor [] propDescs = new PropertyDescriptor[$intf.propertyCount];
+        PropertyDescriptor [] propDescriptors = new PropertyDescriptor[$intf.propertyCount];
         int i = 0;
         try
         {
@@ -86,11 +102,14 @@
                     #if ($property.propertyInfo)
                         pd.setBound($property.propertyInfo.bound());
                         pd.setConstrained($property.propertyInfo.constrained());
+                        #if ($property.editorClass)
+                        pd.setPropertyEditorClass(${property.editorClass}.class);
+                        #end
                     #end
                     #if ($property.featureInfo)
-                        #initFeatureDescriptor("pd" $property.featureInfo $property.memberName);
+                        #initFeatureDescriptor("pd" $property.featureInfo $property.memberName)
                     #end
-                    propDescs[i++] = pd;
+                    propDescriptors[i++] = pd;
                 #end
             #end
         }
@@ -98,7 +117,119 @@
         {
             throw new ControlException("Unable to create PropertyDescriptor", ie);
         }
-        return propDescs;
+        return propDescriptors;
+    }
+    #end
+
+    #if ($intf.operations.size() != 0)
+    public MethodDescriptor [] getMethodDescriptors()
+    {
+        MethodDescriptor [] methodDescriptors = new MethodDescriptor[$intf.operations.size()];
+        int i = 0;
+        String [] paramNames;
+        ParameterDescriptor [] paramDescriptors;
+        MethodDescriptor md;
+
+        #foreach ($operation in $intf.operations)
+            //
+            // Declare MethodDescriptor for ${operation.name}(${operation.argList})
+            //
+            paramNames = _methodParamMap.get($operation.methodField);
+            paramDescriptors = new ParameterDescriptor[paramNames.length];
+            for (int j = 0; j < paramNames.length; j++)
+            {
+                paramDescriptors[j] = new ParameterDescriptor();
+                paramDescriptors[j].setName(paramNames[j]);
+                paramDescriptors[j].setDisplayName(paramNames[j]);
+            }
+            md = new MethodDescriptor($operation.methodField, paramDescriptors);
+            #if ($operation.featureInfo)
+                #initFeatureDescriptor("md" $operation.featureInfo $operation.name)
+            #end
+            methodDescriptors[i++] = md;
+
+        #end
+        return methodDescriptors;
+    }
+    #end
+
+    #if ($intf.eventSets.size() != 0)
+    public EventSetDescriptor [] getEventSetDescriptors()
+    {
+        EventSetDescriptor [] eventSetDescriptors = new EventSetDescriptor[$intf.eventSets.size()];
+        int setIndex = 0;
+        int eventIndex = 0;
+        EventSetDescriptor esd;
+        Method addListener, removeListener;
+        Class eventIntf;
+        MethodDescriptor md;
+        String [] paramNames;
+        ParameterDescriptor [] paramDescriptors;
+        MethodDescriptor [] eventDescriptors;
+        #foreach ($eventSet in $intf.eventSets)
+            eventIntf = ${eventSet.name}.class;
+            eventDescriptors = new MethodDescriptor[$eventSet.events.size()];
+
+            //
+            // Find the add/remove listener methods
+            //
+            try
+            {
+                addListener = 
+                    ${bean.className}.class.getDeclaredMethod("$eventSet.addListenerMethod",
+                                                               new Class [] { eventIntf });
+                removeListener = 
+                    ${bean.className}.class.getDeclaredMethod("$eventSet.removeListenerMethod",
+                                                               new Class [] { eventIntf });
+            }
+            catch (NoSuchMethodException nsme)
+            {
+                // This is moderately lame, but there is no checked exception declared for this
+                // method.  This could only happen as a result of a mismatch between bean class
+                // and introspector codegen.
+                throw new ControlException("Unable to locate listener method", nsme);
+            }
+
+            //
+            // Build a method descriptor for each event method
+            //
+            eventIndex = 0;
+            #foreach ($event in $eventSet.events)
+
+                //
+                // Declare MethodDescriptor for ${event.name}(${event.argList})
+                //
+                paramNames = _methodParamMap.get($event.methodField);
+                paramDescriptors = new ParameterDescriptor[paramNames.length];
+                for (int k = 0; k < paramNames.length; k++)
+                {
+                    paramDescriptors[k] = new ParameterDescriptor();
+                    paramDescriptors[k].setName(paramNames[k]);
+                    paramDescriptors[k].setDisplayName(paramNames[k]);
+                }
+                md = new MethodDescriptor($event.methodField, paramDescriptors);
+                #if ($event.featureInfo)
+                    #initFeatureDescriptor("md" $event.featureInfo $event.name)
+                #end
+                eventDescriptors[eventIndex++] = md;
+            #end
+
+            try
+            {
+                esd = new EventSetDescriptor("$eventSet.descriptorName", eventIntf,
+                                              eventDescriptors, addListener, removeListener);
+                #if ($eventSet.featureInfo)
+                    #initFeatureDescriptor("esd" $eventSet.featureInfo $eventSet.descriptorName)
+                #end
+            }
+            catch (IntrospectionException ie)
+            {
+                throw new ControlException("Unable to create EventDescriptor", ie);
+            }
+            eventSetDescriptors[setIndex++] = esd;
+
+        #end
+        return eventSetDescriptors;
     }
     #end
 }

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlClient.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlClient.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlEvent.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlEvent.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlEventHandler.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlEventHandler.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlEventSet.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlEventSet.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlField.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlImpl.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlImpl.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlInterface.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlInterface.java?view=auto&rev=109373
==============================================================================

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,81 @@
+##
+## The Velocity code generation template file containing various method macro utilities
+##
+## Copyright 2004 The Apache Software Foundation.
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+## 
+##     http://www.apache.org/licenses/LICENSE-2.0
+## 
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+## $Header:$
+##
+## The following context variables are used by this template:
+##      $bean - a ControlBean instance that defines the attributes of the bean
+##      $intf - a ControlInterface instance that defines the attributes of the public interface
+##
+## The actual class template apears at the end of this file, and is preceded by a number of
+## supporting macros that define elements of the template.
+##
+## SUPPORTING MACROS
+##
+## A simple helper macro that converts a primitive type to the equivalent object
+##
+#macro (toObject $type)#if ($type == "int")Integer#elseif ($type == "long")Long#elseif ($type == "boolean")Boolean#elseif ($type == "byte")Byte#elseif ($type == "short")Short#elseif ($type == "char")Character#elseif ($type == "float")Float#elseif ($type == "double")Double#else${type}#end#end
+##
+## A simple helper macro that converts a object type to the equivalent primitive
+##
+## This macro provides the template for declaring the static final Method fields that
+## are associated with all declared operations
+##
+#macro (declareMethodStatics)
+    #foreach ($operation in $intf.operations)
+        static final Method $operation.methodField;
+    #end
+    #foreach ($eventSet in $intf.eventSets)
+        #foreach ($event in $eventSet.events)
+            static final Method $event.methodField;
+        #end
+    #end
+
+    //
+    // This HashMap will map from a Method to the array of names for parameters of the
+    // method.  This is necessary because parameter name data isn't carried along in the
+    // class file, but if available can enable ease of use by referencing parameters by
+    // the declared name (vs. by index).
+    //
+    // This map should be read-only after its initialization in the static block, hence
+    // using a plain HashMap is thread-safe.
+    //
+    static HashMap<Method, String []> _methodParamMap = new HashMap<Method, String []>();
+#end
+##
+## This macros provides the template for initializing the static final Method fields that
+## are associated with declared operations
+##
+#macro (initMethodStatics)
+    try
+    {
+        #foreach ($operation in $intf.operations)
+            $operation.methodField = ${intf.className}.class.getMethod("${operation.name}", new Class [] {$operation.argTypes});
+            _methodParamMap.put($operation.methodField, new String [] { $operation.getArgList(true) });
+        #end
+        #foreach ($eventSet in $intf.eventSets)
+            #foreach ($event in $eventSet.events)
+                $event.methodField = ${eventSet.name}.class.getMethod("${event.name}", new Class [] {$event.argTypes});
+                _methodParamMap.put($event.methodField, new String [] { $event.getArgList(true) });
+            #end
+        #end
+    }
+    catch (NoSuchMethodException nsme)
+    {
+        throw new ExceptionInInitializerError(nsme);
+    }
+#end

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlOperation.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlOperation.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlProperty.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlProperty.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlPropertySet.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlPropertySet.java?view=auto&rev=109373
==============================================================================

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/EventAdaptor.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/EventAdaptor.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/EventAdaptor.java&r1=109373&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/EventAdaptor.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/EventAdaptor.java	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/EventAdaptor.java	Wed Dec  1 11:33:41 2004
@@ -28,7 +28,7 @@
     /**
      * Constructs a new EventAdaptor for events declared on an EventSet
      */
-    public EventAdaptor(EventField eventField, ControlEventSet eventSet)
+    public EventAdaptor(AptEventField eventField, AptEventSet eventSet)
     {
         _eventField = eventField;
         _eventSet = eventSet;
@@ -56,12 +56,12 @@
     /**
      * Returns the EventSet associated with this Adaptor
      */
-    public ControlEventSet getEventSet() { return _eventSet; }
+    public AptEventSet getEventSet() { return _eventSet; }
 
     /**
-     * Adds a new EventHandler for a ControlEvent to the EventAdaptor
+     * Adds a new EventHandler for a Event to the EventAdaptor
      */
-    public void addHandler(ControlEvent event, GenMethod eventHandler)
+    public void addHandler(AptEvent event, AptMethod eventHandler)
     {
         assert event.getEventSet() == _eventSet;
         _handlerMap.put(event, eventHandler);
@@ -70,7 +70,7 @@
     /**
      * Returns true if there is an EventHandler for ControlEvent on this EventAdaptor
      */
-    public boolean hasHandler(ControlEvent event)
+    public boolean hasHandler(AptEvent event)
     {
         return _handlerMap.containsKey(event);
     }
@@ -78,13 +78,13 @@
     /**
      * Returns the EventHandler for a ControlEvent on this EventAdaptor
      */
-    public GenMethod getHandler(ControlEvent event)
+    public AptMethod getHandler(AptEvent event)
     {
         return _handlerMap.get(event);
     }
 
     private String _className;
-    private EventField _eventField;
-    private ControlEventSet _eventSet;
-    private HashMap<ControlEvent, GenMethod> _handlerMap = new HashMap<ControlEvent,GenMethod>();
+    private AptEventField _eventField;
+    private AptEventSet _eventSet;
+    private HashMap<AptEvent, AptMethod> _handlerMap = new HashMap<AptEvent,AptMethod>();
 }

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/EventField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/EventField.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/GenField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/GenField.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/GenMethod.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/GenMethod.java?view=auto&rev=109373
==============================================================================

Added: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/Generator.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/Generator.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/Generator.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,53 @@
+package org.apache.beehive.controls.runtime.generator;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+
+import com.sun.mirror.apt.Filer;
+
+/**
+ * The Generator interface will be implemented by APT data types that result in the generation
+ * of new source or text artifacts.
+ * for template usage on class-type objects
+ * <p>
+ * This is done with an abstract class (instead of an interface) so derived abstract classes
+ * can be subclassed from it w/out requiring all of the methods to be declared there.
+ */
+public interface Generator
+{
+    /**
+     * Returns the list of fully qualified class names for types that are derived
+     * from this Generator
+     */
+    public String [] getGeneratedTypes();
+    
+    /**
+     * Returns the list of generated files derived from this Generator during the
+     * check phase of annotation processing.
+     */
+    public List<GeneratorOutput> getCheckOutput(Filer filer) throws IOException;
+
+    /**
+     * Returns the list of generated files derived from this Generator during the
+     * generate phase of annotation processing.
+     */
+    public List<GeneratorOutput> getGenerateOutput(Filer filer) throws IOException;
+}

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.java&r1=109373&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.java	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.java	Wed Dec  1 11:33:41 2004
@@ -23,13 +23,13 @@
  * The ImplInitializer class is a generated class that contains the code necessary to initialize
  * a ControlBean implementation instance.
  */
-public class ImplInitializer extends GenClass
+public class ImplInitializer
 {
     /**
      * Constructs a new ImplInitializer class supporting a particular control bean implementation
      * @param controlImpl the control implementation to be initialized
      */
-    protected ImplInitializer(ControlImpl controlImpl)
+    protected ImplInitializer(AptControlImplementation controlImpl)
     {
         super();
         _controlImpl = controlImpl;
@@ -53,11 +53,11 @@
         //
         // Compute the list of impl fields that will require reflected Fields.
         //
-        _reflectFields = new ArrayList<GenField>();
-        for (GenField genField : _controlImpl.getContexts())
+        _reflectFields = new ArrayList<AptField>();
+        for (AptField genField : _controlImpl.getContexts())
             if (needsReflection(genField))
                 _reflectFields.add(genField);
-        for (GenField genField : _controlImpl.getClients())
+        for (AptField genField : _controlImpl.getClients())
             if (needsReflection(genField))
                 _reflectFields.add(genField);
     }
@@ -88,12 +88,12 @@
     /**
      * Returns the ControlBean implementation instance
      */
-    public ControlImpl getControlImpl() { return _controlImpl; }
+    public AptControlImplementation getControlImplementation() { return _controlImpl; }
 
     /**
      * Returns the public or extension interface associated with the ControlBean implementation
      */
-    public ControlInterface getControlInterface() { return _controlIntf; }
+    public AptControlInterface getControlInterface() { return _controlIntf; }
 
     /**
      * Returns the ImplInitializer super class for this ImplInitializer
@@ -104,7 +104,7 @@
      * Returns true if the initializer will use Reflection to initialize the field, false
      * otherwise.
      */
-    static public boolean needsReflection(GenField genField)
+    static public boolean needsReflection(AptField genField)
     {
         //
         // Since initializers are generated into the same package as the initialized class,
@@ -120,7 +120,7 @@
     /**
      * Returns the list of impl class fields that must be initialized using Reflection
      */
-    public ArrayList<GenField> getReflectFields()
+    public ArrayList<AptField> getReflectFields()
     {
         return _reflectFields;
     }
@@ -128,8 +128,8 @@
     String _packageName;
     String _shortName;
     String _className;
-    ControlImpl _controlImpl;
-    ControlInterface _controlIntf;
+    AptControlImplementation _controlImpl;
+    AptControlInterface _controlIntf;
     ImplInitializer _superClass;
-    ArrayList<GenField> _reflectFields;
+    ArrayList<AptField> _reflectFields;
 }

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/SimpleFiler.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/SimpleFiler.java?view=auto&rev=109373
==============================================================================

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/VelocityGenerator.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/VelocityGenerator.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/VelocityGenerator.java&r1=109373&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/VelocityGenerator.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/VelocityGenerator.java	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/VelocityGenerator.java	Wed Dec  1 11:33:41 2004
@@ -47,6 +47,8 @@
         p.setProperty(VelocityEngine.RESOURCE_LOADER, "class");
         p.setProperty("class." + VelocityEngine.RESOURCE_LOADER + ".class",
                       ClasspathResourceLoader.class.getName());
+        p.setProperty("velocimacro.library", 
+                      "org/apache/beehive/controls/runtime/generator/ControlMacros.vm");
         _ve.init(p);
     }
 

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptAnnotationHelper.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptAnnotationHelper.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptClientField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptClientField.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptContextField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptContextField.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlClient.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlClient.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlField.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlField.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlImplementation.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlImplementation.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptEvent.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptEvent.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptEventHandler.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptEventHandler.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptEventSet.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptEventSet.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptFieldHelper.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptFieldHelper.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptMethodHelper.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptMethodHelper.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptOperation.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptOperation.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptProperty.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptProperty.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptPropertySet.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptPropertySet.java?view=auto&rev=109373
==============================================================================

Deleted: /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptUtils.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptUtils.java?view=auto&rev=109373
==============================================================================

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessor.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessor.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessor.java&r1=109373&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessor.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessor.java	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessor.java	Wed Dec  1 11:33:41 2004
@@ -37,9 +37,11 @@
 import org.apache.beehive.controls.api.bean.ControlImplementation;
 import org.apache.beehive.controls.api.bean.ControlInterface;
 
+import org.apache.beehive.controls.runtime.generator.AptControlImplementation;
+import org.apache.beehive.controls.runtime.generator.AptControlInterface;
 import org.apache.beehive.controls.runtime.generator.CodeGenerationException;
 import org.apache.beehive.controls.runtime.generator.CodeGenerator;
-import org.apache.beehive.controls.runtime.generator.GenClass;
+import org.apache.beehive.controls.runtime.generator.Generator;
 import org.apache.beehive.controls.runtime.generator.GeneratorOutput;
 
 public class ControlAnnotationProcessor extends TwoPhaseAnnotationProcessor
@@ -54,7 +56,7 @@
     public void check(Declaration decl)
     {
         AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment();
-        GenClass genClass = null;
+        Generator genClass = null;
         if (decl.getAnnotation(ControlInterface.class) != null)
         {
             genClass = new AptControlInterface(decl, env);
@@ -92,7 +94,7 @@
     public void generate(Declaration decl)
     {
         AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment();
-        GenClass genClass = null;
+        Generator genClass = null;
         if (decl.getAnnotation(ControlInterface.class) != null)
         {
             genClass = new AptControlInterface(decl, env);
@@ -168,6 +170,6 @@
         return _generator;
     }
 
-    HashMap<Declaration, GenClass> _typeMap = new HashMap<Declaration,GenClass>();
+    HashMap<Declaration, Generator> _typeMap = new HashMap<Declaration,Generator>();
     CodeGenerator _generator;
 }

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java&r1=109373&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java	Wed Dec  1 11:33:41 2004
@@ -28,8 +28,9 @@
 
 import java.util.*;
 
+import org.apache.beehive.controls.runtime.generator.AptControlClient;
 import org.apache.beehive.controls.runtime.generator.CodeGenerationException;
-import org.apache.beehive.controls.runtime.generator.GenClass;
+import org.apache.beehive.controls.runtime.generator.Generator;
 import org.apache.beehive.controls.runtime.generator.GeneratorOutput;
 import org.apache.beehive.controls.runtime.generator.CodeGenerator;
 import org.apache.beehive.controls.runtime.bean.ControlBeanContext;
@@ -147,7 +148,7 @@
             // Emit initializer
 
             AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment();
-            GenClass genClass = new AptControlClient( clientType, env );
+            Generator genClass = new AptControlClient( clientType, env );
 
             if ( genClass != null )
             {

Modified: incubator/beehive/trunk/controls/test/build.xml
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/build.xml?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/test/build.xml&r1=109373&p2=incubator/beehive/trunk/controls/test/build.xml&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/test/build.xml	(original)
+++ incubator/beehive/trunk/controls/test/build.xml	Wed Dec  1 11:33:41 2004
@@ -174,6 +174,7 @@
              necessary because the bean types are needed to compile a public interface -->
         <echo message="** Phase One **"/>
         <apt srcdir="${controls.test.controls}" destdir="${build.beans}" gendir="${build.beansrc}"
+             debug="on"
              classpathref="test.classpath" compileByExtension="true"
              srcExtensions="*.java,*.jcx,*.jcs" >
             <include name="**/composition/InnerControl*"/>
@@ -181,6 +182,7 @@
 
         <echo message="** Phase Two **"/>
         <apt srcdir="${controls.test.controls}" destdir="${build.beans}" gendir="${build.beansrc}"
+             debug="on"
              compileByExtension="true"
              classpathref="test.classpath"
              srcExtensions="*.java,*.jcx,*.jcs" >
@@ -290,6 +292,13 @@
             failonerror="true" >
             <include name="**/*generated/*"/>
         </javac>
+
+        <!-- copy supporting datafiles into the build directory -->
+        <copy todir="${build.tests}">
+            <fileset dir="${controls.test.units}">
+                <include name="**/*beaninfo"/>
+            </fileset>
+        </copy>
 
         <property name="_build.java.tests.ran" value="true"/>
 

Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTest.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTest.java?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTest.java&r1=109373&p2=incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTest.java&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTest.java	(original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTest.java	Wed Dec  1 11:33:41 2004
@@ -6,6 +6,7 @@
 import java.lang.annotation.Target;
 
 import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.events.EventSet;
 import org.apache.beehive.controls.api.packaging.FeatureAttribute;
 import org.apache.beehive.controls.api.packaging.FeatureInfo;
 import org.apache.beehive.controls.api.packaging.PropertyInfo;
@@ -27,15 +28,12 @@
 @ManifestAttribute(name="Attribute1", value="Value1")
 @FeatureInfo(
     name="InfoTest name",
-    displayName="InfoTest display name"
-    /*
+    displayName="InfoTest display name",
     attributes=
     {
         @FeatureAttribute(name="fa1", value="fv1"),
         @FeatureAttribute(name="fa2", value="fv2")
-    }
-    */
-)
+    })
 public interface InfoTest
 {
     @PropertySet
@@ -49,4 +47,24 @@
         public boolean prop2() default false;
     }
 
+    @EventSet
+    public interface TestEvents
+    {
+        @FeatureInfo(name="InfoTest eventMethod1", displayName="InfoTest eventMethod1",
+                     isHidden=true, isExpert=true)
+        public void eventMethod1();
+        public int  eventMethod2(String stringArg);
+    }
+
+    @FeatureInfo(
+        name="infoTestMethod name",
+        displayName="infoTestMethod display name",
+        isHidden=true,
+        isExpert=true,
+        attributes=
+        {
+            @FeatureAttribute(name="methodFA1", value="methodFV2"),
+            @FeatureAttribute(name="methodFA2", value="methodFV2")
+        })
+    public void infoTestMethod(int anIntArg, Class aClassArg);
 }

Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTestImpl.jcs
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTestImpl.jcs?view=diff&rev=109374&p1=incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTestImpl.jcs&r1=109373&p2=incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTestImpl.jcs&r2=109374
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTestImpl.jcs	(original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTestImpl.jcs	Wed Dec  1 11:33:41 2004
@@ -9,5 +9,5 @@
 @ControlImplementation
 public class InfoTestImpl implements InfoTest
 {
-
+    public void infoTestMethod(int anIntArg, Class aClassArg) {}
 }

Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/util/ControlIntrospector.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/util/ControlIntrospector.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/util/ControlIntrospector.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,349 @@
+package org.apache.beehive.controls.test.controls.util;
+
+import java.beans.*;
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * A utility class for introspecting Control beans
+ */
+public class ControlIntrospector
+{
+    Class _beanClass;
+    int _indentLevel = 0;
+    PrintWriter _pw;
+
+    public ControlIntrospector(Class beanClass, OutputStream output)
+    {
+        _beanClass = beanClass;
+        _pw = new PrintWriter(output);
+    }
+
+    private void indent() { _indentLevel++; }
+
+    private void unindent() { _indentLevel--; }
+
+    private void printf(String format, Object ...args)
+    {
+        for(int i = 0; i < _indentLevel; i++)
+            _pw.append("    ");
+        _pw.printf(format, args);
+    }
+
+    private void printElement(String name, String value)
+    {
+        printf("<%s>\n",name);
+        indent();
+        printf("%s\n", value);
+        unindent();
+        printf("</%s>\n",name);
+    }
+
+    /**
+     * Introspects the target class and writes the formatted results from introspection to
+     * the provided output stream
+     */
+    public void introspect(int flags) throws IntrospectionException
+    {
+        int indent = 0;
+        BeanInfo beanInfo = Introspector.getBeanInfo(_beanClass, flags);
+        if (beanInfo == null)
+            throw new IntrospectionException("No BeanInfo for " + _beanClass);
+        introspectBeanInfo(beanInfo);
+
+        _pw.flush();
+    }
+
+    public void introspect() throws IntrospectionException
+    {
+        introspect(Introspector.USE_ALL_BEANINFO);
+    }
+
+    private void introspectBeanInfo(BeanInfo beanInfo)
+    {
+        printf("<bean-info name=\"%s\">\n", beanInfo.getBeanDescriptor().getBeanClass().getName());
+        indent();
+        {
+            introspectBeanDescriptor(beanInfo.getBeanDescriptor());
+
+            MethodDescriptor [] methodDescs = beanInfo.getMethodDescriptors();
+            if (methodDescs != null && methodDescs.length != 0)
+            {
+                printf("<method-descriptors>\n");
+                indent();
+                introspectMethodDescriptors(methodDescs);
+                unindent();
+                printf("</method-descriptors>\n");
+            }
+            else
+                printf("<method-descriptors/>\n");
+
+            PropertyDescriptor [] propDescs = beanInfo.getPropertyDescriptors();
+            if (propDescs != null && propDescs.length != 0)
+            {
+                printf("<property-descriptors default-index=%d>\n", beanInfo.getDefaultPropertyIndex());
+                indent();
+                for (int i = 0; i < propDescs.length; i++)
+                    introspectPropertyDescriptor(propDescs[i], 
+                                                 i == beanInfo.getDefaultPropertyIndex());
+                unindent();
+                printf("</property-descriptors>\n");
+            }
+            else
+                printf("<property-descriptors/>\n");
+
+            EventSetDescriptor [] eventSetDescs = beanInfo.getEventSetDescriptors();
+            if (eventSetDescs != null && eventSetDescs.length != 0)
+            {
+                printf("<event-set-descriptors default-index=%d>\n", 
+                       beanInfo.getDefaultEventIndex());
+                indent();
+                for (int i = 0; i < eventSetDescs.length; i++)
+                    introspectEventSetDescriptor(eventSetDescs[i],
+                                                 i == beanInfo.getDefaultEventIndex());
+                unindent();
+                printf("</event-set-descriptors>\n");
+            }
+            else
+                printf("<event-set-descriptors/>\n");
+
+            BeanInfo [] additionalBeanInfo = beanInfo.getAdditionalBeanInfo();
+            if (additionalBeanInfo != null && additionalBeanInfo.length != 0)
+            {
+                printf("<additional-bean-info>\n");
+                indent();
+                {
+                    for (int i = 0; i < additionalBeanInfo.length; i++)
+                        introspectBeanInfo(additionalBeanInfo[i]);
+                }
+                unindent();
+                printf("</additional-bean-info>\n");
+            }
+            else
+                printf("<additional-bean-info/>\n");
+        }
+        unindent();
+        printf("</bean-info>");
+    }
+
+    private void introspectBeanDescriptor(BeanDescriptor beanDesc)
+    {
+        printf("<bean-descriptor name=\"%s\">\n", beanDesc.getDisplayName());
+        indent();
+        {
+            introspectFeatureDescriptor(beanDesc);;
+            printElement("bean-class", beanDesc.getBeanClass().getName());
+            Class customizerClass = beanDesc.getCustomizerClass();
+            if (customizerClass != null)
+                printElement("customizer-class", customizerClass.getName());
+        }
+        unindent();
+        printf("</bean-descriptor>\n");
+    }
+
+    private void introspectFeatureDescriptor(FeatureDescriptor featureDesc)
+    {
+        printf("<feature-descriptor name=\"%s\"\n", featureDesc.getDisplayName());
+        indent();
+        {
+            printf("full-name=\"%s\"\n", featureDesc.getName());
+            printf("is-expert=%b\n", featureDesc.isExpert()); 
+            printf("is-hidden=%b\n", featureDesc.isHidden()); 
+            printf("is-preferred=%b>\n", featureDesc.isPreferred()); 
+
+            printElement("short-description", featureDesc.getShortDescription()); 
+
+            Enumeration<String> attrNames = featureDesc.attributeNames(); 
+            if (attrNames != null && attrNames.hasMoreElements()) 
+            { 
+                SortedSet<String> sortedNames = new TreeSet<String>(); 
+                while (attrNames.hasMoreElements()) 
+                    sortedNames.add(attrNames.nextElement()); 
+                printf("<attributes>"); 
+                indent(); 
+                { 
+                    for (String attrName: sortedNames) 
+                    { 
+                        printf("<attribute name=\"%s\" value=\"%s\">\n", 
+                               attrName, featureDesc.getValue(attrName.toString())); 
+                    } 
+                } 
+                unindent(); 
+                printf("</attributes>"); 
+            } 
+        } 
+        unindent(); 
+        printf("</feature-descriptor>\n", featureDesc.getDisplayName());
+    } 
+
+    /** * Provides a predictable ordering of method descriptors, based upon the underlying 
+     * java.lang.reflect.Method attributes.  Uses the following tests: 
+     *  - compare method names.  If equal, then: 
+     *  - compare parameter list lengths.  If equals, then: 
+     *  - compare parameter type names, in order, until they are unequal 
+     */ 
+    static private class MethodDescriptorComparator implements Comparator<MethodDescriptor> 
+    { 
+        public int compare(MethodDescriptor md1, MethodDescriptor md2) 
+        { 
+            Method m1 = md1.getMethod(); 
+            Method m2 = md2.getMethod(); 
+            int retval = m1.getName().compareTo(m2.getName()); 
+            if (retval == 0) 
+            { 
+                Class [] parms1 = m1.getParameterTypes();
+                Class [] parms2 = m1.getParameterTypes(); 
+                if (parms1.length < parms2.length) 
+                    retval = -1; 
+                else if (parms1.length > parms2.length) 
+                    retval = 1; 
+                else 
+                { 
+                    for (int i = 0; i < parms1.length; i++)
+                    {
+                        retval = parms1[i].getName().compareTo(parms2[i].getName());
+                        if (retval != 0)
+                            break;
+                    }
+                }
+            }
+            return retval;
+        }
+
+        public boolean equals(Object o)
+        {
+            return o != null && o instanceof MethodDescriptorComparator;
+        }
+    }
+
+    /** Sorts an input array of MethodDescriptors */
+    private Set<MethodDescriptor> sortMethodDescriptors(MethodDescriptor [] methodDescs)
+    {
+        Set<MethodDescriptor> sortedMethodDescs = 
+            new TreeSet<MethodDescriptor>(new MethodDescriptorComparator());
+        for (int i = 0; i < methodDescs.length; i++)
+            sortedMethodDescs.add(methodDescs[i]);
+        return sortedMethodDescs;
+    }
+
+    private void introspectMethodDescriptors(MethodDescriptor [] methodDescs)
+    {
+        Set<MethodDescriptor> sortedMethodDescs = sortMethodDescriptors(methodDescs);
+        for (MethodDescriptor methodDesc: sortedMethodDescs)
+            introspectMethodDescriptor(methodDesc);
+    }
+
+    private void introspectMethodDescriptor(MethodDescriptor methodDesc)
+    {
+        printf("<method-descriptor name=\"%s\"\n", methodDesc.getDisplayName());
+        indent();
+        {
+            printElement("method", methodDesc.getMethod().toGenericString());
+            ParameterDescriptor [] paramDescs = methodDesc.getParameterDescriptors();
+            if (paramDescs != null && paramDescs.length != 0)
+            {
+                printf("<parameter-descriptors>\n");
+                indent();
+                for (int i = 0; i < paramDescs.length; i++)
+                    introspectParameterDescriptor(paramDescs[i]);
+                unindent();
+                printf("</parameter-descriptors>\n");
+            }
+            else
+                printf("<param-descriptors/>\n");
+            introspectFeatureDescriptor(methodDesc);
+        }
+        unindent();
+        printf("</method-descriptor>\n");
+    }
+
+    private void introspectParameterDescriptor(ParameterDescriptor paramDesc)
+    {
+        printf("<parameter-descriptor name=\"%s\">\n", paramDesc.getDisplayName());
+        indent();
+        introspectFeatureDescriptor(paramDesc);
+        unindent();
+        printf("</parameter-descriptor>\n", paramDesc.getDisplayName());
+    }
+
+    private void introspectPropertyDescriptor(PropertyDescriptor propDesc, boolean isDefault)
+    {
+        printf("<property-descriptor name=\"%s\">\n", propDesc.getDisplayName());
+        indent();
+        {
+            printf("type=\"%s\"\n", propDesc.getPropertyType().getName());
+            printf("isBound=%b\n", propDesc.isBound());
+            printf("isConstrained=%b\n", propDesc.isConstrained());
+            printf("isDefault=%b>\n", isDefault);
+
+            Method readMethod = propDesc.getReadMethod();
+            if (readMethod != null)
+                printElement("read-method", readMethod.toGenericString());
+
+            Method writeMethod = propDesc.getWriteMethod();
+            if (writeMethod != null)
+                printElement("write-method", writeMethod.toGenericString());
+
+            Class propertyEditorClass = propDesc.getPropertyEditorClass();
+            if (propertyEditorClass != null)
+                printElement("property-editor-class", propertyEditorClass.getName());
+            introspectFeatureDescriptor(propDesc);
+        }
+        unindent();
+        printf("</property-descriptor>\n", propDesc.getDisplayName());
+    }
+
+    private void introspectEventSetDescriptor(EventSetDescriptor eventDesc, boolean isDefault)
+    {
+        printf("<event-descriptor name=\"%s\"\n", eventDesc.getDisplayName());
+        indent();
+        {
+            printf("is-unicast=%b\n", eventDesc.isUnicast());
+            printf("is-in-default=%b\n", eventDesc.isInDefaultEventSet());
+            printf("is-default=%b>\n", isDefault);
+            printElement("listener-type", eventDesc.getListenerType().getName());
+
+            Method meth = eventDesc.getAddListenerMethod();
+            if (meth != null)
+                printElement("add-listener-method", meth.toGenericString());
+
+            meth = eventDesc.getRemoveListenerMethod();
+            if (meth != null)
+                printElement("remove-listener-method", meth.toGenericString());
+
+            meth = eventDesc.getGetListenerMethod();
+            if (meth != null)
+                printElement("get-listener-method", meth.toGenericString());
+
+            MethodDescriptor [] methodDescs = eventDesc.getListenerMethodDescriptors();
+            if (methodDescs != null && methodDescs.length != 0)
+            {
+                printf("<listener-method-descriptors>\n");
+                indent();
+                introspectMethodDescriptors(methodDescs);
+                unindent();
+                printf("</listener-method-descriptors>\n");
+            }
+            else
+            {
+                printf("<listener-method-descriptors/>\n");
+            }
+            introspectFeatureDescriptor(eventDesc);
+        }
+        unindent();
+    }
+
+    static public void main(String [] args) throws Exception
+    {
+        if (args.length < 1)
+            System.err.println("Usage: java org.apache.beehive.controls.test.controls.util.ControlIntrospector [beanClass] ...");
+
+        for (int i = 0; i < args.length; i++)
+        {
+            Class beanClass = Class.forName(args[i]);
+            ControlIntrospector ci = new ControlIntrospector(beanClass, System.out);
+            ci.introspect();
+        }
+    }
+}

Added: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/beaninfo/BeanInfoTest.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/beaninfo/BeanInfoTest.java?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/beaninfo/BeanInfoTest.java	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,59 @@
+package org.apache.beehive.controls.test.java.beaninfo;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
+
+import java.io.*;
+
+import org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean;
+import org.apache.beehive.controls.test.controls.util.ControlIntrospector;
+
+/**
+ * A TestCase that tests generated BeanInfo
+ *
+ * TO GET LIVE BEANINFO DATA, EXECUTE THE FOLLOWING FROM THE CONTROLS/TEST DIR:
+ * java -classpath build/classes/beans:../build/jars/controls.jar org.apache.beehive.controls.test.controls.util.ControlIntrospector org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean
+ */
+@Freq("checkin")
+public class BeanInfoTest extends TestCase
+{
+    public BeanInfoTest(String s) { super(s); }
+
+    public void setUp() { }
+
+    /**
+     * Tests basic Context events for Controls
+     */
+    public void testBeanInfo() throws Exception
+    {  
+
+        StringWriter sw = new StringWriter();
+        File tempFile = File.createTempFile("InfoTestBean", ".beaninfo");
+        FileOutputStream fos = new FileOutputStream(tempFile);
+        ControlIntrospector ci = new ControlIntrospector(InfoTestBean.class, fos);
+        ci.introspect();
+        fos.close();
+
+        InputStream valid = 
+            this.getClass().getClassLoader().getResourceAsStream(
+                "org/apache/beehive/controls/test/java/beaninfo/InfoTestBean.beaninfo");
+        if (valid == null)
+            fail("Could not locate valid beaninfo file");
+
+        InputStream current = new FileInputStream(tempFile);
+        int validVal, currentVal;
+        do
+        {
+            validVal = valid.read();
+            currentVal = current.read();
+            if (validVal != currentVal)
+                fail("BeanInfo data in " + tempFile.getName() + " differs from valid file");
+        }
+        while (validVal != -1);
+
+        // Pass, so remove the temporary output file
+        tempFile.delete();
+    }
+}

Added: incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/beaninfo/InfoTestBean.beaninfo
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/beaninfo/InfoTestBean.beaninfo?view=auto&rev=109374
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/beaninfo/InfoTestBean.beaninfo	Wed Dec  1 11:33:41 2004
@@ -0,0 +1,169 @@
+<bean-info name="org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean">
+    <bean-descriptor name="InfoTest display name">
+        <feature-descriptor name="InfoTest display name"
+            full-name="InfoTest name"
+            is-expert=false
+            is-hidden=false
+            is-preferred=false>
+            <short-description>
+                
+            </short-description>
+        </feature-descriptor>
+        <bean-class>
+            org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean
+        </bean-class>
+    </bean-descriptor>
+    <method-descriptors>
+        <method-descriptor name="infoTestMethod display name"
+            <method>
+                public abstract void org.apache.beehive.controls.test.controls.beaninfo.InfoTest.infoTestMethod(int,java.lang.Class)
+            </method>
+            <parameter-descriptors>
+                <parameter-descriptor name="anIntArg">
+                    <feature-descriptor name="anIntArg"
+                        full-name="anIntArg"
+                        is-expert=false
+                        is-hidden=false
+                        is-preferred=false>
+                        <short-description>
+                            anIntArg
+                        </short-description>
+                    </feature-descriptor>
+                </parameter-descriptor>
+                <parameter-descriptor name="aClassArg">
+                    <feature-descriptor name="aClassArg"
+                        full-name="aClassArg"
+                        is-expert=false
+                        is-hidden=false
+                        is-preferred=false>
+                        <short-description>
+                            aClassArg
+                        </short-description>
+                    </feature-descriptor>
+                </parameter-descriptor>
+            </parameter-descriptors>
+            <feature-descriptor name="infoTestMethod display name"
+                full-name="infoTestMethod name"
+                is-expert=true
+                is-hidden=true
+                is-preferred=false>
+                <short-description>
+                    
+                </short-description>
+            </feature-descriptor>
+        </method-descriptor>
+    </method-descriptors>
+    <property-descriptors default-index=-1>
+        <property-descriptor name="InfoTest prop1">
+            type="int"
+            isBound=true
+            isConstrained=false
+            isDefault=false>
+            <read-method>
+                public int org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean.getProp1()
+            </read-method>
+            <write-method>
+                public void org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean.setProp1(int)
+            </write-method>
+            <feature-descriptor name="InfoTest prop1"
+                full-name="InfoTest prop1"
+                is-expert=false
+                is-hidden=false
+                is-preferred=false>
+                <short-description>
+                    
+                </short-description>
+            </feature-descriptor>
+        </property-descriptor>
+        <property-descriptor name="prop2">
+            type="boolean"
+            isBound=false
+            isConstrained=false
+            isDefault=false>
+            <read-method>
+                public boolean org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean.isProp2()
+            </read-method>
+            <write-method>
+                public void org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean.setProp2(boolean)
+            </write-method>
+            <feature-descriptor name="prop2"
+                full-name="prop2"
+                is-expert=false
+                is-hidden=false
+                is-preferred=false>
+                <short-description>
+                    prop2
+                </short-description>
+            </feature-descriptor>
+        </property-descriptor>
+    </property-descriptors>
+    <event-set-descriptors default-index=-1>
+        <event-descriptor name="testEvents"
+            is-unicast=false
+            is-in-default=true
+            is-default=false>
+            <listener-type>
+                org.apache.beehive.controls.test.controls.beaninfo.InfoTest$TestEvents
+            </listener-type>
+            <add-listener-method>
+                public synchronized void org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean.addTestEventsListener(org.apache.beehive.controls.test.controls.beaninfo.InfoTest$TestEvents) throws java.util.TooManyListenersException
+            </add-listener-method>
+            <remove-listener-method>
+                public synchronized void org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean.removeTestEventsListener(org.apache.beehive.controls.test.controls.beaninfo.InfoTest$TestEvents)
+            </remove-listener-method>
+            <listener-method-descriptors>
+                <method-descriptor name="InfoTest eventMethod1"
+                    <method>
+                        public abstract void org.apache.beehive.controls.test.controls.beaninfo.InfoTest$TestEvents.eventMethod1()
+                    </method>
+                    <param-descriptors/>
+                    <feature-descriptor name="InfoTest eventMethod1"
+                        full-name="InfoTest eventMethod1"
+                        is-expert=true
+                        is-hidden=true
+                        is-preferred=false>
+                        <short-description>
+                            
+                        </short-description>
+                    </feature-descriptor>
+                </method-descriptor>
+                <method-descriptor name="eventMethod2"
+                    <method>
+                        public abstract int org.apache.beehive.controls.test.controls.beaninfo.InfoTest$TestEvents.eventMethod2(java.lang.String)
+                    </method>
+                    <parameter-descriptors>
+                        <parameter-descriptor name="stringArg">
+                            <feature-descriptor name="stringArg"
+                                full-name="stringArg"
+                                is-expert=false
+                                is-hidden=false
+                                is-preferred=false>
+                                <short-description>
+                                    stringArg
+                                </short-description>
+                            </feature-descriptor>
+                        </parameter-descriptor>
+                    </parameter-descriptors>
+                    <feature-descriptor name="eventMethod2"
+                        full-name="eventMethod2"
+                        is-expert=false
+                        is-hidden=false
+                        is-preferred=false>
+                        <short-description>
+                            eventMethod2
+                        </short-description>
+                    </feature-descriptor>
+                </method-descriptor>
+            </listener-method-descriptors>
+            <feature-descriptor name="testEvents"
+                full-name="testEvents"
+                is-expert=false
+                is-hidden=false
+                is-preferred=false>
+                <short-description>
+                    testEvents
+                </short-description>
+            </feature-descriptor>
+    </event-set-descriptors>
+    <additional-bean-info/>
+</bean-info>
\ No newline at end of file