You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/05/10 22:32:32 UTC

svn commit: r169518 [4/8] - in /incubator/beehive/trunk: docs/forrest/src/documentation/content/xdocs/ docs/forrest/src/documentation/content/xdocs/system-controls/ docs/forrest/src/documentation/content/xdocs/system-controls/ejb/ docs/forrest/src/documentation/content/xdocs/system-controls/jdbc/ docs/forrest/src/documentation/content/xdocs/system-controls/jms/ docs/forrest/src/documentation/content/xdocs/system-controls/webservices/ docs/forrest/src/documentation/content/xdocs/tutorial/ system-controls/samples/ system-controls/samples/ejb/ system-controls/samples/ejb/client/ system-controls/samples/ejb/client/org/ system-controls/samples/ejb/client/org/apache/ system-controls/samples/ejb/client/org/apache/beehive/ system-controls/samples/ejb/client/org/apache/beehive/controls/ system-controls/samples/ejb/client/org/apache/beehive/controls/system/ system-controls/samples/ejb/client/org/apache/beehive/controls/system/ejb/ system-controls/samples/ejb/client/org/apache/beehive/controls/system/ejb/sample/ system-controls/samples/ejb/client/org/apache/beehive/controls/system/ejb/sample/client/ system-controls/samples/ejb/control/ system-controls/samples/ejb/control/org/ system-controls/samples/ejb/control/org/apache/ system-controls/samples/ejb/control/org/apache/beehive/ system-controls/samples/ejb/control/org/apache/beehive/controls/ system-controls/samples/ejb/control/org/apache/beehive/controls/system/ system-controls/samples/ejb/control/org/apache/beehive/controls/system/ejb/ system-controls/samples/ejb/control/org/apache/beehive/controls/system/ejb/sample/ system-controls/samples/ejb/control/org/apache/beehive/controls/system/ejb/sample/control/ system-controls/samples/ejb/ejb/ system-controls/samples/ejb/ejb/META-INF/ system-controls/samples/ejb/ejb/org/ system-controls/samples/ejb/ejb/org/apache/ system-controls/samples/ejb/ejb/org/apache/beehive/ system-controls/samples/ejb/ejb/org/apache/beehive/controls/ system-controls/samples/ejb/ejb/org/apache/beehive/controls/system/ system-controls/samples/ejb/ejb/org/apache/beehive/controls/system/ejb/ system-controls/samples/ejb/ejb/org/apache/beehive/controls/system/ejb/sample/ system-controls/samples/ejb/ejb/org/apache/beehive/controls/system/ejb/sample/bean/ system-controls/samples/jdbc/ system-controls/samples/jdbc/jdbcControlSample/ system-controls/samples/jdbc/jdbcControlSample/META-INF/ system-controls/samples/jdbc/jdbcControlSample/WEB-INF/ system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/ system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/controls/ system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/servlet/ system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/shared/ system-controls/samples/jms/ system-controls/samples/jms/src/ system-controls/samples/jms/src/org/ system-controls/samples/jms/src/org/apache/ system-controls/samples/jms/src/org/apache/beehive/ system-controls/samples/jms/src/org/apache/beehive/controls/ system-controls/samples/jms/src/org/apache/beehive/controls/system/ system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/ system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/ system-controls/samples/webservice/ system-controls/samples/webservice/amazon/ system-controls/samples/webservice/amazon/junit/ system-controls/samples/webservice/amazon/schemas/ system-controls/samples/webservice/common/ system-controls/samples/webservice/common/src/ system-controls/samples/webservice/common/src/test/ system-controls/samples/webservice/google/ system-controls/samples/webservice/google/junit/ system-controls/samples/webservice/google/junit/model/ system-controls/samples/webservice/google/rpc_schemas/ system-controls/samples/webservice/google/servlet/ system-controls/samples/webservice/lib/ system-controls/samples/webservice/wsm_samples_client/ system-controls/samples/webservice/wsm_samples_client/doc_schemas/ system-controls/samples/webservice/wsm_samples_client/junit/ system-controls/samples/webservice/wsm_samples_client/junit/org/ system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/ system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/ system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/ system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/ system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/ system-controls/samples/webservice/wsm_samples_client/rpc_schemas/ system-controls/samples/webservice/xmlbeans/ system-controls/samples/webservice/xmlbeans/junit/ system-controls/samples/webservice/xmlbeans/schemas/ system-controls/src/ejb/

Added: incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/controls/SimpleDBControl.jcx
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/controls/SimpleDBControl.jcx?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/controls/SimpleDBControl.jcx (added)
+++ incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/controls/SimpleDBControl.jcx Tue May 10 13:32:29 2005
@@ -0,0 +1,64 @@
+/*
+ * 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 controls; 
+
+import java.sql.SQLException; 
+import java.sql.ResultSet;
+import org.apache.beehive.controls.system.jdbc.JdbcControl;
+
+/** 
+ * JdbcControl implementation for the JdbcControl sample app.
+ */ 
+@org.apache.beehive.controls.api.bean.ControlExtension
+@JdbcControl.ConnectionDataSource(jndiName="java:comp/env/jdbc/JdbcControlSampleDB")
+public interface SimpleDBControl extends JdbcControl
+{ 
+
+    static public class Product 
+    { 
+        private String _name; 
+        private String _description;
+        private int _quantity; 
+
+        public int getQuantity() { return _quantity; }
+        public void setQuantity(int i) { _quantity = i; }
+
+        public String getName() { return _name; }
+        public void setName(String n) { _name = n; }
+
+        public String getDescription() { return _description; }
+        public void setDescription(String n) { _description = n; }
+    }
+
+    /**
+     * Get the name column from the products table.
+     * @return An array of strings.
+     */
+    @JdbcControl.SQL(statement="SELECT name FROM products")
+    public String[] getProductNames() throws SQLException;
+
+    /**
+     * Get the rest of the columns associated with a product name.
+     * @param productName Name of product to lookup.
+     * @return An instance of Product.
+     */
+    @JdbcControl.SQL(statement="SELECT * FROM products WHERE name={productName}")
+    public Product getProductDetails(String productName) throws SQLException;
+   
+    static final long serialVersionUID = 1L;
+}

Added: incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/servlet/DerbyListener.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/servlet/DerbyListener.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/servlet/DerbyListener.java (added)
+++ incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/servlet/DerbyListener.java Tue May 10 13:32:29 2005
@@ -0,0 +1,53 @@
+/*
+ * 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 servlet;
+
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletContextEvent;
+
+import org.apache.beehive.netui.util.logging.Logger;
+
+/**
+ *
+ */
+public class DerbyListener implements ServletContextListener {
+
+    private static final Logger LOGGER = Logger.getInstance(DerbyListener.class);
+    private static final String _dbUrlStr = "jdbc:derby:JdbcControlSampleDB";
+
+    public void contextInitialized(ServletContextEvent event) {
+        try {
+            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+        } catch(Exception e) {
+            assert e instanceof ClassNotFoundException;
+            e.printStackTrace();
+            LOGGER.error("Exception occurred starting webapp context.  Cause: " + e.getMessage(), e);
+        }
+    }
+
+    public void contextDestroyed(ServletContextEvent event) {
+        try {
+            DriverManager.getConnection(_dbUrlStr + ";shudown=true");
+        } catch(SQLException sql) {
+            sql.printStackTrace();
+            LOGGER.error("Exception occurred stopping webapp context.  Cause: " + sql.getMessage(), sql);
+        }
+    }
+}

Added: incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/shared/SharedFlow.jpfs
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/shared/SharedFlow.jpfs?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/shared/SharedFlow.jpfs (added)
+++ incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/shared/SharedFlow.jpfs Tue May 10 13:32:29 2005
@@ -0,0 +1,85 @@
+package shared;
+
+import java.io.IOException;
+
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowException;
+import org.apache.beehive.netui.pageflow.SharedFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * This shared flow can define actions, exception handlers, and state to be shared among page flows
+ * that reference it.  A page flow references this shared flow inside a <code>Jpf.Controller</code>
+ * annotation as:
+ * <pre>
+ *     sharedFlowRefs={
+ *         &#064;Jpf.SharedFlowRef(name="shared", type=shared.SharedFlow.class)
+ *     }
+ * </pre>
+ * 
+ * Once referenced, the following features apply:
+ *    <ul>
+ *        <li>
+ *            An instance of this shared flow will be created and stored the first time the page
+ *            flow is accessed.
+ *        </li>
+ *        <li>
+ *            The page flow (or its pages) can reference actions using the pattern
+ *            <i>shared-flow-name.action-name</i>, e.g., "shared.someAction".
+ *        </li>
+ *        <li>
+ *            Unhandled exceptions in the page flow will be handled by <code>Jpf.Catch</code>
+ *            annotations in this shared flow.
+ *        </li>
+ *        <li>
+ *            In pages and annotations that bind to data using the expression language, properties
+ *            in this shared flow are accessed through the <code>sharedFlow</code> binding context.
+ *        </li>
+ *        <li>
+ *            A page flow can have an automatically-initialized member reference to this shared
+ *            flow using the <code>Jpf.SharedFlowField</code> annotation, like this:
+ *            <pre>
+ *                &#064;Jpf.SharedFlowField(name="shared")
+ *                private shared.SharedFlow _mySharedFlowReference;
+ *            </pre>
+ *        </li>
+ *    </ul>
+ */
+@Jpf.Controller(
+    catches={
+       @Jpf.Catch(type=PageFlowException.class, method="handlePageFlowException"),
+       @Jpf.Catch(type=Exception.class, method="handleException")
+    }
+)
+public class SharedFlow
+    extends SharedFlowController
+{
+    @Jpf.ExceptionHandler(
+        forwards={
+            @Jpf.Forward(name="errorPage", path="/error.jsp")
+        }
+    )
+    protected Forward handleException(Exception ex, String actionName, String message, Object form)
+    {
+        System.err.print("[" + getRequest().getContextPath() + "] ");
+        System.err.println("Unhandled exception caught in shared flow " + getDisplayName() + ":");
+        ex.printStackTrace();
+        return new Forward("errorPage");
+    }
+
+    /** 
+     * Handler for native page flow exceptions (e.g., ActionNotFoundException, which is thrown when
+     * an unknown page flow action is requested).  This handler allows these exceptions to write
+     * informative error pages to the response when the server is not in production mode, and it
+     * allows them to send an appropriate error on the response when the server is in production
+     * mode.  To use the standard exception handler for these exceptions, simply remove this method
+     * and the Jpf.Catch annotation that references it.
+     */
+    @Jpf.ExceptionHandler
+    public Forward handlePageFlowException(PageFlowException ex, String actionName, String message, Object form) 
+        throws IOException
+    { 
+        ex.sendError(getRequest(), getResponse()); 
+        return null; 
+    } 
+}

Added: incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/web.xml?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/web.xml (added)
+++ incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/web.xml Tue May 10 13:32:29 2005
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+    version="2.4">
+
+    <display-name>Beehive Web Application</display-name>
+
+    <filter>
+        <filter-name>PageFlowJspFilter</filter-name>
+        <filter-class>org.apache.beehive.netui.pageflow.PageFlowJspFilter</filter-class>
+    </filter>
+
+    <filter>
+        <filter-name>PageFlowFacesFilter</filter-name>
+        <filter-class>org.apache.beehive.netui.pageflow.PageFlowFacesFilter</filter-class>
+    </filter>
+
+    <filter-mapping>
+        <filter-name>PageFlowJspFilter</filter-name>
+        <url-pattern>*.jsp</url-pattern>
+        <dispatcher>FORWARD</dispatcher>
+        <dispatcher>REQUEST</dispatcher>
+        <dispatcher>INCLUDE</dispatcher>
+    </filter-mapping>
+
+    <filter-mapping>
+        <filter-name>PageFlowJspFilter</filter-name>
+        <url-pattern>*.jspx</url-pattern>
+        <dispatcher>FORWARD</dispatcher>
+        <dispatcher>REQUEST</dispatcher>
+        <dispatcher>INCLUDE</dispatcher>
+    </filter-mapping>
+
+    <filter-mapping>
+        <filter-name>PageFlowFacesFilter</filter-name>
+        <url-pattern>*.faces</url-pattern>
+        <dispatcher>FORWARD</dispatcher>
+        <dispatcher>REQUEST</dispatcher>
+        <dispatcher>INCLUDE</dispatcher>
+    </filter-mapping>
+
+    <filter-mapping>
+        <filter-name>PageFlowFacesFilter</filter-name>
+        <url-pattern>*.jsf</url-pattern>
+        <dispatcher>FORWARD</dispatcher>
+        <dispatcher>REQUEST</dispatcher>
+        <dispatcher>INCLUDE</dispatcher>
+    </filter-mapping>
+
+    <!-- Action Servlet Configuration (with debugging) -->
+    <servlet>
+        <servlet-name>action</servlet-name>
+        <servlet-class>org.apache.beehive.netui.pageflow.PageFlowActionServlet</servlet-class>
+        <init-param>
+            <param-name>config</param-name>
+            <param-value>/WEB-INF/.pageflow-struts-generated/jpf-struts-config.xml</param-value>
+        </init-param>
+        <init-param>
+            <param-name>debug</param-name>
+            <param-value>2</param-value>
+        </init-param>
+        <init-param>
+            <param-name>detail</param-name>
+            <param-value>2</param-value>
+        </init-param>
+        <load-on-startup>2</load-on-startup>
+    </servlet>
+
+    <!-- Struts Action Servlet Mappings -->
+    <!-- Note that because Struts takes the *last* mapping here as the extension to add to
+         actions posted from forms, we must have *.do come after *.jpf. -->
+    <servlet-mapping>
+        <servlet-name>action</servlet-name>
+        <url-pattern>*.jpf</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>action</servlet-name>
+        <url-pattern>*.do</url-pattern>
+    </servlet-mapping>
+
+    <welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+
+    <error-page>
+        <error-code>500</error-code>
+        <location>/error.jsp</location>
+    </error-page>
+
+  <resource-ref>
+      <description>DB Connection</description>
+      <res-ref-name>jdbc/TestDB</res-ref-name>
+      <res-type>javax.sql.DataSource</res-type>
+      <res-auth>Container</res-auth>
+  </resource-ref>
+
+</web-app>

Added: incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/demo.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/demo.jsp?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/demo.jsp (added)
+++ incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/demo.jsp Tue May 10 13:32:29 2005
@@ -0,0 +1,71 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
+
+<netui:html>
+
+  <head>
+    <title>JspControlApp Sample Application</title>
+    <netui:base/>
+    <style>
+
+.datagrid-header{
+    background-color: #eeeeee;
+}
+.datagrid-header-cel{
+    background-color: #f0f0f0;
+}
+.custom-datagrid-header-cell{
+    background-color: #0f0f0f;
+}
+.datagrid-data-cell{
+}
+.datagrid-even{
+    background-color: #ffffff;
+}
+.datagrid-even a {
+    text-decoration: none;
+    color: #000000;   
+}
+.datagrid-odd{
+    background-color: #ffffde;
+}
+.datagrid-odd a {
+    text-decoration: none;
+    color: #000000;
+}
+    </style>
+  </head>
+
+  <netui:body>
+
+      <h1>JdbcControl Sample</h1>
+      <p></p>
+      <p>This is a tiny sample application which uses a JdbcControl inside of a Beehive PageFlow. When 
+         this page is accessed for the first time, a small Derby database is created and populated by the 
+         JdbcControl PopulateDBCtrl.</p>
+
+      <p>The data grid of product names below has been provided by the SimpleJdbcCtrl's getProductNames() 
+         method. Clicking in the second column will trigger another call to the SimpleJdbcCtrl to get
+         more detailed information from the database for the selected item.</p>
+
+      <netui-data:dataGrid dataSource="pageFlow.productNames" name="productNameGrid">
+        <netui-data:configurePager disableDefaultPager="true"/>
+          <netui-data:header>
+            <netui-data:headerCell headerText="Product Name"/>
+            <netui-data:headerCell headerText="Detailed Product Information"/>
+          </netui-data:header>
+          <netui-data:rows>
+            <netui-data:spanCell value="${container.item}"/>
+            <netui-data:anchorCell action="productDetails" value="click for details...">
+              <netui:parameter name="key" value="${container.item}"/>
+            </netui-data:anchorCell>
+          </netui-data:rows>
+
+      </netui-data:dataGrid>
+
+
+  </netui:body>
+
+</netui:html>

Added: incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/details.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/details.jsp?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/details.jsp (added)
+++ incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/details.jsp Tue May 10 13:32:29 2005
@@ -0,0 +1,62 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
+
+<netui:html>
+  <head>
+    <title>JdbcControl Sample Application</title>
+    <netui:base/>
+    <style>
+.datagrid-header{
+    background-color: #eeeeee;
+}
+.datagrid-header-cel{
+    background-color: #f0f0f0;
+}
+.custom-datagrid-header-cell{
+    background-color: #0f0f0f;
+}
+.datagrid-data-cell{
+}
+.datagrid-even{
+    background-color: #ffffff;
+}
+.datagrid-even a {
+    text-decoration: none;
+    color: #000000;   
+}
+.datagrid-odd{
+    background-color: #ffffde;
+}
+.datagrid-odd a {
+    text-decoration: none;
+    color: #000000;
+}
+    </style>
+  </head>
+
+  <netui:body>
+      <p></p>
+      <p>This page displays additional data for the specified product name.  Data is retrieved from the database
+         by the JdbcControl SimpleDBControl.jcx using its getProductDetails() method.</p>
+      <p></p>
+
+      <netui-data:dataGrid dataSource="pageFlow.productDetails" name="productDetailsGrid">
+        <netui-data:configurePager disableDefaultPager="true"/>
+          <netui-data:header>
+            <netui-data:headerCell headerText="Product Name"/>
+            <netui-data:headerCell headerText="Product Description"/>
+            <netui-data:headerCell headerText="Quantity"/>
+          </netui-data:header>
+        <netui-data:rows>
+          <netui-data:spanCell value="${container.item.name}"/>
+          <netui-data:spanCell value="${container.item.description}"/>
+          <netui-data:spanCell value="${container.item.quantity}"/>
+        </netui-data:rows>
+      </netui-data:dataGrid>
+      <br>
+      <p><netui:anchor action="startDemo">back</netui:anchor></p>
+  </netui:body>
+
+</netui:html>

Added: incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/error.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/error.jsp?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/error.jsp (added)
+++ incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/error.jsp Tue May 10 13:32:29 2005
@@ -0,0 +1,69 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<netui:html>
+  <head>
+    <title>NetUI Error</title>
+    <style>
+    table {
+        border: solid 1pt #90180F;
+        background-color: #ffffff;
+    }
+    body {
+        margin: 20pt 5%;
+        background-color: #fdf4b6;
+        font-family: Arial, Helvetica, sans-serif;
+        font-size: 10pt;
+    }
+    .caption {
+        font-weight: bold;
+        font-size: 20pt;
+        text-align: left;
+        width: 500px
+    }
+    th {vertical-align: top;
+        text-align: right;
+        font-size: 12pt;
+        color: #90180F;
+        width: 100px;
+    }
+    td {
+        text-align: left;
+        }
+    hr {
+        color: #90180F;
+    }
+    .posTitle {
+        position: relative; 
+        color: #6C0C06;
+        left: -160pt; 
+        top: -12pt; 
+    }
+    .pfErrorLineOne {
+        color: red;
+        font-size: 12pt;
+        font-style: italic;
+    }
+    img {
+        border: solid 2pt #90180F;
+    }
+    </style>
+    <netui:base/>
+  </head>
+  <netui:body>
+    <div class="caption">
+    <netui:image src="${pageContext.request.contextPath}/resources/beehive/version1/images/error-header.jpg" width="338" height="96" alt="Page Flow Error"/>
+    <span class="posTitle">NetUI Error</span>
+    </div>
+    <table border="0" cellspacing='0' cellpadding='4'>
+       <c:if test="${request.errorMessage != null}">
+            <tr><th>Message:</th><td class="pfErrorLineOne"><netui:label value="${request.errorMessage}" defaultValue="&nbsp;"/></td></tr>
+       </c:if> 
+       <tr><th>Exception:</th><td class="pfErrorLineOne"><netui:exceptions showMessage="true"/></td></tr> 
+       <tr><td colspan="2" style="min-width:342"><hr></td></tr>     
+       <tr><th>Stack Trace:</th><td><netui:exceptions showMessage="false" showDevModeStackTrace="true"/></td></tr>
+    </table>      
+  </netui:body>
+</netui:html>
+<%-- Some browsers will not display this page unless the response status code is 200. --%>
+<% response.setStatus(200); %>

Added: incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/index.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/index.jsp?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/index.jsp (added)
+++ incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/index.jsp Tue May 10 13:32:29 2005
@@ -0,0 +1,16 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
+<netui:html>
+  <head>
+    <title>Sample JdbcControl Page</title>
+    <netui:base/>
+  </head>
+  <netui:body>
+    <p>
+      Sample JdbcControl Page
+      <netui:anchor action="startDemo">Start Demo</netui:anchor>
+    </p>
+  </netui:body>
+</netui:html>

Added: incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/sql.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/sql.jsp?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/sql.jsp (added)
+++ incubator/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/sql.jsp Tue May 10 13:32:29 2005
@@ -0,0 +1,59 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
+<%@ page import="java.sql.*,javax.naming.*,javax.sql.*" %>
+<html>
+  <head>
+    <title>SQL on Tomcat Test</title>
+  </head>
+  <body>
+    <p>
+    <b>SQL on Tomcat Test</b>
+
+<%
+    Class.forName("org.apache.derby.jdbc.EmbeddedDriver");    
+
+    Context ctx = new InitialContext();
+    if(ctx == null) 
+        throw new RuntimeException("Could not create an InitialContext");
+
+    DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
+    if(ds == null) 
+        throw new RuntimeException("Could not create a DataSource");
+    out.write("<br/>found ds: " + ds + "<br/>");
+
+    Connection conn = ds.getConnection();
+    if(conn == null) 
+        throw new RuntimeException("Could not get database connection");
+    out.write("got here</br>");
+
+    java.sql.Statement stmt = conn.createStatement();
+    try {
+      stmt.execute("drop table CATEGORIES");
+      stmt.close();
+    } catch(Exception ignore) {ignore.printStackTrace(); stmt.close();}
+    stmt = conn.createStatement();
+    boolean result = stmt.execute(
+     "CREATE TABLE Categories (CategoryID int GENERATED ALWAYS AS IDENTITY, CategoryName varchar (15) NOT NULL, Description CLOB (2K), CONSTRAINT PK_Categories PRIMARY KEY(CategoryID))");
+    out.write("result: " + result);
+    stmt.close();
+
+    stmt = conn.createStatement();
+    stmt.execute("insert into categories (CategoryName,Description) VALUES('Beverages','Soft drinks, coffees, teas, beers, and ales')");
+    stmt.close();
+
+    stmt = conn.createStatement();
+    ResultSet rs = stmt.executeQuery("select * from categories");
+    pageContext.setAttribute("rs", rs);
+    while(rs.next()) {
+        out.write("name: " + rs.getObject("categoryname") + "<br/>");
+        out.write("name: " + rs.getObject("description") + "<br/>");
+    }
+    rs.close();
+    stmt.close();
+    conn.close();
+%>
+    </p>
+  </body>
+</html>

Added: incubator/beehive/trunk/system-controls/samples/jms/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jms/build.xml?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jms/build.xml (added)
+++ incubator/beehive/trunk/system-controls/samples/jms/build.xml Tue May 10 13:32:29 2005
@@ -0,0 +1,66 @@
+<?xml version="1.0" ?>
+
+
+<project name="jms-control" basedir="." default="build">
+
+    <import file="../../systemcontrols-imports.xml"/>
+
+    <property name="samples.src.dir" value="${basedir}/src"/>
+    <property name="samples.build.dir" value="${basedir}/build"/>
+    <property name="samples.build.classes" value="${samples.build.dir}/classes"/>
+    <property name="samples.build.beansrc" value="${samples.build.dir}/beansrc"/>
+    <property name="samples.lib.dir" value="${basedir}/lib"/>
+
+    <path id="build.classpath">
+        <fileset file="${build.lib.dir}/beehive-jms-control.jar"/>
+        <path refid="controls.dependency.path"/>
+        <path refid="ejb.dependency.path"/>
+        <path refid="xbean.dependency.path"/>
+        <path refid="velocity.dependency.path"/>
+    </path>
+
+    <taskdef name="apt"
+        classname="org.apache.beehive.controls.runtime.generator.AptTask"
+        onerror="report"
+        classpathref="build.classpath"/>
+
+
+    
+
+    <target name="clean" description="Deletes all generated files">
+        <delete dir="${samples.build.dir}"/>
+        <delete file="velocity.log"/>
+    </target>
+
+
+    <target name="dirs">
+        <mkdir dir="${samples.build.classes}"/>
+        <mkdir dir="${samples.build.beansrc}"/>
+        <mkdir dir="${samples.lib.dir}"/>
+    </target>
+
+
+    <target name="build" depends="dirs" description="Build samples">
+
+        <apt srcdir="${samples.src.dir}"
+            destdir="${samples.build.classes}"
+            gendir="${samples.build.beansrc}"
+            excludes="**/Test*.java"
+            classpathref="build.classpath"
+            debug="on"
+            compileByExtension="true"
+            srcExtensions="*.java,*.jcx,*.jcs"
+            target="1.5">
+        </apt>
+
+        <javac
+            destdir="${samples.build.classes}"
+            source="1.5"
+            debug="on"
+            classpathref="build.classpath"
+            includes="**/Test*.java">
+            <src path="${samples.src.dir}"/>
+        </javac>
+
+    </target>
+</project>

Added: incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/ControlTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/ControlTestCase.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/ControlTestCase.java (added)
+++ incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/ControlTestCase.java Tue May 10 13:32:29 2005
@@ -0,0 +1,134 @@
+/*
+ * 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.system.jms.samples;
+
+
+import java.beans.Beans;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.beehive.controls.api.bean.ControlBean;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.context.ControlThreadContext;
+import org.apache.beehive.controls.api.context.ControlContainerContext;
+
+
+/**
+ * An test case that handles establishing a bean context
+ * if there isn't one and providing methods instantiating controls by name
+ * via proper channels (@see Beans.instantiate) and adding/removing
+ * them.
+ */
+public abstract class ControlTestCase extends TestCase
+{
+    /* Public Constructor(s) */
+    /**
+     * Contstruct a test-case with the given name.
+     * @param name the name of the test case.
+     */
+    public ControlTestCase(String name) throws Exception
+    {
+        super(name);
+    }
+    /* Public Method(s) */
+    /**
+     * @see TestCase#setUp
+     */
+    public void setUp() throws Exception
+    {
+        _embeddedContext = ControlThreadContext.getContext();
+        if(_embeddedContext == null)
+        {
+            _embeddedContext = _cntxt = new DefaultContainerContext();
+	        _cntxt.beginContext();
+        }
+        initializeAsClient(this);
+    }
+    /**
+     * @see TestCase#tearDown
+     */
+    public void tearDown() throws Exception
+    {
+        if(_cntxt != null)
+        {
+            _cntxt.endContext();
+        }
+    }
+    /* Protected Method(s) */
+    /**
+     * Instantiate the control with the given name and add
+     * it to the current bean-context.
+     * @param name the fully-qualified name of the control.
+     */
+    protected ControlBean instantiateControl(String name) throws Exception
+    {
+        ControlBean bean = (ControlBean)Beans.instantiate(Thread.currentThread().getContextClassLoader(),
+                name,_embeddedContext);
+        initializeAsClient(bean);
+        return bean;
+    }
+    /**
+     * Remove the given control from the current bean-context.
+     * @param bean
+     */
+    protected void freeControl(ControlBean bean)
+    {
+        if(bean != null)
+        {
+            _embeddedContext.remove(bean);
+        }
+    }
+    /**
+     * Initialize this junit as a control client.
+     */
+    protected void initializeAsClient(Object obj)
+    {
+        if(_cntxt == null)
+        {
+            return;
+        }
+        Class cls = obj.getClass();
+        while(cls != null && cls != ControlTestCase.class && cls != Object.class)
+        {
+	        String init = cls.getName()+CLASS_ClientInitializer;
+	        try
+	        {
+	            Class clazz = Thread.currentThread().getContextClassLoader().loadClass(init);
+	            Object initializer = cls.newInstance();
+	            Method m = clazz.getMethod(METHOD_Initialize,new Class[] {ControlBeanContext.class,cls });
+	            m.invoke(initializer,new Object[] { _cntxt ,this } );
+	            
+	        }
+	        catch(Exception e)
+	        {
+	            
+	        }
+	        cls = cls.getSuperclass();
+        }
+    }
+    /* Private Constant(s) */
+    final private static String CLASS_ClientInitializer 	= "ClientInitializer";
+    final private static String METHOD_Initialize 			= "initialize";
+    
+    /* Private Field(s) */
+    /* The current context. */
+    private ControlContainerContext _embeddedContext;
+    /* The default context if one didn't exist */
+    private ControlContainerContext _cntxt;
+}

Added: incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/DefaultContainerContext.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/DefaultContainerContext.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/DefaultContainerContext.java (added)
+++ incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/DefaultContainerContext.java Tue May 10 13:32:29 2005
@@ -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.system.jms.samples;
+
+
+import java.io.IOException;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.context.ControlHandle;
+import org.apache.beehive.controls.api.bean.ControlBean;
+import org.apache.beehive.controls.runtime.bean.ControlContainerContext;
+import org.apache.beehive.controls.runtime.bean.ControlBeanContext;
+
+
+
+
+
+/**
+ * The DefaultContainerContext provides a ControlContainerContext implementation to be used
+ * for simple testing of controls.
+ */
+public class DefaultContainerContext extends ControlContainerContext
+{
+
+    /* Public Constructor(s) */
+    /**
+     * Construct a container-context for a standalone
+     * application use.
+     */
+    public DefaultContainerContext()
+    {
+        super();
+    }
+    /* Public Method(s) */
+
+    /**
+     * @see ControlContainerContext#getControlHandle(org.apache.beehive.controls.runtime.bean.ControlBean)
+     */
+    public ControlHandle getControlHandle(ControlBean bean)
+    {
+        return new DefaultControlHandle(this,bean);
+    }
+    
+    /* Private Constant(s) */
+    private static final long serialVersionUID = -7967007783133727017L;
+
+}

Added: incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/DefaultControlHandle.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/DefaultControlHandle.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/DefaultControlHandle.java (added)
+++ incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/DefaultControlHandle.java Tue May 10 13:32:29 2005
@@ -0,0 +1,114 @@
+/*
+ * 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.system.jms.samples;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.beehive.controls.api.context.ControlHandle;
+import org.apache.beehive.controls.api.context.ControlThreadContext;
+import org.apache.beehive.controls.api.events.EventRef;
+import org.apache.beehive.controls.api.bean.ControlBean;
+import org.apache.beehive.controls.api.context.ControlContainerContext;
+
+/**
+ * A control-handle used for simple invokation/event support.
+ */
+public class DefaultControlHandle implements ControlHandle, Serializable
+{
+    /** Public Constructor(s) */
+    /**
+     * Default constructor (used by serialization).
+     */
+    public DefaultControlHandle()
+    {
+
+    }
+
+    /**
+     * Construct a simple-control handle.
+     * 
+     * @param context
+     *            The control-container-context.
+     * @param bean
+     *            the control bean.
+     */
+    public DefaultControlHandle(ControlContainerContext context,
+            ControlBean bean)
+    {
+        _context = context;
+        _controlId = bean.getControlID();
+        _controlInterface = bean.getControlInterface().getName();
+        _controlBean = bean.getClass().getName();
+    }
+
+    /** Public Method(s) */
+    /**
+     * @see org.apache.beehive.controls.api.context.ControlHandle#getControlID()
+     */
+    public String getControlID()
+    {
+        return _controlId;
+    }
+
+    /**
+     * @see org.apache.beehive.controls.api.context.ControlHandle#sendEvent(org.apache.beehive.controls.api.events.EventRef,
+     *      java.lang.Object[])
+     */
+    public Object sendEvent(EventRef event, Object[] args)
+            throws IllegalAccessException, IllegalArgumentException,
+            InvocationTargetException
+    {
+        if(_context == null)
+        {
+            _context = ControlThreadContext.getContext();
+        }
+        if(_context == null)
+        {
+            throw new IllegalArgumentException("No container context to send event to");
+        }
+        try
+        {
+            //
+            // Push the test context, to simulate re-entering the container
+            //
+            _context.beginContext();
+
+            return _context.dispatchEvent(this, event, args);
+        } finally
+        {
+            _context.endContext();
+        }
+    }
+
+    private static final long serialVersionUID = 1928410200080675302L;
+
+    /* Private Field(s) */
+    /** The control-id of the control. */
+    private String _controlId;
+
+    /** The interface class of the control. */
+    private String _controlInterface;
+
+    /** The bean class of the control. */
+    private String _controlBean;
+
+    /** The control container context */
+    private transient ControlContainerContext _context;
+
+}

Added: incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/OrderQueue.jcx
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/OrderQueue.jcx?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/OrderQueue.jcx (added)
+++ incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/OrderQueue.jcx Tue May 10 13:32:29 2005
@@ -0,0 +1,59 @@
+/*
+ * 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.system.jms.samples;
+
+import java.util.Date;
+
+import org.apache.beehive.controls.api.bean.ControlExtension;
+import org.apache.beehive.controls.system.jms.JMSControl;
+
+
+@ControlExtension
+@JMSControl.Destination(sendJndiName="jms.SimpleJmsQ",jndiConnectionFactory="weblogic.jws.jms.QueueConnectionFactory")
+public interface OrderQueue extends JMSControl
+{
+    /**
+     * Represents a simple order.
+     */
+	public class Order implements java.io.Serializable
+	{
+	    /**
+         * Comment for <code>serialVersionUID</code>
+         */
+        private static final long serialVersionUID = 8951994251593378324L;
+        public Order()
+	    {
+	        
+	    }
+	    public Order(int buyer,String[] list)
+	    {
+	        buyerId = buyer;
+	        itemList = list;
+	        
+	    }
+	    private int buyerId;
+	    private String[] itemList;
+	}
+	/**
+	 * Submit an order with the given deliverBy and type.
+	 * @param order the order to be submitted.
+	 * @param deliverBy the deliver by date.
+	 * @return the JMS message sent.
+	 */
+    public javax.jms.Message submitOrder(Order order,@Property(name="DeliverBy") Date deliverBy);
+}

Added: incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/SampleQueue.jcx
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/SampleQueue.jcx?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/SampleQueue.jcx (added)
+++ incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/SampleQueue.jcx Tue May 10 13:32:29 2005
@@ -0,0 +1,50 @@
+/*
+ * 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.system.jms.samples;
+
+import java.util.Date;
+
+import org.apache.beehive.controls.api.bean.ControlExtension;
+import org.apache.beehive.controls.system.jms.JMSControl;
+import org.apache.xmlbeans.XmlObject;
+
+@ControlExtension
+@JMSControl.Destination(sendJndiName="jms.SampleQueue",jndiConnectionFactory="weblogic.jws.jms.QueueConnectionFactory")
+public interface SampleQueue extends JMSControl
+{
+	/**
+	 * Submit an xml object (org.apache.xmlbeans) as a text message.
+	 * @param document the document.
+	 * @param type the message JMS type.
+	 */
+    public void submitXml(XmlObject document,@Type String type);
+    
+    /**
+	 * Submit an xml object (org.apache.xmlbeans) with JMS type "xmlObject".
+	 * @param document the document.
+	 */
+	@Message(MessageType.Text)
+	@Type("xmlObject")
+    public void submitXml(XmlObject document);
+    
+    /**
+	 * Submit an already constructed message
+	 * @param message the jms-message.
+	 */
+    public void submitMessage(Message message);
+}

Added: incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/TestOrderQueue.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/TestOrderQueue.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/TestOrderQueue.java (added)
+++ incubator/beehive/trunk/system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/TestOrderQueue.java Tue May 10 13:32:29 2005
@@ -0,0 +1,72 @@
+/*
+ * 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.system.jms.samples;
+
+import java.util.Date;
+
+import javax.jms.Message;
+import javax.jms.Queue;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.system.jms.samples.OrderQueueBean;
+import org.apache.beehive.controls.system.jndi.JndiControlBean;
+
+/**
+ * Test the order-queue jms-control.
+ * This test case will work with an ejb-container. Just set 
+ * the system properties jndi.provider and jndi.factory.
+ */
+public class TestOrderQueue extends ControlTestCase
+{    
+    public TestOrderQueue(String name) throws Exception
+    {
+        super(name);
+    }
+    public void testQueue() throws Exception
+    {
+        // Programmatically instantiate order queue.
+        OrderQueueBean orders = (OrderQueueBean)instantiateControl("org.apache.beehive.controls.system.jms.samples.OrderQueueBean");
+        // Load up jndi info.
+        String provider = System.getProperty("jndi.provider");
+        if(provider != null)
+        {
+            orders.setJndiProviderURL(provider);
+        }
+        String factory = System.getProperty("jndi.factory");
+        if(factory != null)
+        {
+            orders.setJndiContextFactory(factory);
+        }
+        // Submit an order.
+        OrderQueue.Order order = new OrderQueue.Order(5,new String[] { "hair spray"});
+        Date now = new Date();
+        Message mess = orders.submitOrder(order,now);
+        javax.jms.QueueSession sess = (javax.jms.QueueSession)orders.getSession();
+        sess.commit();
+        // Read the queue using the same session/connection.
+        orders.getConnection().start();
+        javax.jms.QueueReceiver consumer = sess.createReceiver((Queue)orders.getDestination());
+        Message qmess = consumer.receive(5000);
+        consumer.close();
+        assertNotNull(qmess);
+        String by = qmess.getStringProperty("DeliverBy");
+        assertNotNull(by);
+        assertEquals(by,now);
+    }
+
+}

Added: incubator/beehive/trunk/system-controls/samples/webservice/amazon/README.txt
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/amazon/README.txt?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/amazon/README.txt (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/amazon/README.txt Tue May 10 13:32:29 2005
@@ -0,0 +1,10 @@
+Amazon web services are in beta stage.  Their WSDL is subject to change.
+
+This sample is built with the 2005-01-19 version of the Commerce WSDL that was
+obtained from: 
+
+http://www.amazon.com/gp/aws/sdk/002-3610582-9148860?
+
+The Alex Web Service WSDL was downloaded from:
+
+http://www.amazon.com/gp/browse.html/ref=sc_fe_l_1/002-3610582-9148860?%5Fencoding=UTF8&node=12782661&no=13584171&me=A36L942TSJ2AJA

Added: incubator/beehive/trunk/system-controls/samples/webservice/amazon/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/amazon/build.xml?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/amazon/build.xml (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/amazon/build.xml Tue May 10 13:32:29 2005
@@ -0,0 +1,214 @@
+<!--
+   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:$
+ -->
+
+<project name="xmlbea _service_control_sample" default="run.test">
+
+    <property environment="env"/>
+    <property name="beehive.home" value="${env.BEEHIVE_HOME}"/>
+    <import file="${beehive.home}/beehive-imports.xml" />
+
+    <property name="build.dir" value="./build"/>
+    <property name="xbeangen.dir" value="${build.dir}/xbeangen"/>
+    <property name="extgen.dir" value="${build.dir}/extgen"/>
+    <property name="jcxgen.dir" value="${build.dir}/controlgen"/>
+
+
+    <property name="source.dir" value="./src"/>
+
+    <property name="junit.source.dir" value="./junit"/>
+    <property name="common.source.dir" value="../common/src"/>
+    <property name="test.logs" value="./logs"/>
+    <property name="servers.dir" value="./servers/local"/>  <!-- test servers -->
+    <property name="build.classes" value="${build.dir}/classes"/>
+    <property name="build.beansrc" value="${build.dir}/beansrc"/>
+    <property name="axisbeangen.dir" value="${build.dir}/axisbeangen"/>
+    <property name="servicecontrol.jar" value="../../servicecontrol/build/jars/webservice-control.jar"/>
+
+    <property name="beehive.common.lib.dir" value="${beehive.home}/lib/common"/>
+
+    <property name="controls.jar" value="${beehive.home}/lib/controls/beehive-controls.jar"/>
+    <property name="schema.dir" value="schemas"/>
+
+
+    <path id="beehive.class.path">
+        <fileset dir="${beehive.home}/lib/wsm" includes="*.jar"/>
+        <pathelement location="${beehive.home}/lib/controls/beehive-controls.jar"/>
+        <fileset dir="${beehive.common.lib.dir}">
+            <include name="**/*.jar"/>
+        </fileset>
+        <pathelement location="${lib.dir}/junit-3.8.1.jar"/>
+        <pathelement location="${basedir}/lib/servlet-api-2.4-20040521.jar"/>
+        <pathelement location="${basedir}/lib/jsp-api-2.0-20040521.jar"/>
+    </path>
+
+    <path id="build.classpath">
+        <fileset dir="${beehive.home}/lib/wsm">
+            <include name="*.jar"/>
+        </fileset>
+        <pathelement location="${beehive.home}/lib/controls/beehive-webservice-control.jar"/>
+        <pathelement location="../lib/commons-cli-1.0.jar"/>
+        <!--
+        <fileset dir="../../servicecontrol/lib">
+            <include name="**/*.jar"/>
+        </fileset>
+        -->
+
+        <path refid="beehive.class.path"/>
+        <pathelement path="${servicecontrol.jar}"/>
+    </path>
+
+    <taskdef name="apt" classname="org.apache.beehive.controls.runtime.generator.AptTask"
+        classpath="${controls.jar}" onerror="report"/>
+    <taskdef name="control-jar"
+        classname="org.apache.beehive.controls.runtime.packaging.ControlJarTask"
+        classpath="${controls.jar}" onerror="report"/>
+
+    <!-- XMLBean build -->
+    <taskdef name="xmlbeanbuild"
+        classname="org.apache.xmlbeans.impl.tool.XMLBean">
+        <classpath>
+            <path refid="build.classpath"/>
+        </classpath>
+    </taskdef>
+
+    <target name="clean" description="Deletes all generated files">
+        <delete dir="${build.dir}"/>
+        <delete file="velocity.log"/>
+        <delete dir="${xbeangen.dir}"/>
+        <delete dir="${test.logs}"/>
+        <delete dir="${extgen.dir}"/>
+        <delete dir="${jcxgen.dir}"/>
+    </target>
+
+    <target name="dirs">
+        <mkdir dir="${build.classes}"/>
+        <mkdir dir="${xbeangen.dir}"/>
+        <mkdir dir="${test.logs}"/>
+        <mkdir dir="${extgen.dir}"/>
+        <mkdir dir="${jcxgen.dir}"/>
+    </target>
+
+    <target name="build" depends="build_jcx, build_junit" description="Builds source, and servlets"/>
+
+
+    <target name="gen_jcx" depends="gen_xmlbeans">
+        <java classname="org.apache.beehive.controls.system.webservice.generator.ExtensionMaker">
+            <classpath>
+                <path refid="build.classpath"/>
+                <pathelement location="${build.classes}"/>
+            </classpath>
+            <arg line="-gen_root ${jcxgen.dir}
+                -wsdl ${schema.dir}
+                -pkg amazonWS
+                -wsdl_path_annotation ."/>
+        </java>
+
+        <!-- have the wsdls, next to the jcx files -->
+        <copy todir="${jcxgen.dir}/amazonWS">
+            <fileset dir="${schema.dir}">
+                <include name="**/*.wsdl"/>
+            </fileset>
+        </copy>
+
+    </target>
+
+    <target name="build_jcx" depends="gen_jcx">
+        <echo message="jcxgen: ${jcxgen.dir}   extgen: ${extgen.dir}"/>
+
+        <apt srcdir="${jcxgen.dir}"
+            destdir="${build.classes}"
+            gendir="${extgen.dir}"
+            classpathref="build.classpath"
+            compileByExtension="true"
+            srcExtensions="*.jcx,*.java"
+            debug="true"/>
+
+        <!-- copy wsdls to the classes -->
+        <copy todir="${build.classes}">
+            <fileset dir="${jcxgen.dir}">
+                <include name="**/*.wsdl"/>
+                <include name="**/*.properties"/>
+            </fileset>
+        </copy>
+
+    </target>
+
+
+    <target name="checkxbean">
+        <uptodate property="noxbeanrebuild" targetfile="${xbeangen.dir}">
+            <srcfiles dir="${schema.dir}" includes="*.wsdl,*.xsd"/>
+        </uptodate>
+    </target>
+
+    <target name="gen_xmlbeans" depends="checkxbean, dirs" unless="noxbeanrebuild">
+        <xmlbeanbuild
+            schema="${schema.dir}"
+            srcgendir="${xbeangen.dir}"
+            classgendir="${build.classes}"
+            failonerror="true">
+            <classpath>
+                <path refid="build.classpath"/>
+            </classpath>
+        </xmlbeanbuild>
+    </target>
+
+
+    <target name="build_junit" depends="build_jcx">
+
+        <apt srcdir="${common.source.dir}" destdir="${build.classes}" gendir="${build.beansrc}"
+            debug="on"
+            compileByExtension="true"
+            srcExtensions="*.jcx,*.java">
+            <classpath>
+                <path refid="build.classpath"/>
+            </classpath>
+        </apt>
+
+        <apt srcdir="${junit.source.dir}" destdir="${build.classes}" gendir="${build.beansrc}"
+            debug="on"
+            compileByExtension="true"
+            srcExtensions="*.jcx,*.java">
+            <classpath>
+                <path refid="build.classpath"/>
+            </classpath>
+        </apt>
+
+        <!-- update properties (e.g. log4j.properties) -->
+        <copy todir="${build.classes}">
+            <fileset dir="${junit.source.dir}">
+                <include name="**/*properties"/>
+            </fileset>
+        </copy>
+
+    </target>
+    <target name="run.test" depends="build">
+        <junit failureproperty="testfailed" printsummary="on" tempdir="${build.dir}" fork="yes">
+            <classpath>
+                <pathelement location="${build.classes}"/>
+                <path refid="build.classpath"/>
+            </classpath>
+            <formatter type="plain"/>
+            <batchtest filtertrace="off" todir="${test.logs}">
+                <fileset dir="${junit.source.dir}">
+                    <include name="**/*Test.java"/>
+                </fileset>
+            </batchtest>
+        </junit>
+        <fail if="testfailed" message="One or more tests in the Google test failed."/>
+    </target>
+</project>

Added: incubator/beehive/trunk/system-controls/samples/webservice/amazon/junit/AmazonCommerceTest.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/amazon/junit/AmazonCommerceTest.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/amazon/junit/AmazonCommerceTest.java (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/amazon/junit/AmazonCommerceTest.java Tue May 10 13:32:29 2005
@@ -0,0 +1,124 @@
+/*
+ * 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.List;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.wsm.databinding.GenericHolder;
+import org.apache.xmlbeans.XmlCursor;
+import test.ControlTestCase;
+import amazonWS.AWSECommerceService;
+
+import com.amazon.webservices.awsAlexa.x20040915.OperationRequestDocument;
+import com.amazon.webservices.awseCommerceService.x20050323.ErrorsDocument.Errors;
+import com.amazon.webservices.awseCommerceService.x20050323.ItemsDocument.Items;
+import com.amazon.webservices.awseCommerceService.x20050323.OperationRequestDocument.OperationRequest;
+import com.amazon.webservices.awseCommerceService.x20050323.ItemSearchDocument;
+import com.amazon.webservices.awseCommerceService.x20050323.ItemSearchResponseDocument;
+import com.amazon.webservices.awseCommerceService.x20050323.ItemSearchDocument.ItemSearch;
+import com.amazon.webservices.awseCommerceService.x20050323.ItemSearchResponseDocument.ItemSearchResponse;
+import com.amazon.webservices.awseCommerceService.x20050323.ItemSearchRequest;
+
+/*******************************************************************************
+ * 
+ * 
+ * @author Jonathan Colwell
+ */
+public class AmazonCommerceTest extends ControlTestCase {
+	String subId = "1QZP1NHPQW2XT7SJ9AG2";
+
+	String validate = "False";
+
+	@Control
+	public AWSECommerceService mAmazonECS;
+
+	public void testItemSearch() throws Exception {
+
+		String subId = "1QZP1NHPQW2XT7SJ9AG2";
+		String validate = "False";
+
+		ItemSearchRequest isr = ItemSearchRequest.Factory.newInstance();
+		isr.setSearchIndex("SportingGoods");
+		isr.setManufacturer("Callaway");
+
+		GenericHolder<Items[]> itemsHolder = new GenericHolder<Items[]>(
+				new Items[0]);
+		GenericHolder<OperationRequest> operationRequestHolder = new GenericHolder<OperationRequest>(
+				OperationRequest.Factory.newInstance());
+
+		mAmazonECS.ItemSearch(subId, "", "", validate, isr, null, itemsHolder,
+				operationRequestHolder);
+
+		Items[] items = itemsHolder.value;
+		// OperationRequest opReq = searchResults.getOperationRequest();
+		assertNotNull(items);
+		// assertNotNull(opReq);
+		assertTrue("Invalid Item length... Make sure your WSDL is up to date!",
+				items.length > 0);
+		if (items[0].getRequest().isSetErrors()) {
+			Errors errs = items[0].getRequest().getErrors();
+			Errors.Error[] errArray = errs.getErrorArray();
+			for (Errors.Error err : errArray) {
+				System.out.println(err.getMessage());
+			}
+		}
+		assertEquals("True", items[0].getRequest().getIsValid());
+
+	}
+
+	public void testBatchedItemSearch() throws Exception {
+
+		ItemSearchRequest shared = ItemSearchRequest.Factory.newInstance();
+		ItemSearchRequest item1 = ItemSearchRequest.Factory.newInstance();
+		ItemSearchRequest item2 = ItemSearchRequest.Factory.newInstance();
+
+		shared.setSearchIndex("Books");
+		item1.setAuthor("Larson");
+		item2.setTitle("Horton Hearts");
+
+		ItemSearchRequest[] requests = new ItemSearchRequest[2];
+		requests[0] = item1;
+		requests[1] = item2;
+
+		GenericHolder<Items[]> itemsHolder = new GenericHolder<Items[]>(
+				new Items[0]);
+		GenericHolder<OperationRequest> operationRequestHolder = new GenericHolder<OperationRequest>(
+				OperationRequest.Factory.newInstance());
+
+		mAmazonECS.ItemSearch(subId, "", "", validate, shared, requests,
+				itemsHolder, operationRequestHolder);
+
+		Items[] items = itemsHolder.value;
+		// OperationRequest opReq = searchResults.getOperationRequest();
+		assertNotNull(items);
+		// assertNotNull(opReq);
+		assertTrue("Invalid Item length... Make sure your WSDL is up to date!",
+				items.length > 0);
+		if (items[0].getRequest().isSetErrors()) {
+			Errors errs = items[0].getRequest().getErrors();
+			Errors.Error[] errArray = errs.getErrorArray();
+			for (Errors.Error err : errArray) {
+				System.out.println(err.getMessage());
+			}
+		}
+		assertEquals("True", items[0].getRequest().getIsValid());
+
+	}
+
+}

Added: incubator/beehive/trunk/system-controls/samples/webservice/amazon/junit/log4j.properties
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/amazon/junit/log4j.properties?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/amazon/junit/log4j.properties (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/amazon/junit/log4j.properties Tue May 10 13:32:29 2005
@@ -0,0 +1,22 @@
+# Set root category priority to INFO and its only appender to CONSOLE.
+log4j.rootCategory=DEBUG, CONSOLE
+#log4j.rootCategory=INFO, CONSOLE, LOGFILE
+log4j.logger.org.apache.beehive.controls.system.webservice=	DEBUG, CONSOLE
+
+# Set the enterprise logger category to FATAL and its only appender to CONSOLE.
+log4j.logger.org.apache.axis=	INFO, CONSOLE
+log4j.logger.org.apache.axis.client=	debug, CONSOLE
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=- %c: %m%n
+
+# LOGFILE is set to be a File appender using a PatternLayout.
+log4j.appender.LOGFILE=org.apache.log4j.FileAppender
+log4j.appender.LOGFILE.File=axis.log
+log4j.appender.LOGFILE.Append=true
+log4j.appender.LOGFILE.Threshold=INFO
+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+