You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@apache.org on 2006/01/31 07:03:29 UTC

svn commit: r373732 [1/2] - in /struts/shale/trunk/sql-browser: ./ ext/ lib/ nbproject/ src/ src/conf/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/shale/ src/java/org/apache/shale/examples/ src/java/org/apache/shale/examples/sqlbro...

Author: craigmcc
Date: Mon Jan 30 22:03:15 2006
New Revision: 373732

URL: http://svn.apache.org/viewcvs?rev=373732&view=rev
Log:
Beginnings of a Shale sample application to show off some of the Tiger
Extensions features (annotated managed beans, annotated view controller),
plus the general flexibility that a component oriented development
environment can provide.  This application is *not* yet compete, and is
*not* tied in to the overall build environment yet.

Added:
    struts/shale/trunk/sql-browser/
    struts/shale/trunk/sql-browser/LICENSE.txt
    struts/shale/trunk/sql-browser/NOTICE.txt
    struts/shale/trunk/sql-browser/README.txt
    struts/shale/trunk/sql-browser/build.xml   (with props)
    struts/shale/trunk/sql-browser/default.properties   (with props)
    struts/shale/trunk/sql-browser/derby.log
    struts/shale/trunk/sql-browser/ext/
    struts/shale/trunk/sql-browser/lib/
    struts/shale/trunk/sql-browser/nbproject/
    struts/shale/trunk/sql-browser/nbproject/project.xml   (with props)
    struts/shale/trunk/sql-browser/src/
    struts/shale/trunk/sql-browser/src/conf/
    struts/shale/trunk/sql-browser/src/conf/MANIFEST.MF
    struts/shale/trunk/sql-browser/src/java/
    struts/shale/trunk/sql-browser/src/java/org/
    struts/shale/trunk/sql-browser/src/java/org/apache/
    struts/shale/trunk/sql-browser/src/java/org/apache/shale/
    struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/
    struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/
    struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Application.java   (with props)
    struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Bundle.properties   (with props)
    struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/InternalDataSource.java   (with props)
    struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Listener.java   (with props)
    struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Messages.java   (with props)
    struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Query.java   (with props)
    struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/package.html   (with props)
    struts/shale/trunk/sql-browser/src/java/overview.html   (with props)
    struts/shale/trunk/sql-browser/src/systest/
    struts/shale/trunk/sql-browser/src/systest/org/
    struts/shale/trunk/sql-browser/src/systest/org/apache/
    struts/shale/trunk/sql-browser/src/systest/org/apache/shale/
    struts/shale/trunk/sql-browser/src/systest/org/apache/shale/blank/
    struts/shale/trunk/sql-browser/src/systest/org/apache/shale/blank/systest/
    struts/shale/trunk/sql-browser/src/systest/org/apache/shale/blank/systest/WelcomeTestCase.java   (with props)
    struts/shale/trunk/sql-browser/src/test/
    struts/shale/trunk/sql-browser/src/test/org/
    struts/shale/trunk/sql-browser/src/test/org/apache/
    struts/shale/trunk/sql-browser/src/test/org/apache/shale/
    struts/shale/trunk/sql-browser/src/test/org/apache/shale/blank/
    struts/shale/trunk/sql-browser/src/test/org/apache/shale/blank/WelcomeBeanTestCase.java   (with props)
    struts/shale/trunk/sql-browser/src/web/
    struts/shale/trunk/sql-browser/src/web/WEB-INF/
    struts/shale/trunk/sql-browser/src/web/WEB-INF/chain-config.xml   (with props)
    struts/shale/trunk/sql-browser/src/web/WEB-INF/dialog-config.xml   (with props)
    struts/shale/trunk/sql-browser/src/web/WEB-INF/faces-config.xml   (with props)
    struts/shale/trunk/sql-browser/src/web/WEB-INF/web.xml   (with props)
    struts/shale/trunk/sql-browser/src/web/index.jsp   (with props)
    struts/shale/trunk/sql-browser/src/web/messages.jspf   (with props)
    struts/shale/trunk/sql-browser/src/web/query.jsp   (with props)
    struts/shale/trunk/sql-browser/src/web/welcome.jsp   (with props)

Added: struts/shale/trunk/sql-browser/LICENSE.txt
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/LICENSE.txt?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/LICENSE.txt (added)
+++ struts/shale/trunk/sql-browser/LICENSE.txt Mon Jan 30 22:03:15 2006
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.

Added: struts/shale/trunk/sql-browser/NOTICE.txt
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/NOTICE.txt?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/NOTICE.txt (added)
+++ struts/shale/trunk/sql-browser/NOTICE.txt Mon Jan 30 22:03:15 2006
@@ -0,0 +1,6 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product contains code written by David Geary and Cay Horstmann
+for the first edition of Core JavaServer Faces. 
+

Added: struts/shale/trunk/sql-browser/README.txt
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/README.txt?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/README.txt (added)
+++ struts/shale/trunk/sql-browser/README.txt Mon Jan 30 22:03:15 2006
@@ -0,0 +1,236 @@
+<!--
+
+ Copyright 2006 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.
+
+ $Id: build.xml 366441 2006-01-06 06:57:59Z craigmcc $
+
+-->
+
+
+# ==============================================================================
+# README.txt for the Shale Blank Starter Application
+# ==============================================================================
+
+
+Welcome to the Shale Blank Starter Application!  These artifacts are provided
+for two major reasons:
+
+* Provide a very simple example of a minimal application using Shale.
+
+* For developers using Ant to build their projects, provide a complete
+  "starter kit" project directory structure, without requiring you
+  to hand configure the entire environment.
+
+
+# ------------------------------------------------------------------------------
+# Components of the Shale Blank Starter Application
+# ------------------------------------------------------------------------------
+
+To download a runnable version of this application, which can be simply
+dropped into a servlet container, download a file named
+"shale-blank-YYMMDD.war" from the nightly builds directory:
+
+    http://cvs.apache.org/builds/struts/nightly/struts-shale/
+
+The source code for this application is the Starter Kit artifact described
+in the next section.
+
+To run the application, most servlet containers provide a directory into which
+you can simply drop a WAR file, and it will automatically execute.  For Tomcat,
+this is $CATALINA_HOME/webapps.
+
+The application consists of a single JSP page (welcome.jsp) which uses
+several <h:outputText> components to retrieve localized message strings from
+a resource bundle included in the application, plus a component that is bound
+to the "timestamp" property of the corresponding backing bean.  The backing
+bean class (WelcomeBean) implements ViewController (indirectly, by virtue of
+the fact that it extends AbstractViewController).  The prerender() method is
+called immediately before the corresponding page is rendered, so we insert
+logic here to go retrieve the current date/time value that will be displayed
+by the component.
+
+The source code for the application (found in the Starter Kit) also includes
+other artifacts useful in understanding Shale based applications:
+
+- Basic configuration resources (web.xml and faces-config.xml)
+  with comments describing customizations you would typically make.
+
+- A simple example of a unit test for a ViewController bean, used to
+  perform out-of-container unit testing of the backing beans.  These
+  tests leverage the facilities of the Shale Test Framework.
+
+
+# ------------------------------------------------------------------------------
+# Using the Shale Blank Starter Application As A Starter Kit
+# ------------------------------------------------------------------------------
+
+To use the Shale Blank Starter Application as a starter kit, follow these steps:
+
+* Download a file named "shale-blank-YYYYMMDD.tar.gz" or "shale-blank-YYYYMMDD.zip"
+  into the parent directory of where you want to create your new project.  You
+  can find this at the Shale nightly distribution site:
+
+    http://cvs.apache.org/builds/struts/nightly/struts-shale/
+
+* Untar or unzip the downloaded file to create the standard Shale Blank
+  directory structure.
+
+* Rename the top level directory (shale-blank-YYYYMMDD) to the desired name
+  for your project's top level directory, and change your current working
+  directory into the project's top level directory.
+
+* In a text viewing application, open the "default.properties" file in the
+  top level directory to review the property settings that you may configure
+  without having to modify the build.xml script at all.
+
+* In a text editing application, create a new build.properties file (in the
+  same directory as the default.properties file) to contain overrides for the
+  properties you need to change.  At a minimum, you will generally need to
+  create custom values for the following properties:
+
+  - All of the "Project Description Information" properties (project.copyright
+    through project.version).
+
+  - webapp.state.saving - The desired setting for JavaServer Faces component
+    state saving (client or server).
+
+  - lib.dir - Fully qualified pathname of a directory containing all of the
+    library dependencies (other than a Shale distribution) that you will want
+    to include in the web application's /WEB-INF/lib directory.  It is acceptable
+    for the JAR files in this directory to be nested inside other directories.
+    One convenient mechanism to acquire such a set of libraries is to download
+    a "shale-dependencies-YYYYMMDD.tar.gz" or "shale-dependencies-YYYYMMDD.zip"
+    file from the nightly build distribution site mentioned above.
+
+  - ext.dir - (Optional) Fully qualified pathname of a directory containing JAR
+    files for dependencies that you wish to have present on the compile time
+    classpath, but should *not* be included in the /WEB-INF/lib directory
+    (presumably because they will be provided by the container you are running
+    on already).  It is acceptable for the JAR files in this directory to be
+    nested inside other directories.
+
+  - shale.dir - Fully qualified pathname of a directory containing the Shale
+    binary distribution.
+
+  - All of the (Optional) Tomcat Integration properties, *if* you plan on using
+    the corresponding targets to install, reload, and remove your web application
+    from a running instance of Tomcat (5.0 or later).
+
+* If necessary, you can customize the behavior of the build.xml script
+  itself.  This will not be needed for most simple applications, however.
+
+* Next, customize the configuration files for your application as necessary.
+
+  - src/web/WEB-INF/web.xml - IF you are going to use the optional Spring
+    Framework, integration features, uncomment the context initialization
+    parameter and listener entries used to configure it.  You will need to
+    create a "src/web/WEB-INF/applicationContext.xml" configuration for the
+    beans to be loaded by Spring (or, use a different name if you change the
+    value of the configuration parameter).
+
+  - src/web/WEB-INF/web.xml - Change the mapping for the JavaServer Faces
+    servlet if you prefer something other than the default (".faces).  Changing
+    this value will also require you to change the path in "src/web/index.jsp".
+
+  - src/web/WEB-INF/faces-config.xml - Define the localization properties for
+    the default and supported locales, and (optionally) declaring a resource
+    bundle used to look up replacements for the standard messages.  The easiest
+    way to accomplish this is to uncomment the existing example entries, making
+    any required changes.
+
+  - src/web/WEB-INF/dialog-config.xml - If you are using the Shale Dialogs
+    feature, you will define your dialogs here.  Use the commented-out example
+    as a guide to the required information, or see the web site documentation
+    for more details:
+
+        http://struts.apache.org/struts-shale/features-dialog-manager.html
+        http://struts.apache.org/struts-shale/shale-core/apidocs/org/apache/shale/dialog/package-summary.html
+
+  - src/web/WEB-INF/chain-config.xml - If you are using the advanced features
+    of Shale to configure the Shale Application Controller Filter, you will
+    create command chains here.
+
+  - src/web/index.jsp - Adjust the path of the <jsp:forward> entry to point at
+    your actual starting page.  Be sure you use a URL that includes the mapping
+    value for the JavaServer Faces controller servlet.
+
+* Now, you are ready to add a new page and its corresponding backing bean to
+  the application.  This generally involves the following steps:
+
+  - src/web/WEB-INF/faces-config.xml - Add a new section of configuration
+    information for the new page.
+
+  - src/web/WEB-INF/faces-config.xml - Add a <managed-bean> element describing
+    the backing bean for your new view.  If you are using the View Controller
+    feature, be sure that the name you assign this bean corresponds to the
+    mapping requirements described in the documentation:
+
+        http://struts.apache.org/struts-shale/features-view-controller.html
+
+    Unless you have a *really* good reason to do otherwise, view controller
+    managed beans should be placed into request scope.
+
+  - Add a corresponding Java class in the "src/java" directory, creating new
+    package subdirectories as needed.  If you are using the view controller
+    capability, you will find it easiest to extend the convenience base class
+    that Shale provides ("org.apache.shale.view.AbstractViewController").
+
+  - (Optional, but highly recommended) add a unit test class, into the "src/test"
+    directory.  The package name should be the same as the package containing
+    the backing bean itself, and the class name should be the same as the
+    simple class name of the backing bean itself, suffixed with "TestCase"
+    (this enables the build.xml script to locate and execute all unit tests
+    when you execute the "test" target).  You will generally find it easiest
+    to extend one of the base test classes provided by Shale's Test Framework
+    (AbstractJsfTestCase or AbstractViewControllerTestCase) because they will
+    set up all of the relevant container mock objects for you.  For more
+    information on using the test framework to create unit tests, see:
+
+        http://struts.apache.org/struts-shale/features-test-framework.html
+
+* After you have created one or more of your own pages, you will likely want
+  to remove the demo page (welcome.jsp), and corresponding Java classes
+  (WelcomeBean and WelcomeBeanTestCase).
+
+* The supplied build.xml script includes optional integration with a running
+  instance of Tomcat 5.0 or later.  This capability utilizes custom Ant tasks
+  provided by Tomcat to dynamically install, remove, or reload a web application
+  currenty being developed, without having to restart Tomcat itself every
+  time.  Using this feature supports a very rapid turnaround cycle, with
+  steps like this:
+
+  (1) Start up Tomcat if it is not already running.
+
+  (2) Execute the "install" target once, to install the application (if it
+      is not already present).  This target will automatically recompile
+      anything that has been changed.
+
+  (3) Test your web application in a browser, and note a change that needs
+      to be made.
+
+  (4) Make the necessary changes in your favorite IDE environment, on the
+      files in the "src" directory hierarchy of your project.
+
+  (5) Execute the "reload" target to recompile (if necessary) and redeploy
+      the application.
+
+  (6) Return to step (3) for the next incremental change, or proceed to
+      Step (7) if you are done for now.
+
+  (7) Optionally, execute the "remove" target to undeploy the application
+      from Tomcat.
+
+  (8) Optionally, shut down Tomcat if you are through with it.
+

Added: struts/shale/trunk/sql-browser/build.xml
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/build.xml?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/build.xml (added)
+++ struts/shale/trunk/sql-browser/build.xml Mon Jan 30 22:03:15 2006
@@ -0,0 +1,503 @@
+<!--
+
+ Copyright 2006 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.
+
+ $Id$
+
+-->
+
+
+<project name="Shale SQL Browser Example" default="compile" basedir=".">
+
+
+  <!-- ===================== Initialize Property Values ==================== -->
+
+
+  <!-- Initialize property values -->
+  <property file="build.properties"/>
+  <property file="default.properties"/>
+
+
+  <!-- Search classpath for setting conditional processing flags -->
+  <path id="search.classpath">
+    <fileset                        dir="${lib.dir}"
+                               includes="**/*.jar"/>
+  </path>
+
+
+  <!-- Conditional Processing Flags -->
+  <available                   property="jsfri.present"
+                              classname="com.sun.faces.RIConstants"
+                           classpathref="search.classpath"/>
+  <available                   property="license.present"
+                                   file="${basedir}/LICENSE.txt"/>
+  <available                   property="myfaces.present"
+                              classname="org.apache.myfaces.config.MyfacesConfig"
+                           classpathref="search.classpath"/>
+  <available                   property="notice.present"
+                                   file="${basedir}/NOTICE.txt"/>
+  <condition                   property="spring.present">
+    <and>
+      <available              classname="org.springframework.core.Constants"
+                           classpathref="search.classpath"/>
+      <available              classname="org.springframework.context.ApplicationContext"
+                           classpathref="search.classpath"/>
+      <available              classname="org.springframework.web.jsf.DelegatingVariableResolver"
+                           classpathref="search.classpath"/>
+    </and>
+  </condition>
+  <available                   property="tiger.present"
+                              classname="java.net.Proxy"
+                           classpathref="search.classpath"/>
+  <available                   property="tiles.present"
+                              classname="org.apache.tiles.servlets.TilesServlet"
+                           classpathref="search.classpath"/>
+
+
+  <!-- Compile Classpath -->
+  <path id="compile.classpath">
+    <fileset                        dir="${lib.dir}"
+                               includes="**/*.jar">
+      <exclude                     name="junit.jar"/>
+      <exclude                     name="shale-spring.jar"
+                                 unless="spring.present"/>
+      <exclude                     name="shale-tiger.jar"
+                                 unless="tiger.present"/>
+      <exclude                     name="shale-tiles.jar"
+                                 unless="tiles.present"/>
+    </fileset>
+    <fileset                        dir="${ext.dir}"
+                               includes="**/*.jar"/>
+    <fileset                        dir="${shale.dir}/dist"
+                               includes="**/*.jar"
+                               excludes="shale-test.jar"/>
+    <pathelement               location="${derby.jar}"/>
+  </path>
+
+
+  <!-- Unit Test Classpath -->
+  <path id="test.classpath">
+    <path                         refid="compile.classpath"/>
+    <fileset                        dir="${lib.dir}"
+                               includes="**/junit.jar"/>
+    <fileset                        dir="${ext.dir}"
+                               includes="**/junit.jar"/>
+    <path                      location="${build.web.dir}/WEB-INF/classes"/>
+    <fileset                        dir="${shale.dir}/dist"
+                               includes="shale-test.jar"/>
+    <path                      location="${build.test.dir}"/>
+  </path>
+
+
+  <!-- System Integration Test Classpath -->
+  <path id="systest.classpath">
+    <path                         refid="compile.classpath"/>
+    <fileset                        dir="${htmlunit.dir}/lib"
+                               includes="*.jar"/>
+    <fileset                        dir="${lib.dir}"
+                               includes="**/junit.jar"/>
+    <fileset                        dir="${ext.dir}"
+                               includes="**/junit.jar"/>
+    <fileset                        dir="${shale.dir}/dist"
+                               includes="shale-test.jar"/>
+    <pathelement               location="${build.sys.dir}"/>
+    <pathelement               location="${build.web.dir}/WEB-INF/classes"/>
+  </path>
+
+
+  <!-- ==================== Maintenance Targets ============================ -->
+
+
+  <target     name="clean"
+       description="Clean all build directories">
+    <delete    dir="${build.dir}"/>
+    <delete    dir="${dist.dir}"/>
+  </target>
+
+
+  <target     name="init">
+    <echo  message="---------- ${project.name} ${project.version} -----------"/>
+    <filter  token="implVendor"        value="${project.vendor}"/>
+    <filter  token="implVendorId"      value="${project.vendor.id}"/>
+    <filter  token="implVersion"       value="${project.version}"/>
+    <filter  token="projectName"       value="${project.name}"/>
+    <filter  token="projectPackage"    value="${project.package}"/>
+    <filter  token="specVendor"        value="${project.spec.vendor}"/>
+    <filter  token="specVersion"       value="${project.spec.version}"/>
+    <filter  token="stateSaving"       value="${webapp.state.saving}"/>
+    <echo  message="jsfri.present =    ${jsfri.present}"/>
+    <echo  message="myfaces.present =  ${myfaces.present}"/>
+    <echo  message="spring.present =   ${spring.present}"/>
+    <echo  message="tiger.present =    ${tiger.present}"/>
+    <echo  message="tiles.present =    ${tiles.present}"/>
+  </target>
+
+
+  <target     name="prepare" depends="init">
+    <mkdir     dir="${build.dir}"/>
+    <mkdir     dir="${build.web.dir}"/>
+    <mkdir     dir="${build.web.dir}/META-INF"/>
+    <mkdir     dir="${build.web.dir}/WEB-INF"/>
+    <mkdir     dir="${build.web.dir}/WEB-INF/classes"/>
+    <mkdir     dir="${build.web.dir}/WEB-INF/lib"/>
+    <mkdir     dir="${dist.dir}"/>
+    <mkdir     dir="${dist.dir}/docs"/>
+    <mkdir     dir="${dist.dir}/docs/api"/>
+  </target>
+
+
+  <target     name="static" depends="prepare,static.license,static.notice">
+
+    <!-- Copy and filter configuration files -->
+    <copy    todir="${build.dir}/META-INF"
+         filtering="on"
+              file="${src.conf.dir}/MANIFEST.MF"/>
+
+    <!-- Copy static web resources -->
+    <copy    todir="${build.web.dir}"
+         filtering="on">
+      <fileset dir="${src.web.dir}"/>
+    </copy>
+
+    <!-- Copy libraries from "lib.dir" directory -->
+    <copy    todir="${build.web.dir}/WEB-INF/lib"
+           flatten="true">
+      <fileset dir="${lib.dir}"
+          includes="**/*.jar">
+        <exclude name="**/commons-codec.jar"
+               unless="myfaces.present"/>
+        <exclude name="**/commons-el.jar"
+               unless="myfaces.present"/>
+        <exclude name="**/commons-fileupload.jar"
+               unless="myfaces.present"/>
+        <exclude name="**/jsf-api.jar"
+                   if="myfaces.present"/>
+        <exclude name="**/jsf-impl.jar"
+                   if="myfaces.present"/>
+        <exclude name="**/junit.jar"/>
+        <exclude name="**/jsp-api.jar"/>
+        <!-- Comment out following line if using MyFaces components -->
+        <exclude name="**/myfaces-extensions.jar"/>
+        <exclude name="**/portlet-api.jar"/>
+        <exclude name="**/servlet-api.jar"/>
+        <!-- Comment out the following lines for Spring components you need -->
+        <exclude name="**/spring*.jar"/>
+        <exclude name="**/struts-mailreader-dao.jar"/>
+        <exclude name="**/taglibrarydoc.jar"/>
+        <exclude name="**/tiles-core.jar"/>
+      </fileset>
+    </copy>
+
+
+    <!-- Copy libraries from Shale release -->
+    <copy         todir="${build.web.dir}/WEB-INF/lib"
+                flatten="true">
+      <fileset      dir="${shale.dir}/dist"
+               includes="**/*.jar">
+        <exclude   name="shale-spring.jar"
+                 unless="spring.present"/>
+        <exclude   name="shale-test.jar"/>
+        <exclude   name="shale-tiger.jar"
+                 unless="tiger.present"/>
+        <exclude   name="shale-tiles.jar"
+                 unless="tiles.present"/>
+         <exclude  name="shale-clay.jar"/>
+         <exclude  name="shale-remoting.jar"/>
+         <exclude  name="shale-spring.jar"/>
+         <exclude  name="shale-tiles.jar"/>
+         <exclude  name="tiles-core.jar"/>
+      </fileset>
+    </copy>
+
+    <!-- Copy the Derby embedded database JAR -->
+    <copy         todir="${build.web.dir}/WEB-INF/lib"
+                   file="${derby.jar}"/>
+
+  </target>
+
+
+  <target     name="static.license" if="license.present">
+    <copy    todir="${build.web.dir}/META-INF"
+              file="${basedir}/LICENSE.txt"/>
+  </target>
+
+
+  <target     name="static.notice" if="notice.present">
+    <copy    todir="${build.web.dir}/META-INF"
+              file="${basedir}/NOTICE.txt"/>
+  </target>
+
+
+  <!-- ================= Compile Application Components ==================== -->
+
+
+  <target         name="compile" depends="static"
+           description="Compile application components">
+
+    <!-- Compile Java Sources -->
+    <javac      srcdir="${src.java.dir}"
+               destdir="${build.web.dir}/WEB-INF/classes"
+                 debug="${compile.debug}"
+           deprecation="${compile.deprecation}"
+              optimize="${compile.optimize}"
+                source="${project.source}"
+                target="${project.target}">
+      <classpath refid="compile.classpath" />
+    </javac>
+
+    <!-- Copy non-Java Sources -->
+    <copy        todir="${build.web.dir}/WEB-INF/classes">
+      <fileset     dir="${src.java.dir}">
+        <exclude  name="**/*.java"/>
+        <exclude  name="**/overview.html"/>
+        <exclude  name="**/package.html"/>
+      </fileset>
+    </copy>
+
+  </target>
+
+
+  <!-- ===================== Generate Documentation ======================== -->
+
+
+  <target         name="javadocs" depends="compile"
+           description="Create JavaDocs">
+
+    <mkdir         dir="${build.docs.dir}"/>
+
+    <javadoc
+            sourcepath="${src.java.dir}"
+               destdir="${build.docs.dir}"
+                author="false"
+               private="true"
+               version="true"
+                source="${project.source}"
+          packagenames="${project.package}.*"
+           windowtitle="${project.name} (Version ${project.version})"
+              doctitle="${project.name} (Version ${project.version})"
+                bottom="${project.copyright}">
+      <classpath refid="compile.classpath"/>
+    </javadoc>
+
+    <copy        todir="${build.docs.dir}">
+      <fileset     dir="${src.java.dir}"
+              includes="**/*.gif"/>
+    </copy>
+
+  </target>
+
+
+  <!-- ==================== Create Binary Distribution ===================== -->
+
+
+  <target name="dist" depends="javadocs"
+   description="Create binary distribution">
+
+    <mkdir     dir="${dist.dir}"/>
+
+    <!-- Copy license and configuration files -->
+    <copy    todir="${dist.dir}">
+      <fileset dir="${basedir}" includes="*.txt build.* default.properties"
+                                excludes="build.properties"/>
+    </copy>
+
+    <!-- Create a runnable web application archive -->
+    <jar   jarfile="${dist.dir}/${project.path}-${project.version}.war"
+           basedir="${build.web.dir}"
+          manifest="${build.dir}/META-INF/MANIFEST.MF"/>
+
+    <!-- Optional:  Copy the source directories -->
+    <mkdir     dir="${dist.dir}/src"/>
+    <copy    todir="${dist.dir}/src">
+      <fileset dir="src" excludes="**/.svn/** **/CVS/**"/>
+    </copy>
+
+    <!-- Optional:  Create an IDE-friendly zip of the Java sources -->
+    <zip    zipfile="${dist.dir}/${project.path}-${project.version}-src.zip"
+            basedir="${src.java.dir}"/>
+
+    <!-- Optional:  Copy unpacked javadocs -->
+    <mkdir      dir="${dist.dir}/docs"/>
+    <mkdir      dir="${dist.dir}/docs/api"/>
+    <copy     todir="${dist.dir}/docs/api">
+      <fileset  dir="${build.docs.dir}"/>
+    </copy>
+
+    <!-- Optional:  Create an IDE-friendly zip of the Javadocs -->
+    <zip    zipfile="${dist.dir}/${project.path}-${project.version}-doc.zip"
+            basedir="${build.docs.dir}"/>
+
+  </target>
+
+
+  <!-- ===================== Tomcat Integration ============================ -->
+
+
+  <path id="catalina.classpath">
+    <path                      location="${catalina.home}/server/lib/catalina-ant.jar"/>
+  </path>
+
+
+  <target    name="install" depends="compile"
+      description="Install webapp on Tomcat">
+    <taskdef name="install"
+        classname="org.apache.catalina.ant.InstallTask"
+     classpathref="catalina.classpath"/>
+    <install  url="${catalina.manager}"
+         username="${catalina.username}"
+         password="${catalina.password}"
+             path="/${project.path}"
+              war="file://${build.web.dir}"/>
+  </target>
+
+
+  <target    name="list"
+      description="List installed webapps on Tomcat">
+    <taskdef name="list"
+        classname="org.apache.catalina.ant.ListTask"
+     classpathref="catalina.classpath"/>
+    <list     url="${catalina.manager}"
+         username="${catalina.username}"
+         password="${catalina.password}"/>
+  </target>
+
+
+  <target    name="reload" depends="compile"
+      description="Reload webapp on Tomcat">
+    <taskdef name="reload"
+        classname="org.apache.catalina.ant.ReloadTask"
+     classpathref="catalina.classpath"/>
+    <reload   url="${catalina.manager}"
+         username="${catalina.username}"
+         password="${catalina.password}"
+             path="/${project.path}"/>
+  </target>
+
+
+  <target    name="remove"
+      description="Remove webapp from Tomcat">
+    <taskdef name="remove"
+        classname="org.apache.catalina.ant.RemoveTask"
+     classpathref="catalina.classpath"/>
+    <remove   url="${catalina.manager}"
+         username="${catalina.username}"
+         password="${catalina.password}"
+             path="/${project.path}"/>
+  </target>
+
+
+  <!-- ========================== Unit Tests =============================== -->
+
+
+  <target         name="test.compile" depends="compile">
+
+    <mkdir         dir="${build.test.dir}"/>
+
+    <!-- Compile Java Sources -->
+    <javac      srcdir="${src.test.dir}"
+               destdir="${build.test.dir}"
+                 debug="${compile.debug}"
+           deprecation="${compile.deprecation}"
+              optimize="${compile.optimize}"
+                source="${project.source}"
+                target="${project.target}">
+      <classpath refid="test.classpath" />
+    </javac>
+
+    <!-- Copy non-Java Sources -->
+    <copy        todir="${build.test.dir}">
+      <fileset     dir="${src.test.dir}">
+        <exclude  name="**/*.java"/>
+      </fileset>
+    </copy>
+
+  </target>
+
+
+  <target name="test" depends="test.compile"
+   description="Execute unit tests">
+
+    <mkdir          dir="${build.dir}/test-results"/>
+
+    <echo       message="Running unit tests ..."/>
+    <junit printSummary="no" fork="yes"
+          haltonfailure="yes" haltonerror="yes">
+      <classpath  refid="test.classpath"/>
+      <formatter   type="plain"
+                usefile="false"/>
+      <formatter   type="xml"
+                usefile="true"/>
+      <batchtest todir="${build.dir}/test-results">
+        <fileset    dir="${build.test.dir}"
+               includes="**/*TestCase.class"/>
+      </batchtest>
+    </junit>
+
+  </target>
+
+
+  <!-- =============== System Integration Tests ============================ -->
+
+
+  <target         name="systest.compile">
+
+    <mkdir         dir="${build.sys.dir}"/>
+
+    <!-- Compile Java Sources -->
+    <javac      srcdir="${src.sys.dir}"
+               destdir="${build.sys.dir}"
+                 debug="${compile.debug}"
+           deprecation="${compile.deprecation}"
+              optimize="${compile.optimize}"
+                source="${project.source}"
+                target="${project.target}">
+      <classpath refid="systest.classpath" />
+    </javac>
+
+    <!-- Copy non-Java Sources -->
+    <copy        todir="${build.sys.dir}">
+      <fileset     dir="${src.sys.dir}">
+        <exclude  name="**/*.java"/>
+      </fileset>
+    </copy>
+
+  </target>
+
+
+  <target name="systest" depends="systest.compile"
+   description="Execute system integration tests">
+
+    <junit         fork="yes"
+           printSummary="yes"
+            haltonerror="yes"
+          haltonfailure="yes">
+
+      <classpath  refid="systest.classpath"/>
+      <formatter   type="plain"
+                usefile="false"/>
+      <sysproperty  key="url"
+                  value="${htmlunit.url}"/>
+
+      <batchtest>
+        <fileset    dir="${build.sys.dir}"
+               includes="**/*TestCase.class"/>
+      </batchtest>
+
+    </junit>
+
+  </target>
+
+
+</project>

Propchange: struts/shale/trunk/sql-browser/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/build.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/shale/trunk/sql-browser/default.properties
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/default.properties?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/default.properties (added)
+++ struts/shale/trunk/sql-browser/default.properties Mon Jan 30 22:03:15 2006
@@ -0,0 +1,172 @@
+# Copyright 2006 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.
+#
+# $Id$
+
+
+# ==============================================================================
+# Default Configuration Properties
+# ==============================================================================
+
+# These properties define default values for your application.  You can
+# override them by supplying a "build.properties" file in the top level
+# directory of your project, containing only the property values you wish
+# to override.
+
+
+# ------------------------------------------------------------------------------
+# Project Description Information
+# ------------------------------------------------------------------------------
+
+# Project copyright notice (for Javadoc generation)
+project.copyright=Copyright &#169; 2006 - The Apache Software Foundation
+
+# Project name (should match <project name="xxx"> setting in build.xml)
+project.name=Shale SQL Browser Example
+
+# Base package name for Java classes in this project (affects Javadoc generation,
+# and is included in manifest files)
+project.package=org.apache.shale.examples.sqlbrowser
+
+# Context path for the generated application (will be included in the
+# target directory
+project.path=shale-sql-browser
+
+# Source JDK platform to compile for
+project.source=1.5
+
+# Specification vendor (will be placed in manifest files)
+project.spec.vendor=The Apache Sofware Foundation
+
+# Specification version number (will be placed in manifest files)
+project.spec.version=1.0
+
+# Target JK platform to compile to
+project.target=1.5
+
+# Implementation vendor (will be placed in manifest files)
+project.vendor=The Apache Software Foundation
+
+# Implementation vendor id (will be placed in manifest files).  Should be the
+# top level package name for classes produced by your organization
+project.vendor.id=org.apache
+
+# Implementation version (will be placed in manifest files)
+project.version=0.1
+
+
+# ------------------------------------------------------------------------------
+# Compilation Options
+# ------------------------------------------------------------------------------
+
+# Should compiler generate line numbers for debugging (true or false)
+compile.debug=true
+
+# Should compiler generate detailed warnings for using deprecated APIs (true or false)
+compile.deprecation=true
+
+# Should compiler optimize the generated code (true or false)
+compiler.optimize=true
+
+
+# ------------------------------------------------------------------------------
+# Web Application Configuration
+# ------------------------------------------------------------------------------
+
+# Setting for the JavaServer Faces state saving option (client or server)
+webapp.state.saving=client
+
+
+# ------------------------------------------------------------------------------
+# Project Directory Structure
+# ------------------------------------------------------------------------------
+
+# Source Directory Structure Definitions
+conf.dir=${basedir}/conf
+src.dir=${basedir}/src
+src.conf.dir=${src.dir}/conf
+src.java.dir=${src.dir}/java
+src.sys.dir=${src.dir}/systest
+src.test.dir=${src.dir}/test
+src.web.dir=${src.dir}/web
+test.dir=${basedir}/test
+web.dir=${basedir}/web
+
+
+# Target Directory Structure Definitions
+build.dir=${basedir}/target
+build.docs.dir=${build.dir}/javadocs
+build.sys.dir=${build.dir}/systest-classes
+build.test.dir=${build.dir}/test-classes
+build.web.dir=${build.dir}/${project.path}
+dist.dir=${basedir}/dist
+
+
+# Library directory containing libraries that will be copied into the
+# web application.  It is legal for the JAR files to be nested inside
+# this directory.
+lib.dir=${basedir}/../lib
+
+
+# Library directory containing libraries that will be added to the
+# compilation classpath, but will not be eopied into the web application
+# (presumably because they will be provided by the container already).
+# It is legal for the JAR riles to be nested inside this directory.
+ext.dir=ext
+
+
+# Directory containing your Shale binary distribution
+shale.dir=${basedir}/../target
+
+
+# ------------------------------------------------------------------------------
+# (Optional) Tomcat Integration
+# ------------------------------------------------------------------------------
+
+# The full pathname to the Tomcat instalation you will be using
+catalina.home=/home/${user.name}/jakarta-tomcat-5.0.28
+
+# The full URL to the manager application you will be using
+catalina.manager=http://localhost:8080/manager
+
+# The username of a Tomcat user that has the "manager" role
+catalina.username=tomcat
+
+# The password of a Tomcat user that has the "manager" role
+catalina.password=tomcat
+
+
+# ------------------------------------------------------------------------------
+# (Optional) System Integration Test Packages
+# ------------------------------------------------------------------------------
+
+
+# The full pathname to the HtmlUnit (version 1.6 or later) binary distribution
+# from http://sourceforge.net
+htmlunit.dir=/usr/local/htmlunit-1.6
+
+
+# the full URL to the application to be tested
+htmlunit.url=http://localhost:8080/${project.path}
+
+
+# ------------------------------------------------------------------------------
+# Derby Integration
+# ------------------------------------------------------------------------------
+
+# The full pathname to the Derby binary distribution (version 10.1.2.1 or later)
+derby.dir=/usr/local/db-derby-10.1.2.1-bin
+
+# The pathname to the embedded Derby JAR file
+derby.jar=${derby.dir}/lib/derby.jar

Propchange: struts/shale/trunk/sql-browser/default.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/default.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/shale/trunk/sql-browser/derby.log
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/derby.log?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/derby.log (added)
+++ struts/shale/trunk/sql-browser/derby.log Mon Jan 30 22:03:15 2006
@@ -0,0 +1,10 @@
+----------------------------------------------------------------
+2006-01-31 05:59:02.653 GMT:
+ Booting Derby version The Apache Software Foundation - Apache Derby - 10.1.2.1 - (330608): instance c013800d-0109-1f0a-ea90-0000004fd248
+on database directory /home/craigmcc/jakarta-tomcat-5.0.28/work/Catalina/localhost/shale-sql-browser/DATABASE 
+
+Database Class Loader started - derby.database.classpath=''
+
+2006-01-31 06:00:37.431 GMT:
+Shutting down instance c013800d-0109-1f0a-ea90-0000004fd248
+----------------------------------------------------------------

Added: struts/shale/trunk/sql-browser/nbproject/project.xml
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/nbproject/project.xml?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/nbproject/project.xml (added)
+++ struts/shale/trunk/sql-browser/nbproject/project.xml Mon Jan 30 22:03:15 2006
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.ant.freeform</type>
+    <configuration>
+        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+            <!-- Do not use Project Properties customizer when editing this file manually. -->
+            <name>Shale SQL Browser Example</name>
+            <properties/>
+            <folders>
+                <source-folder>
+                    <label>src/conf</label>
+                    <type>java</type>
+                    <location>src/conf</location>
+                </source-folder>
+                <source-folder>
+                    <label>src/java</label>
+                    <type>java</type>
+                    <location>src/java</location>
+                </source-folder>
+                <source-folder>
+                    <label>src/systest</label>
+                    <type>java</type>
+                    <location>src/systest</location>
+                </source-folder>
+                <source-folder>
+                    <label>src/test</label>
+                    <type>java</type>
+                    <location>src/test</location>
+                </source-folder>
+                <source-folder>
+                    <label>src/web</label>
+                    <type>java</type>
+                    <location>src/web</location>
+                </source-folder>
+            </folders>
+            <ide-actions>
+                <action name="build">
+                    <target>compile</target>
+                </action>
+                <action name="clean">
+                    <target>clean</target>
+                </action>
+                <action name="javadoc">
+                    <target>javadocs</target>
+                </action>
+                <action name="test">
+                    <target>test</target>
+                </action>
+                <action name="rebuild">
+                    <target>clean</target>
+                    <target>compile</target>
+                </action>
+            </ide-actions>
+            <view>
+                <items>
+                    <source-folder style="packages">
+                        <label>src/conf</label>
+                        <location>src/conf</location>
+                    </source-folder>
+                    <source-folder style="packages">
+                        <label>src/java</label>
+                        <location>src/java</location>
+                    </source-folder>
+                    <source-folder style="packages">
+                        <label>src/systest</label>
+                        <location>src/systest</location>
+                    </source-folder>
+                    <source-folder style="packages">
+                        <label>src/test</label>
+                        <location>src/test</location>
+                    </source-folder>
+                    <source-folder style="packages">
+                        <label>src/web</label>
+                        <location>src/web</location>
+                    </source-folder>
+                    <source-file>
+                        <location>build.xml</location>
+                    </source-file>
+                </items>
+                <context-menu>
+                    <ide-action name="build"/>
+                    <ide-action name="clean"/>
+                    <ide-action name="javadoc"/>
+                    <ide-action name="test"/>
+                    <ide-action name="rebuild"/>
+                </context-menu>
+            </view>
+            <subprojects/>
+        </general-data>
+        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
+            <compilation-unit>
+                <package-root>src/conf</package-root>
+                <package-root>src/java</package-root>
+                <package-root>src/systest</package-root>
+                <package-root>src/test</package-root>
+                <package-root>src/web</package-root>
+                <classpath mode="compile">../target/dist/shale-core.jar:../target/dist/shale-tiger.jar:../lib/myfaces/myfaces-api.jar:../lib/servlet-api/servlet-api.jar:../lib/myfaces/myfaces-api.jar:../../../../../../../usr/local/db-derby-10.1.2.1-bin/lib/derby.jar</classpath>
+                <source-level>1.5</source-level>
+            </compilation-unit>
+        </java-data>
+    </configuration>
+</project>

Propchange: struts/shale/trunk/sql-browser/nbproject/project.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/nbproject/project.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/shale/trunk/sql-browser/src/conf/MANIFEST.MF
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/src/conf/MANIFEST.MF?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/src/conf/MANIFEST.MF (added)
+++ struts/shale/trunk/sql-browser/src/conf/MANIFEST.MF Mon Jan 30 22:03:15 2006
@@ -0,0 +1,7 @@
+Extension-Name: @projectPackage@
+Specification-Vendor: @specVendor@
+Specification-Version: @specVersion@
+Implementation-Vendor-Id: @implVendorId@
+Implementation-Vendor: @implVendor@
+Implementation-Version: @implVersion@
+

Added: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Application.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Application.java?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Application.java (added)
+++ struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Application.java Mon Jan 30 22:03:15 2006
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2006 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.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.examples.sqlbrowser;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameClassPair;
+import javax.naming.NamingEnumeration;
+import javax.sql.DataSource;
+import org.apache.shale.tiger.managed.Bean;
+import org.apache.shale.tiger.managed.Scope;
+
+/**
+ * <p>Application scope managed bean for the SQL Browser application.</p>
+ */
+@Bean(name="appbean", scope=Scope.APPLICATION)
+public class Application {
+    
+
+    public Application() {
+        System.err.println("Application constructor()");
+    }
+
+
+    // ------------------------------------------------------ Manifest Constants
+
+
+    /**
+     * <p>The prefix of the JNDI name for all relevant data sources.</p>
+     */
+    private static final String PREFIX = "java:comp/env";
+
+
+    // ------------------------------------------------------ Instance Variables
+
+
+    /**
+     * <p>The list of <code>DataSource</code>s available via JNDI for this
+     * web application.</p>
+     */
+    private SelectItem[] dataSources = null;
+
+
+    // ---------------------------------------------------------- Public Methods
+
+
+    /**
+     * <p>Return the list of <code>DataSource</code>s available via JNDI
+     * for this web application.</p>
+     */
+    public SelectItem[] getDataSources() {
+
+        System.err.println("Application getDataSources()");
+        if (dataSources == null) {
+            List<SelectItem> list = new ArrayList<SelectItem>();
+            internal(list);
+            try {
+                InitialContext context = new InitialContext();
+                append(context, PREFIX, list);
+            } catch (Exception e) {
+                throw new FacesException(e);
+            }
+            dataSources = (SelectItem[]) list.toArray(new SelectItem[list.size()]);
+        }
+        System.err.println("Application getDataSources() --> " + dataSources.length);
+        return dataSources;
+
+    }
+
+
+    // --------------------------------------------------------- Private Methods
+
+
+    /**
+     * <p>Append any data sources found in the specified JNDI context
+     * to the specified list.  If a JNDI subcontext is found, apply this
+     * method recursively.</p>
+     *
+     * @param context JNDI context to be searched
+     * @param prefix Prefix for the fully qualified resource names to be added
+     * @param list List of data sources to which new ones should be added
+     */
+    private void append(Context context, String prefix, List<SelectItem> list) {
+
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        if (cl == null) {
+            cl = Application.class.getClassLoader();
+        }
+        try {
+            NamingEnumeration<NameClassPair> entries = context.list(prefix);
+            while (entries.hasMore()) {
+                NameClassPair entry = entries.next();
+                Class clazz = cl.loadClass(entry.getClassName());
+                if (DataSource.class.isAssignableFrom(clazz)) {
+                    list.add(new SelectItem(prefix + "/" + entry.getName(),
+                                            (prefix + "/" + entry.getName()).substring(PREFIX.length())));
+                } else if (Context.class.isAssignableFrom(clazz)) {
+                    Context search = (Context) context.lookup(entry.getName());
+                    append(search, prefix + "/" + entry.getName(), list);
+                }
+            }
+        } catch (Exception e) {
+            throw new FacesException(e);
+        }
+
+    }
+
+
+    /**
+     * <p>Append the default internal data source for this application.</p>
+     *
+     * @param list List of <code>SelectItem</code> of available data sources
+     */
+    private void internal(List<SelectItem> list) {
+
+        FacesContext context = FacesContext.getCurrentInstance();
+        // FIXME - localize the label
+        list.add(new SelectItem("", "Embedded"));
+
+    }
+
+
+}

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Application.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Application.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Bundle.properties
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Bundle.properties?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Bundle.properties (added)
+++ struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Bundle.properties Mon Jan 30 22:03:15 2006
@@ -0,0 +1,20 @@
+# Copyright 2006 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.
+#
+# $Id$
+
+sqlbrowser.title=SQL Query Browser
+sqlbrowser.dataSource=Data Source:
+sqlbrowser.query=SQL Query:
+sqlbrowser.execute=Execute

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Bundle.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Bundle.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/InternalDataSource.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/InternalDataSource.java?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/InternalDataSource.java (added)
+++ struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/InternalDataSource.java Mon Jan 30 22:03:15 2006
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2006 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.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.examples.sqlbrowser;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import org.apache.derby.jdbc.EmbeddedDataSource;
+
+/**
+ * <p>Trivial implementation of <code>DataSource</code> that wraps a data source
+ * provided by Derby, and provides a shutdown hook.</p>
+ */
+public class InternalDataSource extends EmbeddedDataSource {
+
+
+    // ------------------------------------------------------------ Constructors
+
+
+    /**
+     * <p>Construct a connection pool for the specified URL.</p>
+     */
+    public InternalDataSource(String url) throws SQLException {
+
+        // Instantiate and configure a Derby EmbeddedDataSource
+        setDatabaseName(url);
+        setCreateDatabase("create");
+
+    }
+
+
+    // ---------------------------------------------------------- Public Methods
+
+
+    /**
+     * <p>Cause the embedded Derby database to be shut down.</p>
+     */
+    public void shutdown() throws SQLException {
+
+        setShutdownDatabase("shutdown");
+        Connection conn = null;
+        try {
+            conn = getConnection();
+        } catch (SQLException e) {
+            ; // Ignore errors here; we just wanted to trigger the shutdown
+        } finally {
+            try {
+                if (conn != null) {
+                    conn.close();
+                }
+            } catch (SQLException e) {
+                ;
+            }
+        }
+
+    }
+
+
+}

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/InternalDataSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/InternalDataSource.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Listener.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Listener.java?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Listener.java (added)
+++ struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Listener.java Mon Jan 30 22:03:15 2006
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2006 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.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.examples.sqlbrowser;
+
+import java.io.File;
+import java.sql.SQLException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.faces.FacesException;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.sql.DataSource;
+
+/**
+ * <p>A servlet context listener that sets up the embedded example database.</p>
+ */
+public class Listener implements ServletContextListener {
+
+
+    // ------------------------------------------------------ Manifest Constants
+
+
+    /**
+     * <p>The application scope attribute under which we store a data source
+     * for the embedded database.</p>
+     */
+    public static final String INTERNAL_DATA_SOURCE = "internal";
+
+
+
+    // ------------------------------------------------------ Instance Variables
+
+
+    /**
+     * <p>The internal data source we have configured for Derby.</p>
+     */
+    private InternalDataSource ds = null;
+
+
+    /**
+     * <p>The log instance for this class.</p>
+     */
+    private transient Logger logger =
+      Logger.getLogger(this.getClass().getName());
+
+
+
+    // ------------------------------------------ ServletContextListener Methods
+
+
+    /**
+     * <p>Perform cleanup actions upon application shutdown.</p>
+     */
+    public void contextDestroyed(ServletContextEvent event) {
+
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "Shutting down database");
+        }
+
+        // Shut down the Derby data source
+        try {
+            ds.shutdown();
+        } catch (SQLException e) {
+            if (logger.isLoggable(Level.SEVERE)) {
+                while (e != null) {
+                    logger.log(Level.SEVERE, e.getMessage(), e);
+                    e = e.getNextException();
+                }
+            }
+        }
+
+    }
+
+
+    /**
+     * <p>Perform setup actions upon application startup.</p>
+     */
+    public void contextInitialized(ServletContextEvent event) {
+
+        // Calculate a database URL for the database to be created
+        ServletContext context = event.getServletContext();
+        File tempDir = (File) context.getAttribute("javax.servlet.context.tempdir");
+//        String url = "jdbc:derby:" + tempDir.getAbsolutePath() +
+//          File.separator + "DATABASE";
+        String url = tempDir.getAbsolutePath() + File.separator + "DATABASE";
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "Creating database " + url);
+        }
+
+        // Create and publish a data source for the embedded database
+        try {
+            ds = new InternalDataSource(url);
+        } catch (SQLException e) {
+            if (logger.isLoggable(Level.SEVERE)) {
+                while (e != null) {
+                    logger.log(Level.SEVERE, e.getMessage(), e);
+                    e = e.getNextException();
+                }
+            }
+            throw new FacesException("SQLException occurred during startup (see log for details): " + e.getMessage());
+        }
+        context.setAttribute(INTERNAL_DATA_SOURCE, ds);
+
+    }
+
+
+}

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Listener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Listener.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Messages.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Messages.java?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Messages.java (added)
+++ struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Messages.java Mon Jan 30 22:03:15 2006
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2006 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.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.examples.sqlbrowser;
+
+import org.apache.shale.tiger.managed.Bean;
+import org.apache.shale.tiger.managed.Scope;
+import org.apache.shale.util.LoadBundle;
+
+/**
+ * <p>Proxy for localized messages container for the SQL Browser application.</p>
+ */
+@Bean(name="messages", scope=Scope.APPLICATION)
+public class Messages extends LoadBundle {
+    
+
+    /**
+     * <p>Creates a new instance of Messages for the default bundle name.</p>
+     */
+    public Messages() {
+        this("org.apache.shale.examples.sqlbrowser.Bundle");
+    }
+    
+
+    /**
+     * <p>Creates a new instance of Messages for the specified bundle name.</p>
+     *
+     * @param name Name of the resource bundle to be wrapped.</p>
+     */
+    public Messages(String name) {
+        super(name);
+    }
+
+
+}

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Messages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Messages.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Query.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Query.java?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Query.java (added)
+++ struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Query.java Mon Jan 30 22:03:15 2006
@@ -0,0 +1,222 @@
+/*
+ * Copyright 2006 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.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.examples.sqlbrowser;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.context.FacesContext;
+import javax.faces.model.ResultSetDataModel;
+import javax.sql.DataSource;
+import org.apache.shale.tiger.managed.Bean;
+import org.apache.shale.tiger.managed.Scope;
+import org.apache.shale.tiger.view.Prerender;
+import org.apache.shale.tiger.view.View;
+
+/**
+ * <p>Backing bean for the SQL query demo page.</p>
+ */
+@Bean(name="query", scope=Scope.REQUEST)
+@View
+public class Query {
+    
+
+    // ------------------------------------------------------ Instance Variables
+
+
+    // ---------------------------------------------------------- JSF Properties
+
+
+    /**
+     * <p>Flag indicating whether the dynamically constructed table has been
+     * completed, and should therefore be displayed.</p>
+     */
+    private boolean completed = false;
+
+    public boolean isCompleted() {
+        return this.completed;
+    }
+
+    public void setCompleted(boolean completed) {
+        this.completed = completed;
+    }
+
+
+    /**
+     * <p>The name of the JNDI data source we should use for querying.</p>
+     */
+    private String dataSource = null;
+
+    public String getDataSource() {
+        return this.dataSource;
+    }
+
+    public void setDataSource(String dataSource) {
+        this.dataSource = dataSource;
+    }
+
+
+
+    /**
+     * <p>The SQL query we should execute.</p>
+     */
+    private String query = null;
+
+    public String getQuery() {
+        return this.query;
+    }
+
+    public void setQuery(String query) {
+        this.query = query;
+    }
+
+
+    /**
+     * <p>The results table we will dynamically construct.</p>
+     */
+    private HtmlDataTable results = new HtmlDataTable();
+
+    public HtmlDataTable getResults() {
+        return this.results;
+    }
+
+    public void setResults(HtmlDataTable results) {
+        this.results = results;
+    }
+
+
+    /**
+     * <p>The <code>ResultSetDataModel</code> to which we will bind
+     * our data table component.</p>
+     */
+    private ResultSetDataModel resultSetDataModel = null;
+
+    public ResultSetDataModel getResultSetDataModel() {
+        return this.resultSetDataModel;
+    }
+
+
+    // ------------------------------------------------------ JSF Event Handlers
+
+
+    /**
+     * <p>Process the submit of the query form.</p>
+     */
+    public String execute() {
+
+        return null;
+
+    }
+
+
+
+    // ------------------------------------------------- View Controller Methods
+
+
+    /**
+     * <p>Perform the dynamic query, and set up the corresponding columns.</p>
+     */
+    @Prerender
+    public void prerender() {
+
+        // If there is no query string at all, do nothing
+        if ((query == null) || (query.length() < 1)) {
+            return;
+        }
+
+        // Perform the query and dynamically set up the results
+        FacesContext context = FacesContext.getCurrentInstance();
+        Connection conn = null;
+        PreparedStatement stmt = null;
+        ResultSet rs = null;
+        try {
+
+            // Look up the appropriate data source
+            // FIXME - add JNDI lookup support for non-internal
+            System.err.println("prerender():  Acquire DataSource and Connection");
+            DataSource ds = (DataSource)
+              context.getExternalContext().getApplicationMap().get(Listener.INTERNAL_DATA_SOURCE);
+            conn = ds.getConnection();
+
+            // Execute the requested query
+            System.err.println("prerender():  Prepare and execute query");
+            stmt = conn.prepareStatement(query);
+            rs = stmt.executeQuery();
+
+            // Acquire the result set metadata
+            ResultSetMetaData rsmd = rs.getMetaData();
+            System.err.println("prerender():  There are " + rsmd.getColumnCount() + " columns");
+
+            // Wire up our table binding
+
+            // Dynamically create columns as needed
+
+        } catch (SQLException e) {
+
+            context.addMessage
+              (null, new FacesMessage("Exception executing this query: " + e));
+            while (e != null) {
+                context.getExternalContext().
+                  log("Exception executing this query", e);
+                e = e.getNextException();
+            }
+            setCompleted(false);
+
+        } finally {
+
+            // Close the result set (if any) that we opened
+            if (rs != null) {
+                try {
+                    rs.close();
+                } catch (SQLException e) {
+                    ;
+                }
+            }
+
+            // Close the statement (if any) that we opened
+            if (stmt != null) {
+                try {
+                    stmt.close();
+                } catch (SQLException e) {
+                    ;
+                }
+            }
+
+            // Close the connection (if any) that we opened
+            if (conn != null) {
+                try {
+                    conn.close();
+                } catch (SQLException e) {
+                    ;
+                }
+            }
+
+        }
+
+        // Set the completed flag to indicate that we should display the results
+        completed = true;
+
+    }
+
+
+}

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Query.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Query.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/package.html
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/package.html?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/package.html (added)
+++ struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/package.html Mon Jan 30 22:03:15 2006
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright 2006 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.
+
+ $Id$
+-->
+
+<body>
+
+  <p>This package contains the backing beans and business logic
+  objects that support the SQL Browser application.</p>
+
+</body>

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/package.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/shale/trunk/sql-browser/src/java/overview.html
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/sql-browser/src/java/overview.html?rev=373732&view=auto
==============================================================================
--- struts/shale/trunk/sql-browser/src/java/overview.html (added)
+++ struts/shale/trunk/sql-browser/src/java/overview.html Mon Jan 30 22:03:15 2006
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright 2006 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.
+
+ $Id$
+-->
+
+<body>
+
+  <p>Replace this content with an overview of the entire application.</p>
+
+</body>

Propchange: struts/shale/trunk/sql-browser/src/java/overview.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/shale/trunk/sql-browser/src/java/overview.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org