You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/06/08 10:05:28 UTC
svn commit: r545451 [1/2] - in
/incubator/tuscany/java/das/samples/sample-ajax-das: ./ src/ src/main/
src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/samples/
src/main/java/...
Author: lresende
Date: Fri Jun 8 01:05:26 2007
New Revision: 545451
URL: http://svn.apache.org/viewvc?view=rev&rev=545451
Log:
TUSCANY-800 - Latest patch from Amita
Added:
incubator/tuscany/java/das/samples/sample-ajax-das/
incubator/tuscany/java/das/samples/sample-ajax-das/build.xml
incubator/tuscany/java/das/samples/sample-ajax-das/pom.xml
incubator/tuscany/java/das/samples/sample-ajax-das/readme.htm
incubator/tuscany/java/das/samples/sample-ajax-das/src/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/util/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/AjaxDBConfig.xml
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/CustomerConfigWithConverter.xml
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/CustomerConfigWithIDConverter.xml
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/DasConfig.xml
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/META-INF/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/META-INF/context.xml
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/META-INF/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/META-INF/context.xml
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/WEB-INF/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/WEB-INF/tld/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/WEB-INF/tld/c.tld
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/WEB-INF/tld/fmt.tld
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/WEB-INF/web.xml
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/html/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/html/DASWebSampleFrame.html
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/html/blank.html
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/js/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/js/ajax.js
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/js/dasmenu.js
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/DASMenu.jsp
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/converter.jsp
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/default.css
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/indexAdhoc.jsp
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/indexCommand.jsp
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/main.css
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/occ.jsp
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/rss.jsp
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/xsl/
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/xsl/company.xsl
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/xsl/companyDepartment.xsl
incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/xsl/customer.xsl
Added: incubator/tuscany/java/das/samples/sample-ajax-das/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/build.xml?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/build.xml (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/build.xml Fri Jun 8 01:05:26 2007
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<project name="samples" default="compile">
+ <property name="mainDir" value="../../.."/>
+ <path id="javac.classpath">
+ <fileset dir="${mainDir}/lib">
+ <include name="tuscany-runtime-incubating-M1.jar"/>
+ </fileset>
+ </path>
+ <path id="java.classpath">
+ <fileset dir="${mainDir}/lib">
+ <include name="tuscany-runtime-incubating-M1.jar"/>
+ </fileset>
+ <pathelement path="target/sample-das-features.jar"/>
+ </path>
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java" destdir="target/classes" debug="on" source="1.5" target="1.5">
+ <classpath refid="javac.classpath"/>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <war destfile="target/sample-das-features.war" webxml="src/main/webapp/WEB-INF/web.xml">
+ <classes dir="target/classes"/>
+ </war>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target" excludes="sample-companyweb-incubating-M1.war"/>
+ </delete>
+ </target>
+</project>
Added: incubator/tuscany/java/das/samples/sample-ajax-das/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/pom.xml?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/pom.xml (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/pom.xml Fri Jun 8 01:05:26 2007
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-samples</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sample-ajax-das</artifactId>
+ <packaging>war</packaging>
+ <name>Tuscany DAS Ajax Sample</name>
+ <description>Sample demo of RDB DAS features in a Web application using Ajax</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das-rdb</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-sample-dbconfig</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.1.2</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>taglibs</groupId>
+ <artifactId>standard</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>5.0.18</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>tomcat</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>5.0.18</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <!-- this will place the java source files inside the war -->
+ <build>
+ <finalName>sample-ajax-das</finalName>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ </build>
+</project>
Added: incubator/tuscany/java/das/samples/sample-ajax-das/readme.htm
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/readme.htm?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/readme.htm (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/readme.htm Fri Jun 8 01:05:26 2007
@@ -0,0 +1,653 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 10">
+<meta name=Originator content="Microsoft Word 10">
+<link rel=File-List href="readme_files/filelist.xml">
+<title>Ajax DAS Web Sample</title>
+<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
+ name="City"/>
+<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
+ name="place"/>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Author>IBM_User</o:Author>
+ <o:LastAuthor>IBM_User</o:LastAuthor>
+ <o:Revision>16</o:Revision>
+ <o:TotalTime>256</o:TotalTime>
+ <o:Created>2007-04-21T09:01:00Z</o:Created>
+ <o:LastSaved>2007-04-24T06:52:00Z</o:LastSaved>
+ <o:Pages>1</o:Pages>
+ <o:Words>688</o:Words>
+ <o:Characters>3924</o:Characters>
+ <o:Company>IBM</o:Company>
+ <o:Lines>32</o:Lines>
+ <o:Paragraphs>9</o:Paragraphs>
+ <o:CharactersWithSpaces>4603</o:CharactersWithSpaces>
+ <o:Version>10.3501</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:SpellingState>Clean</w:SpellingState>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:Compatibility>
+ <w:BreakWrappedTables/>
+ <w:SnapToGridInCell/>
+ <w:ApplyBreakingRules/>
+ <w:WrapTextWithPunct/>
+ <w:UseAsianBreakRules/>
+ <w:UseFELayout/>
+ </w:Compatibility>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]--><!--[if !mso]><object
+ classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
+<style>
+st1\:*{behavior:url(#ieooui) }
+</style>
+<![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ @font-face
+ {font-family:SimSun;
+ panose-1:2 1 6 0 3 1 1 1 1 1;
+ mso-font-alt:\5B8B\4F53;
+ mso-font-charset:134;
+ mso-generic-font-family:auto;
+ mso-font-pitch:variable;
+ mso-font-signature:3 135135232 16 0 262145 0;}
+@font-face
+ {font-family:"\@SimSun";
+ panose-1:2 1 6 0 3 1 1 1 1 1;
+ mso-font-charset:134;
+ mso-generic-font-family:auto;
+ mso-font-pitch:variable;
+ mso-font-signature:3 135135232 16 0 262145 0;}
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:SimSun;}
+h1
+ {mso-style-next:Normal;
+ margin-top:12.0pt;
+ margin-right:0in;
+ margin-bottom:3.0pt;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ page-break-after:avoid;
+ mso-outline-level:1;
+ font-size:16.0pt;
+ font-family:Arial;
+ mso-font-kerning:16.0pt;}
+h3
+ {mso-style-next:Normal;
+ margin-top:12.0pt;
+ margin-right:0in;
+ margin-bottom:3.0pt;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ page-break-after:avoid;
+ mso-outline-level:3;
+ font-size:13.0pt;
+ font-family:Arial;}
+a:link, span.MsoHyperlink
+ {color:blue;
+ text-decoration:underline;
+ text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+ {color:purple;
+ text-decoration:underline;
+ text-underline:single;}
+pre
+ {margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Courier New";
+ mso-fareast-font-family:"Times New Roman";}
+span.codefrag
+ {mso-style-name:codefrag;}
+span.SpellE
+ {mso-style-name:"";
+ mso-spl-e:yes;}
+span.GramE
+ {mso-style-name:"";
+ mso-gram-e:yes;}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+ /* List Definitions */
+ @list l0
+ {mso-list-id:207496062;
+ mso-list-type:hybrid;
+ mso-list-template-ids:243853632 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
+@list l0:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:\F0B7;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ font-family:Symbol;}
+@list l0:level2
+ {mso-level-tab-stop:1.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l0:level3
+ {mso-level-tab-stop:1.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l0:level4
+ {mso-level-tab-stop:2.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l0:level5
+ {mso-level-tab-stop:2.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l0:level6
+ {mso-level-tab-stop:3.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l0:level7
+ {mso-level-tab-stop:3.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l0:level8
+ {mso-level-tab-stop:4.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l0:level9
+ {mso-level-tab-stop:4.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l1
+ {mso-list-id:384569001;
+ mso-list-template-ids:796568378;}
+@list l1:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:\F0B7;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ mso-ansi-font-size:10.0pt;
+ font-family:Symbol;}
+@list l2
+ {mso-list-id:482242244;
+ mso-list-template-ids:994768232;}
+@list l2:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:\F0B7;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ mso-ansi-font-size:10.0pt;
+ font-family:Symbol;}
+@list l3
+ {mso-list-id:1231572300;
+ mso-list-template-ids:986846614;}
+@list l3:level2
+ {mso-level-number-format:alpha-lower;
+ mso-level-tab-stop:1.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l4
+ {mso-list-id:1305811547;
+ mso-list-type:hybrid;
+ mso-list-template-ids:1677090400 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l4:level1
+ {mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l4:level2
+ {mso-level-number-format:alpha-lower;
+ mso-level-tab-stop:1.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l4:level3
+ {mso-level-number-format:roman-lower;
+ mso-level-tab-stop:1.5in;
+ mso-level-number-position:right;
+ text-indent:-9.0pt;}
+@list l4:level4
+ {mso-level-tab-stop:2.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l4:level5
+ {mso-level-tab-stop:2.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l4:level6
+ {mso-level-tab-stop:3.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l4:level7
+ {mso-level-tab-stop:3.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l4:level8
+ {mso-level-tab-stop:4.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l4:level9
+ {mso-level-tab-stop:4.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l5
+ {mso-list-id:1389258758;
+ mso-list-template-ids:-215579238;}
+@list l6
+ {mso-list-id:1605966365;
+ mso-list-type:hybrid;
+ mso-list-template-ids:14685132 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l6:level1
+ {mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l6:level2
+ {mso-level-tab-stop:1.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l6:level3
+ {mso-level-tab-stop:1.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l6:level4
+ {mso-level-tab-stop:2.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l6:level5
+ {mso-level-tab-stop:2.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l6:level6
+ {mso-level-tab-stop:3.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l6:level7
+ {mso-level-tab-stop:3.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l6:level8
+ {mso-level-tab-stop:4.0in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l6:level9
+ {mso-level-tab-stop:4.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+@list l7
+ {mso-list-id:1822502041;
+ mso-list-template-ids:1582195508;}
+@list l7:level1
+ {mso-level-start-at:7;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;}
+ol
+ {margin-bottom:0in;}
+ul
+ {margin-bottom:0in;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0in 5.4pt 0in 5.4pt;
+ mso-para-margin:0in;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p class=MsoNormal><span style='font-family:Arial'><o:p> </o:p></span></p>
+
+<p class=MsoNormal align=center style='text-align:center'><st1:City><st1:place><b><span
+ style='font-size:14.0pt;font-family:Arial'>Ajax</span></b></st1:place></st1:City><b><span
+style='font-size:14.0pt;font-family:Arial'> DAS Web Sample<o:p></o:p></span></b></p>
+
+<p class=MsoNormal><span style='font-family:Arial'><o:p> </o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'>This web
+sample demonstrates SDO RDB Data Access Service using </span><st1:City><st1:place><span
+ style='font-size:11.0pt;font-family:Arial'>Ajax</span></st1:place></st1:City><span
+style='font-size:11.0pt;font-family:Arial'> for the generic framework. <span
+style='mso-spacerun:yes'> </span><o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'>The
+application user can navigate the menu to see examples of different DAS
+features. <br>The application user dbsetup utility to create canned Derby database
+with required tables and populate initial data in them.
+For refreshing database data to initial state, user can click on Refresh Button.
+<br>
+<span style='mso-spacerun:yes'> </span><o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'><span
+style='mso-tab-count:1'> </span>►<span class=SpellE><b>Adhoc</b></span><b>
+Query</b> (CRUD operations on COMPANY and DEPARTMENT using <span class=SpellE>adhoc</span>
+<span class=SpellE>Sql</span> statements)<o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'><o:p> </o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'><span
+style='mso-tab-count:1'> </span>►<b>DAS <span class=SpellE>Commad</span></b>
+(CRUD operations on COMPANY and DEPARTMENT using DAS <span class=SpellE>config</span>
+commands)<o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'><span
+style='mso-tab-count:1'> </span>►<b>Advanced Features</b> <o:p></o:p></span></p>
+
+<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span class=GramE><b><span
+style='font-size:11.0pt;font-family:Arial'>►Optimistic <span
+class=SpellE>Concurrecy</span> Control</span></b><span style='font-size:11.0pt;
+font-family:Arial'> (Using BOOK.</span></span><span style='font-size:11.0pt;
+font-family:Arial'> NAME)<o:p></o:p></span></p>
+
+<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span
+style='font-size:11.0pt;font-family:Arial'>►<b>Converter</b> (Using
+CUSTOMER.LASTNAME)<o:p></o:p></span></p>
+
+<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span
+style='font-size:11.0pt;font-family:Arial'>►<b>Result Set Shape</b>
+(Using CUSTOMER table)<o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'>In future
+more features will get added.<o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-family:Arial'><o:p> </o:p></span></p>
+
+<p class=MsoNormal><b><span style='font-size:14.0pt;font-family:Arial'>Running
+the sample<o:p></o:p></span></b></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:
+"Times New Roman"'>There are two options for running this sample:<o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:
+"Times New Roman"'> <o:p></o:p></span></p>
+
+<ol style='margin-top:0in' start=1 type=1>
+ <li class=MsoNormal style='mso-list:l6 level1 lfo3;tab-stops:list .5in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Run
+ from Tomcat configured by the build <o:p></o:p></span></li>
+ <li class=MsoNormal style='mso-list:l6 level1 lfo3;tab-stops:list .5in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Deploying
+ the sample-ajax-das WAR into a Tomcat you configure yourself <o:p></o:p></span></li>
+</ol>
+
+<p class=MsoNormal style='margin-top:12.0pt;margin-right:0in;margin-bottom:
+3.0pt;margin-left:0in;page-break-after:avoid;mso-outline-level:3'><b><span
+style='font-size:13.0pt;font-family:Arial'>Running from Tomcat configured by
+the build<o:p></o:p></span></b></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:
+"Times New Roman"'>This sample application is deployed (along with the canned
+test database) to an instance of Tomcat as part of our automated sample
+testing.<span style='mso-spacerun:yes'> </span>This means you can run the
+java/<span class=SpellE>das</span>/samples/testing/tomcat build (see
+java/das/samples/testing/tomcat/<span class=GramE>readme.htm )</span><span
+style='mso-spacerun:yes'> </span>and then access the application by pointing
+your browser to <u><span style='color:blue'>http://localhost:8080/sample-ajax-das/</span></u>.<span
+style='mso-spacerun:yes'> </span><o:p></o:p></span></p>
+
+<p class=MsoNormal style='margin-top:12.0pt;margin-right:0in;margin-bottom:
+3.0pt;margin-left:0in;page-break-after:avoid;mso-outline-level:3'><b><span
+style='font-size:13.0pt;font-family:Arial'>Deploying the </span></b><b><span
+style='font-size:13.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>sample-ajax-das</span></b><b><span
+style='font-size:13.0pt;font-family:Arial'> WAR into a Tomcat you configure
+yourself<o:p></o:p></span></b></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:
+"Times New Roman"'>Alternatively, you can deploy the sample to your own
+configured Tomcat installation by following the instructions below.<span
+style='mso-spacerun:yes'> </span>These instructions assume that you have
+either 1) downloaded the Tuscany sample distribution or 2) Downloaded the
+Tuscany source and run our maven build, see the following link to more details
+steps on how to build DAS Sample applications <a
+href="http://incubator.apache.org/tuscany/java_das_overview.html">http://incubator.apache.org/tuscany/java_das_overview.html</a>
+.<o:p></o:p></span></p>
+
+<p class=MsoNormal style='margin-top:12.0pt;margin-right:0in;margin-bottom:
+3.0pt;margin-left:0in;page-break-after:avoid;mso-outline-level:1'><b><span
+style='font-size:13.0pt;font-family:Arial'>Set Up<span style='mso-font-kerning:
+16.0pt'><o:p></o:p></span></span></b></p>
+
+<ol style='margin-top:0in' start=1 type=1>
+ <li class=MsoNormal style='mso-list:l4 level1 lfo6;tab-stops:list .5in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Download
+ and install the most recent stable version of Tomcat 5.5 or Tomcat 6.<span
+ style='mso-spacerun:yes'> </span>You can find it here: <a
+ href="http://tomcat.apache.org/download-55.cgi">http://tomcat.apache.org/download-55.cgi</a>
+ <o:p></o:p></span></li>
+ <li class=MsoNormal style='mso-list:l4 level1 lfo6;tab-stops:list .5in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Download
+ the most recent official release of Derby from here: <a
+ href="http://db.apache.org/derby/index.html">http://db.apache.org/derby/index.html</a>.<span
+ style='mso-spacerun:yes'> </span>The only file youll need from this
+ download is <span class=SpellE>derby.jar</span> <o:p></o:p></span></li>
+ <li class=MsoNormal style='mso-list:l4 level1 lfo6;tab-stops:list .5in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Stop
+ Tomcat <o:p></o:p></span></li>
+ <li class=MsoNormal style='mso-list:l4 level1 lfo6;tab-stops:list .5in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Copy
+ <span class=SpellE>derby.jar</span> (from the derby distribution) to {<span
+ class=SpellE>Tomcat_Home</span>}/common/lib: <o:p></o:p></span></li>
+ <li class=MsoNormal style='mso-list:l4 level1 lfo6;tab-stops:list .5in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Add
+ the sample war file to {<span class=SpellE>Tomcat_Home</span>}/<span
+ class=SpellE>webapps</span> <o:p></o:p></span></li>
+ <ol style='margin-top:0in' start=1 type=a>
+ <li class=MsoNormal style='mso-list:l4 level2 lfo6;tab-stops:list 1.0in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>sample-ajax-das.war<o:p></o:p></span></li>
+ </ol>
+ <li class=MsoNormal style='mso-list:l4 level1 lfo6;tab-stops:list .5in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Define
+ a <span class=SpellE>DataSource</span> by adding a <span class=SpellE>datasource</span>
+ definition to {<span class=SpellE>Tomcat_Home</span>}/conf/<span
+ class=SpellE>server.xml</span>. <o:p></o:p></span></li>
+ <ol style='margin-top:0in' start=1 type=a>
+ <li class=MsoNormal style='mso-list:l4 level2 lfo6;tab-stops:list 1.0in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Find
+ the end-of-section marker </<span class=SpellE>GlobalNamingResources</span>>
+ and add the following lines just above it: <o:p></o:p></span></li>
+ </ol>
+</ol>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
+font-family:Arial;mso-fareast-font-family:"Times New Roman"'> <o:p></o:p></span></p>
+
+<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
+style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'><span
+style='mso-spacerun:yes'> </span><span class=GramE><!--</span> Global
+<span class=SpellE>Datasource</span> for Derby <span class=SpellE>dastest</span>
+database --><o:p></o:p></span></p>
+
+<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
+style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'><span
+style='mso-spacerun:yes'> </span><Resource name="<span
+class=SpellE>jdbc/dastest</span>"<o:p></o:p></span></p>
+
+<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
+style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'><span
+style='mso-spacerun:yes'> </span>type="<span class=SpellE>javax.sql.DataSource</span>"<span
+style='mso-spacerun:yes'> </span>auth="Container"<o:p></o:p></span></p>
+
+<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
+style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'><span
+style='mso-spacerun:yes'> </span><span class=GramE>description</span>="</span><st1:City><st1:place><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Derby</span></st1:place></st1:City><span
+style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>
+database for DAS Company sample"<o:p></o:p></span></p>
+
+<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
+style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'><span
+style='mso-spacerun:yes'> </span><span class=SpellE><span
+class=GramE>maxActive</span></span>="100" <span class=SpellE>maxIdle</span>="30"
+<span class=SpellE>maxWait</span>="10000"<o:p></o:p></span></p>
+
+<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
+style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'><span
+style='mso-spacerun:yes'> </span>username=""
+password="" <o:p></o:p></span></p>
+
+<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
+style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'><span
+style='mso-spacerun:yes'> </span><span class=SpellE>driverClassName</span>="<span
+class=SpellE>org.apache.derby.jdbc.EmbeddedDriver</span>"<o:p></o:p></span></p>
+
+<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
+style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'><span
+style='mso-spacerun:yes'> </span><span class=SpellE><span
+class=GramE>url</span></span>="<span class=SpellE>jdbc:derby</span>:{absolute
+path}Databases/<span class=SpellE>dastest;create</span>=true"/><o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-family:Arial;mso-fareast-font-family:"Times New Roman"'><o:p> </o:p></span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><b style='mso-bidi-font-weight:
+normal'><span style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:
+"Times New Roman"'>Requirement</span></b><span style='font-size:11.0pt;
+font-family:Arial;mso-fareast-font-family:"Times New Roman"'>: You must include
+the absolute path to the Databases directory in the above <span class=SpellE>url</span>
+attribute.<span style='mso-spacerun:yes'> </span>Fore example:<o:p></o:p></span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
+font-family:Arial;mso-fareast-font-family:"Times New Roman"'> <o:p></o:p></span></p>
+
+<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
+style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'><span
+style='mso-spacerun:yes'> </span><span class=SpellE>url</span>="jdbc:derby:c:\apache-tomcat-5.5.17\Databases/dastest"/><o:p></o:p></span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
+font-family:Arial;mso-fareast-font-family:"Times New Roman"'><o:p> </o:p></span></p>
+
+<ol style='margin-top:0in' start=7 type=1>
+ <li class=MsoNormal style='mso-list:l4 level1 lfo6;tab-stops:list .5in'><span
+ style='font-size:11.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman"'>Start
+ tomcat and point your browser to: <a
+ href="http://localhost:8080/sample-ajax-das%7bversion%20tag%7d/">http://localhost:8080/sample-ajax-das/</a> <o:p></o:p></span></li>
+</ol>
+
+<p class=MsoNormal style='margin-left:1.5in'><span style='font-size:11.0pt;
+font-family:Arial;mso-fareast-font-family:"Times New Roman"'><o:p> </o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'><o:p> </o:p></span></p>
+
+<p class=MsoNormal><b><span style='font-size:14.0pt;font-family:Arial'>Sample
+Architecture<o:p></o:p></span></b></p>
+
+<p class=MsoNormal><b><span style='font-size:13.0pt;font-family:Arial'><o:p> </o:p></span></b></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'>The design
+is modular and reusable by other web samples. There are java <span
+class=SpellE>servlet</span>, other java classes, <span class=SpellE>jsp</span>,
+<span class=SpellE>javascript</span>, xml, <span class=SpellE>xsl</span>, <span
+class=SpellE>css</span> and html files.<o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-family:Arial'><o:p> </o:p></span></p>
+
+<p class=MsoNormal><b><u><span style='font-family:Arial'>Client Side Files<o:p></o:p></span></u></b></p>
+
+<p class=MsoNormal><span class=SpellE><b><i><span style='font-size:11.0pt;
+font-family:Arial'>Javascripts</span></i></b></span><b><i><span
+style='font-size:11.0pt;font-family:Arial'><o:p></o:p></span></i></b></p>
+
+<p class=MsoNormal><span class=SpellE><span style='font-size:11.0pt;font-family:
+Arial'>Ajax.js</span></span><span style='font-size:11.0pt;font-family:Arial'>
+and <span class=SpellE>dasmenu.js</span> are generic (not DAS specific) and
+reusable by any web sample. <o:p></o:p></span></p>
+
+<ul style='margin-top:0in' type=disc>
+ <li class=MsoNormal style='mso-list:l0 level1 lfo11;tab-stops:list .5in'><span
+ class=SpellE><b><span style='font-size:11.0pt;font-family:Arial'>Ajax.js</span></b></span><b><span
+ style='font-size:11.0pt;font-family:Arial'> <o:p></o:p></span></b></li>
+</ul>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'>Set
+response handler when request is passed to <span class=SpellE>servlet</span>.
+Response handlers<span style='mso-spacerun:yes'> </span>job is transform xml
+response using <span class=SpellE>xsl</span> into html or plain text based on
+the examples requirement.<o:p></o:p></span></p>
+
+<ul style='margin-top:0in' type=disc>
+ <li class=MsoNormal style='mso-list:l0 level1 lfo11;tab-stops:list .5in'><span
+ class=SpellE><b><span style='font-size:11.0pt;font-family:Arial'>Dasmenu.js</span></b></span><span
+ style='font-size:11.0pt;font-family:Arial'><o:p></o:p></span></li>
+</ul>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'>Used for
+menu/submenu rendering, is quite generic and can be used to display any menu.<o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-family:Arial'><o:p> </o:p></span></p>
+
+<p class=MsoNormal><span class=SpellE><b><i><span style='font-size:11.0pt;
+font-family:Arial'>HTMLs</span></i></b></span><b><i><span style='font-size:
+11.0pt;font-family:Arial'> & <span class=SpellE>jsps</span> (DAS specific
+files)<o:p></o:p></span></i></b></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'>DASMenu.html
+and DASWebSampleFrame.html are for giving frame and menu to web sample.
+DASMenu.html calls required .<span class=SpellE>jsps</span> like <span
+class=SpellE>indexAdhoc.jsp</span>, <span class=SpellE>indexCommand.jsp</span>,
+<span class=SpellE>occ.jsp</span>, <span class=SpellE>converter.jsp</span>.
+These <span class=SpellE>jsps</span> are all DAS specific. The .<span
+class=SpellE>jsp</span> file is responsible for deciding the DAS <span
+class=SpellE>config</span> file required by current sample and relevant .<span
+class=SpellE>xsl</span> file.<o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-family:Arial'><o:p> </o:p></span></p>
+
+<p class=MsoNormal><span class=SpellE><b><u><span style='font-family:Arial'>Serverside</span></u></b></span><b><u><span
+style='font-family:Arial'> files<o:p></o:p></span></u></b></p>
+
+<p class=MsoNormal><b><span style='font-family:Arial'><o:p> </o:p></span></b></p>
+
+<p class=MsoNormal><span class=SpellE><b><span style='font-size:11.0pt;
+font-family:Arial'>CommandServlet.java</span></b></span><b><span
+style='font-size:11.0pt;font-family:Arial'> and <span class=SpellE>ServiceProcessor.java</span></span></b><span
+style='font-size:11.0pt;font-family:Arial'><o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'>Used for
+invoking required service and returning results back to <span class=SpellE>ajax.js</span>.
+These files are not DAS specific.<o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'><o:p> </o:p></span></p>
+
+<p class=MsoNormal><span class=SpellE><b><span style='font-size:11.0pt;
+font-family:Arial'>DASQueryProcessor.java</span></b></span><span
+style='font-size:11.0pt;font-family:Arial'><o:p></o:p></span></p>
+
+<p class=MsoNormal><span style='font-size:11.0pt;font-family:Arial'>Specific to
+DAS sample, has logic to invoke required sample example.<o:p></o:p></span></p>
+
+</div>
+
+</body>
+
+</html>
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java Fri Jun 8 01:05:26 2007
@@ -0,0 +1,451 @@
+package org.apache.tuscany.samples.das;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.ObjectOutputStream;
+import java.lang.reflect.Method;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Random;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.exception.OptimisticConcurrencyException;
+import org.apache.tuscany.samples.das.util.XmlUtil;
+import org.apache.tuscany.samples.web.ServiceProcessor;
+
+import commonj.sdo.DataGraph;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.XMLHelper;
+
+public class DASQueryProcessor extends ServiceProcessor{
+ private DAS das = null;
+ private Command read = null;
+ private Random generator = new Random();
+ private String configFile = null;
+
+ private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd");
+ private static Date kbday;
+ private static Date tbday;
+
+ public String execute(String queryOrcommand, String configFile) throws Exception{
+ String status = null;
+ this.configFile = configFile;
+
+ try{
+ Properties props = validate(queryOrcommand);
+
+ if(props != null){
+ status = this.getResult((String)props.values().iterator().next(),
+ (String)props.keys().nextElement());
+ }
+
+ if(queryOrcommand.startsWith("occ:")){
+ status = this.getOcc();
+ }
+
+ if(queryOrcommand.startsWith("converter:")){
+ status = this.getConverter(queryOrcommand.substring(10));
+ }
+
+ if(queryOrcommand.startsWith("rss:")){
+ status = this.getRss(queryOrcommand.substring(4));
+ }
+ }catch(Exception e){
+ das.releaseResources();
+ e.printStackTrace();
+ throw e;
+ }
+ das.releaseResources();
+ return status ;
+ }
+
+ private Properties validate(String queryOrcommand) throws Exception{
+ if(queryOrcommand == null){
+ throw new Exception("Invalid Command URL -> COMMAND is NULL");
+ }
+
+ if(queryOrcommand.startsWith("query:")){
+ String qry = queryOrcommand.substring(6);
+ if(qry == null || qry.trim().length() == 0){
+ throw new Exception("Invalid Command URL -> COMMAND is NULL");
+ }
+ else{
+ Properties props = new Properties();
+ props.put("query", qry);
+ return props;
+ }
+ }
+
+ if(queryOrcommand.startsWith("command:")){
+ String cmd = queryOrcommand.substring(8);
+ if(cmd == null || cmd.trim().length() == 0){
+ throw new Exception("Invalid Command URL -> COMMAND is NULL");
+ }
+ else{
+ Properties props = new Properties();
+ props.put("command", cmd);
+ return props;
+ }
+ }
+
+
+ return null;
+ }
+
+ /*For any query starting with query: or command: */
+ private String getResult(String qry, String qryOrCommand) throws Exception {
+ getDAS();
+ DataObject root = runCommand(qry, qryOrCommand);
+ //BOOK, COMPANY, DEPARTMENT, CUSTOMER
+ Vector elemNames = new Vector();
+ if(root.getList("BOOK") != null && root.getList("BOOK").size() >0){
+ elemNames.add("BOOK");
+ }
+ if(root.getList("COMPANY") != null && root.getList("COMPANY").size() >0){
+ elemNames.add("COMPANY");
+ }
+ if(root.getList("DEPARTMENT") != null && root.getList("DEPARTMENT").size() >0){
+ elemNames.add("DEPARTMENT");
+ }
+ if(root.getList("CUSTOMER") != null && root.getList("CUSTOMER").size() >0){
+ elemNames.add("CUSTOMER");
+ }
+
+ return formatResult(root, elemNames);
+
+ }
+
+ /* Get DAS config */
+ private InputStream getConfig(String fileName) {
+ return getClass().getClassLoader().getResourceAsStream(fileName);
+ }
+
+ /* Instantiate DAS*/
+ private void getDAS(){
+ das = DAS.FACTORY.createDAS(getConfig(configFile));
+ }
+
+ /*For any query starting with query: or command: */
+ private DataObject runCommand(String qry, String qryOrCommand)throws Exception{
+ DataObject root = null;
+
+ //adhoc queries
+ if(qryOrCommand.startsWith("query")){//query can come single or batch, when batch, it will be {}{}
+ if(!qry.startsWith("{")){
+ read = das.createCommand(qry);
+ root = read.executeQuery();
+ }
+ else{
+ Vector<String> batch = formQueries(qry);//separate {}{} in different queries
+
+ if(batch != null){
+ for(int i=0; i<batch.size(); i++){
+ String curQry = batch.get(i);
+ if(curQry.substring(0, 6).equalsIgnoreCase("select")){
+ read = das.createCommand(curQry);
+ root = read.executeQuery();
+ }
+ else{
+ read = das.createCommand(curQry);
+ read.execute();
+ }
+ }
+ }
+ }
+ }
+
+ //DAS config commands
+ if(qryOrCommand.startsWith("command")){
+ String methodName = "get"+qry; //some convention to form method name instead of lenghtening code
+
+ Method commandMethod = this.getClass().getMethod(methodName, new Class[]{String.class});
+ root = (DataObject)commandMethod.invoke(this, qry);
+ }
+ return root;
+ }
+
+ /* Separate batch of queries into vector of queries - for adhoc*/
+ private Vector<String> formQueries(String qry){
+ Vector<String> batch = new Vector<String>();
+ StringTokenizer strTok = new StringTokenizer(qry, "{");
+ while(strTok.hasMoreTokens()){
+ String curQry = strTok.nextToken();
+ curQry = curQry.substring(0, curQry.length()-1);
+ batch.add(curQry);
+ }
+ return batch;
+ }
+
+ public static String formatResult(DataObject root, Vector elementNames){
+ String xmlStr = "";
+ XMLHelper helper = XMLHelper.INSTANCE;
+ for(int elemCount=0; elemCount<elementNames.size(); elemCount++){
+ String curElemName = (String)elementNames.get(elemCount);
+ List elemList = root.getList(curElemName);
+ for(int i=0; i<elemList.size(); i++){
+ DataObject curComp = (DataObject)elemList.get(i);
+ xmlStr = xmlStr+helper.save(curComp,null, curElemName);
+
+ //System.out.println("xmlStr:"+xmlStr);
+
+ //format xmlstr
+ while(true){
+ String rmvStr = "<?xml version=\"1.0\" encoding=\"ASCII\"?>";
+ int idx = xmlStr.indexOf("<?xml version", 0);
+ if(idx == -1) break;
+ xmlStr = xmlStr.substring(0, idx)+xmlStr.substring(idx+rmvStr.length());
+
+ rmvStr = "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
+ idx = xmlStr.indexOf("xmlns:xsi=", 0);
+ if(idx == -1) break;
+ xmlStr = xmlStr.substring(0, idx)+xmlStr.substring(idx+rmvStr.length());
+
+ rmvStr = "xmlns:das=\"http:///org.apache.tuscany.das.rdb/das\"";
+ idx = xmlStr.indexOf("xmlns:das=", 0);
+ if(idx == -1) break;
+ xmlStr = xmlStr.substring(0, idx)+xmlStr.substring(idx+rmvStr.length());
+
+ //System.out.println("xmlStr:"+xmlStr);
+ }
+
+ while(true){
+ String rmvStr = "xsi:type=\"";
+ int idx = xmlStr.indexOf(rmvStr, 0);
+ if(idx == -1) break;
+ int idxEnd = xmlStr.indexOf("\"", idx+rmvStr.length());
+ xmlStr = xmlStr.substring(0, idx)+xmlStr.substring(idxEnd+1);
+
+ //System.out.println("xmlStr:"+xmlStr);
+ }
+ }
+ }
+
+ String add0Str = "<?xml version='1.0' encoding='ISO-8859-1' ?>\n";
+ String add1Str = "<root xmlns:das='http://org.apache.tuscany.das.rdb/config.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>\n";
+ String add2Str = "<das:DataGraphRoot>";
+ String addEndStr = "</das:DataGraphRoot> </root>";
+
+ xmlStr = add0Str+add1Str+add2Str+xmlStr+"\n"+addEndStr;
+ return xmlStr;
+ }
+
+ //below has improper serialization due to SDO bugs
+ /*From DataGraph get contents related to element <das:DataGraphRoot>*/
+ /*private String xmlizeContent(DataGraph graph) throws Exception{
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(out);
+ oos.writeObject(graph);
+ oos.flush();
+ out.flush();
+ //oos.close();
+ out.close();
+
+ //there are UTF-8 chars which are not ISO-8859-1 ones and xsl transformation does not happen due to that
+ //so filter unwanted.
+ byte[] graphBytes = out.toByteArray();
+ InputStreamReader graphBytesFilter = new InputStreamReader(new ByteArrayInputStream(graphBytes),"ISO-8859-1");
+ char[] graphChars = new char[graphBytes.length];
+ int curChar = -1;
+ int j=0;
+ while((curChar = graphBytesFilter.read()) != -1){
+ graphChars[j] = (char)curChar;
+ j++;
+ }
+
+ String finalStr = new String(graphChars);
+
+ //remove any junk before first <
+ finalStr = finalStr.substring(finalStr.indexOf("<"), finalStr.indexOf("</sdo:datagraph>")+16);
+ String xmlSerializationContent = filterJunk(finalStr);//further remove extra characters appearing
+ System.out.println("xmlSerializationContent:"+xmlSerializationContent);
+ String xmlContent = XmlUtil.getXmlContents(xmlSerializationContent, "<das:DataGraphRoot>", "</das:DataGraphRoot>");
+ System.out.println("xmlContent:"+xmlContent);
+ return xmlContent;
+ }
+
+ //for some reason control chars are appearing, need to filter those
+ //this is ugly solution, need to know why from SDO DataGraph these
+ //chars are coming in the first place.
+ private String filterJunk(String inStr){
+ char[] myCharArr = inStr.toCharArray();
+ StringBuffer strBuf = new StringBuffer();
+
+ for(int i=0; i<myCharArr.length; i++){
+ if((myCharArr[i]>=33 && myCharArr[i]<=125) ||
+ Character.isWhitespace(myCharArr[i])){
+ strBuf.append(myCharArr[i]);
+ }
+ }
+ return strBuf.toString();
+ }*/
+
+ /* Start CRUD example */
+ public DataObject getAllCompanies(String qry) {
+ read = das.getCommand(qry);
+ DataObject root = read.executeQuery();
+ return root;
+ }
+
+ public DataObject getAllCompaniesAndDepartments(String qry) {
+ read = das.getCommand(qry);
+ DataObject root = read.executeQuery();
+ return root;
+ }
+
+ public DataObject getAddDepartmentToFirstCompany(String qry) {
+ Command read = das.getCommand("AllCompaniesAndDepartments");
+ DataObject root = read.executeQuery();
+ DataObject firstCompany = root.getDataObject("COMPANY[1]");
+
+ DataObject newDepartment = root.createDataObject("DEPARTMENT");
+ newDepartment.setString("NAME", "Default Name");
+ List deptList = firstCompany.getList("departments");
+
+ deptList.add(newDepartment);
+ das.applyChanges(root);
+
+ root = read.executeQuery();
+ return root;
+ }
+
+ public DataObject getDeleteDepartmentFromFirstCompany(String qry) {
+ Command read = das.getCommand("AllCompaniesAndDepartments");
+ DataObject root = read.executeQuery();
+ DataObject firstCompany = root.getDataObject("COMPANY[1]");
+
+ List departments = firstCompany.getList("departments");
+ DataObject departmentToDelete = (DataObject)departments.get(departments.size()-1);
+ departmentToDelete.delete();
+ das.applyChanges(root);
+ root = read.executeQuery();
+ return root;
+ }
+
+ public DataObject getUpdateCompanyDepartmentNames(String qry) {
+ Command read = das.getCommand("AllCompaniesAndDepartments");
+ DataObject root = read.executeQuery();
+ DataObject firstCompany = root.getDataObject("COMPANY[1]");
+
+ Iterator i = firstCompany.getList("departments").iterator();
+
+ DataObject department;
+ while (i.hasNext()) {
+ department = (DataObject) i.next();
+ String newName = getRandomDepartmentName();
+ department.setString("NAME", newName);
+ break;
+ }
+ das.applyChanges(root);
+
+ root = read.executeQuery();
+ return root;
+ }
+
+ /* @return random new department name */
+ private String getRandomDepartmentName() {
+ int number = generator.nextInt(1000) + 1;
+ return "Dept-" + number;
+ }
+ /*End CRUD example */
+
+ /*Start OCC example */
+ public String getOcc() throws Exception{
+ getDAS();
+ Command select = das.createCommand("Select * from BOOK where BOOK_ID = 1");
+ DataObject root = select.executeQuery();
+ // Explicitly update the DB to force a collision
+ Command update = das.createCommand("update BOOK set NAME = 'Puss in Hat' where BOOK_ID = 1");
+ update.execute();
+ DataObject book = root.getDataObject("BOOK[1]");
+
+ // Modify customer
+ book.set("NAME", "Puss in Bat");
+
+ // Build apply changes command
+ try {
+ das.applyChanges(root);
+ } catch (OptimisticConcurrencyException ex) {
+ if (!ex.getMessage().equals("An update collision occurred")) {
+ throw ex;
+ }
+ else{
+ return ex.getMessage();
+ }
+ }
+ return "Success";
+ }
+ /* End OCC example */
+
+ /* Start Result Set Shape example*/
+ public String getRss(String stmt) throws Exception{
+ getDAS();
+ read = das.getCommand(stmt);
+ //Read
+ DataObject root = read.executeQuery();
+ Vector elemNames = new Vector();
+ elemNames.add("CUSTOMER");
+ return formatResult(root, elemNames);
+ }
+ /* End Result Set Shape example*/
+
+ /*Converter example start*/
+ static {
+ try {
+ kbday = myformat.parse("1957.09.27");
+ tbday = myformat.parse("1966.12.20");
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String getConverter(String stmt) throws Exception{
+ getDAS();
+ read = das.getCommand("testArbitraryConverter");
+ //Read
+ DataObject root = read.executeQuery();
+
+ if(stmt.equals("stmt0")){//Select * from CUSTOMER where ID = 1;
+ Vector elemNames = new Vector();
+ elemNames.add("CUSTOMER");
+ return this.formatResult(root, elemNames);
+ }
+
+ if(stmt.equals("stmt1")){//Check First Customer's LastName is 1957.09.27
+ return myformat.format(root.getDate("CUSTOMER[1]/LASTNAME"));
+ }
+
+ if(stmt.equals("stmt2")||stmt.equals("stmt3")){//Set First Customer's LastName to 1966.12.20 OR
+ //Check First Customer's LastName is 1966.12.20
+ root.setDate("CUSTOMER[1]/LASTNAME", tbday);
+ das.applyChanges(root);
+ // Read
+ root = read.executeQuery();
+ return myformat.format(root.getDate("CUSTOMER[1]/LASTNAME"));
+ }
+
+ return null;
+ }
+ /* Converter example end**/
+
+ /*For test*/
+ public static void main(String[] args){
+ DASQueryProcessor qryProc = new DASQueryProcessor();
+ try{
+ qryProc.execute("command:AllCompaniesAndDepartments", "DasConfig.xml");
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+}
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java Fri Jun 8 01:05:26 2007
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.samples.das;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.tuscany.das.rdb.Converter;
+
+public class SillyDateStringConverter implements Converter {
+
+ private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd");
+
+ private static Date kbday;
+
+ private static Date tbday;
+
+ public SillyDateStringConverter() {
+ super();
+ }
+
+ static {
+ try {
+ kbday = myformat.parse("1957.09.27");
+ tbday = myformat.parse("1966.12.20");
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Object getPropertyValue(Object columnData) {
+ if (columnData.equals("Pavick")) {
+ return kbday;
+ }
+
+ if (columnData.equals("Williams")) {
+ return tbday;
+ }
+
+ throw new IllegalArgumentException();
+
+ }
+
+ public Object getColumnValue(Object propertyData) {
+ if (propertyData.equals(kbday)) {
+ return "Pavick";
+ }
+
+ if (propertyData.equals(tbday)) {
+ return "Williams";
+ }
+
+ throw new IllegalArgumentException();
+
+ }
+
+}
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java Fri Jun 8 01:05:26 2007
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.samples.das;
+
+import org.apache.tuscany.das.rdb.Converter;
+
+public class StringToLongConverter implements Converter {
+
+ public StringToLongConverter() {
+ super();
+ }
+
+ public Object getPropertyValue(Object columnData) {
+ return new Long(columnData.toString());
+ }
+
+ public Object getColumnValue(Object columnData) {
+ return columnData.toString();
+ }
+
+}
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java Fri Jun 8 01:05:26 2007
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.samples.das.util;
+/**
+ *
+ * XML utilities
+ *
+ */
+public class XmlUtil {
+ /**
+ * From the complete serialized DataGraph, get the required portion
+ *relevant to <das:DataGraphRoot> element.
+ */
+ public static String getXmlContents(String xmlString, String xmlStartElement, String xmlEndElement){
+ int posStartElement = xmlString.indexOf(xmlStartElement);
+ int posEndElement = xmlString.indexOf(xmlEndElement) ;
+
+ //check if startElement was not found
+ if(posStartElement == -1)
+ posStartElement = 0;
+
+ //check if endElement was not found
+ if(posEndElement == -1)
+ posEndElement = xmlString.length();
+ else
+ //fixup the posEndElement to return the closing element tag
+ posEndElement += + xmlEndElement.length();
+
+ //return xml contents for the requested element
+ String xmlBody = xmlString.substring(posStartElement, posEndElement);
+
+
+ String result =
+ "<?xml version='1.0' encoding='ISO-8859-1' ?> \n"+
+ "<root xmlns:das='http://org.apache.tuscany.das.rdb/config.xsd' "+
+ " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> \n"+
+ xmlBody+" </root>";
+
+ return result;
+ }
+
+}
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java Fri Jun 8 01:05:26 2007
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.samples.web;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.das.rdb.dbconfig.DBInitializer;
+/**
+ * This is generic servlet where based on serviceName, it will call the speciliazed processor to
+ * process request and obtain response. This servlet can be used in any web sample, just needs to
+ * pass appropriate serviceProcessorClassName and rest is generic
+ *
+ */
+public class CommandServlet extends HttpServlet {
+ final static long serialVersionUID = 1221332432;
+ /*
+ * (non-Java-doc)
+ *
+ * @see javax.servlet.http.HttpServlet#HttpServlet()
+ */
+ public CommandServlet() {
+ super();
+ }
+
+ public static void refreshDB() throws ServletException {
+ try{
+ DBInitializer dbInitializer = new DBInitializer("AjaxDBConfig.xml");
+ dbInitializer.refreshDatabaseData();
+ }catch(Exception e){
+ e.printStackTrace();
+ ServletException se = new ServletException(e.getMessage());
+ throw se;
+ }
+ }
+
+ public void init(ServletConfig config) throws ServletException {
+ refreshDB();
+ }
+
+ /*
+ * (non-Java-doc)
+ *
+ * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0,
+ * HttpServletResponse arg1)
+ */
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ doTask(request, response);
+ }
+
+ /*
+ * (non-Java-doc)
+ *
+ * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest arg0,
+ * HttpServletResponse arg1)
+ */
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ doTask(request, response);
+ }
+
+ /**Invoke passed service and return result
+ *
+ * @param req
+ * @param resp
+ * @throws ServletException
+ * @throws IOException
+ */
+ public void doTask(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ String textContentType= "text/text";
+ String xmlContentType= "text/xml";
+
+ String refreshRequest = req.getParameter("refreshDB");
+ if(refreshRequest != null && refreshRequest.equals("yes")){
+ {
+ try{
+ refreshDB();
+ }catch(ServletException e){
+ throw e;
+ }
+ }
+ this.writeResponse(resp, "Refreshed database!", textContentType);
+ }
+ else{
+ String serviceName = req.getParameter("serviceName");//e.g. DASQueryProcessor
+ String qry = req.getParameter("Query");//e.g. query:xxx, command:yyy
+ String configFile = req.getParameter("configFile");//name of DAS config file
+
+ try{
+ ServiceProcessor serviceClassInst = null;
+ //so any subclass of abstract ServiceProcessor can be used
+ Object obj = Class.forName(serviceName).newInstance();
+
+ if(obj instanceof ServiceProcessor){
+ serviceClassInst = (ServiceProcessor)obj;
+ }
+
+ String result = serviceClassInst.execute(qry, configFile);
+ this.writeResponse(resp, result, xmlContentType);
+ }catch(Exception e){
+ this.writeResponse(resp, e.getMessage(), textContentType);
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**Write response in required content type to servlet response
+ *
+ * @param resp
+ * @param output
+ * @param contentType
+ * @throws IOException
+ */
+ public void writeResponse(HttpServletResponse resp, String output, String contentType) throws IOException {
+ resp.setContentType(contentType);//"text/text", "text/xml"
+ resp.setHeader("Cache-Control", "no-cache");
+ resp.getWriter().write(output);
+ }
+
+ // Utility methods
+
+ public void gotoURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String url) throws ServletException, IOException {
+ url = response.encodeURL(url);
+ RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
+ dispatcher.forward(request, response);
+ }
+
+ public void redirectURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String url) throws ServletException, IOException {
+ url = response.encodeURL(request.getContextPath() + url);
+ response.sendRedirect(url);
+ }
+
+ public void forwardURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String url) throws ServletException, IOException {
+ url = response.encodeURL(url);
+ RequestDispatcher dispatch = getServletContext().getRequestDispatcher(url);
+ dispatch.forward(request, response);
+ }
+}
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java Fri Jun 8 01:05:26 2007
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.samples.web;
+
+//generic processor
+public abstract class ServiceProcessor {
+ public abstract String execute(String command, String configFile) throws Exception;
+}
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/AjaxDBConfig.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/AjaxDBConfig.xml?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/AjaxDBConfig.xml (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/AjaxDBConfig.xml Fri Jun 8 01:05:26 2007
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+<DBConfig xmlns="http:///org.apache.tuscany.das.rdb/dbconfig.xsd">
+
+ <!--Uncomment below for web container derby database setup-->
+ <ConnectionInfo dataSource="java:comp/env/jdbc/ajaxdastest">
+ </ConnectionInfo>
+
+ <!--<ConnectionInfo>
+ <ConnectionProperties
+ driverClass="org.apache.derby.jdbc.EmbeddedDriver"
+ databaseURL="jdbc:derby:target/dastest; create = true"
+ loginTimeout="600000"/>
+ </ConnectionInfo>-->
+
+ <Table name="COMPANY" SQLCreate="CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME VARCHAR(30))">
+ <row>'ACME Publishing'</row>
+ <row>'Do-rite plumbing'</row>
+ <row>'MegaCorp'</row>
+ </Table>
+
+ <Table name="DEPARTMENT" SQLCreate="CREATE TABLE DEPARTMENT (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME VARCHAR(30),LOCATION VARCHAR(30), DEPNUMBER VARCHAR(10),COMPANYID INT)">
+ <row>'Advanced Technologies', 'NY', '123', 1</row>
+ </Table>
+
+ <Table name="CUSTOMER" SQLCreate="CREATE TABLE CUSTOMER (ID INT PRIMARY KEY NOT NULL,LASTNAME VARCHAR(30),ADDRESS VARCHAR(10) )">
+ <row>1, 'Pavick', 'CA'</row>
+ <row>2, 'Williams', 'NJ'</row>
+ </Table>
+
+ <Table name="BOOK" SQLCreate="CREATE TABLE BOOK (BOOK_ID INT PRIMARY KEY NOT NULL,NAME VARCHAR(30),AUTHOR VARCHAR(30),QUANTITY INT, OCC INT )">
+ <row>1, 'The Brothers Karamazov', 'Fyodor Dostoevsky',5, 17</row>
+ </Table>
+
+</DBConfig>
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/CustomerConfigWithConverter.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/CustomerConfigWithConverter.xml?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/CustomerConfigWithConverter.xml (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/CustomerConfigWithConverter.xml Fri Jun 8 01:05:26 2007
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
+ <ConnectionInfo dataSource="java:comp/env/jdbc/ajaxdastest"/>
+
+ <Command name="testArbitraryConverter" SQL="Select * from CUSTOMER where ID = 1" kind="Select">
+ <ResultDescriptor columnName="ID" tableName="CUSTOMER" columnType="commonj.sdo.IntObject"/>
+ <ResultDescriptor columnName="LASTNAME" tableName="CUSTOMER" columnType="commonj.sdo.Date"/>
+ <ResultDescriptor columnName="ADDRESS" tableName="CUSTOMER" columnType="commonj.sdo.String"/>
+ </Command>
+
+ <Table tableName="CUSTOMER">
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="LASTNAME" converterClassName="org.apache.tuscany.samples.das.SillyDateStringConverter"/>
+ </Table>
+
+</Config>
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/CustomerConfigWithIDConverter.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/CustomerConfigWithIDConverter.xml?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/CustomerConfigWithIDConverter.xml (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/CustomerConfigWithIDConverter.xml Fri Jun 8 01:05:26 2007
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
+ <ConnectionInfo dataSource="java:comp/env/jdbc/ajaxdastest"/>
+
+ <Command name="literal" SQL="Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer" kind="Select">
+ <ResultDescriptor columnName="ID" tableName="CUSTOMER" columnType="commonj.sdo.Long"/>
+ <ResultDescriptor columnName="LASTNAME" tableName="CUSTOMER" columnType="commonj.sdo.String"/>
+ <ResultDescriptor columnName="ADDRESS" tableName="CUSTOMER" columnType="commonj.sdo.String"/>
+ </Command>
+
+ <Table tableName="CUSTOMER">
+ <Column columnName="ID" converterClassName="org.apache.tuscany.samples.das.StringToLongConverter"/>
+ </Table>
+
+</Config>
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/DasConfig.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/DasConfig.xml?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/DasConfig.xml (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/DasConfig.xml Fri Jun 8 01:05:26 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <ConnectionInfo dataSource="java:comp/env/jdbc/ajaxdastest"/>
+
+ <Command name="AllCompanies" SQL="select * from COMPANY" kind="Select"/>
+
+ <Command name="AllCompaniesAndDepartments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID" kind="Select"/>
+
+ <Table tableName="COMPANY">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ </Table>
+
+ <Table tableName="DEPARTMENT">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ </Table>
+
+ <Table tableName="BOOK">
+ <Column columnName="BOOK_ID" primaryKey="true" generated="true"/>
+ </Table>
+
+ <Relationship name="departments" primaryKeyTable="COMPANY" foreignKeyTable="DEPARTMENT" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="COMPANYID"/>
+ </Relationship>
+
+
+</Config>
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/META-INF/context.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/META-INF/context.xml?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/META-INF/context.xml (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/resources/META-INF/context.xml Fri Jun 8 01:05:26 2007
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+<Context path="/DAS Features" debug="5" reloadable="true" crossContext="true">
+
+ <Manager pathname=""/>
+ <ResourceLink name="jdbc/dastest" global="jdbc/dastest" type="javax.sql.DataSource" />
+
+</Context>
Added: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/META-INF/context.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/META-INF/context.xml?view=auto&rev=545451
==============================================================================
--- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/META-INF/context.xml (added)
+++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/META-INF/context.xml Fri Jun 8 01:05:26 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<Context path="/DAS Stand alone app" debug="5" reloadable="true" crossContext="true">
+
+ <Manager pathname=""/>
+ <ResourceLink name="jdbc/ajaxdastest" global="jdbc/ajaxdastest" type="javax.sql.DataSource" />
+
+</Context>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org