You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ke...@apache.org on 2006/07/13 03:34:07 UTC

svn commit: r421473 [1/6] - in /beehive/sandbox/hornet: ./ controls/ controls/api/ controls/api/src/ controls/api/src/main/ controls/api/src/main/java/ controls/api/src/main/java/org/ controls/api/src/main/java/org/apache/ controls/api/src/main/java/or...

Author: kentam
Date: Wed Jul 12 18:34:03 2006
New Revision: 421473

URL: http://svn.apache.org/viewvc?rev=421473&view=rev
Log:
Initial Hornet prototyping, exploring some ideas relating to modularizing and radically simplifying Beehive controls.


Added:
    beehive/sandbox/hornet/
    beehive/sandbox/hornet/controls/
    beehive/sandbox/hornet/controls/api/
    beehive/sandbox/hornet/controls/api/pom.xml   (with props)
    beehive/sandbox/hornet/controls/api/src/
    beehive/sandbox/hornet/controls/api/src/main/
    beehive/sandbox/hornet/controls/api/src/main/java/
    beehive/sandbox/hornet/controls/api/src/main/java/org/
    beehive/sandbox/hornet/controls/api/src/main/java/org/apache/
    beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/
    beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/
    beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/
    beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ControlException.java   (with props)
    beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/Extensible.java   (with props)
    beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ExtensionFactory.java   (with props)
    beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PName.java   (with props)
    beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySet.java   (with props)
    beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySetReader.java   (with props)
    beehive/sandbox/hornet/controls/pom.xml   (with props)
    beehive/sandbox/hornet/controls/rationale.txt   (with props)
    beehive/sandbox/hornet/controls/runtime/
    beehive/sandbox/hornet/controls/runtime/pom.xml   (with props)
    beehive/sandbox/hornet/controls/runtime/src/
    beehive/sandbox/hornet/controls/runtime/src/main/
    beehive/sandbox/hornet/controls/runtime/src/main/java/
    beehive/sandbox/hornet/controls/runtime/src/main/java/org/
    beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/
    beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/
    beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/
    beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/
    beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/DefaultExtensionFactoryImpl.java   (with props)
    beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/JdkProxyInvocationHandler.java   (with props)
    beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/PropertyMap.java   (with props)
    beehive/sandbox/hornet/controls/runtime/src/test/
    beehive/sandbox/hornet/controls/runtime/src/test/java/
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensibleControlImpl.java   (with props)
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensionControl.java   (with props)
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/InvocationTestCase.java   (with props)
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControl.java   (with props)
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControlImpl.java   (with props)
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesExtension.java   (with props)
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertyMapTestCase.java   (with props)
    beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/SimpleControl.java   (with props)
    beehive/sandbox/hornet/controls/samples/
    beehive/sandbox/hornet/controls/samples/jdbc/
    beehive/sandbox/hornet/controls/samples/jdbc/pom.xml   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultResultSetMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultRowSetResultSetMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultXmlObjectResultSetMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControl.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/ResultSetHashMap.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/ResultSetIterator.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/ResultSetMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/RowMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/RowMapperFactory.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/RowToHashMapMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/RowToMapMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/RowToObjectMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/RowToXmlObjectMapper.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/TypeMappingsFactory.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/JdbcFragment.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/LiteralFragment.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ParameterChecker.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ParseException.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SimpleCharStream.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlFragment.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlFragmentContainer.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlGrammar.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlGrammar.jj   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlGrammarConstants.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlGrammarTokenManager.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlParser.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlSubstitutionFragment.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/Token.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/TokenMgrError.java   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/parser/strings.properties   (with props)
    beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/strings.properties   (with props)
    beehive/sandbox/hornet/controls/samples/pom.xml   (with props)
    beehive/sandbox/hornet/controls/samples/spring/
    beehive/sandbox/hornet/controls/samples/spring/pom.xml   (with props)
    beehive/sandbox/hornet/controls/samples/spring/src/
    beehive/sandbox/hornet/controls/samples/spring/src/test/
    beehive/sandbox/hornet/controls/samples/spring/src/test/java/
    beehive/sandbox/hornet/controls/samples/spring/src/test/java/org/
    beehive/sandbox/hornet/controls/samples/spring/src/test/java/org/apache/
    beehive/sandbox/hornet/controls/samples/spring/src/test/java/org/apache/beehive/
    beehive/sandbox/hornet/controls/samples/spring/src/test/java/org/apache/beehive/controls/
    beehive/sandbox/hornet/controls/samples/spring/src/test/java/org/apache/beehive/controls/samples/
    beehive/sandbox/hornet/controls/samples/spring/src/test/java/org/apache/beehive/controls/samples/spring/

Added: beehive/sandbox/hornet/controls/api/pom.xml
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/api/pom.xml?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/api/pom.xml (added)
+++ beehive/sandbox/hornet/controls/api/pom.xml Wed Jul 12 18:34:03 2006
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *  Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ -->
+<project>
+    <parent>
+        <groupId>org.apache.beehive</groupId>
+        <artifactId>hornet</artifactId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>hornet-api</artifactId>
+    <name>Hornet API</name>
+    <description></description>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>jmock</groupId>
+            <artifactId>jmock</artifactId>
+            <version>1.0.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: beehive/sandbox/hornet/controls/api/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ControlException.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ControlException.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ControlException.java (added)
+++ beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ControlException.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,62 @@
+/*
+ * 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:$
+ */
+package org.apache.beehive.controls.api;
+
+/**
+ * The ControlException class declares an unchecked exception that is thrown by the Controls
+ * runtime under certain failure conditions.
+ */
+public class ControlException extends RuntimeException
+{
+    /**
+     * Default constructor.
+     */
+    public ControlException() {
+        super();
+    }
+
+    /**
+	 * Constructs a ControlException object with the specified String as a message.
+	 *
+	 * @param message The message to use.
+	 */
+    public ControlException(String message)
+    {
+        super(message);
+    }
+
+    /**
+     * Constructs a ControlException with the specified cause.
+     * @param t the cause
+     */
+    public ControlException(Throwable t) {
+        super(t);
+    }
+
+    /**
+	 * Constructs a ControlException object using the specified String as a message, and the
+     * specified Throwable as a nested exception.
+	 *
+	 * @param message The message to use.
+	 * @param t The exception to nest within this exception.
+	 */
+    public ControlException(String message, Throwable t)
+    {
+        super(message + "[" + t + "]", t);
+    }
+}

Propchange: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ControlException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/Extensible.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/Extensible.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/Extensible.java (added)
+++ beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/Extensible.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,44 @@
+/*
+ * 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:$
+ */
+package org.apache.beehive.controls.api;
+
+import java.lang.reflect.Method;
+
+/**
+ * The Extensible interface is implemented by a Java Control implementation class if the
+ * control defines an extensibility model that allows extended operations to be declared
+ * using a JCX interface.
+ * <p>
+ * The interface provides the <code>invoke</code> method, that is called whenever an
+ * extended operation is called by the client at run time.
+ */
+public interface Extensible
+{
+    /**
+     * Called by the Controls runtime to handle calls to methods of an
+     * extensible control.
+     * <p>
+     * @param method The extended operation that was called.
+     * @param args Parameters of the operation.
+     * @return The value that should be returned by the operation.
+     * @throws java.lang.Throwable any exception declared on the extended operation may be
+     * thrown.  If a checked exception is thrown from the implementation that is not declared
+     * on the original interface, it will be wrapped in a ControlException.
+     */
+    public Object invoke(Method method, Object[] args) throws Throwable;
+}

Propchange: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/Extensible.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ExtensionFactory.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ExtensionFactory.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ExtensionFactory.java (added)
+++ beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ExtensionFactory.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,21 @@
+package org.apache.beehive.controls.api;
+
+/**
+ * Implementions are used to create control extension proxy instances.
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public interface ExtensionFactory {
+
+    /**
+     * Creates a control proxy instance for the specified control extension interface, backed by the specified control
+     * implementation instance.
+     *
+     * @param controlInterface The control interface for which a proxy instance is desired.
+     * @param controlImplInstance  Instance of the a class that implements the specified control interface (or any
+     * interface in the specified control interface's ancestor chain).  The caller is expected to have configured the
+     * instance prior to this call (typically via injection).
+     * @return a new control proxy instance
+     */
+    public <T> T createInstance(Class<T> controlInterface, Object controlImplInstance );
+}

Propchange: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/ExtensionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PName.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PName.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PName.java (added)
+++ beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PName.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,17 @@
+package org.apache.beehive.controls.api;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Optional marker annotation used to hold parameter names 
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+@Target({ElementType.PARAMETER})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PName {
+    String value();
+}

Propchange: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PName.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySet.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySet.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySet.java (added)
+++ beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySet.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,98 @@
+/*
+ * 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:$
+ */
+package org.apache.beehive.controls.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The PropertySet annotation type is used to mark an interface that defines a set of
+ * properties that are associated with a Java Control.  By convention, property sets
+ * are declared as an inner annotation types on the Java Control public interface.
+ * <p>
+ * Each member of the annotation type targeted by the <code>PropertySet</code> annotation
+ * will define a new property for the control.
+ * <p>
+ * Here is a simple example:
+ * <code><pre>
+ * public interface MyControl extends org.apache.beehive.controls.api.Control
+ * {
+ *     <sp>@PropertySet
+ *     public @interface MyProperties
+ *     {
+ *         public String aStringProperty();
+ *         public int anIntProperty();
+ *         ...
+       }
+ * }
+ * </pre></code>
+ * <p>
+ * A Java Control can have multiple property sets associated with it.
+ */
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.ANNOTATION_TYPE})
+public @interface PropertySet
+{
+    /**
+     * The prefix member defines a prefix that will be used in all property setter/getter
+     * methods for properties in the <code>PropertySet</code>.  It is necessary to specify
+     * a prefixes when a control interface has multiple property sets that contain
+     * properties with the same name.
+     * <p>
+     * The following code shows the basic conventions for setter/getter methods on a Java
+     * Control Bean:
+     * <code><pre>
+     *     public void set&lt;prefix&gt;&lt;propertyName&gt;(&lt;propertyType&gt; value);
+     *     public &lt;propertyType&gt; get&lt;prefix&gt;&lt;propertyName&gt;();
+     * </pre>/code>
+     * where <code>prefix</code> is the prefix member value, <code>propertyName</code> is
+     * the name of the declared property member, and <code>propertyType</code> is the
+     * type associated with the declared property member.
+     */
+    String prefix() default "";
+
+    /**
+     * The externalConfig member defines whether properties in the set will be settable
+     * via external configuration.
+     */
+    boolean externalConfig() default true;
+
+    /**
+     * The optional member specifies that this property set may optionally be associated
+     * with the control.  Because there is no way to represent an 'unset' property value,
+     * optional properties will not expose a getter method to clients;  a control
+     * implementation class can determine whether a property is/is not set, because the
+     * PropertySet query APIs on ControlBeanContext will return null if unset.  For
+     * properties that are not optional, a PropertySet instance with all default values
+     * will be returned if unset.
+     *
+     * @see org.apache.beehive.controls.api.context.ControlBeanContext#getControlPropertySet
+     * @see org.apache.beehive.controls.api.context.ControlBeanContext#getMethodPropertySet
+     */
+    boolean optional() default false;
+
+    /**
+     * The hasSetters member defines whether properties in the set will have programmatic
+     * setter methods.
+     */
+    boolean hasSetters() default true;
+}
\ No newline at end of file

Propchange: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySetReader.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySetReader.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySetReader.java (added)
+++ beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySetReader.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,86 @@
+package org.apache.beehive.controls.api;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Arrays;
+
+/**
+ * Provides runtime access to PropertySet annotations (typically on methods and parameters).
+ *
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+// TODO: replace naive AnnotatedElement.getAnnotation() impls w/ something that
+// permits sourcing the propertyset from other data.  This will probably involve
+// namespacing JavaBean properties by method signature (or at least name).  See
+// Propertymap.readFromMethod() for some thoughts.
+
+public class PropertySetReader
+{
+    public static <T extends Annotation> T getMethodPropertySet(Method m, Class<T> ac)
+    {
+        return m.getAnnotation(ac);
+    }
+
+    public static <T extends Annotation> T getParameterPropertySet(Method m, int index, Class<T> ac)
+    {
+        Annotation [] paramAnnots = m.getParameterAnnotations()[index];
+        for (Annotation paramAnnot : paramAnnots)
+            if (ac.isAssignableFrom(paramAnnot.getClass()))
+                return (T) paramAnnot;
+
+        return null;
+    }
+
+    /**
+     * Preliminary hack at supporting access to named parameters.  Probably not in the right place given the
+     * name of this class.
+     * @param m
+     */
+    public static String[] getParameterNames(Method m)
+    {
+        Annotation[][] paramAnnotArrays = m.getParameterAnnotations();
+
+        int numParams = paramAnnotArrays.length;
+        String [] paramNames = new String[numParams];
+        int i = 0;
+        for (Annotation[] paramAnnots : paramAnnotArrays )
+        {
+            String paramName = null;
+            for (Annotation paramAnnot : paramAnnots)
+            {
+                if (paramAnnot instanceof PName)
+                    paramName = ((PName)paramAnnot).value();
+            }
+            paramNames[i++] = paramName;
+        }
+
+        return paramNames;
+    }
+
+    public static Object getParameterValue(Method m, String parameterName, Object [] parameters)
+        throws IllegalArgumentException
+    {
+        String [] names = getParameterNames(m);
+
+        // Validate the input parameter array
+        if (parameters.length != names.length)
+            throw new IllegalArgumentException("Expected " + names.length + " parameters," +
+                                               "Found " + parameters.length);
+
+        // Finding the index of the matching parameter name
+        int i = 0;
+        while (i < names.length)
+        {
+            if (names[i].equals(parameterName))
+                break;
+            i++;
+        }
+        if (i == names.length)
+            throw new IllegalArgumentException("No method parameter with name: " + parameterName);
+
+        // Return the parameter value at the matched index
+        return parameters[i];
+    }
+}

Propchange: beehive/sandbox/hornet/controls/api/src/main/java/org/apache/beehive/controls/api/PropertySetReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/pom.xml
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/pom.xml?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/pom.xml (added)
+++ beehive/sandbox/hornet/controls/pom.xml Wed Jul 12 18:34:03 2006
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *  Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.beehive</groupId>
+    <artifactId>hornet</artifactId>
+    <version>0.1-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>Hornet</name>
+    <url></url>
+    <description>Hornet: A lightweight modular evolution of Beehive Controls
+    </description>
+    <inceptionYear>2006</inceptionYear>
+    <organization>
+        <name>Apache Software Foundation</name>
+        <url>http://www.apache.org/</url>
+    </organization>
+
+    <prerequisites>
+        <maven>2.0.4</maven>
+    </prerequisites>
+
+    <licenses>
+        <license>
+            <name>The Apache Software License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+            <distribution>repo</distribution>
+        </license>
+    </licenses>
+
+    <repositories>
+        <repository>
+            <id>ibiblio</id>
+            <name>ibiblio</name>
+            <url>http://www.ibiblio.org/maven2</url>
+        </repository>
+    </repositories>
+
+    <modules>
+        <module>api</module>
+        <module>runtime</module>
+        <module>samples</module>
+    </modules>
+
+    <distributionManagement>
+        <snapshotRepository>
+            <id>maven-snapshot-repository</id>
+            <name>Apache SNAPSHOT Repository</name>
+            <url>scp://cvs.apache.org/www/cvs.apache.org/maven-snapshot-repository</url>
+        </snapshotRepository>
+    </distributionManagement>
+
+    <build>
+        <defaultGoal>install</defaultGoal>
+
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-pmd-plugin</artifactId>
+                    <configuration>
+                        <rulesets>
+                            <ruleset>${basedir}/.ruleset</ruleset>
+                        </rulesets>
+                        <linkXRef>false</linkXRef>
+                        <targetJdk>1.5</targetJdk>
+                    </configuration>
+                    <executions>
+                        <execution>
+                            <id>process-sources</id>
+                            <phase>process-sources</phase>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <configuration>
+                        <source>1.5</source>
+                        <target>1.5</target>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>2.1.3</version>
+                    <configuration>
+                        <includes>
+                            <include>**/*TestCase.java</include>
+                        </includes>
+                        <reportFormat>brief</reportFormat>
+                        <useFile>false</useFile>
+                        <forkMode>once</forkMode>
+                        <argLine>-ea</argLine>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+
+        <testResources>
+            <testResource>
+                <directory>src/test/resources</directory>
+            </testResource>
+        </testResources>
+
+        <extensions>
+            <extension>
+                <groupId>org.apache.maven.wagon</groupId>
+                <artifactId>wagon-ssh-external</artifactId>
+                <version>1.0-alpha-5</version>
+            </extension>
+        </extensions>
+    </build>
+
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/beehive/sandbox/hornet</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/beehive/sandbox/hornet</developerConnection>
+        <url>http://svn.apache.org/viewcvs.cgi/beehive/sandbox/hornet</url>
+    </scm>
+
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <artifactId>maven-javadoc-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <artifactId>maven-jxr-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </reporting>
+
+</project>

Propchange: beehive/sandbox/hornet/controls/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/rationale.txt
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/rationale.txt?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/rationale.txt (added)
+++ beehive/sandbox/hornet/controls/rationale.txt Wed Jul 12 18:34:03 2006
@@ -0,0 +1,54 @@
+Beehive "Hornet"
+
+Guiding Principals
+==================
+
+Features should be as modular and independent as possible; user buy-in can be incremental, you only pay for what you need, etc.
+
+Proposal: Eliminate generated ControlBean construct.  All access is via control interface, implying that all functionality that used to exist only on the controlbean either has to get surfaced to the interface, removed, or exposed via some other mechanism.
+
+Benefits: Significantly reduces the complexity of the controls model by removing an entire conceptual artifact.  Having a generated control bean, understanding why it exists and when to use it vs the control interface has always been confusing for users.  It also complicated integration with other technologies, since the controlbean essentially defined its own container, complete with injection.  Testability is improved; you can mock a control by mocking the control interface without losing surface area, and instantiation/configuration is simplified.
+
+---
+
+Feature: Control instantiation/declaration:
+===========================================
+
+Proposal: Simple control instantiation consists merely of calling the implementation constructor.  Extensible control instantiation consists of constructing a dynamic proxy that implements the control interface and delegates to the control implementation.
+
+Benefits: Simplifies integration into other frameworks; minimal overhead, proxy only when necessary.
+
+---
+
+Feature: Class and instance level properties:
+=============================================
+
+(Currently, such properties were defined via nested annotation definition on the interface, and results in generated accessors on the controlbean (a point of some user confusion))
+
+Proposal: Follow standard JavaBean model for class & instance level properties -- define them via the presence of accessors on the control interface (property name is inferred from the accessor name per standard JavaBean property conventions).
+
+Proposal: For class and instance level properties, @PropertySet annotations are optional and sub-ordinate to accessors for property definition.  @PropertySet naming and prefix must correspond to accessor names rather than the other way around.
+
+Benefits: Developers already understand what JavaBean properties are; rather than force them to think about them in terms of annotations (@PropertySets) in order to define them, this makes it clearer that annotations are just another (optional) way to set properties -- they don't attempt to _define_ properties.  Simplifies integration with other injection frameworks, which get to treat the interface as a 1st class entity (functionality is not hidden).  Annotation overriding is more obvious (just use the setters).  Removes the artifical limitation annotations impose on property types.
+
+Drawbacks: Control authors have to think about potentially keeping accessor methods & PropertySet annotations synchronized.  Tooling is a has a straightforward solution to this, but even in its absence, command-line compilation tools can help greatly.
+
+Proposal: Expand tooling support for enforcing strong property types and constraints on all properties, not just those that are set using annotations (ie, allow @AnnotationConstraints and @AnnotationMemberTypes functionality to generic JavaBean properties by annotating accessors).  Note that Spring supports container enforcement like this via RequiredAnnotationBeanPostProcessor; we could expand this to include "all if any" and other rules in @AnnotationConstraints, and provide that support in container-neutral form.
+
+---
+
+Feature: Method and parameter level properties:
+===============================================
+It's unclear how much real value there is in providing a richer backing store for method and param level property data; there are namespacing issues, and I haven't seen many interesting usecases for being able to set a method-level property via e.g. an accessor -- I'd love to hear some and dig into what might be a good model for supporting that.
+
+Per the last proposal bullet re: tooling support for enforcing property types/constraints, that's definitely a point of continued value-add for method and parameter level properties.
+
+---
+
+Feature: Support for runtime access to method parameter names:
+==============================================================
+
+Proposal: Explicitly expose parameter name via an @PName annotation on parameters.
+
+While the current approach of generating BeanInfo requires less authoring, the cost of additional artifact generation is high.  Other frameworks have addressed the parameter naming problem (c.f. Spring's *SqlParameterSource classes), and the language itself is in-flight to addressing it (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5082475).  Requiring an explicit annotation is redundant, but easily tooled, and makes the feature very lightweight and modular.
+

Propchange: beehive/sandbox/hornet/controls/rationale.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/pom.xml
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/pom.xml?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/pom.xml (added)
+++ beehive/sandbox/hornet/controls/runtime/pom.xml Wed Jul 12 18:34:03 2006
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *  Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ -->
+<project>
+    <parent>
+        <groupId>org.apache.beehive</groupId>
+        <artifactId>hornet</artifactId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>hornet-runtime</artifactId>
+    <name>Hornet Runtime</name>
+    <description></description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.beehive</groupId>
+            <artifactId>hornet-api</artifactId>
+            <version>0.1-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.1</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>jmock</groupId>
+            <artifactId>jmock</artifactId>
+            <version>1.0.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: beehive/sandbox/hornet/controls/runtime/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/DefaultExtensionFactoryImpl.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/DefaultExtensionFactoryImpl.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/DefaultExtensionFactoryImpl.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/DefaultExtensionFactoryImpl.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,21 @@
+package org.apache.beehive.controls.runtime;
+
+import org.apache.beehive.controls.api.ExtensionFactory;
+
+import java.lang.reflect.Proxy;
+
+/**
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public class DefaultExtensionFactoryImpl implements ExtensionFactory
+{
+    public DefaultExtensionFactoryImpl() { }
+    
+    public <T> T createInstance(Class<T> controlInterface, Object controlImplementation)
+    {
+        JdkProxyInvocationHandler ih = new JdkProxyInvocationHandler(controlInterface, controlImplementation);
+        Object proxy = Proxy.newProxyInstance(controlInterface.getClassLoader(), new Class[] { controlInterface }, ih );
+        return (T)proxy;
+    }
+}

Propchange: beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/DefaultExtensionFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/JdkProxyInvocationHandler.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/JdkProxyInvocationHandler.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/JdkProxyInvocationHandler.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/JdkProxyInvocationHandler.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,104 @@
+package org.apache.beehive.controls.runtime;
+
+import org.apache.beehive.controls.api.Extensible;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Array;
+import java.util.*;
+import java.io.Serializable;
+
+/**
+ * A JDK dynamic proxy implementation for control proxies.  For performance purposes this should eventually be
+ * replaced with asm or cglib runtime generated proxies, but that kind of code is harder to iterate during
+ * prototyping.
+ *
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public class JdkProxyInvocationHandler implements InvocationHandler, Serializable
+{
+    private static long serialVersionUID = 1L;
+
+    protected Class  _proxyInterface;
+    protected Object _controlImplementation;
+    protected Class  _implementedInterface; // interface implemented directly by the control impl
+
+    protected Set<Method> _implementedMethods; // methods implemented directly by the control impl
+    protected Method      _extensibleInvoke;   // cached ref to Extensible invoke method; may be null
+
+    /**
+     * Constructor
+     * @param proxyInterface the control interface to proxy
+     * @param controlImplementation the control implementation instance that will back the proxy.  Must implement the
+     * proxy interface or a superinterface of the proxy interface.
+     */
+    public JdkProxyInvocationHandler( Class proxyInterface, Object controlImplementation )
+    {
+        _proxyInterface = proxyInterface;
+        _controlImplementation = controlImplementation;
+
+        // Compute ancestor list for control interface
+        List<Class> controlInterfaces = new ArrayList();
+
+        Class i;
+        Queue<Class> q = new LinkedList<Class>();
+        q.offer( _proxyInterface );
+        while (  (i = q.poll()) != null )
+        {
+            controlInterfaces.add(i);
+            q.addAll(Arrays.asList(i.getInterfaces()));
+        }
+
+        // Determine which proxy interface ancestor is actually implemented by the impl instance
+        Class controlImplClass = controlImplementation.getClass();
+        for ( Class j : controlInterfaces )
+        {
+            if ( j.isAssignableFrom(controlImplClass) )
+            {
+                _implementedInterface = j;
+                break;
+            }
+        }
+
+        assert ( _implementedInterface != null );
+
+        if ( _implementedInterface != proxyInterface )
+        {
+            // better be an Extensible control!
+            assert ( Extensible.class.isAssignableFrom(controlImplClass) );
+            Class objectArray = Array.newInstance(Object.class, 1 ).getClass();
+            try {
+                _extensibleInvoke = Extensible.class.getMethod( "invoke", Method.class, objectArray );
+            }
+            catch ( NoSuchMethodException nsme )
+            {
+                assert (false);
+            }
+        }
+
+        // Cache set of implemented methods
+        _implementedMethods = new HashSet<Method>();
+        _implementedMethods.addAll( Arrays.asList(_implementedInterface.getMethods()) );
+    }
+
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+    {
+        if ( _implementedMethods.contains(method) )
+        {
+            // Invoke a normally implemented (non-extensible) control method
+            return method.invoke( _controlImplementation, args );
+        }
+        else
+        {
+            // Invoke an extensible control method (via the Extensible.invoke tunnel)
+            return _extensibleInvoke.invoke( _controlImplementation, method, args );
+        }
+    }
+
+    /*
+    TODO: implement writeObject and readObject to reinitialize reflection-based fields
+    after deserialization.  One possible approach: emitting the names of the classes/methods
+    into the stream as Strings, and then doing reflection on read.
+    */
+}

Propchange: beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/JdkProxyInvocationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/PropertyMap.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/PropertyMap.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/PropertyMap.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/PropertyMap.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,244 @@
+package org.apache.beehive.controls.runtime;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.ClassUtils;
+import org.apache.beehive.controls.api.PropertySet;
+
+import java.util.*;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.annotation.Annotation;
+
+/**
+ * Manages mapping from propertyset annotations and JavaBean properties.  Can read property
+ * annotations on fields and types, and inject the resulting values as JavaBean properties.
+ *
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public class PropertyMap
+{
+    /**
+     * PropertyHolder encapsulates the value and type of a property.
+     */
+    private static class PropertyHolder
+    {
+        public PropertyHolder(Class t, Object v)
+        {
+            type  = t;
+            value = v;
+        }
+
+        public Class  type;
+        public Object value;
+    }
+
+    private HashMap<String, PropertyHolder> _properties; // maps JavaBean propnames to a property holder (w/ value, type etc)
+    private HashMap<Class<? extends Annotation>, Collection<String>> _annotations; // maps propertyset annotations to a list of JavaBean propnames
+
+    public PropertyMap()
+    {
+        _properties = new HashMap<String,PropertyHolder>();
+        _annotations = new HashMap<Class<? extends Annotation>, Collection<String>>();
+    }
+
+    /**
+     * Retrieves the names of the properties currently stored in the map.
+     * @return a list of property names
+     */
+    public List<String> getPropertyNames()
+    {
+        return new ArrayList<String>( _properties.keySet() );
+    }
+
+    /**
+     * Retrieves a collection of property names mapped from the specified propertyset annotation.
+     *
+     * @param ac a propertyset annotation type
+     * @return a collection of JavaBean property names.  May be null if the propertyset hasn't been mapped.
+     */
+    public Collection<String> getPropertyNamesByAnnotation(Class<? extends Annotation> ac)
+    {
+        return _annotations.get(ac);
+    }
+
+    /**
+     * Retrieves the value of a property.
+     * @param propName the name of the property to retrieve.
+     * @return the value of the named property
+     */
+    public Object getPropertyValue( String propName )
+    {
+        PropertyHolder ph = _properties.get(propName);
+        if ( ph != null )
+            return ph.value;
+        else
+            return null;
+    }
+
+    /**
+     * Retrieves the type of a property.
+     * @param propName the name of the property
+     * @return the type of the property
+     */
+    public Class getPropertyType( String propName )
+    {
+        PropertyHolder ph = _properties.get(propName);
+        if ( ph != null )
+            return ph.type;
+        else
+            return null;
+    }
+
+    /**
+     * Populates the map with properties read from PropertySet-style annotations on a field.
+     * @param f
+     */
+    public void readFromField(Field f)
+    {
+        List<Annotation> annotations = Arrays.asList(f.getAnnotations());
+        readFromAnnotations(annotations);
+    }
+
+    /**
+     * Populates the map with properties read from PropertySet-style annotations on a method.
+     * @param m
+     */
+    public void readFromMethod(Method m)
+    {
+        // REVIEW: It may be interesting to consider namespacing properties with the methodname/signature,
+        // this might allow accessor based override of method-level properties (something current controls
+        // don't allow).  Not sure how useful this is, and some thinking needs to happen on how to make
+        // the mapping bidirectional and sane.
+
+        List<Annotation> annotations = Arrays.asList(m.getAnnotations());
+        readFromAnnotations(annotations);
+    }
+
+    /**
+     * Populates the map with properties read from PropertySet-style annotations on a type.
+     * @param clazz
+     */
+    public void readFromType(Class clazz)
+    {
+        List<Annotation> annotations = Arrays.asList(clazz.getAnnotations());
+        readFromAnnotations(annotations);
+    }
+
+    /**
+     * Injects the property values currently in the map onto a JavaBean using setter methods.
+     *
+     * @param javaBean
+     * @return number of properties that could not be injected (typically due to missing or
+     *         inaccessible setters).  0 if all properties were successfully injected.
+     */
+    public int injectInto(Object javaBean)
+    {
+        Class clazz = javaBean.getClass();
+        Collection<String> propNames = getPropertyNames();
+        int remainingProperties = propNames.size();
+
+        for ( String propName : propNames )
+        {
+            String setterName = "set" + propName;
+            Object propValue = getPropertyValue(propName);
+            Class propType = getPropertyType(propName);
+
+            // System.out.println( "Injecting method=" + setterName + " value=" + propValue);
+
+            try
+            {
+                Method setter = clazz.getMethod( setterName, propType );
+                setter.invoke(javaBean, propValue);
+                remainingProperties--;
+            }
+            catch ( NoSuchMethodException nsme )
+            {
+                nsme.printStackTrace();
+                // no setter, oh well, what can you do..
+            }
+            catch ( IllegalAccessException iae )
+            {
+                iae.printStackTrace();
+                // couldn't invoke setter, oops
+            }
+            catch ( InvocationTargetException ite )
+            {
+                ite.printStackTrace();
+                // couldn't invoke setter, oops
+            }
+        }
+
+        return remainingProperties;
+    }
+
+    /**
+     * Utility logic that translates reflection-based annotation info into property info.
+     *
+     * @param annotations
+     */
+    private void readFromAnnotations(Collection<Annotation> annotations)
+    {
+        for ( Annotation a : annotations )
+        {
+            // is this annotation a controls propertyset?
+            Class<? extends Annotation> ac = a.annotationType();
+            PropertySet propA = ac.getAnnotation(PropertySet.class);
+            if ( propA == null)
+                break;
+
+            String propertyName;
+            Object propertyValue;
+            Class  propertyType;
+
+            // Does the property have a prefix?  If not, use classname as prefix
+            String prefix = propA.prefix();
+            if ( StringUtils.isBlank(prefix) )
+            {
+                prefix = ClassUtils.getShortClassName(ac);
+                int innerPkgIndex = prefix.lastIndexOf(".");
+                if ( innerPkgIndex != -1 )
+                    prefix = prefix.substring(innerPkgIndex+1);
+            }
+
+            // Each method of a propertyset defines a JavaBean property.
+            Collection<String> propNames = new ArrayList<String>();
+            List<Method> methods = Arrays.asList(ac.getDeclaredMethods());
+            for ( Method m : methods )
+            {
+                String methodName = m.getName();
+                propertyType = m.getReturnType();
+
+
+                if ( methodName.equals("value") )
+                    methodName = ""; // just use prefix for propname
+
+                propertyName = prefix + methodName;
+                propertyName = StringUtils.capitalize(propertyName);
+
+                propertyValue = null;
+
+                try
+                {
+                    propertyValue = m.invoke(a, null);
+                }
+                catch ( IllegalAccessException iae )
+                {
+                    iae.printStackTrace();
+                }
+                catch ( InvocationTargetException ite )
+                {
+                    ite.printStackTrace();
+                }
+
+                _properties.put( propertyName, new PropertyHolder(propertyType,propertyValue) );
+                propNames.add( propertyName );
+
+                // System.out.println( "Read property name=" + propertyName + " value=" + propertyValue + " type=" + propertyType + " isPrim=" + propertyType.isPrimitive());
+            }
+
+            _annotations.put(ac, propNames);
+        }
+    }
+}

Propchange: beehive/sandbox/hornet/controls/runtime/src/main/java/org/apache/beehive/controls/runtime/PropertyMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensibleControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensibleControlImpl.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensibleControlImpl.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensibleControlImpl.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,36 @@
+package org.apache.beehive.controls.test.invocation;
+
+import org.apache.beehive.controls.api.Extensible;
+
+import java.lang.reflect.Method;
+
+/**
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public class ExtensibleControlImpl implements SimpleControl, Extensible
+{
+    private int _count;
+
+    public ExtensibleControlImpl() {}
+
+    public int method1(String a) {
+        return 0;
+    }
+
+    public String method2(int b, float c) {
+        return null;
+    }
+
+    public int getCount() {
+        return _count;
+    }
+
+    public void setCount(int i) {
+        _count = i;
+    }
+
+    public Object invoke(Method m, Object[] args) throws Throwable {
+        return args[0];
+    }
+}

Propchange: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensibleControlImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensionControl.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensionControl.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensionControl.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensionControl.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,10 @@
+package org.apache.beehive.controls.test.invocation;
+
+/**
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public interface ExtensionControl extends SimpleControl
+{
+    public String extendedEchoMethod( String a );
+}

Propchange: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/ExtensionControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/InvocationTestCase.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/InvocationTestCase.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/InvocationTestCase.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/InvocationTestCase.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,37 @@
+package org.apache.beehive.controls.test.invocation;
+
+import junit.framework.TestCase;
+import org.apache.beehive.controls.api.ExtensionFactory;
+import org.apache.beehive.controls.runtime.DefaultExtensionFactoryImpl;
+
+/**
+ * Tests invocation of an extended control method.
+ *
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public class InvocationTestCase extends TestCase
+{
+    private ExtensionFactory _controlExtensionFactory;
+
+    public InvocationTestCase() { }
+
+    public void setUp()
+    {
+        _controlExtensionFactory = new DefaultExtensionFactoryImpl();
+    }
+
+    public void testBasicInvocation()
+    {
+        ExtensionControl c = _controlExtensionFactory.createInstance( ExtensionControl.class, new ExtensibleControlImpl() );
+        c.setCount(3);
+        assertEquals( 3, c.getCount() );
+    }
+
+    public void testExtensibleInvocation()
+    {
+        ExtensionControl c = _controlExtensionFactory.createInstance( ExtensionControl.class, new ExtensibleControlImpl() );
+        String ret = c.extendedEchoMethod("foo");
+        assertEquals( ret, "foo" );
+    }
+}

Propchange: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/InvocationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControl.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControl.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControl.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControl.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,64 @@
+package org.apache.beehive.controls.test.invocation;
+
+import org.apache.beehive.controls.api.PropertySet;
+
+import java.lang.annotation.*;
+
+/**
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public interface PropertiesControl
+{
+    @PropertySet()
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE, ElementType.FIELD})
+    public @interface Count
+    {
+        int value();
+    }
+
+    public  int getCount();
+    public void setCount( int i );
+
+    @PropertySet()
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE, ElementType.FIELD})
+    public @interface Color
+    {
+        String Name();
+    }
+
+    public String getColorName();
+    public   void setColorName( String s );
+
+    @PropertySet(prefix="JDBC")
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE, ElementType.FIELD})
+    public @interface Jdbc
+    {
+        String JndiName();
+           int PoolSize();
+    }
+
+    public String getJDBCJndiName();
+    public   void setJDBCJndiName(String s);
+    public    int getJDBCPoolSize();
+    public   void setJDBCPoolSize(int s);
+
+    @PropertySet(prefix="EJBJndi")
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE, ElementType.FIELD})
+    public @interface EjbJndi
+    {
+        String name();
+    }
+
+    public String getEJBJndiname();
+    public   void setEJBJndiname(String s);
+
+    public @interface NonPropertySet
+    {
+        float value();
+    }
+}

Propchange: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControlImpl.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControlImpl.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControlImpl.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,46 @@
+package org.apache.beehive.controls.test.invocation;
+
+/**
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public class PropertiesControlImpl implements PropertiesControl
+{
+    private int _count;
+
+    public int getCount() {
+        return _count;
+    }
+
+    public void setCount(int i) {
+        _count = i;
+    }
+
+    public String getColorName() {
+        return null;
+    }
+
+    public void setColorName(String s) {
+    }
+
+    public String getJDBCJndiName() {
+        return null;
+    }
+
+    public void setJDBCJndiName(String s) {
+    }
+
+    public int getJDBCPoolSize() {
+        return 0;
+    }
+
+    public void setJDBCPoolSize(int s) {
+    }
+
+    public String getEJBJndiname() {
+        return null;
+    }
+
+    public void setEJBJndiname(String s) {
+    }
+}

Propchange: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesControlImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesExtension.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesExtension.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesExtension.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesExtension.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,15 @@
+package org.apache.beehive.controls.test.invocation;
+
+/**
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+@PropertiesControl.Count( 5 )
+@PropertiesControl.Color( Name="blue")
+@PropertiesControl.Jdbc( JndiName="jdbc name", PoolSize=10 )
+@PropertiesControl.EjbJndi( name="ejb name" )
+@PropertiesControl.NonPropertySet( 2.0f )
+public interface PropertiesExtension extends PropertiesControl
+{
+}
+

Propchange: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertiesExtension.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertyMapTestCase.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertyMapTestCase.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertyMapTestCase.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertyMapTestCase.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,74 @@
+package org.apache.beehive.controls.test.invocation;
+
+import junit.framework.TestCase;
+import org.apache.beehive.controls.runtime.PropertyMap;
+import org.apache.beehive.controls.runtime.DefaultExtensionFactoryImpl;
+import org.apache.beehive.controls.api.ExtensionFactory;
+
+/**
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public class PropertyMapTestCase extends TestCase
+{
+    private ExtensionFactory _controlFactor;
+
+    @PropertiesControl.Count( 5 )
+    @PropertiesControl.Color( Name="blue")
+    @PropertiesControl.Jdbc( JndiName="jdbc name", PoolSize=10 )
+    @PropertiesControl.EjbJndi( name="ejb name" )
+    @PropertiesControl.NonPropertySet( 2.0f )
+    public PropertiesControl _controlField;
+
+    public PropertyMapTestCase() { }
+
+    public void testAnnotatedType()
+    {
+        PropertyMap pm = new PropertyMap();
+        pm.readFromType( PropertiesExtension.class );
+        validateProperties(pm);
+    }
+
+    public void testAnnotatedField()
+    {
+        PropertyMap pm = new PropertyMap();
+
+        try
+        {
+            pm.readFromField( this.getClass().getField( "_controlField") );
+        }
+        catch ( NoSuchFieldException nsfe )
+        {
+            nsfe.printStackTrace();
+        }
+
+        validateProperties(pm);
+
+        ExtensionFactory cf = new DefaultExtensionFactoryImpl();
+
+        PropertiesControl pc = new PropertiesControlImpl();
+        pm.injectInto(pc);
+
+        assertEquals(5, pc.getCount());
+    }
+
+    private void validateProperties(PropertyMap pm)
+    {
+        assertEquals( "jdbc name", pm.getPropertyValue("JDBCJndiName") );
+        assertEquals(          10, pm.getPropertyValue("JDBCPoolSize") );
+        assertEquals(           5, pm.getPropertyValue("Count"));
+        assertEquals(      "blue", pm.getPropertyValue("ColorName"));
+        assertEquals(  "ejb name", pm.getPropertyValue("EJBJndiname"));
+
+        /*
+        Set<String> propNames = pm.getPropertyNames();
+
+        assertTrue( propNames.remove("JDBCJndiName") );
+        assertTrue( propNames.remove("JDBCPoolSize") );
+        assertTrue( propNames.remove("Count") );
+        assertTrue( propNames.remove("ColorName") );
+        assertTrue( propNames.remove("EJBJndiname") );
+        assertTrue( propNames.isEmpty() );
+        */
+    }
+}

Propchange: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/PropertyMapTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/SimpleControl.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/SimpleControl.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/SimpleControl.java (added)
+++ beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/SimpleControl.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,14 @@
+package org.apache.beehive.controls.test.invocation;
+
+/**
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public interface SimpleControl
+{
+    public int method1( String a );
+    public String method2( int b, float c );
+
+    public int getCount();
+    public void setCount( int i );
+}

Propchange: beehive/sandbox/hornet/controls/runtime/src/test/java/org/apache/beehive/controls/test/invocation/SimpleControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/samples/jdbc/pom.xml
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/samples/jdbc/pom.xml?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/samples/jdbc/pom.xml (added)
+++ beehive/sandbox/hornet/controls/samples/jdbc/pom.xml Wed Jul 12 18:34:03 2006
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *  Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ -->
+<project>
+    <parent>
+        <groupId>org.apache.beehive</groupId>
+        <artifactId>hornet-samples</artifactId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>jdbc-hornet-samples</artifactId>
+    <name>Hornet JDBC samples</name>
+    <description></description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.beehive</groupId>
+            <artifactId>hornet-api</artifactId>
+            <version>0.1-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.beehive</groupId>
+            <artifactId>hornet-runtime</artifactId>
+            <version>0.1-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.0.4</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>xmlbeans</groupId>
+            <artifactId>xbean</artifactId>
+            <version>2.1.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>jmock</groupId>
+            <artifactId>jmock</artifactId>
+            <version>1.0.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>sun.jdk</groupId>
+            <artifactId>tools</artifactId>
+            <version>1.5.0</version>
+            <scope>system</scope>
+            <systemPath>${java.home}/../lib/tools.jar</systemPath>
+        </dependency>
+    </dependencies>
+</project>

Propchange: beehive/sandbox/hornet/controls/samples/jdbc/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java (added)
+++ beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2005 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:$
+ */
+
+package org.apache.beehive.controls.system.jdbc;
+
+import java.lang.reflect.Method;
+import java.sql.ResultSet;
+import java.util.Calendar;
+import java.util.Iterator;
+
+/**
+ * Default ResultSetMapper implementation for Iterators.
+ */
+public class DefaultIteratorResultSetMapper extends ResultSetMapper {
+
+    /**
+     * Map a ResultSet to an object type
+     * Type of object to interate over is defined in the SQL annotation for the method.
+     *
+     * @param m         Method assoicated with this call.
+     * @param resultSet Result set to map.
+     * @param cal       A Calendar instance for time/date value resolution.
+     * @return          The Iterator object instance resulting from the ResultSet
+     */
+    public Iterator mapToResultType(Method m, ResultSet resultSet, Calendar cal) {
+        return new ResultSetIterator(m, resultSet, cal);
+    }
+
+    /**
+     * Can the ResultSet which this mapper uses be closed by the database control on return from its invoke() method?
+     * @return always returns false
+     */
+    public boolean canCloseResultSet() { return false; }
+}

Propchange: beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java (added)
+++ beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2005 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:$
+ */
+
+package org.apache.beehive.controls.system.jdbc;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.Context;
+
+/**
+ * Default context factory implementation.
+ * May be overridden in class's ConnectionDataSource annotation.
+ */
+class DefaultJndiContextFactory extends JdbcControl.JndiContextFactory {
+
+    /**
+     * Return a Jndi InitialContext
+     * @return InitialContext instance
+     * @throws NamingException on error.
+     */
+    public Context getContext() throws NamingException {
+        return (Context) new InitialContext();
+    }
+}

Propchange: beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java
URL: http://svn.apache.org/viewvc/beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java?rev=421473&view=auto
==============================================================================
--- beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java (added)
+++ beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java Wed Jul 12 18:34:03 2006
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2005 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:$
+ */
+
+package org.apache.beehive.controls.system.jdbc;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.PropertySetReader;
+import org.apache.beehive.controls.system.jdbc.JdbcControl.SQL;
+
+import java.lang.reflect.Method;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Calendar;
+
+/**
+ * Default ResultSetMapper implementation for Objects.
+ */
+public class DefaultObjectResultSetMapper extends ResultSetMapper {
+
+    /**
+     * static reference to the TypeMappingsFactory for this class
+     */
+    protected static final TypeMappingsFactory _tmf = TypeMappingsFactory.getInstance();
+
+    /**
+     * Map the ResultSet to the method's return type. The object type returned is defined by the return type of the method.
+     *
+     * @param m         Method assoicated with this call.
+     * @param resultSet Result set to map.
+     * @param cal       A Calendar instance for time/date value resolution.
+     * @return The Object resulting from the ResultSet
+     */
+    public Object mapToResultType(Method m, ResultSet resultSet, Calendar cal) {
+
+        final Class returnType = m.getReturnType();
+        final boolean isArray = returnType.isArray();
+
+        try {
+            if (isArray) {
+                final SQL methodSQL = PropertySetReader.getMethodPropertySet(m, SQL.class);
+                return arrayFromResultSet(resultSet, methodSQL.arrayMaxLength(), returnType, cal);
+            } else {
+                if (!resultSet.next()) {
+                    return _tmf.fixNull(m.getReturnType());
+                }
+                return RowMapperFactory.getRowMapper(resultSet, returnType, cal).mapRowToReturnType();
+            }
+        } catch (SQLException e) {
+            throw new ControlException(e.getMessage(), e);
+        }
+    }
+
+    //
+    // ////////////////////////////////// PRIVATE METHODS //////////////////////////////////////////
+    //
+
+    /**
+     * Invoked when the return type of the method is an array type.
+     *
+     * @param rs         ResultSet to process.
+     * @param maxRows    The maximum size of array to create
+     * @param arrayClass The class of object contained within the array
+     * @param cal        A calendar instance to use for date/time values
+     * @return An array of the specified class type
+     * @throws SQLException On error.
+     */
+    protected Object arrayFromResultSet(ResultSet rs, int maxRows, Class arrayClass, Calendar cal)
+            throws SQLException {
+
+        Class componentType = arrayClass.getComponentType();
+        ResultSetMetaData md = rs.getMetaData();
+
+        ArrayList<Object> list = new ArrayList<Object>();
+        int numRows;
+
+        boolean hasMoreRows = rs.next();
+        RowMapper rowMapper = RowMapperFactory.getRowMapper(rs, componentType, cal);
+
+        for (numRows = 0; numRows != maxRows && hasMoreRows; numRows++) {
+            list.add(rowMapper.mapRowToReturnType());
+            hasMoreRows = rs.next();
+        }
+
+        Object array = java.lang.reflect.Array.newInstance(componentType, numRows);
+        try {
+            for (int i = 0; i < numRows; i++) {
+                java.lang.reflect.Array.set(array, i, list.get(i));
+            }
+        } catch (IllegalArgumentException iae) {
+            // assuming no errors in resultSetObject() this can only happen
+            // for single column result sets.
+            throw new ControlException("The declared Java type for array " + componentType.getName()
+                                       + "is incompatible with the SQL format of column " + md.getColumnName(1)
+                                       + md.getColumnTypeName(1) + "which returns objects of type + "
+                                       + list.get(0).getClass().getName());
+        }
+        return array;
+    }
+}

Propchange: beehive/sandbox/hornet/controls/samples/jdbc/src/main/java/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java
------------------------------------------------------------------------------
    svn:eol-style = native