You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by st...@apache.org on 2005/12/15 16:59:01 UTC
svn commit: r357035 [1/2] - in
/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample: ./ WEB-INF/
src/ src/controls/ src/servlet/ src/shared/ web/ web/WEB-INF/
web/resources/ web/resources/beehive/ web/resources/beehive/version1/
web/resources/...
Author: steveh
Date: Thu Dec 15 07:58:48 2005
New Revision: 357035
URL: http://svn.apache.org/viewcvs?rev=357035&view=rev
Log:
First pass at resuscitating the db system control sample.
The sample as been reformatted to fit the 'netui-blank' directory style.
Some action outputs/page inputs added.
Test: build.dist pass
Added:
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.properties (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.xml (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/PopulateDBCtrl.java (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/SimpleDBControl.java (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/log4j.xml (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/servlet/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/servlet/DerbyListener.java (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/shared/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/shared/SharedFlow.java (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/Controller.java (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/beehive-netui-validator-rules.xml (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/validator-rules.xml (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/web.xml (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/demo.jsp (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/details.jsp (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/error.jsp (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/index.jsp (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/error-header.jpg (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/folder.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastLineJoin.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastNodeCollapsed.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastNodeExpanded.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lineJoin.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/nodeCollapsed.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/nodeExpanded.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/rootCollapsed.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/rootExpanded.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortable.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortdown.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortup.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/spacer.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/verticalLine.gif (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/javascript/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/javascript/netui-datagrid.js (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/javascript/netui-tree.js (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/jsps/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/jsps/error.jsp (with props)
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/sql.jsp (with props)
Removed:
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/Controller.jpf
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/WEB-INF/
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/demo.jsp
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/details.jsp
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/error.jsp
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/index.jsp
beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/sql.jsp
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.properties
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.properties?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.properties (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.properties Thu Dec 15 07:58:48 2005
@@ -0,0 +1,9 @@
+#
+#
+#
+beehive.home=../../
+
+servlet-api.jar=${os.CATALINA_HOME}/common/lib/servlet-api.jar
+jsp-api.jar=${os.CATALINA_HOME}/common/lib/jsp-api.jar
+
+context.path=jdbcControlSample
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.xml?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.xml (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.xml Thu Dec 15 07:58:48 2005
@@ -0,0 +1,141 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2004-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:$
+ -->
+
+<!--
+ An Ant build file for compiling a Beehive page flow web application.
+-->
+<project name="Beehive/Samples/jdbcControlSample" default="usage" basedir=".">
+
+ <property environment="os"/>
+ <property file="${basedir}/build.properties"/>
+
+ <import file="${beehive.home}/beehive-imports.xml"/>
+ <import file="${beehive.home}/ant/beehive-tools.xml"/>
+
+ <property name="webapp.dir" location="${basedir}"/>
+ <property name="build.dir" location="build"/>
+ <property name="web.dir" location="web"/>
+ <property name="src.dir" location="src"/>
+
+ <property name="tmp.sourcegen.dir" value=".tmpbeansrc"/>
+
+ <!-- Define the classpath used to build the webapp -->
+ <path id="webapp.classpath">
+ <pathelement location="${servlet-api.jar}"/>
+ <pathelement location="${jsp-api.jar}"/>
+ <pathelement location="${build.dir}/WEB-INF/classes"/>
+ <fileset dir="${build.dir}/WEB-INF/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="webapp.sourcepath">
+ <pathelement location="${web.dir}"/>
+ <pathelement location="${src.dir}"/>
+ </path>
+
+ <target name="deploy-beehive" description="Copy the Beehive Page Flow rutime into the target webapp">
+ <mkdir dir="${build.dir}"/>
+ <deploy-netui webappDir="${build.dir}"/>
+ <!-- Needs the beehive-jdbc-controls.jar to work. -->
+ <copy todir="${build.dir}/WEB-INF/lib" file="C:/dev-apache/beehive/trunk/build/dist/apache-beehive-svn-snapshot/lib/controls/beehive-jdbc-control.jar"></copy>
+ </target>
+
+ <target name="build" depends="deploy-beehive" description="Build the webapp">
+ <available property="webapp.dir.available" file="${webapp.dir}" type="dir"/>
+ <fail unless="webapp.dir.available" message="Can't find the webapp directory ${webapp.dir}"/>
+
+ <copy todir="${build.dir}/">
+ <fileset dir="${web.dir}">
+ <exclude name="**/*.java"/>
+ </fileset>
+ </copy>
+
+ <copy todir="${build.dir}/WEB-INF/classes">
+ <fileset dir="${src.dir}/">
+ <include name="sql/**"/>
+ <include name="**/*.properties"/>
+ <include name="**/*.xml"/>
+ </fileset>
+ </copy>
+
+ <!-- compile controls -->
+ <echo>Building Controls</echo>
+ <build-controls srcdir="${basedir}/src"
+ destdir="${build.dir}/WEB-INF/classes"
+ tempdir="${build.dir}/WEB-INF/${tmp.sourcegen.dir}"
+ classpathRef="webapp.classpath"/>
+
+ <!-- compile JPFs -->
+ <echo>Building Page Flows</echo>
+ <build-pageflows srcdir="${basedir}"
+ webcontentdir="${web.dir}"
+ destdir="${build.dir}/WEB-INF/classes"
+ tempdir="${build.dir}/WEB-INF/${tmp.sourcegen.dir}"
+ sourcepathref="webapp.sourcepath"
+ classpathref="webapp.classpath"/>
+
+ <!-- copy resources -->
+ <echo>Copy all .properties and .xml files</echo>
+ <copy todir="${build.dir}/WEB-INF/classes">
+ <fileset dir="${src.dir}" includes="**/*.properties"/>
+ <fileset dir="${src.dir}" includes="**/*.xml"/>
+ </copy>
+ </target>
+
+ <target name="copy.jsps"
+ description="When deploying an exploded webapp, this target copies changed JSPs into the deployed directory">
+ <copy todir="${build.dir}/">
+ <fileset dir="${web.dir}">
+ <exclude name="**/*.java"/>
+ <exclude name="WEB-INF/**"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="clean" description="Clean the webapp">
+ <delete dir="${build.dir}" includeEmptyDirs="true"/>
+ </target>
+
+ <target name="war" description="Build a compressed WAR file that can be deployed to an application container">
+ <property name="archive.dir" value="${basedir}"/>
+
+ <!-- this does *not* exclude source from the archive -->
+ <war destfile="${archive.dir}/${context.path}.war" webxml="${build.dir}/WEB-INF/web.xml">
+ <fileset dir="${build.dir}">
+ <exclude name="WEB-INF/web.xml"/>
+ </fileset>
+ </war>
+ </target>
+
+ <target name="usage" description="Print usage information for this build file">
+ <echo>
+To run the webapp, two steps need to occur:
+- copy the Beehive runtime to the webapp
+- build the webapp
+
+Once the webapp is built, it's ready to deploy onto your application container.
+ </echo>
+
+ <java fork="no" classname="org.apache.tools.ant.Main">
+ <arg line="-f ${ant.file} -projecthelp"/>
+ </java>
+ </target>
+
+</project>
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/PopulateDBCtrl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/PopulateDBCtrl.java?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/PopulateDBCtrl.java (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/PopulateDBCtrl.java Thu Dec 15 07:58:48 2005
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+/**
+ * This Jdbc Control is used to populate the sample database.
+ */
+@org.apache.beehive.controls.api.bean.ControlExtension
+@JdbcControl.ConnectionDriver(databaseDriverClass="org.apache.derby.jdbc.EmbeddedDriver",
+ databaseURL="jdbc:derby:c:/Apache/Derby/jdbcSample/jdbcSampleDB;create=true")
+public interface PopulateDBCtrl extends JdbcControl
+{
+ /**
+ * Create the products table in the database.
+ */
+ @JdbcControl.SQL(statement="CREATE TABLE products (name VARCHAR(64), description VARCHAR(128), quantity INT)")
+ public void createProductsTable() throws SQLException;
+
+ /**
+ * Add a row to the products table.
+ * @param name String
+ * @param description String
+ * @param quantity int
+ */
+ @JdbcControl.SQL(statement="INSERT INTO products VALUES ({name}, {description}, {quantity})")
+ public void addProductRow(String name, String description, int quantity) throws SQLException;
+
+ /**
+ * Returns the number of rows in the products table.
+ * @return
+ */
+ @JdbcControl.SQL(statement="SELECT name FROM products WHERE name='apple'")
+ public String isProductsTableEmpty() throws SQLException;
+
+ static final long serialVersionUID = 1L;
+}
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/PopulateDBCtrl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/SimpleDBControl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/SimpleDBControl.java?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/SimpleDBControl.java (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/SimpleDBControl.java Thu Dec 15 07:58:48 2005
@@ -0,0 +1,65 @@
+/*
+ * 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.ConnectionDriver(databaseDriverClass="org.apache.derby.jdbc.EmbeddedDriver",
+ databaseURL="jdbc:derby:c:/Apache/Derby/jdbcSample/jdbcSampleDB;create=true")
+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;
+}
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/controls/SimpleDBControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/log4j.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/log4j.xml?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/log4j.xml (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/log4j.xml Thu Dec 15 07:58:48 2005
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <appender name="BEEHIVE_FILE_LOG" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="beehive.log"/>
+ <param name="Append" value="true"/>
+ <param name="MaxFileSize" value="500000KB"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} [%x]: %m%n"/>
+ </layout>
+ </appender>
+
+ <appender name="BEEHIVE_CONSOLE_LOG" class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} [%x]: %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- Beehive -->
+ <category name="org.apache.beehive">
+ <priority value="warn"/>
+ <appender-ref ref="BEEHIVE_CONSOLE_LOG"/>
+ </category>
+
+ <!-- NetUI Script: this allows separate configuration of script error reporting -->
+ <category name="org.apache.beehive.netui.script">
+ <priority value="error"/>
+ <appender-ref ref="BEEHIVE_CONSOLE_LOG"/>
+ </category>
+
+ <!-- Struts -->
+ <category name="org.apache.struts">
+ <priority value="warn"/>
+ <appender-ref ref="BEEHIVE_CONSOLE_LOG"/>
+ </category>
+
+ <!-- Jakarta Commons -->
+ <category name="org.apache.commons">
+ <priority value="warn"/>
+ <appender-ref ref="BEEHIVE_CONSOLE_LOG"/>
+ </category>
+
+</log4j:configuration>
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/log4j.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/servlet/DerbyListener.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/servlet/DerbyListener.java?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/servlet/DerbyListener.java (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/servlet/DerbyListener.java Thu Dec 15 07:58:48 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);
+ }
+ }
+}
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/servlet/DerbyListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/shared/SharedFlow.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/shared/SharedFlow.java?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/shared/SharedFlow.java (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/shared/SharedFlow.java Thu Dec 15 07:58:48 2005
@@ -0,0 +1,104 @@
+/*
+ Copyright 2004-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 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={
+ * @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>
+ * @Jpf.SharedFlowField(name="shared")
+ * private shared.SharedFlow _mySharedFlowReference;
+ * </pre>
+ * This is optional; it is useful if you need a hard reference to the shared flow
+ * controller.
+ * </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="/resources/beehive/version1/jsps/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 <code>Jpf.Catch</code> 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;
+ }
+}
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/src/shared/SharedFlow.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/Controller.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/Controller.java?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/Controller.java (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/Controller.java Thu Dec 15 07:58:48 2005
@@ -0,0 +1,131 @@
+import javax.servlet.http.HttpSession;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.controls.api.bean.Control;
+import controls.SimpleDBControl;
+import controls.PopulateDBCtrl;
+import shared.SharedFlow;
+
+@Jpf.Controller(
+ simpleActions={},
+ sharedFlowRefs={
+ @Jpf.SharedFlowRef(name="shared", type=shared.SharedFlow.class)
+ }
+)
+public class Controller
+ extends PageFlowController
+{
+ @Jpf.SharedFlowField(name="shared")
+ private shared.SharedFlow sharedFlow;
+
+ // initialize the SimpleDBCtrl
+ @Control()
+ private SimpleDBControl _simpleDbCtrl;
+
+ // initialize the PopulateDBCtrl
+ @Control()
+ private PopulateDBCtrl _popCtrl;
+
+ public transient String[] productNames;
+ public transient SimpleDBControl.Product productDetails;
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="success", path="index.jsp")
+ }
+ )
+ protected Forward begin() {
+ return new Forward("success");
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="success", path="demo.jsp",
+ actionOutputs = {
+ @Jpf.ActionOutput(name = "products",
+ type = String[].class,
+ required = true)
+ }),
+ @Jpf.Forward(name="error", path="error.jsp")
+ }
+ )
+ protected Forward startDemo() {
+
+ try {
+ productNames = _simpleDbCtrl.getProductNames();
+ } catch (SQLException sqe) {
+ System.out.println("JdbcSampleApp: Error Calling Simpledb: " + sqe);
+ return new Forward("error");
+ }
+ return new Forward("success", "products", productNames);
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="details", path="details.jsp"),
+ @Jpf.Forward(name="error", path="error.jsp")
+ }
+ )
+ protected Forward productDetails() {
+
+ try {
+ productDetails = _simpleDbCtrl.getProductDetails(getRequest().getParameter("key"));
+ } catch (SQLException sqe) {
+ System.out.println("JdbcSampleApp: Error Calling Simpledb: " + sqe);
+ return new Forward("error");
+ }
+ return new Forward("details");
+ }
+
+ /**
+ * Callback that is invoked when this controller instance is created.
+ */
+ protected void onCreate()
+ {
+ String check = null;
+
+ try {
+ Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+ } catch (ClassNotFoundException e) {
+ System.out.println("JdbcSampleApp: Class Not Found: " + e);
+ return;
+ }
+
+ System.out.println("jdbcControlSample: checking to see if products table exists...");
+ try {
+ check = _popCtrl.isProductsTableEmpty();
+ } catch (SQLException sqe) {
+ }
+
+ // table has been loaded -- just return
+ if (check != null) {
+ System.out.println("jdbcControlSample: products table exists.");
+ return;
+ }
+
+ System.out.println("jdbcControlSample: products table does not exist, creating...");
+ try {
+ _popCtrl.createProductsTable();
+ _popCtrl.addProductRow("apple", "red apples", 200);
+ _popCtrl.addProductRow("orange", "orange oranges", 400);
+ _popCtrl.addProductRow("kiwi", "lots of kiwi", 800);
+ _popCtrl.addProductRow("banana", "yellow", 123);
+ _popCtrl.addProductRow("coconut", "coconutty", 21);
+ _popCtrl.addProductRow("plum", "lots of plums", 999);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Callback that is invoked when this controller instance is destroyed.
+ */
+ protected void onDestroy(HttpSession session)
+ {
+ }
+}
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/beehive-netui-validator-rules.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/beehive-netui-validator-rules.xml?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/beehive-netui-validator-rules.xml (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/beehive-netui-validator-rules.xml Thu Dec 15 07:58:48 2005
@@ -0,0 +1,38 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
+<!--
+ This file contains the default NetUI validator definitions. It should be
+ placed in /WEB-INF, and is automatically referenced in Struts config files
+ generated by the Page Flow compiler.
+-->
+
+<form-validation>
+
+ <global>
+
+ <validator name="netui_validwhen"
+ classname="org.apache.beehive.netui.pageflow.validation.ValidatorRules"
+ method="validateValidWhen"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ javax.servlet.http.HttpServletRequest,
+ javax.servlet.ServletContext"
+ msg="errors.netui_validwhen"/>
+
+ <validator name="netui_longRange"
+ classname="org.apache.beehive.netui.pageflow.validation.ValidatorRules"
+ method="validateLongRange"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ javax.servlet.http.HttpServletRequest"
+ depends="long"
+ msg="errors.range"/>
+
+ </global>
+
+</form-validation>
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/beehive-netui-validator-rules.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/validator-rules.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/validator-rules.xml?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/validator-rules.xml (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/validator-rules.xml Thu Dec 15 07:58:48 2005
@@ -0,0 +1,313 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
+<!--
+ $Id: validator-rules.xml 159291 2005-03-28 20:19:29Z niallp $
+
+ This file contains the default Struts Validator pluggable validator
+ definitions. It should be placed somewhere under /WEB-INF and
+ referenced in the struts-config.xml under the plug-in element
+ for the ValidatorPlugIn.
+
+ <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
+ <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
+ /WEB-INF/validation.xml"/>
+ </plug-in>
+
+ These are the default error messages associated with
+ each validator defined in this file. They should be
+ added to your projects ApplicationResources.properties
+ file or you can associate new ones by modifying the
+ pluggable validators msg attributes in this file.
+
+ # Struts Validator Error Messages
+ errors.required={0} is required.
+ errors.minlength={0} can not be less than {1} characters.
+ errors.maxlength={0} can not be greater than {1} characters.
+ errors.invalid={0} is invalid.
+
+ errors.byte={0} must be a byte.
+ errors.short={0} must be a short.
+ errors.integer={0} must be an integer.
+ errors.long={0} must be a long.
+ errors.float={0} must be a float.
+ errors.double={0} must be a double.
+
+ errors.date={0} is not a date.
+ errors.range={0} is not in the range {1} through {2}.
+ errors.creditcard={0} is an invalid credit card number.
+ errors.email={0} is an invalid e-mail address.
+
+ Note: Starting in Struts 1.2.0 the default javascript definitions have
+ been consolidated to commons-validator. The default can be overridden
+ by supplying a <javascript> element with a CDATA section, just as
+ in struts 1.1.
+
+-->
+
+<form-validation>
+
+ <global>
+
+ <validator name="required"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateRequired"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ msg="errors.required"/>
+
+ <validator name="requiredif"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateRequiredIf"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ msg="errors.required"/>
+
+ <validator name="validwhen"
+ msg="errors.required"
+ classname="org.apache.struts.validator.validwhen.ValidWhen"
+ method="validateValidWhen"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"/>
+
+
+ <validator name="minlength"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateMinLength"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.minlength"
+ jsFunction="org.apache.commons.validator.javascript.validateMinLength"/>
+
+
+ <validator name="maxlength"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateMaxLength"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.maxlength"
+ jsFunction="org.apache.commons.validator.javascript.validateMaxLength"/>
+
+
+
+ <validator name="mask"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateMask"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.invalid"/>
+
+
+ <validator name="byte"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateByte"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.byte"
+ jsFunctionName="ByteValidations"/>
+
+
+ <validator name="short"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateShort"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.short"
+ jsFunctionName="ShortValidations"/>
+
+
+ <validator name="integer"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateInteger"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.integer"
+ jsFunctionName="IntegerValidations"/>
+
+
+
+ <validator name="long"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateLong"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.long"/>
+
+
+ <validator name="float"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateFloat"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.float"
+ jsFunctionName="FloatValidations"/>
+
+ <validator name="double"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateDouble"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.double"/>
+
+
+ <validator name="date"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateDate"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.date"
+ jsFunctionName="DateValidations"/>
+
+
+ <validator name="intRange"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateIntRange"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends="integer"
+ msg="errors.range"/>
+
+
+ <validator name="floatRange"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateFloatRange"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends="float"
+ msg="errors.range"/>
+
+ <validator name="doubleRange"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateDoubleRange"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends="double"
+ msg="errors.range"/>
+
+
+ <validator name="creditCard"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateCreditCard"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.creditcard"/>
+
+
+ <validator name="email"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateEmail"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.email"/>
+
+ <validator name="url"
+ classname="org.apache.struts.validator.FieldChecks"
+ method="validateUrl"
+ methodParams="java.lang.Object,
+ org.apache.commons.validator.ValidatorAction,
+ org.apache.commons.validator.Field,
+ org.apache.struts.action.ActionMessages,
+ org.apache.commons.validator.Validator,
+ javax.servlet.http.HttpServletRequest"
+ depends=""
+ msg="errors.url"/>
+
+ <!--
+ This simply allows struts to include the validateUtilities into a page, it should
+ not be used as a validation rule.
+ -->
+ <validator name="includeJavaScriptUtilities"
+ classname=""
+ method=""
+ methodParams=""
+ depends=""
+ msg=""
+ jsFunction="org.apache.commons.validator.javascript.validateUtilities"/>
+
+ </global>
+
+</form-validation>
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/validator-rules.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/web.xml?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/web.xml (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/web.xml Thu Dec 15 07:58:48 2005
@@ -0,0 +1,146 @@
+<?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 to perform Page Flow operations when JSPs are hit directly. -->
+ <filter>
+ <filter-name>PageFlowJspFilter</filter-name>
+ <filter-class>org.apache.beehive.netui.pageflow.PageFlowJspFilter</filter-class>
+ </filter>
+
+ <!-- Filter to perform Page Flow operations when JavaServer Faces pages are hit directly. -->
+ <filter>
+ <filter-name>PageFlowFacesFilter</filter-name>
+ <filter-class>org.apache.beehive.netui.pageflow.PageFlowFacesFilter</filter-class>
+ </filter>
+
+ <!--
+ It is possible - but certainly not required - to keep source files such as page flows and
+ JavaServer Faces backing beans mixed in with web content. In this case, and when the web
+ content directory itself is being deployed without being copied to some other build
+ location, it is important to prevent the source code from being URL-addressable. This
+ filter returns a specified error code when source files are requested.
+ -->
+ <filter>
+ <filter-name>PageFlowForbiddenFilter</filter-name>
+ <filter-class>org.apache.beehive.netui.pageflow.PageFlowForbiddenFilter</filter-class>
+ <init-param>
+ <param-name>response-code</param-name>
+ <param-value>404</param-value>
+ </init-param>
+ </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>
+
+ <!-- Prevent URL access to Java source code. -->
+ <filter-mapping>
+ <filter-name>PageFlowForbiddenFilter</filter-name>
+ <url-pattern>*.java</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+
+ <!-- Prevent URL access to JavaServer Faces backing beans. -->
+ <filter-mapping>
+ <filter-name>PageFlowForbiddenFilter</filter-name>
+ <url-pattern>*.jsfb</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+
+ <!-- Prevent URL access to shared flow source files. -->
+ <filter-mapping>
+ <filter-name>PageFlowForbiddenFilter</filter-name>
+ <url-pattern>*.jpfs</url-pattern>
+ <dispatcher>REQUEST</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>/_pageflow/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>
+
+ <!-- The XmlHttpRequest handler Servlet -->
+ <servlet>
+ <servlet-name>XmlHttpRequestServlet</servlet-name>
+ <servlet-class>org.apache.beehive.netui.pageflow.xmlhttprequest.XmlHttpRequestServlet</servlet-class>
+ </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 (etc.). -->
+ <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>
+
+ <!-- XmlHttpRequest Servlet -->
+ <servlet-mapping>
+ <servlet-name>XmlHttpRequestServlet</servlet-name>
+ <url-pattern>*.xhr</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+ <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>
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/demo.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/demo.jsp?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/demo.jsp (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/demo.jsp Thu Dec 15 07:58:48 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="pageInput.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>
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/demo.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/details.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/details.jsp?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/details.jsp (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/details.jsp Thu Dec 15 07:58:48 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>
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/details.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/error.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/error.jsp?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/error.jsp (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/error.jsp Thu Dec 15 07:58:48 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=" "/></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); %>
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/error.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/index.jsp?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/index.jsp (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/index.jsp Thu Dec 15 07:58:48 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>
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/error-header.jpg
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/error-header.jpg?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/error-header.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/folder.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/folder.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/folder.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastLineJoin.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastLineJoin.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastLineJoin.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastNodeCollapsed.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastNodeCollapsed.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastNodeCollapsed.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastNodeExpanded.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastNodeExpanded.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lastNodeExpanded.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lineJoin.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lineJoin.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/lineJoin.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/nodeCollapsed.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/nodeCollapsed.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/nodeCollapsed.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/nodeExpanded.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/nodeExpanded.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/nodeExpanded.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/rootCollapsed.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/rootCollapsed.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/rootCollapsed.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/rootExpanded.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/rootExpanded.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/rootExpanded.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortable.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortable.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortable.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortdown.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortdown.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortdown.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortup.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortup.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/sortup.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/spacer.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/spacer.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/spacer.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/verticalLine.gif
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/verticalLine.gif?rev=357035&view=auto
==============================================================================
Binary file - no diff available.
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/images/verticalLine.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/javascript/netui-datagrid.js
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/javascript/netui-datagrid.js?rev=357035&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/javascript/netui-datagrid.js (added)
+++ beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/javascript/netui-datagrid.js Thu Dec 15 07:58:48 2005
@@ -0,0 +1,383 @@
+/*
+ * Copyright 2004-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:$
+ */
+
+/* ==========================================================
+ *
+ *
+ *
+ * ==========================================================
+ */
+function NetUIFilterURL() {
+ this._urlParams = new Array();
+ this._filters = new Array();
+}
+
+/* return void */
+NetUIFilterURL.prototype.init = function(search) {
+ /* todo: parse the URL into its component key/value pairs */
+ var qIndex = search.indexOf('?') + 1;
+ var paramsArray = search.substring(qIndex).split('&');
+ var array = new Array();
+ for(var i = 0; i < paramsArray.length; i++) {
+ var eIndex = paramsArray[i].indexOf('=');
+ var key = paramsArray[i].substring(0,eIndex);
+ var value = paramsArray[i].substring(eIndex+1);
+
+ if(key == NetUIFilterList.FILTER_KEY) {
+ //alert('add filter: ' + value);
+ var filter = NetUIFilterList.parse(value);
+ this._filters[this._filters.length] = filter;
+ }
+ else {
+ //alert('add URL param: ' + value);
+ var param = new NetUIUrlParam(key,value);
+ this._urlParams[this._urlParams.length] = param;
+ }
+ }
+}
+
+/* todo: remove this method in favor of processing by the caller */
+NetUIFilterURL.prototype.removeUrlParam = function(key) {
+ for(var i = 0; i < this._urlParams.length; i++) {
+ if(this._urlParams[i].getKey() == key) {
+ /*
+ this is a hack to simulate removing an element from the array
+ todo: need to implement real delete here
+ */
+ this._urlParams[i].setKey('');
+ }
+ }
+}
+
+/* return NetUIFilterList */
+NetUIFilterURL.prototype.lookupFiltersForDataGrid = function(dataGridName) {
+
+ for(var i = 0; i < this._filters.length; i++) {
+ //alert('check filter: ' + this._filters[i].toUrlParam());
+ if(this._filters[i].getDataGridName() == dataGridName)
+ return this._filters[i];
+ }
+
+ return null;
+}
+
+NetUIFilterURL.prototype.hasFiltersForDataGrid = function(dataGridName) {
+ var filters = this.lookupFiltersForDataGrid(dataGridName);
+ return (filters != null ? true : false);
+}
+
+/* return String */
+NetUIFilterURL.prototype.toQueryString = function() {
+
+ qs = '?';
+ for(var i = 0; i < this._urlParams.length; i++) {
+ var p = this._urlParams[i].toUrlParam();
+ if(p == null)
+ continue;
+
+ if(i > 0)
+ qs += '&';
+ qs += this._urlParams[i].toUrlParam();
+ }
+
+ if(qs.length > 1)
+ qs += '&';
+
+ for(var i = 0; i < this._filters.length; i++) {
+ /* allow parameters to return null to indicate that there's no parameter to add */
+ var p = this._filters[i].toUrlParam();
+ if(p == null)
+ continue;
+
+ if(i > 0)
+ qs += '&';
+ //alert('NetUIFilterURL::toQueryString:filter:\"' + p + '\"');
+ qs += p;
+ }
+
+ return qs;
+}
+
+NetUIFilterURL.prototype.addFilterList = function(netuiFilterList) {
+ this._filters[this._filters.length] = netuiFilterList;
+}
+
+/* ==========================================================
+ *
+ *
+ *
+ * ==========================================================
+ */
+function NetUIUrlParam(key,value) {
+ this._key = key;
+ this._value = value;
+}
+
+NetUIUrlParam.prototype.getKey = function() {
+ return this._key;
+}
+
+NetUIUrlParam.prototype.setKey = function(key) {
+ this._key = key;
+}
+
+NetUIUrlParam.prototype.getValue = function() {
+ return this._value;
+}
+
+NetUIUrlParam.prototype.setValue = function(value) {
+ this._value = value;
+}
+
+NetUIUrlParam.prototype.toUrlParam = function() {
+ if(this._key == null || this._key == '')
+ return null;
+ else return this._key + '=' + this._value;
+}
+
+/* ==========================================================
+ *
+ *
+ *
+ * ==========================================================
+ */
+function NetUIFilterList(dataGridName) {
+ this._dataGridName = dataGridName;
+ this._filters = new Array();
+}
+
+function NetUIFilterList_parse(value) {
+ var decodedValue = decodeURIComponent(value);
+ var scIndex = decodedValue.indexOf(';');
+ var dataGridName = decodedValue.substring(0, scIndex);
+ var filter = new NetUIFilterList(dataGridName);
+
+ var filterArray = decodedValue.substring(scIndex+1).split(',');
+ for(var i = 0; i < filterArray.length; i++) {
+ var parts = filterArray[i].split('~');
+ filter.addFilter(parts[0],parts[1],parts[2]);
+ }
+
+ return filter;
+}
+
+NetUIFilterList.parse = NetUIFilterList_parse;
+NetUIFilterList.FILTER_KEY = "netui_filter";
+
+NetUIFilterList.prototype.getDataGridName = function() {
+ return this._dataGridName;
+}
+
+/* return void */
+NetUIFilterList.prototype.addFilter = function(fExpr,fOp,fVal) {
+ this._filters[this._filters.length] = new NetUIFilter(fExpr,fOp,fVal);
+}
+
+NetUIFilterList.prototype.replaceFilters = function(netuiFilterArray) {
+ this._filters = netuiFilterArray;
+}
+
+/* return String */
+NetUIFilterList.prototype.toUrlParam = function() {
+ if(this._filters == null || this._filters.length == 0)
+ return null;
+
+ var paramValue = '';
+ var foundFilter = false;
+
+ paramValue += this._dataGridName;
+ paramValue += ';';
+ for(var i = 0; i < this._filters.length; i++) {
+ var p = this._filters[i].toUrlParam();
+ if(p == null)
+ continue;
+
+ if(foundFilter && i > 0)
+ paramValue += ',';
+ paramValue += p;
+ foundFilter = true;
+ }
+
+ if(!foundFilter)
+ return null;
+ else return NetUIFilterList.FILTER_KEY + '=' + paramValue;
+}
+
+/* return NetUIFilterList */
+NetUIFilterList.prototype.lookupFiltersForFilterExpression = function(filterExpression) {
+ var filters = new Array();
+ for(var i = 0; i < this._filters.length; i++) {
+ if(this._filters[i].getFilterExpression() == filterExpression)
+ filters[filters.length] = this._filters[i];
+ }
+
+ return filters;
+}
+
+/* ==========================================================
+ *
+ *
+ *
+ * ==========================================================
+ */
+function NetUIFilter(fExpr,fOp,fVal) {
+ this._fExpr = fExpr;
+ this._fOp = fOp;
+ this._fVal = fVal;
+}
+
+NetUIFilter.prototype.getFilterExpression = function() {
+ return this._fExpr;
+}
+
+NetUIFilter.prototype.getFilterOperation = function() {
+ return this._fOp;
+}
+
+NetUIFilter.prototype.getFilterValue = function() {
+ return this._fVal;
+}
+
+NetUIFilter.prototype.toUrlParam = function() {
+ if(this._fVal == null || this._fVal == '' ||
+ this._fOp == null || this._fOp == '' ||
+ this._fExpr == null || this._fExpr == '')
+ return null;
+
+ var val = this._fVal;
+ if(this._fOp == 'isempty' || this._fOp == 'isnotempty')
+ val = '*';
+
+ var op = (this._fOp != null ? this._fOp : '');
+
+ var filter = this._fExpr + '~' + op + '~' + val
+
+ return filter;
+}
+
+/* ==========================================================
+ *
+ *
+ *
+ * ==========================================================
+ */
+ /*
+ todo: switch over to using this URL method once the urlParams / filters have
+ been merged in the NetUIFilterUrl class
+ */
+function buildURL(params) {
+ if(params == null || params.length == 0)
+ return '';
+
+ var qs = '?';
+ for(var i = 0; i < params.length; i++) {
+ var p = params[i].toUrlParam();
+ if(p == null)
+ continue;
+
+ if(i > 0)
+ qs += '&';
+ qs += params[i].toUrlParam();
+ }
+
+ return qs;
+}
+
+/* ==========================================================
+ *
+ * Utility method that will load a list of HTML form <inputs>
+ * with filter information out of the URL. The HTML ids of
+ * the <input> elements must match filter expressions in the
+ * URL's filter parameters.
+ *
+ * ==========================================================
+ */
+function doLoadNetUIFilters(formTagId, gridName) {
+ var form = document.getElementById(formTagId);
+ if(form == null)
+ alert('could not find form with id: ' + formTagId);
+
+ var netuiUrl = new NetUIFilterURL();
+ netuiUrl.init(window.location.search);
+ var gridFilters = netuiUrl.lookupFiltersForDataGrid(gridName);
+ if(gridFilters == null)
+ return;
+
+ var elems = form.elements.length;
+ for(var i = 0; i < elems; i++) {
+ var widget = form.elements[i];
+
+ if(widget.type == "submit" || widget.type == "hidden")
+ continue;
+
+ var id = widget.id;
+ var savedFilters = gridFilters.lookupFiltersForFilterExpression(id);
+ if(savedFilters != null)
+ widget.value = savedFilters[0].getFilterValue();
+ }
+ return;
+}
+
+/* ==========================================================
+ *
+ * Utility method that will create a filter URL from given
+ * an HTML form. This method walks the <input> elements
+ * in the form and builds a filter operation from the
+ * values therein. The default filter operation used here
+ * is 'contains'.
+ *
+ * Once the filters have been constructed, the filter URL
+ * is used to directly replace the URL in browser's current
+ * window.
+ *
+ * ==========================================================
+ */
+function doNetUIFilters(formTagId, gridName) {
+ var form = document.getElementById(formTagId);
+ if(form == null)
+ alert('could not find form with id: ' + formTagId);
+
+ var netuiUrl = new NetUIFilterURL();
+ netuiUrl.init(window.location.search);
+ var gridFilters = netuiUrl.lookupFiltersForDataGrid(gridName);
+ if(gridFilters == null) {
+ gridFilters = new NetUIFilterList(gridName);
+ netuiUrl.addFilterList(gridFilters);
+ }
+
+ var filters = new Array();
+ var elems = form.elements.length;
+ for(var i = 0; i < elems; i++) {
+ var widget = form.elements[i];
+
+ if(widget.type == "submit" || widget.type == "hidden")
+ continue;
+
+ var filter = new NetUIFilter(widget.id, 'contains', widget.value);
+ filters[filters.length] = filter;
+ }
+
+ gridFilters.replaceFilters(filters);
+ var search = netuiUrl.toQueryString();
+ /* set the window's location */
+ if(search != null && search.indexOf('?') < 0)
+ search += '?' + search;
+ window.location = window.location.protocol + "//" + location.host + window.location.pathname + (search != null ? search : '');
+
+ return false;
+}
Propchange: beehive/trunk/system-controls/samples/jdbc/jdbcControlSample/web/resources/beehive/version1/javascript/netui-datagrid.js
------------------------------------------------------------------------------
svn:eol-style = native