summaryrefslogtreecommitdiffstats
path: root/das-java/trunk/samples
diff options
context:
space:
mode:
Diffstat (limited to 'das-java/trunk/samples')
-rw-r--r--das-java/trunk/samples/Readme.htm110
-rw-r--r--das-java/trunk/samples/advanced-webapp/build.xml52
-rw-r--r--das-java/trunk/samples/advanced-webapp/pom.xml108
-rw-r--r--das-java/trunk/samples/advanced-webapp/readme.htm204
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java464
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java75
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java37
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java58
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java160
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java24
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml52
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml34
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml33
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/resources/DasConfig.xml45
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/LICENSE353
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/NOTICE32
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/README35
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/resources/log4j.properties36
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/META-INF/context.xml22
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld563
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld671
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml46
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html27
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/html/blank.html25
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/js/ajax.js188
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/js/dasmenu.js112
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp63
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp117
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/default.css35
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp87
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp85
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/main.css120
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp77
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp78
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/company.xsl44
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl65
-rw-r--r--das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl49
-rw-r--r--das-java/trunk/samples/build.xml29
-rw-r--r--das-java/trunk/samples/company-webapp/build.xml55
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/db.lckbin0 -> 38 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/log/log.ctrlbin0 -> 48 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/log/log1.datbin0 -> 1048576 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/log/logmirror.ctrlbin0 -> 48 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c10.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c101.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c111.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c121.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c130.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c141.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c150.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c161.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c171.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c180.datbin0 -> 24576 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c191.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c1a1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c1b1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c1c0.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c1d1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c1e0.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c1f1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c20.datbin0 -> 24576 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c200.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c211.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c221.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c230.datbin0 -> 86016 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c241.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c251.datbin0 -> 12288 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c260.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c271.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c281.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c290.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c2a1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c2b1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c2c1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c2d0.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c2e1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c2f0.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c300.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c31.datbin0 -> 16384 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c311.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c320.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c331.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c340.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c351.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c360.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c371.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c380.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c391.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c3a0.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c3b1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c3c0.datbin0 -> 24576 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c3d1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c3e0.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c3f1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c400.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c41.datbin0 -> 16384 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c411.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c420.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c431.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c440.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c451.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c460.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c471.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c481.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c490.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c4a1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c51.datbin0 -> 16384 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c60.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c71.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c81.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/c90.datbin0 -> 20480 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/ca1.datbin0 -> 24576 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/cb1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/cc0.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/cd1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/ce1.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/seg0/cf0.datbin0 -> 8192 bytes
-rw-r--r--das-java/trunk/samples/company-webapp/dastest/service.properties22
-rw-r--r--das-java/trunk/samples/company-webapp/pom.xml89
-rw-r--r--das-java/trunk/samples/company-webapp/readme.htm201
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java151
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java70
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/resources/CompanyConfig.xml46
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml51
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/resources/META-INF/LICENSE353
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/resources/META-INF/NOTICE32
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/resources/META-INF/README35
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/resources/log4j.properties36
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/webapp/Company.jsp155
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/webapp/META-INF/context.xml25
-rw-r--r--das-java/trunk/samples/company-webapp/src/main/webapp/WEB-INF/web.xml36
-rw-r--r--das-java/trunk/samples/customer/build.xml38
-rw-r--r--das-java/trunk/samples/customer/pom.xml92
-rw-r--r--das-java/trunk/samples/customer/readme.htm156
-rw-r--r--das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java197
-rw-r--r--das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java92
-rw-r--r--das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java206
-rw-r--r--das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java209
-rw-r--r--das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java211
-rw-r--r--das-java/trunk/samples/customer/src/main/resources/CustomersConfig.xml53
-rw-r--r--das-java/trunk/samples/customer/src/main/resources/META-INF/LICENSE353
-rw-r--r--das-java/trunk/samples/customer/src/main/resources/META-INF/NOTICE32
-rw-r--r--das-java/trunk/samples/customer/src/main/resources/META-INF/README35
-rw-r--r--das-java/trunk/samples/customer/src/main/resources/log4j.properties36
-rw-r--r--das-java/trunk/samples/dbconfig/pom.xml123
-rw-r--r--das-java/trunk/samples/dbconfig/readme.html153
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java57
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java179
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java251
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java200
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java154
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java40
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java40
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml47
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/resources/DBConfig.xsd56
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/resources/META-INF/LICENSE353
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/resources/META-INF/NOTICE32
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/resources/META-INF/README35
-rw-r--r--das-java/trunk/samples/dbconfig/src/main/resources/log4j.properties33
-rw-r--r--das-java/trunk/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java69
-rw-r--r--das-java/trunk/samples/dbconfig/src/test/resources/dbConfig.xml52
-rw-r--r--das-java/trunk/samples/pom.xml40
-rw-r--r--das-java/trunk/samples/testing/tomcat/advanced-webapp/pom.xml80
-rw-r--r--das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE353
-rw-r--r--das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE32
-rw-r--r--das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README35
-rw-r--r--das-java/trunk/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java596
-rw-r--r--das-java/trunk/samples/testing/tomcat/build.xml309
-rw-r--r--das-java/trunk/samples/testing/tomcat/company-webapp/pom.xml80
-rw-r--r--das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE353
-rw-r--r--das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE32
-rw-r--r--das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README35
-rw-r--r--das-java/trunk/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java249
-rw-r--r--das-java/trunk/samples/testing/tomcat/context.xsl51
-rw-r--r--das-java/trunk/samples/testing/tomcat/datasource.xsl66
-rw-r--r--das-java/trunk/samples/testing/tomcat/pom.xml112
-rw-r--r--das-java/trunk/samples/testing/tomcat/readme.htm86
-rw-r--r--das-java/trunk/samples/testing/tomcat/server.xsl51
-rw-r--r--das-java/trunk/samples/transaction/build.xml46
-rw-r--r--das-java/trunk/samples/transaction/pom.xml148
-rw-r--r--das-java/trunk/samples/transaction/readme.htm449
-rw-r--r--das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java67
-rw-r--r--das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java118
-rw-r--r--das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java122
-rw-r--r--das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java193
-rw-r--r--das-java/trunk/samples/transaction/src/main/resources/BankAccountDBConfig.xml34
-rw-r--r--das-java/trunk/samples/transaction/src/main/resources/BankAccounts.xml30
187 files changed, 13123 insertions, 0 deletions
diff --git a/das-java/trunk/samples/Readme.htm b/das-java/trunk/samples/Readme.htm
new file mode 100644
index 0000000000..ff4fed6d89
--- /dev/null
+++ b/das-java/trunk/samples/Readme.htm
@@ -0,0 +1,110 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+ 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.
+ -->
+
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>DAS Samples</title>
+
+<style>
+.code {
+ font-size: 11px;
+ color: #006699
+}
+
+.codebox {
+ border: 1px solid #6699CC;
+ background-color: #F1F7FA;
+ padding: 15px
+}
+
+.codebox2 {
+ border: 1px solid #6699CC;
+ background-color: #F1F7FA;
+ padding: 15px;
+ width: 85%
+}
+
+.codeboxW {
+ border: 1px solid #6699CC;
+ background-color: #FFFFFF;
+ padding: 15px
+}
+
+.codeboxB {
+ background-color: #C9DBED;
+ padding: 1px 10px 10px 10px
+}
+</style>
+
+</head>
+
+<h1>
+<center>DAS Samples</center>
+</h1>
+
+<br>
+
+<p>The DAS Java Samples demonstrates the DAS features and how to get
+started with them. Below a list of available samples:</p>
+
+<br>
+
+<p><ul>
+ <table align="left">
+ <tr>
+ <th align="left" style="border-right-style: solid; border-left-style: solid; border-top-style: solid; border-bottom-style: solid">
+ Company-webapp
+ </th>
+ <th align="left" style="border-right-style: solid; border-left-style: solid; border-top-style: solid; border-bottom-style: solid">
+ This stand-alone sample demonstrates DAS in the context of a simple web application.
+ </th>
+ </tr>
+ <tr>
+ <th align="left" style="border-right-style: solid; border-left-style: solid; border-top-style: solid; border-bottom-style: solid">
+ Customer
+ </th>
+ <th align="left" style="border-right-style: solid; border-left-style: solid; border-top-style: solid; border-bottom-style: solid">
+ This stand-alone sample demonstrates DAS in the context of a simple java application
+ </th>
+ </tr>
+ <tr>
+ <th align="left" style="border-right-style: solid; border-left-style: solid; border-top-style: solid; border-bottom-style: solid">
+ Advanced-webapp
+ </th>
+ <th align="left" style="border-right-style: solid; border-left-style: solid; border-top-style: solid; border-bottom-style: solid">
+ This web sample demonstrates DAS advanced features in the context of a simple web application using Ajax. Some of the features demonstrated are : Basic CRUD, Optimistic Concurrency Control (OCC), Result Set Shape, Column Converter, Integration with dbConfig
+ </th>
+ </tr>
+ <tr>
+ <th align="left" style='border-right-style: solid; border-left-style: solid; border-top-style: solid; border-bottom-style: solid'>
+ Transaction
+ </th>
+ <th align="left" style="border-right-style: solid; border-left-style: solid; border-top-style: solid; border-bottom-style: solid">
+ This stand-alone sample uses DAS with Geronimo Transaction Manager. Connection is passed to DAS by client. Geronimo TM manages database changes involving multiple DataGraphs under one transaction.
+ </th>
+ </tr>
+ </table>
+
+</ul>
+
+
+</p></BODY>
+</HTML>
diff --git a/das-java/trunk/samples/advanced-webapp/build.xml b/das-java/trunk/samples/advanced-webapp/build.xml
new file mode 100644
index 0000000000..e8d9d5fbdf
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/build.xml
@@ -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>
diff --git a/das-java/trunk/samples/advanced-webapp/pom.xml b/das-java/trunk/samples/advanced-webapp/pom.xml
new file mode 100644
index 0000000000..84c6bcac75
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/pom.xml
@@ -0,0 +1,108 @@
+<?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-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-das-sample-advanced-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Tuscany DAS Advanced Sample</name>
+ <description>Advanced DAS web applicaiton Sample based on Ajax</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das-rdb</artifactId>
+ <version>${das.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-sample-dbconfig</artifactId>
+ <version>${das.version}</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ </exclusion>
+ </exclusions>
+ </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-advanced-webapp</finalName>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ </build>
+</project>
diff --git a/das-java/trunk/samples/advanced-webapp/readme.htm b/das-java/trunk/samples/advanced-webapp/readme.htm
new file mode 100644
index 0000000000..1ddba99e5e
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/readme.htm
@@ -0,0 +1,204 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+ 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.
+ -->
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Tuscany DAS Sample - Advanced webapp</title>
+
+<style>
+.code {font-size: 11px; color: #006699}
+.codebox {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px}
+.codebox2 {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px; width:85%}
+.codeboxW {border: 1px solid #6699CC; background-color: #FFFFFF;padding:15px}
+.codeboxB {background-color: #C9DBED;padding:1px 10px 10px 10px}
+</style>
+
+</head>
+<body>
+
+<h1><center>Advanced DAS web application Sample</center></h1>
+
+<br>
+
+<p>
+This web sample demonstrates DAS advanced features in the context of a simple web application using Ajax.<br>
+The application user can navigate the menu to see examples of different DAS features.<br>
+The application uses "dbConfig" 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>
+</p>
+
+<ul>
+ <li><b>Adhoc Query</b> (CRUD operations on COMPANY and DEPARTMENT using adhoc Sql statements)</li>
+ <li><b>DAS Command</b> (CRUD operations on COMPANY and DEPARTMENT using DAS config commands)</li>
+ <li><b>Advanced features:</b>
+ <ul>
+ <li><b>Optimistic Concurrency Control</b> (Using BOOK. NAME)</li>
+ <li><b>Converter</b>(Using CUSTOMER.LASTNAME)</li>
+ <li><b>Result Set Shape</b>(Using CUSTOMER table)</li>
+ </ul>
+ </li>
+</ul>
+
+<p>
+In future more features will get added.
+</p>
+
+
+<h2>Running the sample</h2>
+
+<p>
+There are two options for running this sample:
+
+<ul>
+ <li>Run from Tomcat configured by the build</li>
+ <li>Deploying the sample-advanced-webapp WAR into a Tomcat you configure yourself</li>
+</ul>
+
+<h2>Running from Tomcat configured by the build</h2>
+
+<p>
+You need to download the Tuscany RDB DAS source distribution and run maven build to use this option. When you build using maven from the source root {SRC_ROOT} directory, the sample war file is created under {SRC_ROOT}/samples/sample-ajax-das/target. This sample application is deployed to an instance of Tomcat as part of our automated sample testing. For this, follow instructions from reademe.htm from {SRC_ROOT}/samples/testing/tomcat. This will in-effect run the htmlunit tests on the sample. The sample deployed on Tomcat instance will be ready this way and you can just point your browser to <a href="http://localhost:8080/sample-advanced-webapp/">http://localhost:8080/sample-advanced-webapp/</a> to test further.
+</p>
+
+<h2>Deploying the sample-ajax-das WAR into a Tomcat you configure yourself</h2>
+
+<p>
+Alternatively, you can deploy the sample to your own configured Tomcat installation by following the instructions below. <br>
+These instructions assume that you have either :
+<ul>
+ <li>1) Downloaded the Tuscany binary distribution or </li>
+ <li>2) Downloaded the Tuscany source and run maven build </li>
+</ul>
+see the following link to more details steps on how to build DAS Sample applications <a href="http://incubator.apache.org/tuscany/das-java-developer-guide.html">http://incubator.apache.org/tuscany/das-java-developer-guide.html</a> .
+</p>
+
+<h3>Set Up - Derby</h3>
+
+<ul>
+ <li>Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi</li>
+ <li>Download the most recent official release of Derby from here: http://db.apache.org/derby/index.html. The only file you'll need from this download is derby(version).jar</li>
+ <li>Stop Tomcat</li>
+ <li>Copy derby(version).jar (from the derby distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. derby-10.2.2.0.jar.</li>
+ <li>Add the sample war file to {Tomcat_Home}/webapps
+ <ul>
+ <li>sample-advanced-webapp.war</li>
+ </ul>
+ </li>
+ <li>Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml.
+ <ul>
+ <li>Find the end-of-section marker </GlobalNamingResources> and add the following lines just above it:</li>
+ </ul>
+
+ <pre STYLE="{font-style:italic}">
+ &lt;!-- Global Datasource for Derby ajaxdastest database --&gt;
+ &lt;Resource name="jdbc/ajaxdastest"
+ type="javax.sql.DataSource" auth="Container"
+ description="Derby database for DAS Advanced sample"
+ maxActive="100" maxIdle="30" maxWait="10000"
+ username="" password=""
+ driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
+ url="jdbc:derby:{absolute path}Databases/ajaxdastest;create=true"/&gt;
+ </pre>
+
+ <b>Requirement:</b> You must include the absolute path to the <i>Databases</i> directory in the above url attribute. <br/>
+ Fore example: url="jdbc:derby:c:\apache-tomcat-6.0.13\Databases/ajaxdastest;create=true "
+ <p/>
+ </li>
+ <li>Start tomcat and point your browser to: <a href="http://localhost:8080/sample-advanced-webapp/">http://localhost:8080/sample-advanced-webapp/</a></li>
+</ul>
+
+<h3>Set Up - MySQL</h3>
+
+<ul>
+ <li>Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi</li>
+ <li>Download the most recent official release of MySQL. The only file you'll need from this download is mysql(version).jar (e.g. mysql-connector-java-5.0.4.jar) </li>
+ <li>Stop Tomcat</li>
+ <li>Copy mysql(version).jar (from the MySQL distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. mysql-connector-java-5.0.4.jar.</li>
+ <li>Add the sample war file to {Tomcat_Home}/webapps
+ <ul>
+ <li>sample-advanced-webapp.war</li>
+ </ul>
+ </li>
+ <li>Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml.
+ <ul>
+ <li>Find the end-of-section marker </GlobalNamingResources> and add the following lines just above it:</li>
+ </ul>
+
+ <pre STYLE="{font-style:italic}">
+ &lt;!-- Global Datasource for MySQL ajaxdastest database --&gt;
+ &lt;Resource name="jdbc/ajaxdastest"
+ type="javax.sql.DataSource" auth="Container"
+ description="MySQL database for DAS Advanced sample"
+ maxActive="100" maxIdle="30" maxWait="10000"
+ username="dastest" password="dastest"
+ driverClassName="com.mysql.jdbc.Driver"
+ url="jdbc:mysql://localhost/ajaxdastest?createDatabaseIfNotExist=true"/&gt;
+ </pre>
+
+ <b>Requirement:</b> MySQL service should be up with configured port open for TCPIP communication.
+ <br>
+ <br>
+ As the new utility, dbConfig is embedded in this sample war, the MySQL database "dastest" will get created with
+ required tables and data when the web application gets loaded for the first time in tomcat. Please note that,
+ in the binary distribution, WEB-INF/classes/CompanyWebDBConfig.xml has SQL Table creation syntax for Derby.
+ To make it compatible to MySQL, simply replace GENERATED ALWAYS AS IDENTITY with AUTO_INCREMENT for all
+ table creation statements. (For this unjar the .war, change CompanyWebDBConfig.xml and jar the .war
+ back with changed CompanyWebDBConfig.xml)
+ <br>
+ <br>
+ </li>
+ <li>Start tomcat and point your browser to: <a href="http://localhost:8080/sample-advanced-webapp/">http://localhost:8080/sample-advanced-webapp/</a></li>
+</ul>
+
+
+<h2>Sample Architecture</h2>
+
+<p>The design is modular and reusable by other web samples. There are java servlet, other java classes, jsp, javascript, xml, xsl, css and html files.</p>
+
+<h3><u>Client Side Files</u></h3>
+
+<h4><u>Javascripts</u></h4>
+
+<p></p>
+
+<ul>
+ <li><b>Ajax.js:</b> <br>
+ Ajax.js and dasmenu.js are generic (not DAS specific) and reusable by any web sample.</li>
+ <li><b>Dasmenu.js:</b> <br>
+ Set response handler when request is passed to servlet. Response handler's job is transform xml response using xsl into html or plain text based on the example�s requirement.</li>
+</ul>
+
+<p>Used for menu/submenu rendering, is quite generic and can be used to display any menu.</p>
+
+<h4><u>HTMLs & jsps (DAS specific files)</u></h4>
+
+<ul>
+ <li><b>DASMenu.html</b> and <b>DASWebSampleFrame.html</b> are for giving frame and menu to web sample. DASMenu.html calls required .jsps like indexAdhoc.jsp, indexCommand.jsp, occ.jsp, converter.jsp. These jsps are all DAS specific. The .jsp file is responsible for deciding the DAS config file required by current sample and relevant .xsl file.</li>
+</ul>
+
+
+<h4><u>Serverside files</u></h4>
+
+<ul>
+ <li><b>CommandServlet.java</b> and <b>ServiceProcessor.java</b> <br>
+ Used for invoking required service and returning results back to ajax.js. These files are not DAS specific.</li>
+
+ <li><b>DASQueryProcessor.java</b> <br>
+ Specific to DAS sample, has logic to invoke required sample example.</li>
+</ul> \ No newline at end of file
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java
new file mode 100644
index 0000000000..86b83be235
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java
@@ -0,0 +1,464 @@
+/*
+ * 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.io.InputStream;
+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.web.ServiceProcessor;
+
+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 batch = formQueries(qry);//separate {}{} in different queries
+
+ if(batch != null){
+ for(int i=0; i<batch.size(); i++){
+ String curQry = (String) 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, new Object[] {qry});
+ }
+ return root;
+ }
+
+ /* Separate batch of queries into vector of queries - for adhoc*/
+ private Vector formQueries(String qry){
+ Vector batch = new Vector();
+ 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();
+ }
+
+ }
+
+}
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java
new file mode 100644
index 0000000000..f1fe21cfd4
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java
@@ -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();
+
+ }
+
+}
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java
new file mode 100644
index 0000000000..fc26164191
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java
@@ -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();
+ }
+
+}
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java
new file mode 100644
index 0000000000..9a615fa33c
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java
@@ -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;
+ }
+
+}
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java
new file mode 100644
index 0000000000..ffab0d107b
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java
@@ -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.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+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);
+ }
+}
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java
new file mode 100644
index 0000000000..aefebb8808
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java
@@ -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;
+}
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml b/das-java/trunk/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml
new file mode 100644
index 0000000000..f172c089c9
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml
@@ -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>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml b/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml
new file mode 100644
index 0000000000..0ef0c5b9b1
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml
@@ -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>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml b/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml
new file mode 100644
index 0000000000..f26082a340
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml
@@ -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>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/DasConfig.xml b/das-java/trunk/samples/advanced-webapp/src/main/resources/DasConfig.xml
new file mode 100644
index 0000000000..69ac31895c
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/DasConfig.xml
@@ -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>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000000..fb4df3722c
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,353 @@
+
+ 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.
+
+===============================================================================================================
+
+Other components and dependencies under Apache Software License 2.0 :
+
+ log4j-1.2.14.jar - Apache Logging Services
+ derby 10.2.2.0.jar - Apache Derby
+ stax-api-1.0.1.jar - The Streaming API for XML (StAX)
+ wstx-asl-3.2.0.jar - WoodStox StAX implementation
+ standard-1.1.1.jar - The Apache Jackarta Taglibs
+ jstl-1.1.2.jar - The Apache Jackarta Taglibs
+ *.tld - The Apache Jackarta Taglibs
+
+===============================================================================================================
+
+
+Apache Tuscany SDO for Java Subcomponents
+=========================================:
+
+The Tuscany SDO for Java release includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar)
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+
+For the Eclipse EMF components
+(codegen-2.2.3.jar
+codegen-ecore-2.2.3.jar
+common-2.2.3.jar
+ecore-2.2.3.jar
+ecore-change-2.2.3.jar
+ecore-xmi-2.2.3.jar
+xsd-2.2.3.jar)
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED 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. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+===================================================================================================
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..c2cf1f95b4
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,32 @@
+Apache Tuscany SDO for Java
+Copyright 2006, 2007 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other successful
+ASF projects. While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be fully endorsed
+by the ASF.
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE.txt file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+The terms and conditions governing the distribution may refer to the AL or other license
+agreements, notices or terms and conditions. Some of these other license agreements may
+include (but are not limited to):
+
+ . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html)
+
+It is your obligation to read and accept all such terms and conditions prior to use of the
+distribution. If term or condition is provided, please contact the Apache Software Foundation
+to determine what terms and conditions govern that particular distribution.
+
+This product also includes software developed by the Open Service Oriented Architecture organisation
+(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this
+distribution.
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/README b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/README
new file mode 100644
index 0000000000..d1905ee3e8
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/README
@@ -0,0 +1,35 @@
+Apache Tuscany M2 build (October, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/log4j.properties b/das-java/trunk/samples/advanced-webapp/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..7f18e4dc72
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/log4j.properties
@@ -0,0 +1,36 @@
+# 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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, NULL
+
+# NULL Appender
+log4j.appender.NULL=org.apache.log4j.varia.NullAppender
+
+log4j.appender.NULL.layout=org.apache.log4j.PatternLayout
+log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n
+
+# CONSOLE is set to be a ConsoleAppender.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n
+
+
+# Print only messages of level WARN or above in the package com.foo.
+log4j.logger.org.apache.tuscany=NONE \ No newline at end of file
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/META-INF/context.xml b/das-java/trunk/samples/advanced-webapp/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000000..e2da613636
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/META-INF/context.xml
@@ -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>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld
new file mode 100644
index 0000000000..22698c97dc
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld
@@ -0,0 +1,563 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+
+ <description>JSTL 1.1 core library</description>
+ <display-name>JSTL core</display-name>
+ <tlib-version>1.1</tlib-version>
+ <short-name>c</short-name>
+ <uri>http://java.sun.com/jsp/jstl/core</uri>
+
+ <validator>
+ <description>
+ Provides core validation features for JSTL tags.
+ </description>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.JstlCoreTLV
+ </validator-class>
+ </validator>
+
+ <tag>
+ <description>
+ Catches any Throwable that occurs in its body and optionally
+ exposes it.
+ </description>
+ <name>catch</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+exception thrown from a nested action. The type of the
+scoped variable is the type of the exception thrown.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Simple conditional tag that establishes a context for
+ mutually exclusive conditional operations, marked by
+ &lt;when&gt; and &lt;otherwise&gt;
+ </description>
+ <name>choose</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+
+ <tag>
+ <description>
+ Simple conditional tag, which evalutes its body if the
+ supplied condition is true and optionally exposes a Boolean
+ scripting variable representing the evaluation of this condition
+ </description>
+ <name>if</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+The test condition that determines whether or
+not the body content should be processed.
+ </description>
+ <name>test</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+resulting value of the test condition. The type
+of the scoped variable is Boolean.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope for var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Retrieves an absolute or relative URL and exposes its contents
+ to either the page, a String in 'var', or a Reader in 'varReader'.
+ </description>
+ <name>import</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+The URL of the resource to import.
+ </description>
+ <name>url</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+resource's content. The type of the scoped
+variable is String.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope for var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+resource's content. The type of the scoped
+variable is Reader.
+ </description>
+ <name>varReader</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the context when accessing a relative
+URL resource that belongs to a foreign
+context.
+ </description>
+ <name>context</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Character encoding of the content at the input
+resource.
+ </description>
+ <name>charEncoding</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ The basic iteration tag, accepting many different
+ collection types and supporting subsetting and other
+ functionality
+ </description>
+ <name>forEach</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Collection of items to iterate over.
+ </description>
+ <name>items</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description>
+If items specified:
+Iteration begins at the item located at the
+specified index. First item of the collection has
+index 0.
+If items not specified:
+Iteration begins with index set at the value
+specified.
+ </description>
+ <name>begin</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description>
+If items specified:
+Iteration ends at the item located at the
+specified index (inclusive).
+If items not specified:
+Iteration ends when index reaches the value
+specified.
+ </description>
+ <name>end</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description>
+Iteration will only process every step items of
+the collection, starting with the first one.
+ </description>
+ <name>step</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+current item of the iteration. This scoped
+variable has nested visibility. Its type depends
+on the object of the underlying collection.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+status of the iteration. Object exported is of type
+javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
+visibility.
+ </description>
+ <name>varStatus</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Iterates over tokens, separated by the supplied delimeters
+ </description>
+ <name>forTokens</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+String of tokens to iterate over.
+ </description>
+ <name>items</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>
+The set of delimiters (the characters that
+separate the tokens in the string).
+ </description>
+ <name>delims</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>
+Iteration begins at the token located at the
+specified index. First token has index 0.
+ </description>
+ <name>begin</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description>
+Iteration ends at the token located at the
+specified index (inclusive).
+ </description>
+ <name>end</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description>
+Iteration will only process every step tokens
+of the string, starting with the first one.
+ </description>
+ <name>step</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+current item of the iteration. This scoped
+variable has nested visibility.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+status of the iteration. Object exported is of
+type
+javax.servlet.jsp.jstl.core.LoopTag
+Status. This scoped variable has nested
+visibility.
+ </description>
+ <name>varStatus</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Like &lt;%= ... &gt;, but for expressions.
+ </description>
+ <name>out</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Expression to be evaluated.
+ </description>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Default value if the resulting value is null.
+ </description>
+ <name>default</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Determines whether characters &lt;,&gt;,&amp;,'," in the
+resulting string should be converted to their
+corresponding character entity codes. Default value is
+true.
+ </description>
+ <name>escapeXml</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+
+ <tag>
+ <description>
+ Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
+ and runs only if all of the prior conditions evaluated to
+ 'false'
+ </description>
+ <name>otherwise</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+
+ <tag>
+ <description>
+ Adds a parameter to a containing 'import' tag's URL.
+ </description>
+ <name>param</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Name of the query string parameter.
+ </description>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Value of the parameter.
+ </description>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Redirects to a new URL.
+ </description>
+ <name>redirect</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+The URL of the resource to redirect to.
+ </description>
+ <name>url</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the context when redirecting to a relative URL
+resource that belongs to a foreign context.
+ </description>
+ <name>context</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Removes a scoped variable (from a particular scope, if specified).
+ </description>
+ <name>remove</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <description>
+Name of the scoped variable to be removed.
+ </description>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope for var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Sets the result of an expression evaluation in a 'scope'
+ </description>
+ <name>set</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Name of the exported scoped variable to hold the value
+specified in the action. The type of the scoped variable is
+whatever type the value expression evaluates to.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Expression to be evaluated.
+ </description>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Target object whose property will be set. Must evaluate to
+a JavaBeans object with setter property property, or to a
+java.util.Map object.
+ </description>
+ <name>target</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the property to be set in the target object.
+ </description>
+ <name>property</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope for var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Creates a URL with optional query parameters.
+ </description>
+ <name>url</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+processed url. The type of the scoped variable is
+String.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope for var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+URL to be processed.
+ </description>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the context when specifying a relative URL
+resource that belongs to a foreign context.
+ </description>
+ <name>context</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Subtag of &lt;choose&gt; that includes its body if its
+ condition evalutes to 'true'
+ </description>
+ <name>when</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+The test condition that determines whether or not the
+body content should be processed.
+ </description>
+ <name>test</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>boolean</type>
+ </attribute>
+ </tag>
+
+</taglib>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld
new file mode 100644
index 0000000000..3b9a54a87d
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld
@@ -0,0 +1,671 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+
+ <description>JSTL 1.1 i18n-capable formatting library</description>
+ <display-name>JSTL fmt</display-name>
+ <tlib-version>1.1</tlib-version>
+ <short-name>fmt</short-name>
+ <uri>http://java.sun.com/jsp/jstl/fmt</uri>
+
+ <validator>
+ <description>
+ Provides core validation features for JSTL tags.
+ </description>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.JstlFmtTLV
+ </validator-class>
+ </validator>
+
+ <tag>
+ <description>
+ Sets the request character encoding
+ </description>
+ <name>requestEncoding</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <description>
+Name of character encoding to be applied when
+decoding request parameters.
+ </description>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Stores the given locale in the locale configuration variable
+ </description>
+ <name>setLocale</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <description>
+A String value is interpreted as the
+printable representation of a locale, which
+must contain a two-letter (lower-case)
+language code (as defined by ISO-639),
+and may contain a two-letter (upper-case)
+country code (as defined by ISO-3166).
+Language and country codes must be
+separated by hyphen (-) or underscore
+(_).
+ </description>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Vendor- or browser-specific variant.
+See the java.util.Locale javadocs for
+more information on variants.
+ </description>
+ <name>variant</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope of the locale configuration variable.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Specifies the time zone for any time formatting or parsing actions
+ nested in its body
+ </description>
+ <name>timeZone</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+The time zone. A String value is interpreted as
+a time zone ID. This may be one of the time zone
+IDs supported by the Java platform (such as
+"America/Los_Angeles") or a custom time zone
+ID (such as "GMT-8"). See
+java.util.TimeZone for more information on
+supported time zone formats.
+ </description>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Stores the given time zone in the time zone configuration variable
+ </description>
+ <name>setTimeZone</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <description>
+The time zone. A String value is interpreted as
+a time zone ID. This may be one of the time zone
+IDs supported by the Java platform (such as
+"America/Los_Angeles") or a custom time zone
+ID (such as "GMT-8"). See java.util.TimeZone for
+more information on supported time zone
+formats.
+ </description>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable which
+stores the time zone of type
+java.util.TimeZone.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope of var or the time zone configuration
+variable.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Loads a resource bundle to be used by its tag body
+ </description>
+ <name>bundle</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.BundleTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Resource bundle base name. This is the bundle's
+fully-qualified resource name, which has the same
+form as a fully-qualified class name, that is, it uses
+"." as the package component separator and does not
+have any file type (such as ".class" or ".properties")
+suffix.
+ </description>
+ <name>basename</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Prefix to be prepended to the value of the message
+key of any nested &lt;fmt:message&gt; action.
+ </description>
+ <name>prefix</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Loads a resource bundle and stores it in the named scoped variable or
+ the bundle configuration variable
+ </description>
+ <name>setBundle</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <description>
+Resource bundle base name. This is the bundle's
+fully-qualified resource name, which has the same
+form as a fully-qualified class name, that is, it uses
+"." as the package component separator and does not
+have any file type (such as ".class" or ".properties")
+suffix.
+ </description>
+ <name>basename</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable which stores
+the i18n localization context of type
+javax.servlet.jsp.jstl.fmt.LocalizationC
+ontext.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope of var or the localization context
+configuration variable.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Maps key to localized message and performs parametric replacement
+ </description>
+ <name>message</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.MessageTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Message key to be looked up.
+ </description>
+ <name>key</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Localization context in whose resource
+bundle the message key is looked up.
+ </description>
+ <name>bundle</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable
+which stores the localized message.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope of var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Supplies an argument for parametric replacement to a containing
+ &lt;message&gt; tag
+ </description>
+ <name>param</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParamTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Argument used for parametric replacement.
+ </description>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Formats a numeric value as a number, currency, or percentage
+ </description>
+ <name>formatNumber</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Numeric value to be formatted.
+ </description>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Specifies whether the value is to be
+formatted as number, currency, or
+percentage.
+ </description>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Custom formatting pattern.
+ </description>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+ISO 4217 currency code. Applied only
+when formatting currencies (i.e. if type is
+equal to "currency"); ignored otherwise.
+ </description>
+ <name>currencyCode</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Currency symbol. Applied only when
+formatting currencies (i.e. if type is equal
+to "currency"); ignored otherwise.
+ </description>
+ <name>currencySymbol</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Specifies whether the formatted output
+will contain any grouping separators.
+ </description>
+ <name>groupingUsed</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Maximum number of digits in the integer
+portion of the formatted output.
+ </description>
+ <name>maxIntegerDigits</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Minimum number of digits in the integer
+portion of the formatted output.
+ </description>
+ <name>minIntegerDigits</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Maximum number of digits in the
+fractional portion of the formatted output.
+ </description>
+ <name>maxFractionDigits</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Minimum number of digits in the
+fractional portion of the formatted output.
+ </description>
+ <name>minFractionDigits</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable
+which stores the formatted result as a
+String.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope of var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Parses the string representation of a number, currency, or percentage
+ </description>
+ <name>parseNumber</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+String to be parsed.
+ </description>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Specifies whether the string in the value
+attribute should be parsed as a number,
+currency, or percentage.
+ </description>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Custom formatting pattern that determines
+how the string in the value attribute is to be
+parsed.
+ </description>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Locale whose default formatting pattern (for
+numbers, currencies, or percentages,
+respectively) is to be used during the parse
+operation, or to which the pattern specified
+via the pattern attribute (if present) is
+applied.
+ </description>
+ <name>parseLocale</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Specifies whether just the integer portion of
+the given value should be parsed.
+ </description>
+ <name>integerOnly</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable which
+stores the parsed result (of type
+java.lang.Number).
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope of var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Formats a date and/or time using the supplied styles and pattern
+ </description>
+ <name>formatDate</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <description>
+Date and/or time to be formatted.
+ </description>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Specifies whether the time, the date, or both
+the time and date components of the given
+date are to be formatted.
+ </description>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Predefined formatting style for dates. Follows
+the semantics defined in class
+java.text.DateFormat. Applied only
+when formatting a date or both a date and
+time (i.e. if type is missing or is equal to
+"date" or "both"); ignored otherwise.
+ </description>
+ <name>dateStyle</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Predefined formatting style for times. Follows
+the semantics defined in class
+java.text.DateFormat. Applied only
+when formatting a time or both a date and
+time (i.e. if type is equal to "time" or "both");
+ignored otherwise.
+ </description>
+ <name>timeStyle</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Custom formatting style for dates and times.
+ </description>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Time zone in which to represent the formatted
+time.
+ </description>
+ <name>timeZone</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable which
+stores the formatted result as a String.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope of var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Parses the string representation of a date and/or time
+ </description>
+ <name>parseDate</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Date string to be parsed.
+ </description>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Specifies whether the date string in the
+value attribute is supposed to contain a
+time, a date, or both.
+ </description>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Predefined formatting style for days
+which determines how the date
+component of the date string is to be
+parsed. Applied only when formatting a
+date or both a date and time (i.e. if type
+is missing or is equal to "date" or "both");
+ignored otherwise.
+ </description>
+ <name>dateStyle</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Predefined formatting styles for times
+which determines how the time
+component in the date string is to be
+parsed. Applied only when formatting a
+time or both a date and time (i.e. if type
+is equal to "time" or "both"); ignored
+otherwise.
+ </description>
+ <name>timeStyle</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Custom formatting pattern which
+determines how the date string is to be
+parsed.
+ </description>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Time zone in which to interpret any time
+information in the date string.
+ </description>
+ <name>timeZone</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Locale whose predefined formatting styles
+for dates and times are to be used during
+the parse operation, or to which the
+pattern specified via the pattern
+attribute (if present) is applied.
+ </description>
+ <name>parseLocale</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable in
+which the parsing result (of type
+java.util.Date) is stored.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope of var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..c60d36566b
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright (c) 2005 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.
+ -->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app id="WebApp">
+ <display-name>Tuscany DAS Features</display-name>
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>html/DASWebSampleFrame.html</welcome-file>
+ </welcome-file-list>
+
+ <!-- Command Servlet -->
+ <servlet>
+ <display-name>CommandServlet</display-name>
+ <servlet-name>CommandServlet</servlet-name>
+ <servlet-class>org.apache.tuscany.samples.web.CommandServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>CommandServlet</servlet-name>
+ <url-pattern>/CommandServlet</url-pattern>
+ </servlet-mapping>
+
+ <!-- JSTL Tag Library Descriptors -->
+ <taglib>
+ <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
+ <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
+ </taglib>
+ <taglib>
+ <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
+ <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
+ </taglib>
+</web-app>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html b/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html
new file mode 100644
index 0000000000..49f913eaec
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+ "http://www.w3.org/TR/html4/frameset.dtd">
+<!--
+ Copyright (c) 2005 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.
+ -->
+
+<HTML>
+<HEAD>
+<TITLE>Tuscany DAS Web Sample</TITLE>
+</HEAD>
+<FRAMESET rows="40%,70%">
+ <FRAME name="fixed" src="jsp/DASMenu.jsp">
+ <FRAME name="dynamic" src="html/blank.html">
+</FRAMESET>
+</HTML> \ No newline at end of file
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/blank.html b/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/blank.html
new file mode 100644
index 0000000000..0bc2a49864
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/blank.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+ Copyright (c) 2005 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.
+ -->
+
+<HTML>
+<HEAD>
+<TITLE></TITLE>
+</HEAD>
+<BODY>
+</BODY>
+</HTML> \ No newline at end of file
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/ajax.js b/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/ajax.js
new file mode 100644
index 0000000000..c0b0be5e54
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/ajax.js
@@ -0,0 +1,188 @@
+//<!--
+// Copyright (c) 2005 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.
+// -->
+
+var req;
+var url;
+var xslFileName;
+var brwsr;
+var htmlunitlimit;
+
+function startup(pageName) {
+ if(pageName == 'adhoc'){
+ document.forms[0].sqlQuery.focus = true;
+ }
+
+ if(pageName == 'command') {
+ document.forms[0].DasCommand.focus = true;
+ }
+}
+
+function init() {
+ if (window.XMLHttpRequest) {
+ brwsr="NOIE";
+ req = new XMLHttpRequest();
+ } else if (window.ActiveXObject) {
+ brwsr="IE";
+ req = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ var url = "../CommandServlet";
+ req.open("POST", url, true);
+ req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+}
+
+function formWaitMessage(){
+ var swappableSection = document.getElementById('msg');
+ if (window.XSLTProcessor)
+ {
+ swappableSection.innerHTML = '';
+ var x = document.createTextNode('Retreiving result..please wait');
+ swappableSection.appendChild(x);
+ }
+ else if(window.ActiveXObject)
+ {
+ swappableSection.innerHTML = 'Retreiving result..please wait' ;
+ }
+}
+
+function executeQuery(reqParams, xslFileNameVal) {
+ init();
+ req.onreadystatechange = resultHandler;
+ xslFileName = xslFileNameVal;
+ //alert(reqParams);
+ xsldocloaded = false;
+ loadXsl();
+ req.send(reqParams);
+ //alert('req sent');
+}
+
+ var xsldocloaded = false;
+ var xsldoc;
+
+function loadXsl(){
+ if(xslFileName != ''){
+ if (window.XSLTProcessor)
+ {
+ // support Mozilla/Gecko based browsers
+ xsldoc = document.implementation.createDocument("", "", null);
+ xsldoc.addEventListener("load", onXslLoad, false);
+ xsldoc.load(xslFileName);
+ //alert("done loadXsl Mozilla");
+ htmlunitlimit='false';
+ }
+ else if(window.ActiveXObject)
+ {
+ // support Windows / ActiveX
+ xsldoc = new ActiveXObject("Microsoft.XMLDOM");
+ xsldoc.ondataavailable = onXslLoad;
+ xsldoc.load(xslFileName);
+ //alert("done loadXsl IE");
+ htmlunitlimit='false';
+ }
+ else{
+ //alert('setiing htmlunitlimit true');
+ htmlunitlimit='true';
+ }
+ }
+}
+
+function onXslLoad()
+{
+ // flag that the xsl is loaded
+ xsldocloaded = true;
+}
+
+function resultHandler()
+{
+ // Make sure the request is loaded (readyState = 4)
+ if (req.readyState == 4)
+ {
+ // Make sure the status is "OK"
+ if (req.status == 200)
+ {
+ // Make sure the XSL document is loaded
+ if (!xsldocloaded && xslFileName != '')
+ {
+ if(htmlunitlimit=='false'){
+ alert("Unable to transform data. XSL is not yet loaded.");
+ // break out of the function
+ return;
+ }
+ else{
+ var swappableSectionUT = document.getElementById('msg');
+ if(brwsr=='NOIE'){
+ //alert('limit case, xsl present, noie');
+ swappableSectionUT.removeChild(swappableSectionUT.childNodes[0]);//remove wait message
+ var x = document.createTextNode(req.responseText);
+ swappableSectionUT.appendChild(x);
+ }
+ else{
+ swappableSectionUT.innerHTML = req.responseText;
+ }
+ //alert('returning result:'+req.responseText);
+ return;
+ }
+ }
+
+ var swappableSection = document.getElementById("msg");
+
+ if (window.XSLTProcessor)
+ {
+ if(xslFileName == ''){
+ swappableSection.removeChild(swappableSection.childNodes[0]);//remove wait message
+ var x = document.createTextNode(req.responseText);
+ swappableSection.appendChild(x);
+ }
+ else{
+ // support Mozilla/Gecko based browsers
+ var xsltProcessor = new XSLTProcessor();
+ xsltProcessor.importStylesheet(xsldoc);
+ var outputXHTML = xsltProcessor
+ .transformToFragment(req.responseXML, document);
+ swappableSection.innerHTML = "";
+ swappableSection.appendChild(outputXHTML);
+ }
+ }
+ else if(window.ActiveXObject)
+ {
+ if(xslFileName == ''){
+ swappableSection.innerHTML = req.responseText;
+ }
+ else{
+ // support Windows/ActiveX enabled browsers
+ var outputXHTML = req.responseXML.transformNode(xsldoc);
+ swappableSection.innerHTML = outputXHTML;
+ }
+ }
+ else{
+ var swappableSectionUT = document.getElementById('msg');
+ if(brwsr=='NOIE'){
+ swappableSectionUT.removeChild(swappableSectionUT.childNodes[0]);//remove wait message
+ var x = document.createTextNode(req.responseText);
+ swappableSectionUT.appendChild(x);
+ }
+ else{
+ swappableSectionUT.innerHTML = req.responseText;
+ }
+ return;
+ }
+ }
+ else
+ {
+ alert("There was a problem retrieving the XML data:\n" +
+ req.statusText);
+ }
+ }
+}
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/dasmenu.js b/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/dasmenu.js
new file mode 100644
index 0000000000..96b5d5288e
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/dasmenu.js
@@ -0,0 +1,112 @@
+//<!--
+// Copyright (c) 2005 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.
+// -->
+var dbstatus;
+var brwsrDB;
+var reqDB;
+
+function showSubMenu(){
+ var objThis = this;
+
+ for(var i = 0; i < objThis.childNodes.length; i++)
+ {
+ if(objThis.childNodes.item(i).nodeName == "UL")
+ {
+ objThis.childNodes.item(i).style.display = "block";
+ }
+ }
+}
+
+function hideSubMenu()
+{
+ var objThis = this;
+
+ for(var i = 0; i < objThis.childNodes.length; i++)
+ {
+ if(objThis.childNodes.item(i).nodeName == "UL")
+ {
+ objThis.childNodes.item(i).style.display = "none";
+ return;
+ }
+ }
+}
+
+function initialiseMenu()
+{
+ var objLICollection = document.body.getElementsByTagName("LI");
+ for(var i = 0; i < objLICollection.length; i++)
+ {
+ var objLI = objLICollection[i];
+ for(var j = 0; j < objLI.childNodes.length; j++)
+ {
+ if(objLI.childNodes.item(j).nodeName == "UL")
+ {
+ objLI.onmouseover=showSubMenu;
+ objLI.onmouseout=hideSubMenu;
+
+ for(var j = 0; j < objLI.childNodes.length; j++)
+ {
+ if(objLI.childNodes.item(j).nodeName == "A")
+ {
+ objLI.childNodes.item(j).className = "hassubmenu";
+ }
+ }
+ }
+ }
+ }
+}
+
+function refreshdb(){
+ if (window.XMLHttpRequest) {
+ brwsrDB='NOIE';
+ reqDB = new XMLHttpRequest();
+ } else if (window.ActiveXObject) {
+ brwsrDB='IE';
+ reqDB = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+
+ var dbRefreshMsg = document.getElementById('dbmsg');
+ if(brwsrDB=='NOIE'){
+ var x = document.createTextNode('Refreshing database..please wait');
+ dbRefreshMsg.appendChild(x);
+ }
+ else{
+ dbmsg.innerHTML = 'Refreshing database..please wait';
+ }
+
+ //TODO
+ var urlDB = "../CommandServlet";
+ reqDB.open("POST", urlDB, true);
+ reqDB.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ reqDB.onreadystatechange = dbresultHandler;
+ reqDB.send('refreshDB=yes');
+}
+
+function dbresultHandler() {
+ if (reqDB.readyState == 4) {
+ if (reqDB.status == 200) {
+ var dbRefreshMsg = document.getElementById('dbmsg');
+ if(brwsrDB=='NOIE'){
+ dbRefreshMsg.removeChild(dbRefreshMsg.childNodes[0]);//remove wait message
+ var x = document.createTextNode('Refreshed database!');
+ dbRefreshMsg.appendChild(x);
+ }
+ else{
+ dbmsg.innerHTML = 'Refreshed database!';
+ }
+ return;
+ }
+ }
+}
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp
new file mode 100644
index 0000000000..041e05c8bb
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ Copyright (c) 2005 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.
+ -->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <link rel="stylesheet" type="text/css" href="main.css" media="screen, print" />
+ <script type="text/javascript" src="../js/dasmenu.js" >
+ </script>
+
+ <title>DASMenu: Web Sample</title>
+ <meta name="description" content="DAS Features Demo" />
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="expires" content="-1" />
+ <meta http-equiv="pragma" content="no-cache" />
+ </head>
+ <body onload="initialiseMenu();
+
+ ">
+ <h1>Tuscany DAS Web Sample</h1>
+ <ul id="mainmenu">
+ <li><a href="../html/blank.html" target="dynamic">Advanced Features</a>
+ <ul>
+ <li><a href="./occ.jsp" target="dynamic">OCC</a></li>
+ <li><a href="./converter.jsp" target="dynamic">Converter</a></li>
+ <li><a href="./rss.jsp" target="dynamic">Result Set Shape</a></li>
+ </ul>
+ </li>
+ <li><a href="./indexAdhoc.jsp" target="dynamic">Adhoc Query</a></li>
+ <li><a href="./indexCommand.jsp" target="dynamic">Command</a></li>
+ </ul>
+ <p>Tuscany DAS web sample demonstrates - simple adhoc queries, DAS predefined commands execution and
+ some advanced features like Optimistic Concurrency Control (OCC), Converter, Result Set Shape etc.
+ </p>
+ <p>Check more details by navigating menu.
+ Press <b>Refresh!</b> button anytime for database refresh.
+ </p>
+
+ <FORM name='MenuForm'>
+ <INPUT TYPE="button" id="refreshButton" name="refreshButton" value="Refresh!"
+ onClick=" refreshdb();
+ "
+ >
+ </INPUT>
+ <!-- Font for Status Message -->
+ <font face="Arial,Helvetica,Verdana" size="2" color="#FF0000">
+ <b id="dbmsg"></b>
+ </font>
+ </FORM>
+ </body>
+</html> \ No newline at end of file
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp
new file mode 100644
index 0000000000..a3610e7639
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp
@@ -0,0 +1,117 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<%--
+ * Copyright (c) 2005 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.
+ --%>
+
+<%-- JSTL tags --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+
+<html>
+
+<head>
+<link href="default.css" rel="stylesheet" type="text/css">
+<script type="text/javascript" src="../js/ajax.js" >
+</script>
+
+</head>
+
+<body onload="startup()">
+
+<%@ page import="java.util.*" %>
+
+<font face="Arial,Helvetica,Verdana" size="3">
+
+<form name="DasForm" >
+
+<input type="hidden" id="serviceName" name="serviceName" value="org.apache.tuscany.samples.das.DASQueryProcessor"/>
+<input type="hidden" id="configFile" name="configFile" value="CustomerConfigWithConverter.xml"/>
+<input type="hidden" id="type" name="type" value="converter:"/>
+<input type="hidden" id="param" name="param" value=""/>
+<input type="hidden" id="xslFileName" name="xslFileName" value=""/>
+
+<b>Arbitrary Converter: </b>
+ The column converted is a VARCAHAR.
+ ResultSetShape is used to specify that the property will be a SDODataTypes.DATE.
+ So this example uses a converter that transforms a string column into a date property
+ and conversely, a date property back to a string for the underlying column.
+ <br>
+ The converter returns 1957.09.27 if the column value is "Pavick" and 1966.12.20 if
+ the value is "Williams"
+ <br>
+ On write, the converter returns "Williams" if the property value is 1966.12.20 and "Pavick"
+ if the property value is 1957.09.27
+ <br>
+ Check using direct database connection that the database table rows's column values are
+ either "Williams" or "Pavick".
+<br>
+<hr width="90%" size="1">
+<input type="radio" name="stmt" id="stmt" checked="checked" value="stmt0">
+Select * from CUSTOMER where ID = 1;
+<br>
+<input type="radio" name="stmt" id="stmt" value="stmt1">
+Check First Customer's LastName is 1957.09.27
+<br>
+<input type="radio" name="stmt" id="stmt" value="stmt2">
+Set First Customer's LastName to 1966.12.20
+<br>
+<input type="radio" name="stmt" id="stmt" value="stmt3">
+Check First Customer's LastName is 1966.12.20
+<br>
+
+
+&nbsp; &nbsp;
+<input type="button" id="converterButton" name="converterButton" value="ExecuteTransaction"
+ onclick="
+ var varVal;
+ if(this.form.stmt[0].checked){
+ varVal = 'stmt0';
+ xslFileName.value = '../xsl/customer.xsl';
+ }
+ if(this.form.stmt[1].checked){
+ varVal = 'stmt1';
+ xslFileName.value = '';
+ }
+ if(this.form.stmt[2].checked){
+ varVal = 'stmt2';
+ xslFileName.value = '';
+ }
+ if(this.form.stmt[3].checked){
+ varVal = 'stmt3';
+ xslFileName.value = '';
+ }
+
+ param.value = 'Query=' + this.form.type.value+varVal;
+ param.value += '&serviceName='+this.form.serviceName.value;
+ param.value += '&configFile='+this.form.configFile.value;
+ executeQuery(param.value, xslFileName.value);
+ formWaitMessage();
+ ">
+</input>
+<hr>
+
+<!-- Font for Status Message -->
+<font face="Arial,Helvetica,Verdana" size="2" color="#FF0000">
+<div id="msg">&nbsp;</div>
+</font>
+<!-- Font End -->
+
+</form>
+
+</font>
+
+</body>
+</html>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/default.css b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/default.css
new file mode 100644
index 0000000000..5680fab9ed
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/default.css
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+BODY {BACKGROUND-COLOR: #FFFFFF; COLOR: #333366; FONT-FAMILY: 'Times New Roman'}
+H1 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize }
+H2 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize }
+H3 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize }
+H4 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize }
+H5 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize }
+H6 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize }
+TH {COLOR: #000000; font-weight: bold }
+
+#TRowEven {background-color: #ccff99}
+#TRowOdd {background-color: #ffffcc}
+
+A:link {cursor:hand; color: #3300FF; text-decoration: none;}
+A:visited {cursor:hand; color: #3300FF; text-decoration: none; }
+A:active {cursor:hand; color:#FEAA02; text-decoration: none;}
+A:hover {cursor:hand; color:#FEAA02;}
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp
new file mode 100644
index 0000000000..f212d744f1
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp
@@ -0,0 +1,87 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<%--
+ * Copyright (c) 2005 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.
+ --%>
+
+<%-- JSTL tags --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+
+<html>
+
+<head>
+<link href="default.css" rel="stylesheet" type="text/css">
+<script type="text/javascript" src="../js/ajax.js" >
+</script>
+
+</head>
+
+<body onload="startup()">
+
+<%@ page import="java.util.*" %>
+
+<font face="Arial,Helvetica,Verdana" size="3">
+
+<form name="DasForm" >
+
+<input type="hidden" id="serviceName" name="serviceName" value="org.apache.tuscany.samples.das.DASQueryProcessor"/>
+<input type="hidden" id="configFile" name="configFile" value="DasConfig.xml"/>
+<input type="hidden" id="type" name="type" value="query:"/>
+<input type="hidden" id="param" name="param" value=""/>
+<input type="hidden" id="xslFileName" name="xslFileName" value=""/>
+
+<b>Adhoc SQL Query: </b><br>
+<select id="sqlQuery" name="sqlQuery"
+ onfocus="this.form.queryButton.disabled=false;">
+<option value="NullQuery"></option>
+<option value="SELECT * FROM COMPANY">SELECT * FROM COMPANY</option>
+<option value="SELECT * FROM COMPANY LEFT OUTER JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID">SELECT * FROM COMPANY LEFT OUTER JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID</option>
+<option value="{INSERT INTO DEPARTMENT (NAME, COMPANYID) VALUES ('MyDept',1)}{SELECT * FROM COMPANY LEFT OUTER JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID}">
+ INSERT INTO DEPARTMENT (NAME, COMPANYID) VALUES ('MyDept',1)</option>
+<option value="{DELETE FROM DEPARTMENT WHERE DEPARTMENT.COMPANYID=1 and DEPARTMENT.ID>1}{SELECT * FROM COMPANY LEFT OUTER JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID}">
+ DELETE FROM DEPARTMENT WHERE COMPANYID=1 and ID>1</option>
+<option value="{UPDATE DEPARTMENT SET NAME='MyUpdDept' WHERE COMPANYID=1 AND ID=1}{SELECT * FROM COMPANY LEFT OUTER JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID}">
+ UPDATE DEPARTMENT SET NAME='MyUpdDept' WHERE COMPANYID=1 AND ID=1</option>
+</select>
+&nbsp; &nbsp;
+<input type="button" id="queryButton" name="queryButton" value="ExecuteQuery"
+ onclick="
+ if(this.form.sqlQuery.value=='SELECT * FROM COMPANY'){
+ this.form.xslFileName.value = '../xsl/company.xsl';
+ }
+ else{
+ this.form.xslFileName.value = '../xsl/companyDepartment.xsl';
+ }
+ param.value = 'Query=' + this.form.type.value+this.form.sqlQuery.value;
+ param.value += '&serviceName='+this.form.serviceName.value;
+ param.value += '&configFile='+this.form.configFile.value;
+ executeQuery(param.value, xslFileName.value);
+ formWaitMessage();
+ " >
+</input>
+<hr>
+
+<!-- Font for Status Message -->
+<font face="Arial,Helvetica,Verdana" size="2" color="#FF0000">
+<div id="msg">&nbsp;</div>
+</font>
+<!-- Font End -->
+</form>
+
+</font>
+
+</body>
+</html>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp
new file mode 100644
index 0000000000..55dcb56e38
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<%--
+ * Copyright (c) 2005 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.
+ --%>
+
+<%-- JSTL tags --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+
+<html>
+
+<head>
+<link href="default.css" rel="stylesheet" type="text/css">
+<script src="../js/ajax.js" language="javascript" type="text/javascript"></script>
+
+</head>
+
+<body onload="startup()">
+
+<%@ page import="java.util.*" %>
+
+<font face="Arial,Helvetica,Verdana" size="3">
+
+<form name="DasForm" >
+
+<input type="hidden" id="serviceName" name="serviceName" value="org.apache.tuscany.samples.das.DASQueryProcessor"/>
+<input type="hidden" id="configFile" name="configFile" value="DasConfig.xml"/>
+<input type="hidden" id="type" name="type" value="command:"/>
+<input type="hidden" id="param" name="param" value=""/>
+<input type="hidden" id="xslFileName" name="xslFileName" value=""/>
+
+<b>DAS Command: </b>
+
+<select id="DasCommand" name="DasCommand"
+ onfocus="this.form.commandButton.disabled=false;">
+<option value="NullCommand"></option>
+<option value="AllCompanies">all companies</option>
+<option value="AllCompaniesAndDepartments">all companies and departments</option>
+<option value="AddDepartmentToFirstCompany">Add department to first company</option>
+<option value="DeleteDepartmentFromFirstCompany">Delete department from first company</option>
+<option value="UpdateCompanyDepartmentNames">Update one department name from first company</option>
+</select>
+
+
+<input type="button" id="commandButton" name="commandButton" value="ExecuteCommand"
+ onclick="this.form.type.value='command:';
+ if(this.form.DasCommand.value=='AllCompanies'){
+ this.form.xslFileName.value = '../xsl/company.xsl';
+ }
+ else{
+ this.form.xslFileName.value = '../xsl/companyDepartment.xsl';
+ }
+
+ param.value = 'Query=' + this.form.type.value+this.form.DasCommand.value;
+ param.value += '&serviceName='+this.form.serviceName.value;
+ param.value += '&configFile='+this.form.configFile.value;
+ executeQuery(param.value, this.form.xslFileName.value);
+ formWaitMessage();
+ " >
+</input>
+<hr>
+<!-- Font for Status Message -->
+<font face="Arial,Helvetica,Verdana" size="2" color="#FF0000">
+<div id="msg">&nbsp;</div>
+</font>
+<!-- Font End -->
+</form>
+
+</font>
+
+</body>
+</html>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/main.css b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/main.css
new file mode 100644
index 0000000000..264facc985
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/main.css
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+body
+{
+ margin: 0px;
+ border: 0px;
+ padding: 0px;
+ font-family: Verdana, Arial, Sans-Serif;
+ font-size: 0px;
+}
+
+img
+{
+ border: none 0px #ffffff;
+}
+
+h1
+{
+ background-color: #ffcc00;
+ border-bottom: solid 1px #333333;
+ padding: 5px;
+ margin: 0px;
+ font-size: x-large;
+}
+
+h2
+{
+ font-size: large;
+}
+
+p
+{
+ font-size: small;
+}
+
+/* Real menu */
+ul, li
+{
+ font-size: small;
+ margin-top: 0px;
+ margin-right: 0px;
+ margin-bottom: 0px;
+ display: block;
+}
+
+ul
+{
+ width: 130px;
+ border: solid 1px #333333;
+ border-top: solid 5px #333333;
+ border-right: solid 2px #333333;
+ padding: 0px;
+}
+
+li ul
+{
+ display: none;
+ position: absolute;
+ margin-left: 100px;
+ margin-top: -20px;
+}
+
+li a
+{
+ padding: 2px;
+ text-decoration: none;
+ color: #000000;
+ background-color: #ffffee;
+ width: 100%;
+ display: block;
+ border-bottom: dashed 1px #333333;
+ text-indent: 2px;
+ font-size: small;
+}
+
+li a:hover
+{
+ background-color: #ffcc00;
+ font-weight: bold;
+ border-bottom: solid 1px #333333;
+}
+
+li
+{
+ float: left;
+ width: 98%;
+}
+
+a.hassubmenu
+{
+ background-image: url(../img/lay_dmnuhassub.gif);
+ background-repeat: no-repeat;
+ background-position: 120px 7px;
+}
+
+#mainmenu
+{
+ margin: 10px;
+ margin-left: 5px;
+ float: left;
+ border-bottom: solid 2px #333333;
+ margin-bottom: 100%;
+} \ No newline at end of file
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp
new file mode 100644
index 0000000000..ed5a7ee0c1
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<%--
+ * Copyright (c) 2005 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.
+ --%>
+
+<%-- JSTL tags --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+
+<html>
+
+<head>
+<link href="default.css" rel="stylesheet" type="text/css">
+<script type="text/javascript" src="../js/ajax.js" >
+</script>
+
+</head>
+
+<body onload="startup()">
+
+<%@ page import="java.util.*" %>
+
+<font face="Arial,Helvetica,Verdana" size="3">
+
+<form name="DasForm" >
+
+<input type="hidden" id="serviceName" name="serviceName" value="org.apache.tuscany.samples.das.DASQueryProcessor"/>
+<input type="hidden" id="configFile" name="configFile" value="DasConfig.xml"/>
+<input type="hidden" id="type" name="type" value="occ:"/>
+<input type="hidden" id="param" name="param" value=""/>
+<input type="hidden" id="xslFileName" name="xslFileName" value=""/>
+
+<b>Automatic Optimistic Concurrency Control: </b>
+ Try to modify same column in same database table row twice in one transaction.
+<br>
+<TEXTAREA name="occTransactions" id="occTransactions" rows="3" cols="60" readonly="true">
+ Select * from BOOK where BOOK_ID = 1;
+ update BOOK set NAME = 'Puss in Hat' where BOOK_ID = 1;
+ 'UpdateNameForFirstBook'
+</TEXTAREA>
+
+&nbsp; &nbsp;
+<input type="button" id="occButton" name="occButton" value="ExecuteTransaction"
+ onclick="
+ param.value = 'Query=' + this.form.type.value;
+ param.value += '&serviceName='+this.form.serviceName.value;
+ param.value += '&configFile='+this.form.configFile.value;
+ executeQuery(param.value, xslFileName.value);
+ formWaitMessage();
+ ">
+</input>
+<hr>
+
+<!-- Font for Status Message -->
+<font face="Arial,Helvetica,Verdana" size="2" color="#FF0000">
+<div id="msg">&nbsp;</div>
+</font>
+<!-- Font End -->
+</form>
+
+</font>
+
+</body>
+</html>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp
new file mode 100644
index 0000000000..2d217d68b3
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp
@@ -0,0 +1,78 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<%--
+ * Copyright (c) 2005 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.
+ --%>
+
+<%-- JSTL tags --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+
+<html>
+
+<head>
+<link href="default.css" rel="stylesheet" type="text/css">
+<script type="text/javascript" src="../js/ajax.js" >
+</script>
+
+</head>
+
+<body onload="startup()">
+
+<%@ page import="java.util.*" %>
+
+<font face="Arial,Helvetica,Verdana" size="3">
+
+<form name="DasForm" >
+
+<input type="hidden" id="serviceName" name="serviceName" value="org.apache.tuscany.samples.das.DASQueryProcessor"/>
+<input type="hidden" id="configFile" name="configFile" value="CustomerConfigWithIDConverter.xml"/>
+<input type="hidden" id="type" name="type" value="rss:"/>
+<input type="hidden" id="param" name="param" value=""/>
+<input type="hidden" id="xslFileName" name="xslFileName" value=""/>
+
+<b>Result Set Shape: </b>
+ DAS has ability to specify format(shape) of the ResultSet. This is necessary
+ when the JDBC driver in use does not provide adequate support for ResultSetMetadata.
+ Also, we expect that specifying the result set shape will increase performance.
+<br>
+<hr width="90%" size="1">
+<input type="text" name="stmt" id="stmt" value="literal" size="20">
+(Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer)
+
+&nbsp; &nbsp;
+<input type="button" id="rssButton" name="rssButton" value="ExecuteQuery"
+ onclick="
+ this.form.xslFileName.value='../xsl/customer.xsl';
+ param.value = 'Query=' + this.form.type.value+this.form.stmt.value;
+ param.value += '&serviceName='+this.form.serviceName.value;
+ param.value += '&configFile='+this.form.configFile.value;
+ executeQuery(param.value, xslFileName.value);
+ formWaitMessage();
+ " >
+</input>
+<hr>
+
+<!-- Font for Status Message -->
+<font face="Arial,Helvetica,Verdana" size="2" color="#FF0000">
+<div id="msg">&nbsp;</div>
+</font>
+<!-- Font End -->
+</form>
+
+</font>
+
+</body>
+</html>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/company.xsl b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/company.xsl
new file mode 100644
index 0000000000..99d9dc1fad
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/company.xsl
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright (c) 2005 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.
+ -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:das="http://org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <xsl:output method="html" version="1.0" encoding="Unicode" indent="yes"/>
+ <xsl:template match="/root/das:DataGraphRoot">
+ <html>
+ <body>
+ <h2>Query Result</h2>
+ <xsl:apply-templates select="COMPANY"/>
+ </body>
+ </html>
+ </xsl:template>
+ <xsl:template match="COMPANY">
+ <table border="1">
+ <tr bgcolor="#9acd32">
+ <th align="left">COMPANYID</th>
+ <th align="left">COMPANYNAME</th>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of select="ID"/>
+ </td>
+ <td>
+ <xsl:value-of select="NAME"/>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl
new file mode 100644
index 0000000000..f79d30595e
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright (c) 2005 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.
+ -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:das="http://org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <xsl:output method="html" version="1.0" encoding="Unicode" indent="yes"/>
+ <xsl:key name="companyidkey" match="/root/das:DataGraphRoot/DEPARTMENT" use="COMPANYID"/>
+ <xsl:template match="/root/das:DataGraphRoot">
+ <html>
+ <body>
+ <h2>Query Result</h2>
+ <xsl:apply-templates select="COMPANY"/>
+ </body>
+ </html>
+ </xsl:template>
+ <xsl:template match="COMPANY">
+ <table border="1">
+ <tr bgcolor="#9acd32">
+ <th align="left">COMPANYID</th>
+ <th align="left">COMPANYNAME</th>
+ </tr>
+
+ <tr>
+ <td>
+ <xsl:value-of select="ID"/>
+ </td>
+ <td>
+ <xsl:value-of select="NAME"/>
+ </td>
+ <table border="1">
+ <tr bgcolor="#9acd32">
+ <th align="left">DEPID</th>
+ <th align="left">DEPNAME</th>
+ </tr>
+
+ <xsl:variable name="tmp" select="ID"/>
+ <xsl:for-each select="key('companyidkey', $tmp)">
+ <tr>
+ <td>
+ <xsl:value-of select="ID"/>
+ </td>
+ <td>
+ <xsl:value-of select="NAME"/>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </tr>
+ </table>
+
+</xsl:template>
+</xsl:stylesheet>
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl
new file mode 100644
index 0000000000..40e260bcce
--- /dev/null
+++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright (c) 2005 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.
+ -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:das="http://org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
+ <xsl:template match="/">
+ <html>
+ <body>
+ <h2>Query Result</h2>
+ <table border="1">
+ <tr bgcolor="#9acd32">
+ <th align="left">ID</th>
+ <th align="left">LASTNAME</th>
+ <th align="left">ADDRESS</th>
+ </tr>
+ <xsl:for-each select="root">
+ <xsl:for-each select="das:DataGraphRoot">
+ <tr>
+ <td>
+ <xsl:value-of select="CUSTOMER/ID"/>
+ </td>
+ <td>
+ <xsl:value-of select="CUSTOMER/LASTNAME"/>
+ </td>
+ <td>
+ <xsl:value-of select="CUSTOMER/ADDRESS"/>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </table>
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/das-java/trunk/samples/build.xml b/das-java/trunk/samples/build.xml
new file mode 100644
index 0000000000..f78ca9a3c8
--- /dev/null
+++ b/das-java/trunk/samples/build.xml
@@ -0,0 +1,29 @@
+<?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.
+ -->
+<project name="samples" default="compile">
+
+ <target name="compile">
+ <ant dir="companyweb"/>
+ </target>
+
+ <target name="clean">
+ <ant dir="companyweb" target="clean"/>
+ </target>
+</project>
diff --git a/das-java/trunk/samples/company-webapp/build.xml b/das-java/trunk/samples/company-webapp/build.xml
new file mode 100644
index 0000000000..dd269b628e
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/build.xml
@@ -0,0 +1,55 @@
+<?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.
+ -->
+<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-companyweb.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-companyweb.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>
diff --git a/das-java/trunk/samples/company-webapp/dastest/db.lck b/das-java/trunk/samples/company-webapp/dastest/db.lck
new file mode 100644
index 0000000000..9f6b4b3d4b
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/db.lck
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/log/log.ctrl b/das-java/trunk/samples/company-webapp/dastest/log/log.ctrl
new file mode 100644
index 0000000000..edbd775299
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/log/log.ctrl
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/log/log1.dat b/das-java/trunk/samples/company-webapp/dastest/log/log1.dat
new file mode 100644
index 0000000000..7e85ac8e8f
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/log/log1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/log/logmirror.ctrl b/das-java/trunk/samples/company-webapp/dastest/log/logmirror.ctrl
new file mode 100644
index 0000000000..edbd775299
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/log/logmirror.ctrl
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c10.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c10.dat
new file mode 100644
index 0000000000..5d8ecaa10f
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c10.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c101.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c101.dat
new file mode 100644
index 0000000000..0f79fa7574
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c101.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c111.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c111.dat
new file mode 100644
index 0000000000..39d49e3d19
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c111.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c121.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c121.dat
new file mode 100644
index 0000000000..2a4311779b
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c121.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c130.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c130.dat
new file mode 100644
index 0000000000..64e3c18d62
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c130.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c141.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c141.dat
new file mode 100644
index 0000000000..0632d04164
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c141.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c150.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c150.dat
new file mode 100644
index 0000000000..d7541026f6
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c150.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c161.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c161.dat
new file mode 100644
index 0000000000..6673bf1873
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c161.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c171.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c171.dat
new file mode 100644
index 0000000000..c2a753cc5d
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c171.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c180.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c180.dat
new file mode 100644
index 0000000000..cb9391aed1
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c180.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c191.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c191.dat
new file mode 100644
index 0000000000..d3cf1d6364
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c191.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1a1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1a1.dat
new file mode 100644
index 0000000000..a7a2d536e9
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c1a1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1b1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1b1.dat
new file mode 100644
index 0000000000..19097e69e7
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c1b1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1c0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1c0.dat
new file mode 100644
index 0000000000..359525a31a
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c1c0.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1d1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1d1.dat
new file mode 100644
index 0000000000..9f257df932
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c1d1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1e0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1e0.dat
new file mode 100644
index 0000000000..e43e52fb7f
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c1e0.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1f1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1f1.dat
new file mode 100644
index 0000000000..7e6ee3b1e0
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c1f1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c20.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c20.dat
new file mode 100644
index 0000000000..1be6390f06
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c20.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c200.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c200.dat
new file mode 100644
index 0000000000..b15d56855c
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c200.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c211.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c211.dat
new file mode 100644
index 0000000000..84b0022312
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c211.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c221.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c221.dat
new file mode 100644
index 0000000000..63106a9523
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c221.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c230.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c230.dat
new file mode 100644
index 0000000000..9975f27c1f
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c230.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c241.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c241.dat
new file mode 100644
index 0000000000..835c645a16
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c241.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c251.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c251.dat
new file mode 100644
index 0000000000..d3d6adf4fb
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c251.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c260.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c260.dat
new file mode 100644
index 0000000000..8d7333df7d
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c260.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c271.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c271.dat
new file mode 100644
index 0000000000..af722f7d73
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c271.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c281.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c281.dat
new file mode 100644
index 0000000000..3972983c2e
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c281.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c290.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c290.dat
new file mode 100644
index 0000000000..31577b8124
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c290.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2a1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2a1.dat
new file mode 100644
index 0000000000..0f700d13a7
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c2a1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2b1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2b1.dat
new file mode 100644
index 0000000000..1d6382fb3d
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c2b1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2c1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2c1.dat
new file mode 100644
index 0000000000..3bc60d886b
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c2c1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2d0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2d0.dat
new file mode 100644
index 0000000000..c542d3c91c
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c2d0.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2e1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2e1.dat
new file mode 100644
index 0000000000..16abd20b5f
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c2e1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2f0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2f0.dat
new file mode 100644
index 0000000000..eb26be5932
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c2f0.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c300.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c300.dat
new file mode 100644
index 0000000000..1214f1df4b
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c300.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c31.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c31.dat
new file mode 100644
index 0000000000..18c16f1123
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c31.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c311.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c311.dat
new file mode 100644
index 0000000000..926cbf25b5
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c311.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c320.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c320.dat
new file mode 100644
index 0000000000..07e7bc023c
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c320.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c331.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c331.dat
new file mode 100644
index 0000000000..fd827f9dc2
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c331.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c340.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c340.dat
new file mode 100644
index 0000000000..ca70319886
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c340.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c351.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c351.dat
new file mode 100644
index 0000000000..8fbe2a527c
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c351.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c360.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c360.dat
new file mode 100644
index 0000000000..dcf9c746e1
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c360.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c371.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c371.dat
new file mode 100644
index 0000000000..6f21a840ea
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c371.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c380.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c380.dat
new file mode 100644
index 0000000000..b512e8065f
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c380.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c391.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c391.dat
new file mode 100644
index 0000000000..27006e95a1
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c391.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3a0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3a0.dat
new file mode 100644
index 0000000000..565dca97ac
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c3a0.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3b1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3b1.dat
new file mode 100644
index 0000000000..36894c9818
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c3b1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3c0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3c0.dat
new file mode 100644
index 0000000000..d0c538aede
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c3c0.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3d1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3d1.dat
new file mode 100644
index 0000000000..65bcec5527
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c3d1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3e0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3e0.dat
new file mode 100644
index 0000000000..bdab359420
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c3e0.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3f1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3f1.dat
new file mode 100644
index 0000000000..dc2d278b57
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c3f1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c400.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c400.dat
new file mode 100644
index 0000000000..3072709cec
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c400.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c41.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c41.dat
new file mode 100644
index 0000000000..61086690f2
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c41.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c411.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c411.dat
new file mode 100644
index 0000000000..ca551d8249
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c411.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c420.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c420.dat
new file mode 100644
index 0000000000..f04de0840e
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c420.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c431.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c431.dat
new file mode 100644
index 0000000000..398b1672cc
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c431.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c440.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c440.dat
new file mode 100644
index 0000000000..af259d0872
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c440.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c451.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c451.dat
new file mode 100644
index 0000000000..772a18c658
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c451.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c460.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c460.dat
new file mode 100644
index 0000000000..505428362d
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c460.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c471.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c471.dat
new file mode 100644
index 0000000000..484d0df42d
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c471.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c481.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c481.dat
new file mode 100644
index 0000000000..faac073076
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c481.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c490.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c490.dat
new file mode 100644
index 0000000000..7585319d21
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c490.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c4a1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c4a1.dat
new file mode 100644
index 0000000000..4fe8b786e3
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c4a1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c51.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c51.dat
new file mode 100644
index 0000000000..7fc7937b15
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c51.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c60.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c60.dat
new file mode 100644
index 0000000000..d1fb08c946
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c60.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c71.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c71.dat
new file mode 100644
index 0000000000..d4c2090a3b
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c71.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c81.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c81.dat
new file mode 100644
index 0000000000..38b6ea6520
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c81.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c90.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c90.dat
new file mode 100644
index 0000000000..a607a5969c
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/c90.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/ca1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/ca1.dat
new file mode 100644
index 0000000000..19b4c9e340
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/ca1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/cb1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/cb1.dat
new file mode 100644
index 0000000000..73dc986572
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/cb1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/cc0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/cc0.dat
new file mode 100644
index 0000000000..d1eef3bb56
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/cc0.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/cd1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/cd1.dat
new file mode 100644
index 0000000000..c7e6db3ef7
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/cd1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/ce1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/ce1.dat
new file mode 100644
index 0000000000..8fd3bf17a8
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/ce1.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/cf0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/cf0.dat
new file mode 100644
index 0000000000..332b3d9a8a
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/seg0/cf0.dat
Binary files differ
diff --git a/das-java/trunk/samples/company-webapp/dastest/service.properties b/das-java/trunk/samples/company-webapp/dastest/service.properties
new file mode 100644
index 0000000000..8cfe3b09a5
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/dastest/service.properties
@@ -0,0 +1,22 @@
+#C:\apacheSVN\java\target\dastest
+# ********************************************************************
+# *** Please do NOT edit this file. ***
+# *** CHANGING THE CONTENT OF THIS FILE MAY CAUSE DATA CORRUPTION. ***
+# ********************************************************************
+#Fri Feb 17 08:55:29 MST 2006
+SysschemasIndex2Identifier=225
+SyscolumnsIdentifier=144
+SysconglomeratesIndex1Identifier=49
+SysconglomeratesIdentifier=32
+SyscolumnsIndex2Identifier=177
+SysschemasIndex1Identifier=209
+SysconglomeratesIndex3Identifier=81
+SystablesIndex2Identifier=129
+SyscolumnsIndex1Identifier=161
+derby.serviceProtocol=org.apache.derby.database.Database
+SysschemasIdentifier=192
+derby.storage.propertiesId=16
+SysconglomeratesIndex2Identifier=65
+derby.serviceLocale=en_US
+SystablesIdentifier=96
+SystablesIndex1Identifier=113
diff --git a/das-java/trunk/samples/company-webapp/pom.xml b/das-java/trunk/samples/company-webapp/pom.xml
new file mode 100644
index 0000000000..5cab332043
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/pom.xml
@@ -0,0 +1,89 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-samples</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>tuscany-das-sample-company-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Tuscany DAS Company Sample</name>
+ <description>Sample use of RDB DAS in a Web application</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das-rdb</artifactId>
+ <version>${das.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-sample-dbconfig</artifactId>
+ <version>${das.version}</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- this will place the java source files inside the war -->
+ <build>
+ <finalName>sample-company-webapp</finalName>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ </build>
+</project>
diff --git a/das-java/trunk/samples/company-webapp/readme.htm b/das-java/trunk/samples/company-webapp/readme.htm
new file mode 100644
index 0000000000..f632162b2a
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/readme.htm
@@ -0,0 +1,201 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+ 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.
+ -->
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Tuscany DAS Sample - Company webapp</title>
+
+<style>
+.code {font-size: 11px; color: #006699}
+.codebox {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px}
+.codebox2 {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px; width:85%}
+.codeboxW {border: 1px solid #6699CC; background-color: #FFFFFF;padding:15px}
+.codeboxB {background-color: #C9DBED;padding:1px 10px 10px 10px}
+</style>
+
+</head>
+
+<body>
+
+<h1><center>DAS Company web application Sample</center></h1>
+
+<br>
+<br>
+
+<p>
+This stand-alone sample demonstrates the SDO RDB Data Access Service in the context of a simple web application<br>
+<p>
+<p>
+The application starts with a database of Companies and their related Departments.Through the web page interface, a user can:<br>
+<br>
+
+<ol start=1 type=1>
+ <li>Display all Companies in the database</li>
+ <li>Display all Companies and related Departments</li>
+ <li>Add a new Department to a Company</li>
+ <li>Delete all Departments from a Company</li>
+ <li>Change the names of Departments in a Company</li>
+</ol>
+
+<p>This simple application covers all CRUD operations as well as some relationship manipulation (adding a Department associates that
+Department with the Company).The sample runs on Tomcat 6.0 and employs a Derby database (default) accessed via a DataSource.</p>
+
+<h2>Running the sample</h2>
+
+<p>There are two options for running this sample:</p>
+
+<ol start=1 type=1>
+ <li>Run from Tomcat configured by the build</li>
+ <li>Deploying the Company-webapp WAR into a Tomcat you configure yourself</li>
+</ol>
+
+<h3>Running from Tomcat configured by the build</h3>
+
+<p>
+You need to download the Tuscany RDB DAS source distribution and run maven build to use this option.
+When you build using maven from the source root {SRC_ROOT} directory, the sample war file is created
+under {SRC_ROOT}/samples/company-webapp/target. This sample application is deployed to an instance
+of Tomcat as part of our automated sample testing. For this, follow readme.htm instructions from
+{SRC_ROOT}/samples/testing/tomcat. This will in-effect run the htmlunit tests on the sample.
+The sample deployed on Tomcat instance will be ready this way and you can just point your browser
+to <a href="http://localhost:8080/sample-company-webapp/">http://localhost:8080/sample-company-webapp/</a>
+to test further.
+</p>
+
+<h3>Deploying the Company-webapp WAR into a Tomcat you configured yourself</h3>
+
+<p>
+Alternatively, you can deploy the sample to your own configured Tomcat installation by following
+the instructions below.These instructions assume that you have either 1) downloaded the Tuscany
+binary distribution or 2) Downloaded the Tuscany source and run maven build.See the following
+link for more details steps on how to build DAS Sample applications <a
+href="http://incubator.apache.org/tuscany/das-java-developer-guide.html">
+http://incubator.apache.org/tuscany/das-java-developer-guide.html</a>.
+</p>
+
+<b>Set Up - Derby</b>
+
+<ul>
+ <li>Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi</li>
+ <li>Download the most recent official release of Derby from here: http://db.apache.org/derby/index.html. The only file you'll need from this download is derby(version).jar</li>
+ <li>Stop Tomcat</li>
+ <li>Copy derby(version).jar (from the derby distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. derby-10.2.2.0.jar.</li>
+ <li>Add the sample war file to {Tomcat_Home}/webapps
+ <ul>
+ <li>sample-company-webapp.war</li>
+ </ul>
+ </li>
+ <li>Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml.
+ <ul>
+ <li>Find the end-of-section marker </GlobalNamingResources> and add the following lines just above it:</li>
+ </ul>
+
+ <pre STYLE="{font-style:italic}">
+ &lt;!-- Global Datasource for Derby dastest database --&gt;
+ &lt;Resource name="jdbc/dastest"
+ type="javax.sql.DataSource" auth="Container"
+ description="Derby database for DAS Company sample"
+ maxActive="100" maxIdle="30" maxWait="10000"
+ username="" password=""
+ driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
+ url="jdbc:derby:{absolute path}Databases/dastest;create=true"/&gt;
+ </pre>
+
+ <b>Requirement:</b> You must include the absolute path to the <i>Databases</i> directory in the above url attribute. <br/>
+ Fore example: &lt;url="jdbc:derby:c:\apache-tomcat-6.0.13\Databases/ajaxdastest;create=true"/&gt;
+ <br><br>
+ As the new utility, dbConfig is embedded in this sample war, the Derby database "dastest" will get
+ created with required tables and data when the web application gets loaded for the first time in tomcat.
+ <br><br>
+ </li>
+ <li>Start tomcat and point your browser to: <a href="http://localhost:8080/sample-company-webapp/">http://localhost:8080/sample-company-webapp/</a></li>
+</ul>
+
+
+<b>Set Up - MySQL</b>
+
+<ul>
+ <li>Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi</li>
+ <li>Download the most recent official release of MySQL driver, e.g. mysql-connector-java-5.0.4.jar</li>
+ <li>Stop Tomcat</li>
+ <li>Copy mysql(version).jar (from the MySQL distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. mysql-connector-java-5.0.4.jar.</li>
+ <li>Add the sample war file to {Tomcat_Home}/webapps
+ <ul>
+ <li>sample-company-webapp.war</li>
+ </ul>
+ </li>
+ <li>Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml.
+ <ul>
+ <li>Find the end-of-section marker </GlobalNamingResources> and add the following lines just above it:</li>
+ </ul>
+
+ <pre STYLE="{font-style:italic}">
+ &lt;!-- Global Datasource for MySQL dastest database --&gt;
+ &lt;Resource name="jdbc/dastest"
+ type="javax.sql.DataSource" auth="Container"
+ description="MySQL database for DAS Company sample"
+ maxActive="100" maxIdle="30" maxWait="10000"
+ username="dastest" password="dastest"
+ driverClassName="com.mysql.jdbc.Driver"
+ url="jdbc:mysql://localhost/dastest?createDatabaseIfNotExist=true"/&gt;
+ </pre>
+
+ <b>Requirement:</b>MySQL service should be up with configured port open for TCPIP communication.<br/>
+ <br><br>
+ As the new utility, dbConfig is embedded in this sample war, the MySQL database "dastest" will get created with
+ required tables and data when the web application gets loaded for the first time in tomcat. Please note that,
+ in the binary distribution, WEB-INF/classes/CompanyWebDBConfig.xml has SQL Table creation syntax for Derby.
+ To make it compatible to MySQL, simply replace GENERATED ALWAYS AS IDENTITY with AUTO_INCREMENT for all
+ table creation statements. (For this unjar the .war, change CompanyWebDBConfig.xml and jar the .war
+ back with changed CompanyWebDBConfig.xml)
+ <br>
+ <br>
+ </li>
+ <li>Start tomcat and point your browser to: <a href="http://localhost:8080/sample-advanced-webapp/">http://localhost:8080/sample-advanced-webapp/</a></li>
+</ul>
+
+
+<h2>Sample Architecture</h2>
+
+<p>
+This is a simple, single-page, web application.The main components of this application are:
+</p>
+
+<ul type=disc>
+ <li>The RDB Data Access Service (DAS)</li>
+ <li>SDO</li>
+ <li>CompanyClient.java</li>
+ <li>Company.jsp</li>
+</ul>
+
+<p>The <b>CompanyClient</b> uses the <b>DAS</b> directly and provides high-level services to the jsp such as:</p>
+<p style='margin-left:.5in'>public final List getCompanies()</p>
+
+<p>This is a good place to look for how you might use the DAS in your own application.</p>
+
+<p>The <b>Company.jsp</b> responds to client interaction by invoking services of the CompanyClient.It receives data
+from the CompanyClient as SDO data graphs and manipulates SDOs directly to display data.</p>
+
+<p>The <b>DAS</b> accepts directives (commands) from the <b>CompanyClient</b> and reads and writes to the derby
+database instance appropriately.</p>
+
+</body>
+
+</html>
diff --git a/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java b/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java
new file mode 100644
index 0000000000..d0519ecc08
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java
@@ -0,0 +1,151 @@
+/*
+ * 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.companyweb;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+
+import commonj.sdo.DataObject;
+
+public class CompanyClient {
+
+ private Random generator = new Random();
+
+ private DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"));
+
+ public final List getCompanies() {
+
+ Command read = das.getCommand("all companies");
+ DataObject root = read.executeQuery();
+ return root.getList("COMPANY");
+
+ }
+
+ public final List getCompaniesWithDepartments() {
+
+ Command read = das.getCommand("all companies and departments");
+ DataObject root = read.executeQuery();
+ return root.getList("COMPANY");
+ }
+
+ public final List getDepartmentsForCompany(int id) {
+ Command read = das.getCommand("all departments for company");
+ read.setParameter(1, new Integer(id));
+ DataObject root = read.executeQuery();
+ return root.getList("COMPANY");
+ }
+
+ public final void addDepartmentToFirstCompany() {
+ Command read = das.getCommand("all companies and departments");
+ DataObject root = read.executeQuery();
+ DataObject firstCustomer = root.getDataObject("COMPANY[1]");
+
+ DataObject newDepartment = root.createDataObject("DEPARTMENT");
+ newDepartment.setString("NAME", "Default Name");
+ firstCustomer.getList("departments").add(newDepartment);
+
+ das.applyChanges(root);
+
+ }
+
+ public final void deleteDepartmentsFromFirstCompany() {
+
+ // This section gets the ID of the first Company just so I can
+ // demonstrate a parameterized command next
+ Command readAll = das.getCommand("all companies and departments");
+ DataObject root = readAll.executeQuery();
+ int idOfFirstCustomer = root.getInt("COMPANY[1]/ID");
+ System.out.println("ID of first company is: " + idOfFirstCustomer);
+
+ // Read a specific company based on the known ID
+ Command readCust = das.getCommand("company by id with departments");
+ readCust.setParameter(1, new Integer(idOfFirstCustomer));
+ root = readCust.executeQuery();
+
+ // Delete all the comany's departments from the graph
+ DataObject firstCustomer = root.getDataObject("COMPANY[1]");
+
+ // Shallow copy of list for deleting. This is required to avoid the
+ // dreaded
+ // ConcurrentModificationException since #delete operation also removes
+ // from the original list
+ List allDepartments = new ArrayList(firstCustomer.getList("departments"));
+
+ Iterator i = allDepartments.iterator();
+ DataObject department;
+ while (i.hasNext()) {
+ department = (DataObject) i.next();
+ System.out.println("Deleting department named: " + department.getString("NAME"));
+ department.delete();
+ }
+
+ das.applyChanges(root);
+
+ }
+
+ public final void changeFirstCompanysDepartmentNames() {
+
+ // This section gets the ID of the first Company just so I can
+ // demonstrate a parameterized command next
+ Command readAll = das.getCommand("all companies and departments");
+ DataObject root = readAll.executeQuery();
+ int idOfFirstCustomer = root.getInt("COMPANY[1]/ID");
+ System.out.println("ID of first company is: " + idOfFirstCustomer);
+
+ // Read a specific company based on the known ID
+ Command readCust = das.getCommand("company by id with departments");
+ readCust.setParameter(1, new Integer(idOfFirstCustomer));
+ root = readCust.executeQuery();
+
+ // Modify all the comany's department names
+ DataObject firstCustomer = root.getDataObject("COMPANY[1]");
+ Iterator i = firstCustomer.getList("departments").iterator();
+ DataObject department;
+ while (i.hasNext()) {
+ department = (DataObject) i.next();
+ System.out.println("Modifying department: " + department.getString("NAME"));
+ department.setString("NAME", getRandomDepartmentName());
+ }
+ das.applyChanges(root);
+
+ }
+
+
+ public void releaseResources() {
+ das.releaseResources();
+ }
+
+ // Utilities
+
+ private String getRandomDepartmentName() {
+ int number = generator.nextInt(1000) + 1;
+ return "Dept-" + number;
+ }
+
+ private InputStream getConfig(String fileName) {
+ return getClass().getClassLoader().getResourceAsStream(fileName);
+ }
+
+}
diff --git a/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java b/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java
new file mode 100644
index 0000000000..edd62e6f30
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java
@@ -0,0 +1,70 @@
+/*
+ * 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.companyweb;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.das.rdb.dbconfig.DBInitializer;
+
+public class CompanyDBInit extends HttpServlet {
+ private static final long serialVersionUID = -4795999792460944805L;
+ private static final String dbConfigFile = "CompanyWebDBConfig.xml";
+
+ public void init() throws ServletException {
+ try {
+ DBInitializer dbInitializer;
+ dbInitializer = new DBInitializer(getConfig(dbConfigFile));
+ if (! dbInitializer.isDatabaseReady()) {
+ dbInitializer.initializeDatabase(true);
+ }
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ log(e.toString(), e);
+ throw new ServletException(e);
+ }
+ }
+
+ /*
+ * (non-Java-doc)
+ *
+ * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, HttpServletResponse arg1)
+ */
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ response.setContentType("text/html");
+
+ PrintWriter out = response.getWriter();
+
+ out.println();
+ out.println("<center><h2>CompanyWeb database initialization servlet !<h2></center>");
+ out.println();
+ }
+
+ private InputStream getConfig(String fileName) {
+ return getClass().getClassLoader().getResourceAsStream(fileName);
+ }
+
+}
diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/CompanyConfig.xml b/das-java/trunk/samples/company-webapp/src/main/resources/CompanyConfig.xml
new file mode 100644
index 0000000000..a674724323
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/resources/CompanyConfig.xml
@@ -0,0 +1,46 @@
+<?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 xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
+
+ <ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/>
+
+ <Command name="all companies" SQL="select * from COMPANY" kind="Select"/>
+
+ <Command name="all companies and departments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID" kind="Select"/>
+
+ <Command name="all departments for company" SQL="select * from COMPANY inner join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID where COMPANY.ID = ?" kind="Select"/>
+
+ <Command name="company by id with departments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID where COMPANY.ID = ?" kind="Select"/>
+
+
+ <Table tableName="COMPANY">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ </Table>
+
+ <Table tableName="DEPARTMENT">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ </Table>
+
+ <Relationship name="departments" primaryKeyTable="COMPANY" foreignKeyTable="DEPARTMENT" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="COMPANYID"/>
+ </Relationship>
+
+
+</Config>
diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml b/das-java/trunk/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml
new file mode 100644
index 0000000000..c064045fd5
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml
@@ -0,0 +1,51 @@
+<?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">
+
+ <!--ConnectionInfo>
+ <ConnectionProperties
+ driverClass="org.apache.derby.jdbc.EmbeddedDriver"
+ databaseURL="jdbc:derby:../Databases/dastest; create = true"
+ loginTimeout="600000"/>
+ </ConnectionInfo-->
+ <ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/>
+
+ <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>
+ <row>'Default Name 2', '', '', 1</row>
+ <row>'Default Name 3', '', '', 1</row>
+ <row>'Default Name 4', '', '', 1</row>
+ <row>'Default Name 5', '', '', 1</row>
+ <row>'Default Name 6', '', '', 1</row>
+ <row>'Default Name 7', '', '', 1</row>
+ <row>'Default Name 8', '', '', 1</row>
+ </Table>
+ <Table name="EMPLOYEE" SQLCreate="CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,NAME VARCHAR(30),SN VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)">
+ <row>'John Jones','E0001',0,1</row>
+ <row>'Mary Smith','E0002',1,null</row>
+ <row>'Jane Doe','E0003',0,1</row>
+ <row>'Al Smith','E0004',1,1</row>
+ </Table>
+</DBConfig>
diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000000..9597d92eb3
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,353 @@
+
+ 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.
+
+===============================================================================================================
+
+Other components and dependencies under Apache Software License 2.0 :
+
+ log4j-1.2.14.jar - Apache Logging Services
+ derby 10.2.2.0.jar - Apache Derby
+ stax-api-1.0.1.jar - The Streaming API for XML (StAX)
+ wstx-asl-3.2.0.jar - WoodStox StAX implementation
+ standard-1.1.1.jar - The Apache Jackarta Taglibs
+ jstl-1.1.2.jar - The Apache Jackarta Taglibs
+ *.tld - The Apache Jackarta Taglibs
+
+===============================================================================================================
+
+
+Apache Tuscany SDO for Java Subcomponents
+=========================================:
+
+The Tuscany SDO for Java release includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar)
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+
+For the Eclipse EMF components
+(codegen-2.2.3.jar
+codegen-ecore-2.2.3.jar
+common-2.2.3.jar
+ecore-2.2.3.jar
+ecore-change-2.2.3.jar
+ecore-xmi-2.2.3.jar
+xsd-2.2.3.jar)
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED 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. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+===================================================================================================
diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..e9d98fc7f5
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,32 @@
+Apache Tuscany SDO for Java
+Copyright 2006, 2007 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other successful
+ASF projects. While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be fully endorsed
+by the ASF.
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE.txt file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+The terms and conditions governing the distribution may refer to the AL or other license
+agreements, notices or terms and conditions. Some of these other license agreements may
+include (but are not limited to):
+
+ . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html)
+
+It is your obligation to read and accept all such terms and conditions prior to use of the
+distribution. If term or condition is provided, please contact the Apache Software Foundation
+to determine what terms and conditions govern that particular distribution.
+
+This product also includes software developed by the Open Service Oriented Architecture organisation
+(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this
+distribution.
diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/README b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/README
new file mode 100644
index 0000000000..107de8c3ca
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/README
@@ -0,0 +1,35 @@
+Apache Tuscany M2 build (October, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/log4j.properties b/das-java/trunk/samples/company-webapp/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..ab4ebbb785
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/resources/log4j.properties
@@ -0,0 +1,36 @@
+# 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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, NULL
+
+# NULL Appender
+log4j.appender.NULL=org.apache.log4j.varia.NullAppender
+
+log4j.appender.NULL.layout=org.apache.log4j.PatternLayout
+log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n
+
+# CONSOLE is set to be a ConsoleAppender.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n
+
+
+# Print only messages of level WARN or above in the package com.foo.
+log4j.logger.org.apache.tuscany=NONE \ No newline at end of file
diff --git a/das-java/trunk/samples/company-webapp/src/main/webapp/Company.jsp b/das-java/trunk/samples/company-webapp/src/main/webapp/Company.jsp
new file mode 100644
index 0000000000..9b74f0a357
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/webapp/Company.jsp
@@ -0,0 +1,155 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ 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.
+ -->
+<html>
+<head>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"
+ import="commonj.sdo.*"
+
+ import="org.apache.tuscany.samples.das.companyweb.CompanyClient"
+%>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Company Test</title>
+</head>
+<body>
+
+<H2>Tuscany DAS Companies WEB Example</H2>
+
+
+<form>
+<input type="submit" id="doFill" name="doFill" value="All Companies">
+<input type="submit" id="doFillAll" name="doFillAll" value="All Companies/Departments">
+<input type="submit" id="doAddDepartment" name="doAddDepartment" value="Add department to first company">
+<input type="submit" id="doChangeDepartmentNames" name="doChangeDepartmentNames" value="Change Company(1) Dept names">
+<input type="submit" id="doDeleteDepartments" name="doDeleteDepartments" value="Delete Company(1) Depts">
+<hr>
+
+<!-- Do Fill -->
+<%if(request.getParameter("doFill") != null){%>
+
+<table border>
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Name</th>
+ </tr>
+ </thead>
+ <tbody>
+
+ <%
+ CompanyClient companyClient = new CompanyClient();
+ java.util.Iterator i = companyClient.getCompaniesWithDepartments().iterator();
+ while (i.hasNext()) {
+ DataObject company = (DataObject)i.next();
+ %>
+ <tr>
+ <td><%=company.getInt("ID")%></td>
+ <td><%=company.getString("NAME")%></td>
+ <tr>
+ <%
+ }
+ companyClient.releaseResources();
+ %>
+
+ </tbody>
+</table>
+<%}%>
+
+
+<!-- Do Add Department -->
+<%
+if(request.getParameter("doAddDepartment") != null){
+ CompanyClient companyClient = new CompanyClient();
+ companyClient.addDepartmentToFirstCompany();
+ companyClient.releaseResources();
+}
+%>
+
+<!-- Do Delete Departments from first company -->
+<%
+if(request.getParameter("doDeleteDepartments") != null){
+ CompanyClient companyClient = new CompanyClient();
+ companyClient.deleteDepartmentsFromFirstCompany();
+ companyClient.releaseResources();
+}
+%>
+
+<!-- Do Change First Company's Department Names -->
+<%
+if(request.getParameter("doChangeDepartmentNames") != null){
+ CompanyClient companyClient = new CompanyClient();
+ companyClient.changeFirstCompanysDepartmentNames();
+ companyClient.releaseResources();
+}
+%>
+
+
+<!-- Do FillAll -->
+<%if(request.getParameter("doFill") == null) {%>
+
+<table border>
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Name</th>
+ <th>Department_ID</th>
+ <th>Department_Name</th>
+ </tr>
+ </thead>
+ <tbody>
+
+ <%
+ CompanyClient companyClient = new CompanyClient();
+ java.util.Iterator i = companyClient.getCompaniesWithDepartments().iterator();
+ while (i.hasNext()) {
+ DataObject company = (DataObject)i.next();
+ %>
+ <tr>
+ <td><%=company.getInt("ID")%></td>
+ <td><%=company.getString("NAME")%></td>
+ <tr>
+
+
+
+ <%
+ java.util.Iterator j = company.getList("departments").iterator();
+ while (j.hasNext()) {
+ DataObject department = (DataObject)j.next();
+ %>
+ <tr>
+ <td></td><td></td><td><%=department.getInt("ID")%></td>
+ <td><%=department.getString("NAME")%></td>
+ <tr>
+ <%
+ }
+ %>
+ <%
+ }
+ companyClient.releaseResources();
+ %>
+
+ </tbody>
+</table>
+<%}%>
+
+
+
+</form>
+</body>
+</html>
diff --git a/das-java/trunk/samples/company-webapp/src/main/webapp/META-INF/context.xml b/das-java/trunk/samples/company-webapp/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000000..5f0af32dd5
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/webapp/META-INF/context.xml
@@ -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 Stand alone app" debug="5" reloadable="true" crossContext="true">
+
+ <Manager pathname=""/>
+ <ResourceLink name="jdbc/dastest" global="jdbc/dastest" type="javax.sql.DataSource" />
+
+</Context>
diff --git a/das-java/trunk/samples/company-webapp/src/main/webapp/WEB-INF/web.xml b/das-java/trunk/samples/company-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..a0abb6a655
--- /dev/null
+++ b/das-java/trunk/samples/company-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+ -->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+ <display-name>Tuscany DAS sample Company WEB</display-name>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>Company.jsp</welcome-file>
+ </welcome-file-list>
+
+ <!-- Initialize Company database -->
+ <servlet>
+ <servlet-name>CompanyDBInit</servlet-name>
+ <servlet-class>org.apache.tuscany.samples.das.companyweb.CompanyDBInit</servlet-class>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+</web-app>
diff --git a/das-java/trunk/samples/customer/build.xml b/das-java/trunk/samples/customer/build.xml
new file mode 100644
index 0000000000..94ce30e1ca
--- /dev/null
+++ b/das-java/trunk/samples/customer/build.xml
@@ -0,0 +1,38 @@
+<!--
+ * 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.
+-->
+<project name="customer" default="run">
+ <property name="test.class" value="org.apache.tuscany.samples.das.customer.CustomerClient" />
+ <property name="test.jar" value="sample-customer.jar" />
+
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="${classpath}"/>
+ <fileset dir="../../lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ <pathelement location="derby-10.2.2.0.jar"/>
+ <pathelement path="${test.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+</project>
diff --git a/das-java/trunk/samples/customer/pom.xml b/das-java/trunk/samples/customer/pom.xml
new file mode 100644
index 0000000000..f8665da523
--- /dev/null
+++ b/das-java/trunk/samples/customer/pom.xml
@@ -0,0 +1,92 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-samples</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>tuscany-das-sample-customer</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany DAS Customer Sample</name>
+ <description>Sample use of RDB DAS in a J2SE application</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das-rdb</artifactId>
+ <version>${das.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.2.2.0</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- this will place the java source files inside the jar -->
+ <build>
+ <finalName>sample-customer</finalName>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.samples.das.customer.CustomerClient</mainClass>
+ <addClasspath>true</addClasspath>
+ <!-- classpathPrefix>../../lib/</classpathPrefix -->
+ </manifest>
+
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/das-java/trunk/samples/customer/readme.htm b/das-java/trunk/samples/customer/readme.htm
new file mode 100644
index 0000000000..0c1f6f715d
--- /dev/null
+++ b/das-java/trunk/samples/customer/readme.htm
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+ 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.
+ -->
+
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Tuscany DAS Sample - Customer</title>
+
+<style>
+.code {font-size: 11px; color: #006699}
+.codebox {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px}
+.codebox2 {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px; width:85%}
+.codeboxW {border: 1px solid #6699CC; background-color: #FFFFFF;padding:15px}
+.codeboxB {background-color: #C9DBED;padding:1px 10px 10px 10px}
+</style>
+
+</head>
+
+<h1><center>Customer J2SE sample application</center></h1>
+
+<br>
+
+<p>
+This stand-alone sample demonstrates the RDB Data Access Service in the context of a simple java application.
+</p>
+
+<br>
+
+<h2>Building and Running</h2>
+
+<ul>
+ <li>Apache Ant latest version installed.
+ <ul>
+ <li>Download Apache Ant latest version on and extract into folder &lt;apache_ant_folder&gt;. You can find it here: <a href="http://ant.apache.org/bindownload.cgi">http://ant.apache.org/bindownload.cgi</a>.</li>
+ <li>Add &lt;apache_ant_folder&gt;/bin directory to your OS path variable.</p></li>
+ </ul>
+ </li>
+
+ <li>On console change the actual directory to &lt;tuscany_das_java_distribution&gt;/samples/customer/ and execute ant application:
+ <ul>
+ <li>&lt;tuscany_das_java_distribution&gt;/samples/customer/&gt; ant</li>
+ </ul>
+ </li>
+</ul>
+
+<p>
+The sample will run and output the following:
+</p>
+
+<p>
+<pre style="code">
+Buildfile: build.xml
+
+run:
+ [java] ************* Initializing database *************
+ [java] ** DB type : derby
+ [java] ** Database : jdbc:derby:target/dastest; create = true
+ [java] ** User :
+ [java] ** Password :
+ [java] ************************************************
+ [java] Setting up for derby run!
+ [java] Dropping tables
+ [java] Dropping procedures
+ [java] Creating tables
+ [java] Creating procedures
+ [java] Inserting data in tables
+ [java] Database setup complete!
+ [java]
+ [java] Result:select all customers
+ [java] ID:1 LASTNAME:John ADDRESS:USA
+ [java] ID:2 LASTNAME:Amita ADDRESS:INDIA
+ [java] ID:3 LASTNAME:Patrick ADDRESS:UK
+ [java] ID:4 LASTNAME:Jane ADDRESS:UN
+ [java]
+ [java] Result:insert new customer
+ [java] ID:1 LASTNAME:John ADDRESS:USA
+ [java] ID:2 LASTNAME:Amita ADDRESS:INDIA
+ [java] ID:3 LASTNAME:Patrick ADDRESS:UK
+ [java] ID:4 LASTNAME:Jane ADDRESS:UN
+ [java] ID:5 LASTNAME:Jenny ADDRESS:USA
+ [java]
+ [java] Result:update first customer
+ [java] ID:1 LASTNAME:BlueBerry ADDRESS:USA
+ [java] ID:2 LASTNAME:Amita ADDRESS:INDIA
+ [java] ID:3 LASTNAME:Patrick ADDRESS:UK
+ [java] ID:4 LASTNAME:Jane ADDRESS:UN
+ [java] ID:5 LASTNAME:Jenny ADDRESS:USA
+ [java]
+ [java] Result:delete last customer
+ [java] Deleting customer named: Jenny
+ [java] ID:1 LASTNAME:BlueBerry ADDRESS:USA
+ [java] ID:2 LASTNAME:Amita ADDRESS:INDIA
+ [java] ID:3 LASTNAME:Patrick ADDRESS:UK
+ [java] ID:4 LASTNAME:Jane ADDRESS:UN
+
+BUILD SUCCESSFUL
+</pre>
+</p>
+
+<br>
+
+<p>
+<b>Observation:</b>The build.xml ant file only works on DAS Java binary distribution.
+</p>
+
+
+
+<h2>Running Sample with MySQL</h2>
+<br>
+<p>
+The sample is pre-configured to run using an embedded Derby database.Follow below instructions to run the sample on another database (e.g MySQL).<br>
+</p>
+
+<ul>
+ <li>Expand sample-customer.jar under <tuscany_das_java_distribution>/samples/customer to access CustomersConfig.xml</li>
+ <li>Change CustomersConfig.xml - comment Derby connection info and uncomment MySQL connection info. Check for correct userName, password, and other configuration information </li>
+ <li>Change <tuscany_das_java_distribution>/samples/customer /build.xml to replace pathelement location from Derby jar to MySQL jar like -
+ <ul>
+ <li>&lt;pathelement location="mysql-connector-java-5.0.4.jar"/&gt;</li>
+ </ul>
+ </li>
+ <li>Create new sample-customer.jar to use the changed CustomersConfig.xml , replacing the one from binary distribution under <tuscany_das_java_distribution>/samples/customer.</li>
+ <li>Place required mysql jar (e.g. mysql-connector-java-5.0.4.jar) under <tuscany_das_java_distribution>/samples/customer.</li>
+ <li>From command prompt run the sample application using ant -
+ <ul>
+ <li>&lt;tuscany_das_java_distribution>/samples/customer/&gt; ant</li>
+ </ul>
+ </li>
+ </ul>
+
+<p>
+<b>Observations:</b>
+<ul>
+ <li>These instructions apply only for DAS Java binary distribution.</li>
+ <li>MySQL Database will be created and populated with necessary structure and data if not present</li>
+</ul>
+
+</BODY>
+</HTML> \ No newline at end of file
diff --git a/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java
new file mode 100644
index 0000000000..ca66c5bf4f
--- /dev/null
+++ b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java
@@ -0,0 +1,197 @@
+/*
+ * 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.customer;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+
+import commonj.sdo.DataObject;
+
+public class CustomerClient {
+ private static final String DEFAULT_CUSTOMER_CONFIG = "CustomersConfig.xml";
+
+ private DAS das = null;
+ private final String configFile;
+
+ /**
+ * Default constructor
+ *
+ */
+ public CustomerClient(){
+ this.configFile = DEFAULT_CUSTOMER_CONFIG;
+ }
+
+ /**
+ * Constructor receiving the das config file to be used
+ * @param configFile DAS configuration file
+ */
+ public CustomerClient(String configFile) {
+ this.configFile = configFile;
+ }
+
+ /**
+ * Helper method to get a stream from the customer config file
+ * @param fileName
+ * @return
+ */
+ protected InputStream getConfig(String fileName) {
+ return getClass().getClassLoader().getResourceAsStream(fileName);
+ }
+
+ /**
+ * Get a reference to DAS, initialize it if necessary
+ * @return DAS reference
+ */
+ protected DAS getDAS() {
+ if (this.das == null ) {
+ this.das = DAS.FACTORY.createDAS(getConfig(this.configFile));
+ }
+ return this.das;
+ }
+
+
+ /**
+ * select
+ * @return
+ */
+ public final List getCustomers() {
+ Command read = this.getDAS().getCommand("AllCustomers");
+ DataObject root = read.executeQuery();
+ return root.getList("CUSTOMER");
+ }
+
+ /**
+ * insert
+ *
+ */
+ public final void addCustomer() {
+ Command read = this.getDAS().getCommand("AllCustomers");
+ DataObject root = read.executeQuery();
+
+ DataObject newCustomer = root.createDataObject("CUSTOMER");
+ newCustomer.setInt("ID", 5);
+ newCustomer.setString("LASTNAME", "Jenny");
+ newCustomer.setString("ADDRESS", "USA");
+
+ das.applyChanges(root);
+ }
+
+ /**
+ * delete
+ *
+ */
+ public final void deleteCustomer() {
+ Command readAll = this.getDAS().getCommand("AllCustomers");
+ DataObject root = readAll.executeQuery();
+
+ List allCustomers = root.getList("CUSTOMER");
+
+ DataObject lastCustomer = (DataObject)allCustomers.get(allCustomers.size()-1);
+ if(lastCustomer != null){
+ System.out.println("Deleting customer named: " + lastCustomer.getString("LASTNAME"));
+ lastCustomer.delete();
+ }
+
+ das.applyChanges(root);
+ }
+
+ /**
+ * update
+ *
+ */
+ public final void changeFirstCustomerName() {
+ Command readAll = this.getDAS().getCommand("AllCustomers");
+ DataObject root = readAll.executeQuery();
+
+ DataObject firstCustomer = root.getDataObject("CUSTOMER[1]");
+ firstCustomer.set("LASTNAME", "BlueBerry");
+
+ das.applyChanges(root);
+ }
+
+ /**
+ * display result
+ * @param customers
+ */
+ public static void printList(List customers){
+ for(int i=0; i<customers.size(); i++){
+ System.out.println(" ID:"+(((DataObject)customers.get(i)).getInt("ID"))+
+ " LASTNAME:"+(((DataObject)customers.get(i)).getString("LASTNAME"))+
+ " ADDRESS:"+(((DataObject)customers.get(i)).getString("ADDRESS")));
+ }
+ }
+
+ /**
+ * cleanup
+ *
+ */
+ public void releaseResources() {
+ das.releaseResources();
+ }
+
+ /**
+ * Main customer application
+ */
+ public static void main(String[] args){
+ String customerConfigFile = "CustomersConfig.xml"; //this can be from input params too as below
+
+ if(args != null && args.length >0){
+ customerConfigFile = args[0];
+ }
+
+
+ //initialize customer database using helper class
+ CustomerDatabaseInitializer dbInitializer = new CustomerDatabaseInitializer(customerConfigFile);
+ try {
+ dbInitializer.Initialize();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return;
+ }
+
+
+ //perform customer operations using DAS
+ CustomerClient customerClient = new CustomerClient(customerConfigFile);
+ //test select
+ System.out.println();
+ System.out.println("Result:select all customers");
+ printList(customerClient.getCustomers());
+
+ //test insert
+ System.out.println();
+ System.out.println("Result:insert new customer");
+ customerClient.addCustomer();
+ printList(customerClient.getCustomers());
+
+ //test update
+ System.out.println();
+ System.out.println("Result:update first customer");
+ customerClient.changeFirstCustomerName();
+ printList(customerClient.getCustomers());
+
+ //test delete
+ System.out.println();
+ System.out.println("Result:delete last customer");
+ customerClient.deleteCustomer();
+ printList(customerClient.getCustomers());
+ }
+} \ No newline at end of file
diff --git a/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java
new file mode 100644
index 0000000000..260fc330fd
--- /dev/null
+++ b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java
@@ -0,0 +1,92 @@
+/*
+ * 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.customer;
+
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.util.ConfigUtil;
+import org.apache.tuscany.samples.das.databaseSetup.DerbySetup;
+import org.apache.tuscany.samples.das.databaseSetup.MySQLSetup;
+
+public class CustomerDatabaseInitializer {
+ public static final String DERBY = "derby";
+ public static final String MYSQL = "mysql";
+
+ private final Config config;
+
+ private final String dbType;
+ private final String dbURL;
+ private final String user;
+ private final String password;
+
+
+
+ public CustomerDatabaseInitializer(String configFile) {
+ this.config = ConfigUtil.loadConfig(this.getClass().getClassLoader().getResourceAsStream(configFile));
+
+ if(config.getConnectionInfo().getConnectionProperties().getDriverClass().indexOf(DERBY) != -1) {
+ dbType = DERBY;
+ } else if(config.getConnectionInfo().getConnectionProperties().getDriverClass().indexOf(MYSQL) != -1) {
+ dbType = MYSQL;
+ } else {
+ dbType = null;
+ }
+
+ //get connection info from config
+ dbURL = config.getConnectionInfo().getConnectionProperties().getDatabaseURL();
+ user = config.getConnectionInfo().getConnectionProperties().getUserName();
+ password = config.getConnectionInfo().getConnectionProperties().getPassword();
+ }
+
+
+
+ /**
+ * If database is present connect to it and create necessary tables, procedures, data etc.
+ * If database is not present create database and then create the above elements. Create database
+ * is implemented for MySQL and Derby.
+ */
+ public void Initialize() {
+
+ //display DB configuration iformation
+ DisplayDatabaseConfiguration();
+
+ //initialize DB
+ try {
+ if(dbType.equals(DERBY)){
+ new DerbySetup(dbURL+"-"+user+"-"+password);
+ }
+
+ if(dbType.equals(MYSQL)){
+ new MySQLSetup(dbURL+"-"+user+"-"+password);
+ }
+
+ } catch(Exception e){
+ throw new RuntimeException("Error initializing database !", e);
+ }
+ }
+
+ public void DisplayDatabaseConfiguration() {
+
+ System.out.println("************* Initializing database *************");
+ System.out.println("** DB type : " + dbType );
+ System.out.println("** Database : " + dbURL );
+ System.out.println("** User : " + user );
+ System.out.println("** Password : " + password);
+ System.out.println("************************************************");
+ }
+}
diff --git a/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java
new file mode 100644
index 0000000000..4195dbcac7
--- /dev/null
+++ b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java
@@ -0,0 +1,206 @@
+/*
+ * 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.databaseSetup;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+public class DatabaseSetup{
+ protected Statement s;
+ protected String platformName = "Not initialized";
+ protected String driverName = "Not initialized";
+ protected String databaseURL = "Not initialized";
+ protected String databaseName = null;
+ protected String userName;
+ protected String password;
+
+ // Data Types
+ public static final String stringType = "VARCHAR";
+ public static final String integerType = "INT";
+ public static final String timestampType = "TIMESTAMP";
+ public static final String floatType = "FLOAT";
+ public static final String decimalType = "DECIMAL";
+ protected Connection connection;
+
+ //database types
+ public static final String DERBY = "derby";
+ public static final String MYSQL = "mysql";
+ public static final String DB2 = "db2";
+
+ public DatabaseSetup(String databaseInfo){
+ StringTokenizer strTok = new StringTokenizer(databaseInfo, "-");
+
+ if(strTok.hasMoreTokens()){
+ databaseName = strTok.nextToken();
+ }
+
+ if(strTok.hasMoreTokens()){
+ userName = strTok.nextToken();
+ }
+
+ if(strTok.hasMoreTokens()){
+ password = strTok.nextToken();
+ }
+
+ initConnectionProtocol(databaseName);
+ initConnection();
+ try{
+ this.setUp();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ protected void initConnectionProtocol( String databaseName){
+ }
+
+ private void initConnection() {
+
+ try {
+ Class.forName(driverName).newInstance();
+ Properties props = new Properties();
+ //System.out.println("platform name:"+this.platformName);
+
+ if(this.platformName.equals(DERBY)){
+ if (userName != null) {
+ //System.out.println("derby trying for "+userName+","+password+","+databaseURL);
+ connection = DriverManager.getConnection(databaseURL, userName, password);
+ } else {
+ //System.out.println("derby trying for "+databaseURL);
+ connection = DriverManager.getConnection(databaseURL);
+ }
+ }
+ if(this.platformName.equals(DB2)){
+ if (userName != null && password != null) {
+ props.put("user", userName);
+ props.put("password", password);
+
+ //System.out.println("db2 trying for "+databaseURL+"user,pwd"+userName+","+password);
+ connection = DriverManager.getConnection(databaseURL, props);
+ }else{
+ //System.out.println("db2 trying for "+databaseURL);
+ connection = DriverManager.getConnection(databaseURL);
+ }
+ }
+ if(this.platformName.equals(MYSQL)){
+ databaseURL=databaseURL+"?user="+userName+"&password="+password+"&createDatabaseIfNotExist="+"true";
+ //System.out.println("mysql trying for "+userName+","+password+","+databaseURL);
+ connection = DriverManager.getConnection(databaseURL, props);
+ }
+
+ connection.setAutoCommit(true);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ if (e.getNextException() != null) {
+ e.getNextException().printStackTrace();
+ } else {
+ e.printStackTrace();
+ }
+
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Connection getConnection(){
+ return this.connection;
+ }
+
+ protected void setUp() throws Exception {
+ System.out.println("Setting up for " + platformName + " run!");
+ }
+
+ private void insertData(){
+ }
+
+ private void dropTables() {
+ }
+
+ protected void dropTriggers() {
+ }
+
+ protected void createTriggers() {
+ }
+
+ protected void dropSequences() {
+ }
+
+ protected void createSequences() {
+ }
+
+ protected void dropProcedures() {
+ }
+
+ private void createTables() {
+ }
+
+ protected void createProcedures() {
+ }
+
+ //
+ // This section povides methods that return strings for table creation.
+ // Platform-specific sublcasses
+ // can override these as necessary
+ //
+
+ protected String getCreateCustomer() {
+ return null;
+ }
+ // /////////////////
+
+ protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) {
+ return null;
+ }
+
+ protected String getStringColumn(String name, int length) {
+ return null;
+ }
+
+ protected String getIntegerColumn(String name) {
+ return null;
+ }
+
+ protected String getGeneratedKeyClause() {
+ return null;
+ }
+
+ protected String getDecimalColumn(String name, int size1, int size2) {
+ return null;
+ }
+
+ protected String getFloatColumn(String name) {
+ return null;
+ }
+
+ protected String getTimestampColumn(String name) {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java
new file mode 100644
index 0000000000..339cac3587
--- /dev/null
+++ b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java
@@ -0,0 +1,209 @@
+/*
+ * 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.databaseSetup;
+
+import java.sql.SQLException;
+
+public class DerbySetup extends DatabaseSetup {
+
+ public DerbySetup(String databaseInfo){
+ super(databaseInfo);
+ }
+
+ protected void initConnectionProtocol(String databaseURL){
+ this.platformName=DERBY;
+ this.driverName = "org.apache.derby.jdbc.EmbeddedDriver";
+ this.databaseURL = databaseURL;
+ }
+
+ public void setUp(){
+ try{
+ super.setUp();
+
+ try {
+ s = connection.createStatement();
+
+ dropTriggers();
+ dropSequences();
+ dropTables();
+ dropProcedures();
+
+ createSequences();
+ createTables();
+ createTriggers();
+ createProcedures();
+ connection.commit();
+
+ insertData();
+ connection.commit();
+ } catch (SQLException e) {
+ connection.rollback();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ System.out.println("Database setup complete!");
+ }
+
+ private void insertData(){
+ System.out.println("Inserting data in tables");
+
+ String[] statements = {"INSERT INTO CUSTOMER VALUES (1,'John','USA')",
+ "INSERT INTO CUSTOMER VALUES (2,'Amita','INDIA')",
+ "INSERT INTO CUSTOMER VALUES (3,'Patrick','UK')",
+ "INSERT INTO CUSTOMER VALUES (4,'Jane','UN')"};
+
+ for (int i = 0; i < statements.length; i++) {
+ try {
+ s.execute(statements[i]);
+ } catch (SQLException e) {
+ // If the table does not exist then ignore the exception on drop
+ if ((!(e.getMessage().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0))
+ && (!(e.getMessage().indexOf("42704") >= 0))) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ private void dropTables() {
+ System.out.println("Dropping tables");
+ String[] statements = {"DROP TABLE CUSTOMER" };
+
+ for (int i = 0; i < statements.length; i++) {
+ try {
+ s.execute(statements[i]);
+ } catch (SQLException e) {
+ // If the table does not exist then ignore the exception on drop
+ if ((!(e.getMessage().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0))
+ && (!(e.getMessage().indexOf("42704") >= 0))) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ protected void dropTriggers() {
+
+ }
+
+ protected void createTriggers() {
+
+ }
+
+ protected void dropSequences() {
+
+ }
+
+ protected void createSequences() {
+
+ }
+
+ protected void dropProcedures() {
+
+ System.out.println("Dropping procedures");
+
+ String[] statements = {"DROP PROCEDURE GETNAMEDCUSTOMERS"};
+
+ for (int i = 0; i < statements.length; i++) {
+ try {
+ s.execute(statements[i]);
+ } catch (SQLException e) {
+ // If the proc does not exist then ignore the exception on drop
+ if (!(e.getMessage().indexOf("does not exist") >= 0) && !(e.getMessage().indexOf("42704") >= 0)) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ private void createTables() {
+ System.out.println("Creating tables");
+
+ try {
+ s.execute(getCreateCustomer());
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void createProcedures() {
+
+ System.out.println("Creating procedures");
+ try {
+
+ s.execute("CREATE PROCEDURE GETNAMEDCUSTOMERS(theName VARCHAR(100), OUT theCount INTEGER) "
+ + "PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME "
+ + "'org.apache.tuscany.samples.das.orders.MyStoredProcs.getNamedCustomers'");
+ } catch (SQLException e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+ //
+ // This section povides methods that return strings for table creation.
+ // Platform-specific sublcasses
+ // can override these as necessary
+ //
+
+ protected String getCreateCustomer() {
+ return "CREATE TABLE CUSTOMER (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, "
+ + getStringColumn("LASTNAME", 30)
+ + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")";
+ }
+
+ protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("CONSTRAINT FK1 FOREIGN KEY (");
+ buffer.append(foreignKey);
+ buffer.append(") REFERENCES ");
+ buffer.append(pkTable);
+ buffer.append("(");
+ buffer.append(pkColumn);
+ buffer.append(") ON DELETE NO ACTION ON UPDATE NO ACTION");
+ return buffer.toString();
+ }
+
+ protected String getStringColumn(String name, int length) {
+ return name + ' ' + stringType + "(" + new Integer(length).toString() + ")";
+ }
+
+ protected String getIntegerColumn(String name) {
+ return name + ' ' + integerType;
+ }
+
+ protected String getGeneratedKeyClause() {
+ return "GENERATED ALWAYS AS IDENTITY";
+ }
+
+ protected String getDecimalColumn(String name, int size1, int size2) {
+ return name + ' ' + decimalType + "(" + new Integer(size1).toString() + ','
+ + new Integer(size2).toString() + ")";
+ }
+
+ protected String getFloatColumn(String name) {
+ return name + ' ' + floatType;
+ }
+
+ protected String getTimestampColumn(String name) {
+ return name + ' ' + timestampType;
+ }
+}
diff --git a/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java
new file mode 100644
index 0000000000..f64b16e2db
--- /dev/null
+++ b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java
@@ -0,0 +1,211 @@
+/*
+ * 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.databaseSetup;
+
+import java.sql.SQLException;
+
+public class MySQLSetup extends DatabaseSetup {
+
+ public MySQLSetup(String databaseInfo){
+ super(databaseInfo);
+ }
+
+ protected void initConnectionProtocol(String databaseURL){
+ this.platformName=MYSQL;
+ this.driverName = "com.mysql.jdbc.Driver";
+ this.databaseURL = databaseURL;
+ }
+
+ public void setUp(){
+ try{
+ super.setUp();
+
+ try {
+ s = connection.createStatement();
+
+ dropTriggers();
+ dropSequences();
+ dropTables();
+ dropProcedures();
+
+ createSequences();
+ createTables();
+ createTriggers();
+ createProcedures();
+ insertData();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ System.out.println("Database setup complete!");
+ }
+
+ private void insertData(){
+ System.out.println("Inserting data in tables");
+
+ String[] statements = {"INSERT INTO CUSTOMER VALUES (1,'John','USA')",
+ "INSERT INTO CUSTOMER VALUES (2,'Amita','INDIA')",
+ "INSERT INTO CUSTOMER VALUES (3,'Patrick','UK')",
+ "INSERT INTO CUSTOMER VALUES (4,'Jane','UN')"};
+
+ for (int i = 0; i < statements.length; i++) {
+ try {
+ s.execute(statements[i]);
+ } catch (SQLException e) {
+ // If the table does not exist then ignore the exception on drop
+ if ((!(e.getMessage().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0))
+ && (!(e.getMessage().indexOf("42704") >= 0))) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ private void dropTables() {
+ System.out.println("Dropping tables");
+
+ String[] statements = {"DROP TABLE CUSTOMER"};
+
+ for (int i = 0; i < statements.length; i++) {
+ try {
+ s.execute(statements[i]);
+ } catch (SQLException e) {
+ // If the table does not exist then ignore the exception on drop
+ if ((!(e.getMessage().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0))
+ && (!(e.getMessage().indexOf("42704") >= 0))) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ protected void dropTriggers() {
+
+ }
+
+ protected void createTriggers() {
+
+ }
+
+ protected void dropSequences() {
+
+ }
+
+ protected void createSequences() {
+
+ }
+
+ protected void dropProcedures() {
+
+ System.out.println("Dropping procedures");
+
+ String[] statements = {"DROP PROCEDURE GETNAMEDCUSTOMERS"};
+
+ for (int i = 0; i < statements.length; i++) {
+ try {
+ s.execute(statements[i]);
+ } catch (SQLException e) {
+ // If the proc does not exist then ignore the exception on drop
+ if (!(e.getMessage().indexOf("does not exist") >= 0) && !(e.getMessage().indexOf("42704") >= 0)) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ private void createTables() {
+ System.out.println("Creating tables");
+
+ try {
+
+ s.execute(getCreateCustomer());
+
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ //
+ // This section povides methods that return strings for table creation.
+ // Platform-specific sublcasses
+ // can override these as necessary
+ //
+
+ protected String getCreateCustomer() {
+ return "CREATE TABLE CUSTOMER (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, "
+ + getStringColumn("LASTNAME", 30)
+ + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")";
+ }
+
+ // /////////////////
+
+ protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("CONSTRAINT FK1 FOREIGN KEY (");
+ buffer.append(foreignKey);
+ buffer.append(") REFERENCES ");
+ buffer.append(pkTable);
+ buffer.append("(");
+ buffer.append(pkColumn);
+ buffer.append(") ON DELETE NO ACTION ON UPDATE NO ACTION");
+ return buffer.toString();
+ }
+
+ protected String getStringColumn(String name, int length) {
+ return name + ' ' + stringType + "(" + new Integer(length).toString() + ")";
+ }
+
+ protected String getIntegerColumn(String name) {
+ return name + ' ' + integerType;
+ }
+
+ protected String getDecimalColumn(String name, int size1, int size2) {
+ return name + ' ' + decimalType + "(" + new Integer(size1).toString() + ','
+ + new Integer(size2).toString() + ")";
+ }
+
+ protected String getFloatColumn(String name) {
+ return name + ' ' + floatType;
+ }
+
+ protected String getTimestampColumn(String name) {
+ return name + ' ' + timestampType;
+ }
+
+ protected void createProcedures() {
+ String createGetNamedCustomers = "CREATE PROCEDURE `dastest`.`GETNAMEDCUSTOMERS`(IN thename VARCHAR(30), "
+ + "OUT theCount INTEGER ) " + " BEGIN "
+ + " SELECT * FROM CUSTOMER AS CUSTOMER WHERE LASTNAME = theName; "
+ + " SET theCount = (SELECT COUNT(*) FROM CUSTOMER WHERE LASTNAME = theName); " + " END ";
+
+ System.out.println("Creating procedures");
+ try {
+ s.execute(createGetNamedCustomers);
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected String getGeneratedKeyClause() {
+ return "AUTO_INCREMENT";
+ }
+}
diff --git a/das-java/trunk/samples/customer/src/main/resources/CustomersConfig.xml b/das-java/trunk/samples/customer/src/main/resources/CustomersConfig.xml
new file mode 100644
index 0000000000..41fa03ba2b
--- /dev/null
+++ b/das-java/trunk/samples/customer/src/main/resources/CustomersConfig.xml
@@ -0,0 +1,53 @@
+<?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">
+
+ <!--Uncomment below for derby test-->
+ <ConnectionInfo>
+ <ConnectionProperties
+ driverClass="org.apache.derby.jdbc.EmbeddedDriver"
+ databaseURL="jdbc:derby:target/dastest; create = true"
+ loginTimeout="600000"/>
+ </ConnectionInfo>
+
+ <!--Uncomment below for MySQL test-->
+ <!--
+ <ConnectionInfo>
+ <ConnectionProperties
+ driverClass="com.mysql.jdbc.Driver"
+ databaseURL="jdbc:mysql://localhost/dastest"
+ userName="dastest"
+ password="dastest"
+ loginTimeout="600000"/>
+ </ConnectionInfo>
+ -->
+
+ <Command name="AllCustomers" SQL="select * from CUSTOMER" kind="Select"/>
+
+ <Table tableName="CUSTOMER">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Command name="NamedCustomers" SQL="{call GETNAMEDCUSTOMERS(?,?)}" kind="procedure">
+ <Parameter direction="IN" index="1" columnType="commonj.sdo.String"/>
+ <Parameter direction="OUT" index="2" columnType="commonj.sdo.IntObject"/>
+ </Command>
+
+</Config>
diff --git a/das-java/trunk/samples/customer/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/customer/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000000..fb4df3722c
--- /dev/null
+++ b/das-java/trunk/samples/customer/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,353 @@
+
+ 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.
+
+===============================================================================================================
+
+Other components and dependencies under Apache Software License 2.0 :
+
+ log4j-1.2.14.jar - Apache Logging Services
+ derby 10.2.2.0.jar - Apache Derby
+ stax-api-1.0.1.jar - The Streaming API for XML (StAX)
+ wstx-asl-3.2.0.jar - WoodStox StAX implementation
+ standard-1.1.1.jar - The Apache Jackarta Taglibs
+ jstl-1.1.2.jar - The Apache Jackarta Taglibs
+ *.tld - The Apache Jackarta Taglibs
+
+===============================================================================================================
+
+
+Apache Tuscany SDO for Java Subcomponents
+=========================================:
+
+The Tuscany SDO for Java release includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar)
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+
+For the Eclipse EMF components
+(codegen-2.2.3.jar
+codegen-ecore-2.2.3.jar
+common-2.2.3.jar
+ecore-2.2.3.jar
+ecore-change-2.2.3.jar
+ecore-xmi-2.2.3.jar
+xsd-2.2.3.jar)
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED 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. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+===================================================================================================
diff --git a/das-java/trunk/samples/customer/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/customer/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..c2cf1f95b4
--- /dev/null
+++ b/das-java/trunk/samples/customer/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,32 @@
+Apache Tuscany SDO for Java
+Copyright 2006, 2007 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other successful
+ASF projects. While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be fully endorsed
+by the ASF.
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE.txt file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+The terms and conditions governing the distribution may refer to the AL or other license
+agreements, notices or terms and conditions. Some of these other license agreements may
+include (but are not limited to):
+
+ . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html)
+
+It is your obligation to read and accept all such terms and conditions prior to use of the
+distribution. If term or condition is provided, please contact the Apache Software Foundation
+to determine what terms and conditions govern that particular distribution.
+
+This product also includes software developed by the Open Service Oriented Architecture organisation
+(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this
+distribution.
diff --git a/das-java/trunk/samples/customer/src/main/resources/META-INF/README b/das-java/trunk/samples/customer/src/main/resources/META-INF/README
new file mode 100644
index 0000000000..d1905ee3e8
--- /dev/null
+++ b/das-java/trunk/samples/customer/src/main/resources/META-INF/README
@@ -0,0 +1,35 @@
+Apache Tuscany M2 build (October, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/das-java/trunk/samples/customer/src/main/resources/log4j.properties b/das-java/trunk/samples/customer/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..ab4ebbb785
--- /dev/null
+++ b/das-java/trunk/samples/customer/src/main/resources/log4j.properties
@@ -0,0 +1,36 @@
+# 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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, NULL
+
+# NULL Appender
+log4j.appender.NULL=org.apache.log4j.varia.NullAppender
+
+log4j.appender.NULL.layout=org.apache.log4j.PatternLayout
+log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n
+
+# CONSOLE is set to be a ConsoleAppender.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n
+
+
+# Print only messages of level WARN or above in the package com.foo.
+log4j.logger.org.apache.tuscany=NONE \ No newline at end of file
diff --git a/das-java/trunk/samples/dbconfig/pom.xml b/das-java/trunk/samples/dbconfig/pom.xml
new file mode 100644
index 0000000000..372bcbc302
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/pom.xml
@@ -0,0 +1,123 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-samples</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>tuscany-das-sample-dbconfig</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany DAS Canned DB Initializer Utility</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das-rdb</artifactId>
+ <version>${das.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.2.2.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- this will place the java source files inside the jar -->
+ <build>
+ <finalName>sample-dbconfig</finalName>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>${sdo.version}</version>
+ <executions>
+ <execution>
+ <id>config</id>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/DBConfig.xsd</schemaFile>
+ <noNotification>true</noNotification>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
+
+</project>
diff --git a/das-java/trunk/samples/dbconfig/readme.html b/das-java/trunk/samples/dbconfig/readme.html
new file mode 100644
index 0000000000..da8c83a824
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/readme.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+ 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.
+ -->
+
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Tuscany RDB DAS Database Setup Utility</title>
+
+<style>
+.code {font-size: 11px; color: #006699}
+.codebox {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px}
+.codebox2 {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px; width:85%}
+.codeboxW {border: 1px solid #6699CC; background-color: #FFFFFF;padding:15px}
+.codeboxB {background-color: #C9DBED;padding:1px 10px 10px 10px}
+</style>
+
+</head>
+
+<h1><center>Tuscany RDB DAS Database Setup Utility</center></h1>
+
+<br>
+
+<p>This utility provides a jar file to be used by RDB DAS sample
+applications (web or standalone) to do database setup. So far the
+samples provided canned pre-created Derby database with tables and data.
+There was no convenient way to refresh table data during the samples
+execution. This utility supports Derby database at present and uses a
+config file to get the setup information.</p>
+
+<h2>APIs</h2>
+
+<ul style="border-right-style: solid; border-left-style: solid; border-top-style: solid; border-bottom-style: solid">
+public DBInitializer() – uses default provided ConfigFile CannedSampleDBConfig.xml <br>
+public DBInitializer(String ConfigFileLocation) <br>
+public DBInitializer (InputStream ConfigFileStream) <br>
+public void initializeDatabase(boolean clean) - Create database tables and fill data. If clean=true, all tables will be dropped and recreated. <br>
+public void initializeDatabaseData(boolean clean) - create database data (with clean=true, if a table has pre-existing data, it will be deleted first) <br>
+public void refreshDatabaseData() – calls initializeDatabase(clean=true) <br>
+public boolean isDatabaseReady() - will return true, if the tables exist in the database <br>
+public boolean isDatabasePopulated() - will return true, if the tables have data <br>
+</ul>
+
+<h2>Assumptions:</h2>
+<p>&lt;table&gt; element lists tables in proper sequence, i.e. parent tables
+first and then child tables. This sequence will be used in
+create,insert,delete,drop to take care of referential integrity. The
+config file required by utility supports the following features through
+different attributes and elements. Sample xml file is shown at the end.
+
+</p>
+
+<h2>&lt;ConnectionInfo&gt;</h2>
+<p>This element provides connection specific information - like vendor
+specific database URL, user name, password etc. If the DataSource is
+provided by the web container, user needs to only fill dataSource
+attribute in this. In case of standalone J2SE samples, user needs to
+fill ConnectionProperties element inside ConnectionInfo. These two ways
+of connection specification are mutually exclusive.</p>
+
+<h2>&lt;table&gt;</h2>
+<p>This element needs to specify the table names required by the
+sample. Only these tables will be considered for creation, data
+population. This gives flexibility to the user to choose the required
+set of tables based on the sample's requirement. It also needs to
+specify in the attributes, the Create SQL command used to create this
+table.&lt;table&gt; has sequence element &lt;row&gt; which is used to provide
+the data to be populated in the table.
+</p>
+
+ <h2>Set Up</h2>
+
+ <p>To use this utility, include its jar and required database
+ driver's jar in the classpath. Provide the config file used by this
+ utility , similar to the example below, in the source folder of the
+ sample.<br>
+ </p>
+
+ <h2>DBConfig.xml example</h2>
+
+ <ul style="border-right-style: solid; border-left-style: solid; border-top-style: solid; border-bottom-style: solid">
+ &lt;?xml version="1.0" encoding="ASCII"?&gt;<br>
+ &lt;!-- 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. --&gt; <br><br>
+ &lt;DBConfig
+ xmlns="http:///org.apache.tuscany.das.rdb/dbconfig.xsd"&gt;<br><br>
+ &lt;ConnectionInfo&gt;<br>
+ &lt;ConnectionProperties
+ driverClass="org.apache.derby.jdbc.EmbeddedDriver"
+ databaseURL="jdbc:derby:target/dastest; create = true"
+ loginTimeout="600000" /&gt;<br>
+ &lt;/ConnectionInfo&gt; <br><br>
+ &lt;Table
+ name="COMPANY" SQLCreate="CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT
+ NULL, NAME VARCHAR(30), EOTMID INTEGER)"&gt; <br>
+ &lt;row&gt; 51, 'ACME Publishing', 0 &lt;/row&gt; <br>
+ &lt;row&gt; 52, 'Do-rite plumbing', 0 &lt;/row&gt;<br>
+ &lt;row&gt; 53, 'MegaCorp', 0 &lt;/row&gt;<br>
+ &lt;/Table&gt;<br><br>
+ &lt;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)"&gt; <br>
+ &lt;row&gt; 'Advanced Technologies', 'NY', '123', 1 &lt;/row&gt; <br>
+ &lt;row&gt; 'Default Name', '', '', 51 &lt;/row&gt;<br>
+ &lt;row&gt; 'Default Name', '', '', 51 &lt;/row&gt; <br>
+ &lt;row&gt; 'Default Name', '', '', 51 &lt;/row&gt; <br>
+ &lt;row&gt; 'Default Name', '', '', 51 &lt;/row&gt; <br>
+ &lt;row&gt; 'Default Name', '', '', 51 &lt;/row&gt;<br>
+ &lt;row&gt; 'Default Name', '', '', 51 &lt;/row&gt; <br>
+ &lt;/Table&gt;<br><br>
+
+ &lt;Table name="EMPLOYEE" SQLCreate="CREATE TABLE EMPLOYEE (ID INT
+ PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,NAME VARCHAR(30),SN
+ VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)"&gt; <br>
+ &lt;row&gt; 'John Jones','E0001',0,12 &lt;/row&gt; <br>
+ &lt;row&gt; 'Mary Smith','E0002',1,null &lt;/row&gt; <br>
+ &lt;row&gt; 'Jane Doe','E0003',0,12 &lt;/row&gt; <br>
+ &lt;row&gt; 'Al Smith','E0004',1,12 &lt;/row&gt;<br>
+ &lt;/Table&gt; <br><br>&lt;/DBConfig&gt;<br>
+
+</ul>
+
+
+ </BODY>
+</HTML>
diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java
new file mode 100644
index 0000000000..783f822bc4
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java
@@ -0,0 +1,57 @@
+/*
+ * 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.das.rdb.dbconfig;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * Config util provides config-related utilities such as loading a Config
+ * instance from an InputStream
+ *
+ */
+public final class DBConfigUtil {
+
+ private DBConfigUtil() {
+ }
+
+ public static DBConfig loadDBConfig(InputStream dbconfigStream) {
+
+ if (dbconfigStream == null) {
+ throw new RuntimeException("Cannot load configuration from a null InputStream. "
+ + "Possibly caused by an incorrect config xml file name");
+ }
+
+ HelperContext context = HelperProvider.getDefaultContext();
+ DbconfigFactory.INSTANCE.register(context);
+ XMLHelper helper = context.getXMLHelper();
+
+ try {
+ return (DBConfig) helper.load(dbconfigStream).getRootObject();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java
new file mode 100644
index 0000000000..5f64145c58
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java
@@ -0,0 +1,179 @@
+/*
+ * 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.das.rdb.dbconfig;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
+public class DBConnectionHelper {
+ private static final Logger logger = Logger.getLogger(DBConnectionHelper.class);
+
+ protected DBConnectionHelper(){
+ if(logger.isDebugEnabled()) {
+ logger.log(Level.DEBUG, "DBConnectionHelper()");
+ }
+ }
+
+ /**
+ * Basic validation of Config for connection information and call to
+ * connection helper to establish database connection. Connection using
+ * DriverManager or DataSource are supported.
+ *
+ */
+ public static Connection createConnection(ConnectionInfo connectionInfo) {
+ if (logger.isDebugEnabled()) {
+ logger.log(Level.DEBUG, "DBConnectionHelper.createConnection(ConnectionInfo)");
+ }
+
+ if (connectionInfo == null ||
+ (connectionInfo.getDataSource() == null &&
+ (connectionInfo.getConnectionProperties() == null || connectionInfo.getConnectionProperties().getDatabaseURL() == null
+ || connectionInfo.getConnectionProperties().getDriverClass() == null)) ) {
+ throw new RuntimeException("No connection has been provided and no data source has been specified");
+ }
+
+ if(connectionInfo.getDataSource() != null &&
+ (connectionInfo.getConnectionProperties() != null && connectionInfo.getConnectionProperties().getDatabaseURL() != null) ){
+ throw new RuntimeException("Use either dataSource or databaseURL. Can't use both !");
+ }
+
+ Connection connection = null;
+
+ if(connectionInfo.getDataSource() != null){
+ connection = initializeDatasourceConnection(connectionInfo);
+ }else{
+ connection = initializeDriverManagerConnection(connectionInfo);
+ }
+
+ return connection;
+
+ }
+ /**
+ * Initializes a DB connection on a managed environmet (e.g inside Tomcat)
+ */
+ private static Connection initializeDatasourceConnection(ConnectionInfo connectionInfo){
+ if (logger.isDebugEnabled()) {
+ logger.log(Level.DEBUG, "DBConnectionHelper.initializeDatasourceConnection(ConnectionInfo)");
+ }
+
+ InitialContext ctx;
+ Connection connection;
+
+ try {
+ ctx = new InitialContext();
+ } catch (NamingException e) {
+ throw new RuntimeException(e);
+ }
+ try {
+ DataSource ds = (DataSource) ctx.lookup(connectionInfo.getDataSource());
+ try {
+ try {
+ if(connectionInfo.getConnectionProperties() != null &&
+ connectionInfo.getConnectionProperties().getUserName() != null &&
+ connectionInfo.getConnectionProperties().getPassword() != null ) {
+ connection = ds.getConnection(connectionInfo.getConnectionProperties().getUserName(), connectionInfo.getConnectionProperties().getPassword());
+ } else {
+ connection = ds.getConnection();
+ }
+ }catch(Exception e) {
+ connection = ds.getConnection();
+ }
+
+ if (connection == null) {
+ throw new RuntimeException("Could not obtain a Connection from DataSource");
+ }
+ connection.setAutoCommit(true);
+
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ } catch (NamingException e) {
+ throw new RuntimeException(e);
+ }
+
+ if( logger.isDebugEnabled()) {
+ logger.log(Level.DEBUG, "DBConnectionHelper.initializeDatasourceConnection() exit");
+ }
+ return connection;
+ }
+
+ /**
+ * Initialize a DB connection on a J2SE environment
+ * For more info, see http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/drivermanager.html
+ */
+ private static Connection initializeDriverManagerConnection(ConnectionInfo connectionInfo) {
+ if (logger.isDebugEnabled()) {
+ logger.log(Level.DEBUG, "DBConnectionHelper.initializeDriverManagerConnection(ConnectionInfo)");
+ }
+
+ if (connectionInfo.getConnectionProperties() == null) {
+ throw new DataSourceInitializationException("No existing context and no connection properties");
+ }
+
+ if (connectionInfo.getConnectionProperties().getDriverClass() == null) {
+ throw new DataSourceInitializationException("No jdbc driver class specified!");
+ }
+
+ Connection connection;
+
+ try {
+ //initialize driver and register it with DriverManager
+ Class.forName(connectionInfo.getConnectionProperties().getDriverClass());
+
+ //prepare to initialize connection
+ String databaseUrl = connectionInfo.getConnectionProperties().getDatabaseURL();
+ String userName = connectionInfo.getConnectionProperties().getUserName();
+ String userPassword = connectionInfo.getConnectionProperties().getPassword();
+ int loginTimeout = connectionInfo.getConnectionProperties().getLoginTimeout();
+
+ DriverManager.setLoginTimeout(loginTimeout);
+ if( (userName == null || userName.length() ==0) && (userPassword == null || userPassword.length()==0) ){
+ //no username or password suplied
+ connection = DriverManager.getConnection(databaseUrl);
+ }else{
+ connection = DriverManager.getConnection(databaseUrl, userName, userPassword);
+ }
+
+ if(connection == null){
+ throw new DataSourceInitializationException("Error initializing connection : null");
+ }
+
+ connection.setAutoCommit(true);
+ }catch(ClassNotFoundException cnf){
+ throw new DataSourceInitializationException("JDBC Driver '" + connectionInfo.getConnectionProperties().getDriverClass() + "' not found", cnf);
+ }catch(SQLException sqle){
+ throw new DataSourceInitializationException(sqle.getMessage(), sqle);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.log(Level.DEBUG, "DBConnectionHelper.initializeDriverManagerConnection() exit");
+ }
+
+ return connection;
+ }
+}
diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java
new file mode 100644
index 0000000000..2ef25bdf81
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java
@@ -0,0 +1,251 @@
+/*
+ * 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.das.rdb.dbconfig;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
+public class DBDataHelper {
+ private static final String CLASS_NAME = "DBDataHelper";
+
+ private final Logger logger = Logger.getLogger(DBDataHelper.class);
+
+ private final DBConfig dbConfig;
+
+ protected DBDataHelper(DBConfig dbConfig) {
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, "DBDataHelper()");
+ }
+
+ this.dbConfig = dbConfig;
+ }
+
+ public boolean isDatabasePopulated() {
+ boolean isPopulated = true;
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".isDatabasePopulated()");
+ }
+
+ Iterator tableIterator = dbConfig.getTable().iterator();
+ while (tableIterator.hasNext()) {
+ Table table = (Table) tableIterator.next();
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".isDatabasePopulated() calling isTablePopulated() for '" + table.getName() + "'");
+ }
+
+ isPopulated = this.isTablePopulated(table.getName());
+ if (isPopulated == false) {
+ break;
+ }
+ }
+ return isPopulated;
+ }
+
+ /**
+ *
+ * @param tableName
+ * @return Count of rows present in the table specified by tableName
+ */
+ protected boolean isTablePopulated(String tableName) {
+ boolean isPopulated = false;
+ Connection dbConnection = null;
+ Statement dbStatement = null;
+
+ try {
+ dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo());
+ dbStatement = dbConnection.createStatement();
+ String sqlString = "select count(*) from " + tableName;
+
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".isTablePopulated()=> sqlString => '" + sqlString + "'");
+
+ ResultSet rs = dbStatement.executeQuery(sqlString);
+ rs.next();
+
+ if (rs != null) {
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".isTablePopulated()=> pointer set");
+ }
+ }
+
+ int count = rs.getInt(1);
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".isTablePopulated()=> '" + tableName + "' => " + count);
+ }
+
+ if (count > 0) {
+ isPopulated = true;
+ }
+
+ } catch (SQLException e) {
+ // ignore and return false
+ } finally {
+ try {
+ dbStatement.close();
+ dbConnection.close();
+ } catch (SQLException e1) {
+ // ignore and return false
+ }
+ }
+
+ return isPopulated;
+ }
+
+ protected String generateInsertSQL(Connection dbConnection, String tableName, String rowValues) throws SQLException {
+ StringBuffer sqlBuffer = new StringBuffer(50);
+
+ Statement dbStatement = dbConnection.createStatement();
+ ResultSet dummyRS = dbStatement.executeQuery("SELECT * FROM "+tableName);
+ ResultSetMetaData rsMetaData = dummyRS.getMetaData();
+
+
+ sqlBuffer.append("INSERT INTO ").append(tableName).append(" (");
+
+ int numberOfColumns = rsMetaData.getColumnCount();
+ String columnName = null;
+ int i;
+ for (i = 1; i <= numberOfColumns -1; i++) {
+ //get the column's name.
+ columnName = rsMetaData.getColumnName(i);
+ if(!rsMetaData.isAutoIncrement(i)){
+ sqlBuffer.append(columnName).append(",");
+ }
+ else{
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> auto increment column => " + i + " "+columnName);
+ }
+ }
+ }
+ sqlBuffer.append(rsMetaData.getColumnName(i)).append(") ");
+ sqlBuffer.append("VALUES (").append(rowValues).append(")");
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> SQL Clause => " + sqlBuffer);
+ }
+
+ return sqlBuffer.toString();
+ }
+
+ public void initializeDatabaseData() {
+ Connection dbConnection = null;
+ Statement dbStatement = null;
+
+ try {
+ dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo());
+ dbStatement = dbConnection.createStatement();
+
+ Iterator tableIterator = dbConfig.getTable().iterator();
+ while (tableIterator.hasNext()) {
+ Table table = (Table) tableIterator.next();
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> INSERT FOR TABLE => '" + table.getName() + "'");
+ }
+
+ //String columnClause = generateInsertSQL(dbConnection, table.getName());
+
+ String tableName = table.getName();
+ Iterator dataIterator = table.getRow().iterator();
+ while (dataIterator.hasNext()) {
+ String tableRow = (String) dataIterator.next();
+ String sqlString = generateInsertSQL(dbConnection, tableName, tableRow);
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> sqlString => '" + sqlString + "'");
+ }
+
+ try {
+ dbStatement.executeUpdate(sqlString);
+ }catch(SQLException e){
+ //e.printStackTrace();
+ //ignore and jump to new table
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData() - Error inserting table data : " + e.getMessage(), e);
+ }
+ }
+ }
+ }
+ } catch (SQLException e) {
+ // ignore and return false
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData() - Internal error : " + e.getMessage(), e);
+ }
+ } finally {
+ try {
+ dbStatement.close();
+ dbConnection.close();
+ } catch (SQLException e1) {
+ // ignore and return false
+ }
+ }
+ }
+
+ public void deleteDatabaseData() {
+ Connection dbConnection = null;
+ Statement dbStatement = null;
+
+ try {
+ dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo());
+ dbStatement = dbConnection.createStatement();
+ //inverse order - to take care of parent-child
+ List tables = dbConfig.getTable();
+ for(int i=tables.size()-1; i>-1; i-- ){
+ Table table = (Table) tables.get(i);
+ String sqlString = "DELETE FROM " + table.getName() ;
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".deleteDatabaseData()=> sqlString => '" + sqlString + "'");
+ }
+
+ try {
+ dbStatement.executeQuery(sqlString);
+ }catch(SQLException e){
+ e.printStackTrace();
+ //ignore and jump to new table
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".deleteDatabaseData() - Error inserting table data : " + e.getMessage(), e);
+ }
+ }
+ }
+ } catch (SQLException e) {
+ // ignore and return false
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData() - Internal error : " + e.getMessage(), e);
+ }
+ } finally {
+ try {
+ dbStatement.close();
+ dbConnection.close();
+ } catch (SQLException e1) {
+ // ignore and return false
+ }
+ }
+ }
+}
diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java
new file mode 100644
index 0000000000..028ec59d63
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java
@@ -0,0 +1,200 @@
+/*
+ * 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.das.rdb.dbconfig;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Iterator;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
+public class DBHelper {
+ private static final String CLASS_NAME = "DBHelper";
+
+ private final Logger logger = Logger.getLogger(DBHelper.class);
+
+ private final DBConfig dbConfig;
+
+ /**
+ * Constructor
+ *
+ * @param DBConfig
+ */
+ protected DBHelper(DBConfig dbConfig) {
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + "()");
+ }
+ this.dbConfig = dbConfig;
+ }
+
+ /**
+ * Check if tables specified in Config exist
+ *
+ * @return true if all specified tables exist, false otherwise
+ */
+ protected boolean isDatabaseReady() {
+ boolean bResult = true;
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + "isDatabaseReady()");
+ }
+
+ Connection dbConnection = null;
+ DatabaseMetaData dbMetaData = null;
+ try {
+ dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo());
+ dbMetaData = dbConnection.getMetaData();
+
+ if (dbConfig.getTable() != null && dbConfig.getTable().size() > 0) {
+ Iterator tableIterator = dbConfig.getTable().iterator();
+ while (tableIterator.hasNext()) {
+ Table table = (Table) tableIterator.next();
+
+ if (!dbMetaData.getTables(null, null, table.getName(), null).next()) {
+ bResult = false;
+ }
+
+ }
+ }
+ } catch (SQLException e) {
+ bResult = false;
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, "Error retrieving database metadata", e);
+ }
+ } finally {
+ try {
+ if(dbConnection != null) dbConnection.close();
+ } catch (SQLException e) {
+ // ignore here
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + "isDatabaseReady() exit");
+ }
+
+ return bResult;
+ }
+
+ /**
+ * Create the database tables based on dbConfig definition
+ */
+ protected void initializeDatabase() {
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + "initializeDatabase()");
+ }
+
+ Connection dbConnection = null;
+ Statement dbStatement = null;
+ try {
+ dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo());
+ dbStatement = dbConnection.createStatement();
+
+ if (dbConfig.getTable() != null && dbConfig.getTable().size() > 0) {
+ Iterator tableIterator = dbConfig.getTable().iterator();
+ while (tableIterator.hasNext()) {
+ Table table = (Table) tableIterator.next();
+
+ if (table.getSQLCreate() != null && table.getSQLCreate().length() > 0) {
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, "Creating table '" + table.getName() + "' => " + table.getSQLCreate());
+ }
+
+ dbStatement.execute(table.getSQLCreate());
+ }
+ }
+ }
+ } catch (SQLException e) {
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, "Error retrieving database metadata", e);
+ }
+ } finally {
+ try {
+ dbStatement.close();
+ dbConnection.close();
+ } catch (SQLException e) {
+ // ignore here
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + "initializeDatabase() exit");
+ }
+ }
+
+ /**
+ * Drop the database tables based on dbConfig definition
+ */
+ protected void dropDatabaseTables() {
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + "dropDatabaseTables()");
+ }
+
+ Connection dbConnection = null;
+ Statement dbStatement = null;
+ try {
+ dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo());
+ dbStatement = dbConnection.createStatement();
+
+ if (dbConnection != null && dbStatement != null && dbConfig.getTable() != null && dbConfig.getTable().size() > 0) {
+ //reverse order to take care of dropping child tables before parent tables.
+ for(int i=dbConfig.getTable().size()-1; i>-1; i--) {
+ Table table = (Table) dbConfig.getTable().get(i);
+
+ if (table.getSQLCreate() != null && table.getSQLCreate().length() > 0) {
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, "Dropping table '" + table.getName() );
+ }
+
+ try {
+ dbStatement.execute("DROP TABLE " + table.getName());
+ } catch (SQLException e) {
+ //ignore
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, "Error droping table '" + table.getName() + "'", e);
+ }
+ }
+ }
+ }
+ }
+ } catch (SQLException e) {
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, "Error droping table", e);
+ }
+ } finally {
+ try {
+ if(dbStatement != null)
+ dbStatement.close();
+
+ if(dbConnection != null)
+ dbConnection.close();
+ } catch (SQLException e) {
+ // ignore here
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ this.logger.log(Level.DEBUG, CLASS_NAME + "dropDatabaseTables() exit");
+ }
+ }
+}
diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java
new file mode 100644
index 0000000000..cc6a670dfd
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java
@@ -0,0 +1,154 @@
+/*
+ * 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.das.rdb.dbconfig;
+
+import java.io.InputStream;
+import java.sql.Connection;
+
+/**
+ * This is the master class having public utility APIs exposed for DAS sample creater - for table and data maintainance.
+ *
+ */
+public class DBInitializer {
+ private static final String DEFAULT_CANNED_DB_CONFIGURATION = "CannedSampleDBConfig.xml";
+
+ /**
+ * Database configuration model
+ */
+ protected DBConfig dbConfig;
+
+ /**
+ * Database connection
+ */
+ protected Connection connection;
+
+ /**
+ * To manage database connection
+ */
+ protected DBConnectionHelper dbConnectionHelper;
+
+ /**
+ * To manage database phisical structure
+ */
+ protected DBHelper dbHelper;
+
+ /**
+ * To manage database population
+ */
+ protected DBDataHelper dbDataHelper;
+
+ /**
+ * Create instance of DBInitHelper based on default canned database configuration
+ *
+ * @param dbconfigFileLocation
+ * @throws Exception
+ */
+ public DBInitializer() {
+ InputStream dbConfigStream = this.getClass().getClassLoader().getResourceAsStream(DEFAULT_CANNED_DB_CONFIGURATION);
+ init(dbConfigStream);
+ }
+
+ /**
+ * Create instance of DBInitHelper based on Config file location
+ *
+ * @param dbconfigFileLocation
+ * @throws Exception
+ */
+ public DBInitializer(String dbconfigFileLocation) throws Exception {
+ InputStream dbConfigStream = this.getClass().getClassLoader().getResourceAsStream(dbconfigFileLocation);
+ init(dbConfigStream);
+ }
+
+ /**
+ * Create instance of DBInitHelper based on Config stream
+ *
+ * @param dbconfigStream
+ * @throws Exception
+ */
+ public DBInitializer(InputStream dbConfigStream) throws Exception {
+ init(dbConfigStream);
+ }
+
+ /**
+ * Initialize helper members based on Config
+ *
+ * @param dbconfigStream
+ */
+ protected void init(InputStream dbconfigStream) {
+ dbConfig = DBConfigUtil.loadDBConfig(dbconfigStream);
+
+ dbConnectionHelper = new DBConnectionHelper();
+ dbHelper = new DBHelper(dbConfig);
+ dbDataHelper = new DBDataHelper(dbConfig);
+
+ }
+
+ /**
+ * Check if the Database and all tables have been created on the database
+ *
+ * @return return true if tables exist, else return false.
+ */
+ public boolean isDatabaseReady() {
+ return dbHelper.isDatabaseReady();
+ }
+
+ /**
+ *
+ * @return - return true if all tables have at least a row, false otherwise
+ */
+ public boolean isDatabasePopulated() {
+ return dbDataHelper.isDatabasePopulated();
+ }
+
+ /**
+ * Create tables and populate data.
+ *
+ * @param clean - If true, tables will be force dropped and recreated, else it will skip table creation for pre-existing tables.
+ * @throws Exception
+ */
+ public void initializeDatabase(boolean clean) throws DatabaseInitializerException {
+ if (clean) {
+ dbHelper.dropDatabaseTables();
+ }
+ dbHelper.initializeDatabase();
+ dbDataHelper.initializeDatabaseData();
+ }
+
+ /**
+ * Populate database data
+ *
+ * @param clean If true, table data will be droped before data is created
+ */
+ public void initializeDatabaseData(boolean clean) throws DatabaseInitializerException{
+ if (clean) {
+ dbDataHelper.deleteDatabaseData();
+ }
+ dbDataHelper.initializeDatabaseData();
+ }
+
+ /**
+ * Refresh data in tables.
+ *
+ * @throws Exception
+ */
+ public void refreshDatabaseData() throws DatabaseInitializerException {
+ initializeDatabase(true);
+ }
+}
diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java
new file mode 100644
index 0000000000..ef5bef7761
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java
@@ -0,0 +1,40 @@
+/*
+ * 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.das.rdb.dbconfig;
+
+/**
+ *
+ * Class responsible to throw exception encountered when initializing DataSource.
+ *
+ */
+public class DataSourceInitializationException extends RuntimeException {
+ private static final long serialVersionUID = 302160989411041041L;
+
+ public DataSourceInitializationException(String string) {
+ super(string);
+ }
+
+ public DataSourceInitializationException(Throwable e){
+ super(e);
+ }
+
+ public DataSourceInitializationException(String string, Throwable e) {
+ super(string, e);
+ }
+}
diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java
new file mode 100644
index 0000000000..8c4fd0d71b
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java
@@ -0,0 +1,40 @@
+/*
+ * 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.das.rdb.dbconfig;
+
+/**
+ *
+ * Class responsible to throw exception encountered when initializing DataSource.
+ *
+ */
+public class DatabaseInitializerException extends RuntimeException {
+ private static final long serialVersionUID = 302160989411041041L;
+
+ public DatabaseInitializerException(String string) {
+ super(string);
+ }
+
+ public DatabaseInitializerException(Throwable e){
+ super(e);
+ }
+
+ public DatabaseInitializerException(String string, Throwable e) {
+ super(string, e);
+ }
+}
diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml b/das-java/trunk/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml
new file mode 100644
index 0000000000..2b7b1ba1fd
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml
@@ -0,0 +1,47 @@
+<?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">
+ <ConnectionInfo>
+ <ConnectionProperties
+ driverClass="org.apache.derby.jdbc.EmbeddedDriver"
+ databaseURL="jdbc:derby:c:/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>
+ <row>'Default Name', '', '', 51</row>
+ <row>'Default Name', '', '', 51</row>
+ <row>'Default Name', '', '', 51</row>
+ <row>'Default Name', '', '', 51</row>
+ <row>'Default Name', '', '', 51</row>
+ <row>'Default Name', '', '', 51</row>
+ </Table>
+ <Table name="EMPLOYEE" SQLCreate="CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,NAME VARCHAR(30),SN VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)">
+ <row>'John Jones','E0001',0,12</row>
+ <row>'Mary Smith','E0002',1,null</row>
+ <row>'Jane Doe','E0003',0,12</row>
+ <row>'Al Smith','E0004',1,12</row>
+ </Table>
+</DBConfig>
diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/DBConfig.xsd b/das-java/trunk/samples/dbconfig/src/main/resources/DBConfig.xsd
new file mode 100644
index 0000000000..798c88c75c
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/resources/DBConfig.xsd
@@ -0,0 +1,56 @@
+<?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.
+ -->
+<xsd:schema xmlns:DBConfig="http:///org.apache.tuscany.das.rdb/dbconfig.xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ targetNamespace="http:///org.apache.tuscany.das.rdb/dbconfig.xsd">
+
+ <xsd:element name="DBConfig" type="DBConfig:DBConfig"/>
+
+ <xsd:complexType name="DBConfig">
+ <xsd:sequence>
+ <xsd:element maxOccurs="1" minOccurs="1" name="ConnectionInfo" type="DBConfig:ConnectionInfo"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="1" name="Table" type="DBConfig:Table"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="ConnectionInfo">
+ <xsd:sequence>
+ <xsd:element maxOccurs="1" minOccurs="0" name="ConnectionProperties" type="DBConfig:ConnectionProperties"/>
+ </xsd:sequence>
+ <xsd:attribute name="dataSource" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="ConnectionProperties">
+ <xsd:attribute name="driverClass" type="xsd:string"/>
+ <xsd:attribute name="databaseURL" type="xsd:string"/>
+ <xsd:attribute default="" name="userName" type="xsd:string"/>
+ <xsd:attribute default="" name="password" type="xsd:string"/>
+ <xsd:attribute default="0" name="loginTimeout" type="xsd:int"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="Table">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" minOccurs="1" name="row" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SQLCreate" type="xsd:string"/>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000000..fb4df3722c
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,353 @@
+
+ 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.
+
+===============================================================================================================
+
+Other components and dependencies under Apache Software License 2.0 :
+
+ log4j-1.2.14.jar - Apache Logging Services
+ derby 10.2.2.0.jar - Apache Derby
+ stax-api-1.0.1.jar - The Streaming API for XML (StAX)
+ wstx-asl-3.2.0.jar - WoodStox StAX implementation
+ standard-1.1.1.jar - The Apache Jackarta Taglibs
+ jstl-1.1.2.jar - The Apache Jackarta Taglibs
+ *.tld - The Apache Jackarta Taglibs
+
+===============================================================================================================
+
+
+Apache Tuscany SDO for Java Subcomponents
+=========================================:
+
+The Tuscany SDO for Java release includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar)
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+
+For the Eclipse EMF components
+(codegen-2.2.3.jar
+codegen-ecore-2.2.3.jar
+common-2.2.3.jar
+ecore-2.2.3.jar
+ecore-change-2.2.3.jar
+ecore-xmi-2.2.3.jar
+xsd-2.2.3.jar)
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED 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. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+===================================================================================================
diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..c2cf1f95b4
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,32 @@
+Apache Tuscany SDO for Java
+Copyright 2006, 2007 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other successful
+ASF projects. While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be fully endorsed
+by the ASF.
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE.txt file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+The terms and conditions governing the distribution may refer to the AL or other license
+agreements, notices or terms and conditions. Some of these other license agreements may
+include (but are not limited to):
+
+ . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html)
+
+It is your obligation to read and accept all such terms and conditions prior to use of the
+distribution. If term or condition is provided, please contact the Apache Software Foundation
+to determine what terms and conditions govern that particular distribution.
+
+This product also includes software developed by the Open Service Oriented Architecture organisation
+(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this
+distribution.
diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/README b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/README
new file mode 100644
index 0000000000..723f3fd3ab
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/README
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/log4j.properties b/das-java/trunk/samples/dbconfig/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..3b0e5074da
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/main/resources/log4j.properties
@@ -0,0 +1,33 @@
+# 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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+
+log4j.rootLogger=NONE, NULL
+
+# NULL Appender
+log4j.appender.NULL=org.apache.log4j.varia.NullAppender
+
+log4j.appender.NULL.layout=org.apache.log4j.PatternLayout
+log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n
+
+# CONSOLE is set to be a ConsoleAppender.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+
+# Print only messages of level WARN or above in the package com.foo.
+log4j.logger.org.apache.tuscany=NONE \ No newline at end of file
diff --git a/das-java/trunk/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java b/das-java/trunk/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java
new file mode 100644
index 0000000000..3bd0bae407
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java
@@ -0,0 +1,69 @@
+/*
+ * 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.das.rdb.dbconfig;
+
+import junit.framework.TestCase;
+
+
+
+/**
+ * Tests the Converter framwork
+ */
+public class DBInitializerTestCase extends TestCase {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+ public void testCreateDatabase() throws Exception {
+ DBInitializer dbInitializer = new DBInitializer("dbConfig.xml");
+ dbInitializer.initializeDatabase(true);
+ }
+
+ public void something() throws Exception {
+// try{
+// //DBInitHelper dbInit = new DBInitHelper("DBConfig.xml");
+// DBInitializer dbInit = new DBInitializer(new FileInputStream("c:/DBConfig.xml"));
+// dbInit.initializeDatabase(true);
+//
+// System.out.println("check schema created:"+dbInit.isDatabaseReady());
+// System.out.println("check data created:"+dbInit.isDataCreated());
+//
+// dbInit.deleteData();
+// System.out.println("check data created after deleteData:"+dbInit.isDataCreated());
+//
+// dbInit.deleteSchema();
+// System.out.println("after deleteSchema check schema created:"+dbInit.isDatabaseReady());
+//
+// dbInit.createSchema(false);
+// System.out.println("check schema created after createSchema:"+dbInit.isDatabaseReady());
+//
+// dbInit.refreshData(true);
+// System.out.println("check data created after refreshData:"+dbInit.isDataCreated());
+// }catch(Exception e){
+// e.printStackTrace();
+// }
+ }
+}
diff --git a/das-java/trunk/samples/dbconfig/src/test/resources/dbConfig.xml b/das-java/trunk/samples/dbconfig/src/test/resources/dbConfig.xml
new file mode 100644
index 0000000000..51cb1c11d7
--- /dev/null
+++ b/das-java/trunk/samples/dbconfig/src/test/resources/dbConfig.xml
@@ -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">
+ <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, NAME VARCHAR(30), EOTMID INTEGER)">
+ <row>51, 'ACME Publishing', 0</row>
+ <row>52, 'Do-rite plumbing', 0</row>
+ <row>53, 'MegaCorp', 0</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>
+ <row>'Default Name', '', '', 51</row>
+ <row>'Default Name', '', '', 51</row>
+ <row>'Default Name', '', '', 51</row>
+ <row>'Default Name', '', '', 51</row>
+ <row>'Default Name', '', '', 51</row>
+ <row>'Default Name', '', '', 51</row>
+ </Table>
+ <Table name="EMPLOYEE" SQLCreate="CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,NAME VARCHAR(30),SN VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)">
+ <row>'John Jones','E0001',0,12</row>
+ <row>'Mary Smith','E0002',1,null</row>
+ <row>'Jane Doe','E0003',0,12</row>
+ <row>'Al Smith','E0004',1,12</row>
+ </Table>
+ <Table name="STATES" SQLCreate="CREATE TABLE STATES (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(2))">
+ </Table>
+ <Table name="CITIES" SQLCreate="CREATE TABLE CITIES (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), STATES_ID INTEGER,
+ CONSTRAINT FK1 FOREIGN KEY (STATES_ID) REFERENCES STATES (ID) ON DELETE NO ACTION ON UPDATE NO ACTION)" >
+ </Table>
+</DBConfig>
diff --git a/das-java/trunk/samples/pom.xml b/das-java/trunk/samples/pom.xml
new file mode 100644
index 0000000000..b95b8f9653
--- /dev/null
+++ b/das-java/trunk/samples/pom.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-samples</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany DAS Samples</name>
+
+ <modules>
+ <module>dbconfig</module>
+ <module>company-webapp</module>
+ <module>advanced-webapp</module>
+ <module>customer</module>
+ <module>transaction</module>
+ </modules>
+</project>
diff --git a/das-java/trunk/samples/testing/tomcat/advanced-webapp/pom.xml b/das-java/trunk/samples/testing/tomcat/advanced-webapp/pom.xml
new file mode 100644
index 0000000000..4f54e1d820
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/advanced-webapp/pom.xml
@@ -0,0 +1,80 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-samples-testing-tomcat</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>tuscany-das-samples-testing-tomcat-advanced-webapp</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Testing Ajax DAS Web Sample</name>
+ <description>Testing Tomcat Ajax DAS end user test</description>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>1.9</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>jakarta-regexp</groupId>
+ <artifactId>jakarta-regexp</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-jakarta-regexp</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-xslp</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000000..fb4df3722c
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,353 @@
+
+ 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.
+
+===============================================================================================================
+
+Other components and dependencies under Apache Software License 2.0 :
+
+ log4j-1.2.14.jar - Apache Logging Services
+ derby 10.2.2.0.jar - Apache Derby
+ stax-api-1.0.1.jar - The Streaming API for XML (StAX)
+ wstx-asl-3.2.0.jar - WoodStox StAX implementation
+ standard-1.1.1.jar - The Apache Jackarta Taglibs
+ jstl-1.1.2.jar - The Apache Jackarta Taglibs
+ *.tld - The Apache Jackarta Taglibs
+
+===============================================================================================================
+
+
+Apache Tuscany SDO for Java Subcomponents
+=========================================:
+
+The Tuscany SDO for Java release includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar)
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+
+For the Eclipse EMF components
+(codegen-2.2.3.jar
+codegen-ecore-2.2.3.jar
+common-2.2.3.jar
+ecore-2.2.3.jar
+ecore-change-2.2.3.jar
+ecore-xmi-2.2.3.jar
+xsd-2.2.3.jar)
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED 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. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+===================================================================================================
diff --git a/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..c2cf1f95b4
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,32 @@
+Apache Tuscany SDO for Java
+Copyright 2006, 2007 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other successful
+ASF projects. While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be fully endorsed
+by the ASF.
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE.txt file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+The terms and conditions governing the distribution may refer to the AL or other license
+agreements, notices or terms and conditions. Some of these other license agreements may
+include (but are not limited to):
+
+ . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html)
+
+It is your obligation to read and accept all such terms and conditions prior to use of the
+distribution. If term or condition is provided, please contact the Apache Software Foundation
+to determine what terms and conditions govern that particular distribution.
+
+This product also includes software developed by the Open Service Oriented Architecture organisation
+(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this
+distribution.
diff --git a/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README
new file mode 100644
index 0000000000..723f3fd3ab
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java
new file mode 100644
index 0000000000..1335b4c484
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java
@@ -0,0 +1,596 @@
+/*
+ * 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.test.das;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+
+import junit.framework.TestCase;
+
+import com.gargoylesoftware.htmlunit.BrowserVersion;
+import com.gargoylesoftware.htmlunit.CollectingAlertHandler;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.FrameWindow;
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlButtonInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlOption;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput;
+import com.gargoylesoftware.htmlunit.html.HtmlSelect;
+
+public class AjaxDasTestCase extends TestCase {
+ public static final String testUrl = "http://localhost:8080/sample-advanced-webapp";
+
+ protected WebClient _webClient;
+ protected URL _url;
+ final List collectedAlerts = new ArrayList();
+
+ protected void setUp() throws Exception {
+ //New HTMLunit web client
+ _webClient = new WebClient(BrowserVersion.MOZILLA_1_0);
+ //System.out.println("SETTING ALERT HANDLER");
+ _webClient.setAlertHandler( new CollectingAlertHandler(collectedAlerts) );
+ _webClient.setRedirectEnabled(true);
+ // Going to have the WebClient connect to this URL
+ _url = new URL(testUrl);
+ }
+
+ public void testHomepage() throws Exception {
+ final String TEST_CASE = "AjaxDASHomePage";
+ System.out.print("Running:" + TEST_CASE + "\t\t\t");
+ //System.out.println("js enabled?"+_webClient.isJavaScriptEnabled());
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+ //System.out.println("page title:"+page.getTitleText());
+ String responseText = page.asText();
+ //System.out.println("page html-->\n" + responseText);
+ //check page header
+ assertTrue(-1 != responseText.indexOf("Tuscany DAS Web Sample"));
+
+ FrameWindow menuFrame = page.getFrameByName("fixed");
+ HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
+ String menuResponseText = menuPage.asText();
+ //System.out.println("menu html-->\n" + menuResponseText);
+ //check main menu and sub menu
+ assertTrue(-1 != menuResponseText.indexOf("Advanced Features"));
+ assertTrue(-1 != menuResponseText.indexOf("OCC"));
+ assertTrue(-1 != menuResponseText.indexOf("Converter"));
+ assertTrue(-1 != menuResponseText.indexOf("Result Set Shape"));
+ assertTrue(-1 != menuResponseText.indexOf("Adhoc Query"));
+ assertTrue(-1 != menuResponseText.indexOf("Command"));
+
+ collectedAlerts.clear();
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testDBRefresh() throws Exception{
+ final String TEST_CASE = "DBRefresh";
+ System.out.print("Running:" + TEST_CASE + "\t\t");
+
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+ FrameWindow menuFrame = page.getFrameByName("fixed");
+ HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
+ HtmlButtonInput commandButton = (HtmlButtonInput)menuPage.getFormByName("MenuForm").getHtmlElementById("refreshButton");
+ HtmlPage commandResult = null;
+ if(commandButton != null){
+ //System.out.println("command button text:"+commandButton.asText());
+ commandButton.focus();
+ //System.out.println("command button script:"+commandButton.getOnClickAttribute());
+ commandResult = (HtmlPage)commandButton.click();
+ }
+
+ //System.out.println("alerts size:"+collectedAlerts.size());
+ //if(collectedAlerts.size() > 0){
+ //for(int i=0; i<collectedAlerts.size(); i++){
+ //System.out.println("alert msg:"+collectedAlerts.get(i));
+ //}
+ //}
+
+ String commandResultText = commandResult.asText();
+ //System.out.println("initial commandResultText-->\n"+commandResultText);
+
+ while(commandResultText.indexOf("Refreshed database!") == -1){
+ Thread.sleep(1000);
+ commandResultText = commandResult.asText();
+ //System.out.println("commandResultText-->\n" + commandResultText);
+ }
+ assertTrue(-1 != commandResultText.indexOf("Refreshed database!"));
+
+ collectedAlerts.clear();
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testAllCompanies_Adhoc() throws Exception{
+ final String TEST_CASE = "AllCompanies_Adhoc";
+ System.out.print("Running:" + TEST_CASE + "\t\t\t");
+
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+ FrameWindow menuFrame = page.getFrameByName("fixed");
+ HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
+
+ //basic content
+ HtmlAnchor adhocAnchor = menuPage.getAnchorByHref("./indexAdhoc.jsp");
+ HtmlPage adhocPage = (HtmlPage)adhocAnchor.click();
+ String adhocText = adhocPage.asText();
+ //System.out.println("adhoc html-->\n" + adhocText);
+ assertTrue(-1 != adhocText.indexOf("Adhoc SQL Query"));//heading
+ assertTrue(-1 != adhocText.indexOf("ExecuteQuery"));//button text
+
+ //list values
+ HtmlForm adhocForm = adhocPage.getFormByName("DasForm");
+ //adhocPage.getEnclosingWindow().getWebClient()
+ HtmlSelect adhocList = (HtmlSelect)adhocForm.getHtmlElementById("sqlQuery");
+ List adhocListOptions = adhocList.getOptions();//.asText();
+ //System.out.println(" adhocListOptionsText-->\n" + adhocListOptions.toString());
+ String allOptionsText = "";
+ for(int i=0; i<adhocListOptions.size(); i++){
+ HtmlOption curOption = (HtmlOption)adhocListOptions.get(i);
+ String curOptionText = curOption.getValueAttribute();
+ allOptionsText = allOptionsText + curOptionText;
+ if(curOptionText.equals("SELECT * FROM COMPANY")){
+ adhocList.setSelectedAttribute(curOption, true);
+ //System.out.println("select option..."+curOptionText);
+ }
+ }
+ //System.out.println("allOptionsText:"+allOptionsText);
+
+ assertTrue(-1 != allOptionsText.indexOf("NullQuery"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("SELECT * FROM COMPANY"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("SELECT * FROM COMPANY LEFT OUTER JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("INSERT INTO DEPARTMENT (NAME, COMPANYID) VALUES ('MyDept',1)"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("DELETE FROM DEPARTMENT WHERE DEPARTMENT.COMPANYID=1 and DEPARTMENT.ID>1"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("UPDATE DEPARTMENT SET NAME='MyUpdDept' WHERE COMPANYID=1 AND ID=1"));//check each option
+
+ //check result
+ HtmlButtonInput adhocButton = (HtmlButtonInput)adhocForm.getHtmlElementById("queryButton");
+ adhocButton.focus();
+ HtmlPage adhocResult = (HtmlPage)adhocButton.click();
+ String adhocResultText = adhocResult.asText();
+ //System.out.println("initial result:"+adhocResultText);
+
+ //System.out.println("alerts size:"+collectedAlerts.size());
+ //if(collectedAlerts.size() > 0){
+ // for(int i=0; i<collectedAlerts.size(); i++){
+ // System.out.println("alert msg:"+collectedAlerts.get(i));
+ //}
+ //}
+
+ while(adhocResultText.indexOf("das:DataGraphRoot") == -1){
+ //System.out.println("sleeping:"+adhocResultText);
+ Thread.sleep(1000);
+ adhocResultText = adhocResult.asText();
+ }
+
+ //System.out.println("new result:"+adhocResultText);
+
+ //better to check just data in xml
+ assertTrue(-1 != adhocResultText.indexOf("ACME Publishing"));
+ assertTrue(-1 != adhocResultText.indexOf("Do-rite plumbing"));
+ assertTrue(-1 != adhocResultText.indexOf("MegaCorp"));
+
+ collectedAlerts.clear();
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testAllCompaniesDepartments_Command() throws Exception{
+ final String TEST_CASE = "AllCompaniesDepartments_Command";
+ System.out.print("Running:" + TEST_CASE + "\t\t");
+
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+ FrameWindow menuFrame = page.getFrameByName("fixed");
+ HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
+
+ //basic content
+ HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./indexCommand.jsp");
+ HtmlPage commandPage = (HtmlPage)commandAnchor.click();
+ String commandText = commandPage.asText();
+ //System.out.println("command html-->\n" + commandText);
+ assertTrue(-1 != commandText.indexOf("DAS Command:"));//heading
+ assertTrue(-1 != commandText.indexOf("ExecuteCommand"));//button text
+
+ //list values
+ HtmlForm commandForm = commandPage.getFormByName("DasForm");
+ HtmlSelect commandList = (HtmlSelect)commandForm.getHtmlElementById("DasCommand");
+ List commandListOptions = commandList.getOptions();
+ //System.out.println(" commandListOptionsText-->\n" + commandListOptions.toString());
+ String allOptionsText = "";
+ for(int i=0; i<commandListOptions.size(); i++){
+ HtmlOption curOption = (HtmlOption)commandListOptions.get(i);
+ String curOptionText = curOption.getValueAttribute();
+ allOptionsText = allOptionsText + curOptionText;
+ if(curOptionText.equals("AllCompaniesAndDepartments")){
+ commandList.setSelectedAttribute(curOption, true);
+ //System.out.println("select option..."+curOptionText);
+ }
+ }
+ assertTrue(-1 != allOptionsText.indexOf("NullCommand"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("AllCompanies"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("AllCompaniesAndDepartments"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("AddDepartmentToFirstCompany"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("DeleteDepartmentFromFirstCompany"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("UpdateCompanyDepartmentNames"));//check each option
+
+ //check result
+ HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("commandButton");
+ HtmlPage commandResult = null;
+ if(commandButton != null){
+ //System.out.println("command button text:"+commandButton.asText());
+ commandButton.focus();
+ //System.out.println("command button script:"+commandButton.getOnClickAttribute());
+ commandResult = (HtmlPage)commandButton.click();
+ }
+
+
+ //System.out.println("alerts size:"+collectedAlerts.size());
+ //if(collectedAlerts.size() > 0){
+ //for(int i=0; i<collectedAlerts.size(); i++){
+ //System.out.println("alert msg:"+collectedAlerts.get(i));
+ //}
+ //}
+
+ String commandResultText = commandResult.asText();
+ //System.out.println("initial commandResultText-->\n"+commandResultText);
+
+ while(commandResultText.indexOf("das:DataGraphRoot") == -1){
+ Thread.sleep(1000);
+ commandResultText = commandResult.asText();
+ }
+ //System.out.println("commandResultText-->\n" + commandResultText);
+
+ assertTrue(-1 != commandResultText.indexOf("ACME Publishing"));
+ assertTrue(-1 != commandResultText.indexOf("Do-rite plumbing"));
+ assertTrue(-1 != commandResultText.indexOf("MegaCorp"));
+ assertTrue(-1 != commandResultText.indexOf("Advanced Technologies"));
+ assertTrue(-1 != commandResultText.indexOf("COMPANYID"));
+ assertTrue(-1 != commandResultText.indexOf("1"));
+
+ collectedAlerts.clear();
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testInsertCompanies_Adhoc() throws Exception{
+ final String TEST_CASE = "InsertCompanies_Adhoc";
+ System.out.print("Running:" + TEST_CASE + "\t\t\t");
+
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+ FrameWindow menuFrame = page.getFrameByName("fixed");
+ HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
+
+ //basic content
+ HtmlAnchor adhocAnchor = menuPage.getAnchorByHref("./indexAdhoc.jsp");
+ HtmlPage adhocPage = (HtmlPage)adhocAnchor.click();
+ String adhocText = adhocPage.asText();
+ //System.out.println("adhoc html-->\n" + adhocText);
+ assertTrue(-1 != adhocText.indexOf("Adhoc SQL Query"));//heading
+ assertTrue(-1 != adhocText.indexOf("ExecuteQuery"));//button text
+
+ //list values
+ HtmlForm adhocForm = adhocPage.getFormByName("DasForm");
+ //adhocPage.getEnclosingWindow().getWebClient()
+ HtmlSelect adhocList = (HtmlSelect)adhocForm.getHtmlElementById("sqlQuery");
+ List adhocListOptions = adhocList.getOptions();//.asText();
+ //System.out.println(" adhocListOptionsText-->\n" + adhocListOptions.toString());
+ String allOptionsText = "";
+ for(int i=0; i<adhocListOptions.size(); i++){
+ HtmlOption curOption = (HtmlOption)adhocListOptions.get(i);
+ String curOptionText = curOption.getValueAttribute();
+ allOptionsText = allOptionsText + curOptionText;
+ if(curOptionText.startsWith("{INSERT INTO DEPARTMENT (NAME, COMPANYID) VALUES ('MyDept',1)}" )){
+ adhocList.setSelectedAttribute(curOption, true);
+ //System.out.println("insert option..."+curOptionText);
+ }
+ }
+ //System.out.println("allOptionsText:"+allOptionsText);
+
+ assertTrue(-1 != allOptionsText.indexOf("NullQuery"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("SELECT * FROM COMPANY"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("SELECT * FROM COMPANY LEFT OUTER JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("INSERT INTO DEPARTMENT (NAME, COMPANYID) VALUES ('MyDept',1)"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("DELETE FROM DEPARTMENT WHERE DEPARTMENT.COMPANYID=1 and DEPARTMENT.ID>1"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("UPDATE DEPARTMENT SET NAME='MyUpdDept' WHERE COMPANYID=1 AND ID=1"));//check each option
+
+ //check result
+ HtmlButtonInput adhocButton = (HtmlButtonInput)adhocForm.getHtmlElementById("queryButton");
+ HtmlPage adhocResult = (HtmlPage)adhocButton.click();
+
+ //System.out.println("alerts size:"+collectedAlerts.size());
+ //if(collectedAlerts.size() > 0){
+ //for(int i=0; i<collectedAlerts.size(); i++){
+ //System.out.println("alert msg:"+collectedAlerts.get(i));
+ //}
+ //}
+
+ String adhocResultText = adhocResult.asText();
+ while(adhocResultText.indexOf("das:DataGraphRoot") == -1){
+ Thread.sleep(1000);
+ adhocResultText = adhocResult.asText();
+ //System.out.println("adhocResultText-->\n" + adhocResultText);
+ }
+
+ assertTrue(-1 != adhocResultText.indexOf("ACME Publishing"));
+ assertTrue(-1 != adhocResultText.indexOf("Do-rite plumbing"));
+ assertTrue(-1 != adhocResultText.indexOf("MegaCorp"));
+ assertTrue(-1 != adhocResultText.indexOf("Advanced Technologies"));
+ assertTrue(-1 != adhocResultText.indexOf("COMPANYID"));
+ assertTrue(-1 != adhocResultText.indexOf("1"));
+ assertTrue(-1 != adhocResultText.indexOf("MyDept"));
+ assertTrue(adhocResultText.indexOf("COMPANYID") != adhocResultText.lastIndexOf("COMPANYID"));
+
+ collectedAlerts.clear();
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testDeleteDepartment_Command() throws Exception{
+ final String TEST_CASE = "DeleteDepartment_Command";
+ System.out.print("Running:" + TEST_CASE + "\t\t");
+
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+ FrameWindow menuFrame = page.getFrameByName("fixed");
+ HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
+
+ //basic content
+ HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./indexCommand.jsp");
+ HtmlPage commandPage = (HtmlPage)commandAnchor.click();
+ String commandText = commandPage.asText();
+ //System.out.println("command html-->\n" + commandText);
+ assertTrue(-1 != commandText.indexOf("DAS Command:"));//heading
+ assertTrue(-1 != commandText.indexOf("ExecuteCommand"));//button text
+
+ //list values
+ HtmlForm commandForm = commandPage.getFormByName("DasForm");
+ HtmlSelect commandList = (HtmlSelect)commandForm.getHtmlElementById("DasCommand");
+ List commandListOptions = commandList.getOptions();
+ //System.out.println(" commandListOptionsText-->\n" + commandListOptions.toString());
+ String allOptionsText = "";
+ for(int i=0; i<commandListOptions.size(); i++){
+ HtmlOption curOption = (HtmlOption)commandListOptions.get(i);
+ String curOptionText = curOption.getValueAttribute();
+ allOptionsText = allOptionsText + curOptionText;
+ if(curOptionText.equals("DeleteDepartmentFromFirstCompany")){
+ commandList.setSelectedAttribute(curOption, true);
+ //System.out.println("delete option..."+curOptionText);
+ }
+ }
+ assertTrue(-1 != allOptionsText.indexOf("NullCommand"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("AllCompanies"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("AllCompaniesAndDepartments"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("AddDepartmentToFirstCompany"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("DeleteDepartmentFromFirstCompany"));//check each option
+ assertTrue(-1 != allOptionsText.indexOf("UpdateCompanyDepartmentNames"));//check each option
+
+ //check result
+ HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("commandButton");
+ HtmlPage commandResult = null;
+ if(commandButton != null){
+ //System.out.println("command button text:"+commandButton.asText());
+ commandButton.focus();
+ //System.out.println("command button script:"+commandButton.getOnClickAttribute());
+ commandResult = (HtmlPage)commandButton.click();
+ }
+
+
+ //System.out.println("alerts size:"+collectedAlerts.size());
+ //if(collectedAlerts.size() > 0){
+ //for(int i=0; i<collectedAlerts.size(); i++){
+ //System.out.println("alert msg:"+collectedAlerts.get(i));
+ //}
+ //}
+
+ String commandResultText = commandResult.asText();
+ //System.out.println("initial commandResultText-->\n"+commandResultText);
+
+ while(commandResultText.indexOf("das:DataGraphRoot") == -1){
+ Thread.sleep(1000);
+ commandResultText = commandResult.asText();
+ //System.out.println("commandResultText-->\n" + commandResultText);
+ }
+
+ assertTrue(-1 != commandResultText.indexOf("ACME Publishing"));
+ assertTrue(-1 != commandResultText.indexOf("Do-rite plumbing"));
+ assertTrue(-1 != commandResultText.indexOf("MegaCorp"));
+ assertTrue(-1 != commandResultText.indexOf("Advanced Technologies"));
+ assertTrue(-1 != commandResultText.indexOf("COMPANYID"));
+ assertTrue(-1 != commandResultText.indexOf("1"));
+
+ collectedAlerts.clear();
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testOCC() throws Exception{
+ final String TEST_CASE = "OCC";
+ System.out.print("Running:" + TEST_CASE + "\t\t");
+
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+ FrameWindow menuFrame = page.getFrameByName("fixed");
+ HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
+
+ //basic content
+ HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./occ.jsp");
+ HtmlPage commandPage = (HtmlPage)commandAnchor.click();
+ String commandText = commandPage.asText();
+ //System.out.println("command html-->\n" + commandText);
+ assertTrue(-1 != commandText.indexOf("Automatic Optimistic Concurrency Control:"));//heading
+ assertTrue(-1 != commandText.indexOf("ExecuteTransaction"));//button text
+
+ //list values
+ HtmlForm commandForm = commandPage.getFormByName("DasForm");
+ //check result
+ HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("occButton");
+ HtmlPage commandResult = null;
+ if(commandButton != null){
+ //System.out.println("command button text:"+commandButton.asText());
+ commandButton.focus();
+ //System.out.println("command button script:"+commandButton.getOnClickAttribute());
+ commandResult = (HtmlPage)commandButton.click();
+ }
+
+ //System.out.println("alerts size:"+collectedAlerts.size());
+ //if(collectedAlerts.size() > 0){
+ //for(int i=0; i<collectedAlerts.size(); i++){
+ //System.out.println("alert msg:"+collectedAlerts.get(i));
+ //}
+ //}
+
+ String commandResultText = commandResult.asText();
+ //System.out.println("initial commandResultText-->\n"+commandResultText);
+
+ while(commandResultText.indexOf("collision") == -1){
+ Thread.sleep(1000);
+ commandResultText = commandResult.asText();
+ //System.out.println("commandResultText-->\n" + commandResultText);
+ }
+
+ assertTrue(-1 != commandResultText.indexOf("An update collision occurred"));
+
+ collectedAlerts.clear();
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testRSS() throws Exception{
+ final String TEST_CASE = "RSS";
+ System.out.print("Running:" + TEST_CASE + "\t\t");
+
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+ FrameWindow menuFrame = page.getFrameByName("fixed");
+ HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
+
+ //basic content
+ HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./rss.jsp");
+ HtmlPage commandPage = (HtmlPage)commandAnchor.click();
+ String commandText = commandPage.asText();
+ //System.out.println("command html-->\n" + commandText);
+ assertTrue(-1 != commandText.indexOf("Result Set Shape:"));//heading
+ assertTrue(-1 != commandText.indexOf("ExecuteQuery"));//button text
+
+ //list values
+ HtmlForm commandForm = commandPage.getFormByName("DasForm");
+ //check result
+ HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("rssButton");
+ HtmlPage commandResult = null;
+ if(commandButton != null){
+ //System.out.println("command button text:"+commandButton.asText());
+ commandButton.focus();
+ //System.out.println("command button script:"+commandButton.getOnClickAttribute());
+ commandResult = (HtmlPage)commandButton.click();
+ }
+
+ //System.out.println("alerts size:"+collectedAlerts.size());
+ //if(collectedAlerts.size() > 0){
+ //for(int i=0; i<collectedAlerts.size(); i++){
+ //System.out.println("alert msg:"+collectedAlerts.get(i));
+ //}
+ //}
+
+ String commandResultText = commandResult.asText();
+ //System.out.println("initial commandResultText-->\n"+commandResultText);
+
+ while(commandResultText.indexOf("das:DataGraphRoot") == -1){
+ Thread.sleep(1000);
+ commandResultText = commandResult.asText();
+ }
+
+ //System.out.println("commandResultText-->\n" + commandResultText);
+
+ assertTrue(-1 != commandResultText.indexOf("Roosevelt"));
+ assertTrue(-1 != commandResultText.indexOf("1600 Pennsylvania Avenue"));
+
+ collectedAlerts.clear();
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testConverter() throws Exception{
+ final String TEST_CASE = "Converter";
+ System.out.print("Running:" + TEST_CASE + "\t\t");
+
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+ FrameWindow menuFrame = page.getFrameByName("fixed");
+ HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();
+
+ //basic content
+ HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./converter.jsp");
+ HtmlPage commandPage = (HtmlPage)commandAnchor.click();
+ String commandText = commandPage.asText();
+ //System.out.println("command html-->\n" + commandText);
+ assertTrue(-1 != commandText.indexOf("Arbitrary Converter:"));//heading
+ assertTrue(-1 != commandText.indexOf("ExecuteTransaction"));//button text
+
+ //list values
+ HtmlForm commandForm = commandPage.getFormByName("DasForm");
+ //select first radio buttom
+ HtmlRadioButtonInput stmt0 = (HtmlRadioButtonInput)commandForm.getRadioButtonInput("stmt", "stmt0");
+ if(stmt0 != null){
+ //System.out.println("got stmt0");
+ stmt0.setChecked(true);
+ }
+
+ //check result
+ HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("converterButton");
+ HtmlPage commandResult = null;
+ if(commandButton != null){
+ //System.out.println("command button text:"+commandButton.asText());
+ commandButton.focus();
+ //System.out.println("command button script:"+commandButton.getOnClickAttribute());
+ commandResult = (HtmlPage)commandButton.click();
+ }
+
+ //System.out.println("alerts size:"+collectedAlerts.size());
+ //if(collectedAlerts.size() > 0){
+ //for(int i=0; i<collectedAlerts.size(); i++){
+ //System.out.println("alert msg:"+collectedAlerts.get(i));
+ //}
+ //}
+
+ String commandResultText = commandResult.asText();
+ //System.out.println("initial commandResultText-->\n"+commandResultText);
+
+ while(commandResultText.indexOf("das:DataGraphRoot") == -1){
+ Thread.sleep(1000);
+ commandResultText = commandResult.asText();
+ //System.out.println("commandResultText-->\n" + commandResultText);
+ }
+ assertTrue(-1 != commandResultText.indexOf("1957"));
+
+ collectedAlerts.clear();
+ System.out.println("SUCCESS!!!");
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) throws Exception{
+ AjaxDasTestCase t = new AjaxDasTestCase();
+ t.setUp();
+ try{
+ ////t.testHomepage();
+ //t.testAllCompanies_Adhoc();
+ //t.testAllCompaniesDepartments_Command();
+ //t.testInsertCompanies_Adhoc();
+ //t.testDeleteDepartment_Command();
+ //t.testOCC();
+ ////t.testRSS();
+ //t.testConverter();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/das-java/trunk/samples/testing/tomcat/build.xml b/das-java/trunk/samples/testing/tomcat/build.xml
new file mode 100644
index 0000000000..3f38968476
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/build.xml
@@ -0,0 +1,309 @@
+<?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.
+ -->
+<project name="setup tomcat" default="prepareTomcat" basedir='.'>
+ <property environment="env" />
+ <property file="${user.home}/tuscany/build.properties" />
+ <property file="${user.home}/build.properties" />
+
+ <property name="tuscany.acceptance.tomcat.version" value='6.0.13' />
+ <condition property="tuscany.acceptance.tomcat.zipped" value='apache-tomcat-${tuscany.acceptance.tomcat.version}.zip'>
+ <os family="windows"/>
+ </condition>
+ <condition property="tuscany.acceptance.tomcat.zipped" value='apache-tomcat-${tuscany.acceptance.tomcat.version}.tar.gz'>
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ </condition>
+ <condition property="ant.home" value="${env.ANT_HOME}">
+ <os family="unix"/>
+ </condition>
+
+ <property name="tuscany.acceptance.target.dir" value='target' />
+ <property name="tuscany.acceptance.tc.dir" value='${tuscany.acceptance.target.dir}/apache-tomcat-${tuscany.acceptance.tomcat.version}' />
+ <condition property="tuscany.acceptance.tc.bin.dir" value="${tuscany.acceptance.tc.dir}/lib">
+ <contains string="${tuscany.acceptance.tomcat.version}" substring="6."/>
+ </condition>
+ <condition property="tuscany.acceptance.tc.bin.dir" value="${tuscany.acceptance.tc.dir}/common/lib">
+ <contains string="${tuscany.acceptance.tomcat.version}" substring="5."/>
+ </condition>
+
+
+<!-- KJW define property for the complete path of apache dir -->
+ <property name="fullpath.tuscany.acceptance.tc.dir" value= '${basedir}/${tuscany.acceptance.tc.dir}' />
+
+ <property name="tuscany.acceptance.groupId" value='org/apache/tuscany' />
+ <property name="tuscany.acceptance.version" value='incubating-M1' />
+
+ <property name="tuscany.commonj.acceptance.groupId" value='commonj' />
+ <property name="tuscany.commonj.acceptance.version" value='incubating-M1' />
+
+ <property name="tuscany.sdo.acceptance.groupId" value='org/apache/tuscany' />
+ <property name="tuscany.sdo.acceptance.version" value='incubating-M1' />
+
+<!--KJW Define location of canned Derby database -->
+ <property name="tuscany.acceptance.das.samples.companyweb.dir" value='../../company-webapp' />
+ <property name="tuscany.acceptance.das.samples.advancedweb.dir" value='../../advanced-webapp' />
+
+ <property name="tuscany.maven.repos.dir" value='${user.home}\.m2\repository' />
+ <condition property="isWindows">
+ <os family="windows"/>
+ </condition>
+ <condition property="isUnix">
+ <os family="unix"/>
+ </condition>
+ <condition property="isMac">
+ <os family="mac"/>
+ </condition>
+
+ <patternset id="tuscany.acceptance.common.dependencies">
+ <include name="**/stax/stax-api/1.0/stax-api-1.0.jar"/>
+ <include name="**/woodstox/wstx-asl/2.9.3/wstx-asl-2.9.3.jar" />
+ </patternset>
+
+ <patternset id="tuscany.acceptance.emf.dependencies">
+ <include name="**/org/eclipse/emf/common/2.2.3/common-2.2.3.jar" />
+ <include name="**/org/eclipse/emf/ecore/2.2.3/ecore-2.2.3.jar" />
+ <include name="**/org/eclipse/emf/ecore-change/2.2.3/ecore-change-2.2.3.jar" />
+ <include name="**/org/eclipse/emf/ecore-xmi/2.2.3/ecore-xmi-2.2.3.jar" />
+ <include name="**/org/eclipse/xsd/xsd/2.2.3/xsd-2.2.3.jar" />
+ </patternset>
+
+ <patternset id="tuscany.acceptance.tc.specsdoimpl"> <!--jars which need to go into tomcat common/lib -->
+ <include name="**/${tuscany.sca.acceptance.groupId}/sca-api/${tuscany.sca.acceptance.version}/sca-api-${tuscany.sca.acceptance.version}.jar" />
+ <include name="**/${tuscany.commonj.acceptance.groupId}/sdo-api/${tuscany.commonj.acceptance.version}/sdo-api-${tuscany.commonj.acceptance.version}.jar" />
+ <include name="**/${tuscany.acceptance.groupId}/tuscany-sdo-impl/${tuscany.acceptance.version}/tuscany-sdo-impl-${tuscany.acceptance.version}.jar" />
+ </patternset>
+
+ <target name="init">
+ <available property='tomcat.is.available' file='${tuscany.acceptance.tc.dir}/server/lib/catalina.jar' type='file' />
+ <available property='tuscany.acceptance.tomcat.zipped.available' file='${tuscany.acceptance.tomcat.zipped}' type='file' />
+ <available property='tuscany.acceptance.tomcat.serverxmlorg.available' file='${tuscany.acceptance.tc.dir}/conf/server.xml.original' />
+ <available property='tuscany.acceptance.tomcat.contextxmlorg.available' file='${tuscany.acceptance.tc.dir}/conf/context.xml.original' />
+ </target>
+
+ <target name="check.for.zip" depends="init" unless='tuscany.acceptance.tomcat.zipped.available'>
+ <property name='tuscany.acceptance.tomcat.zipped.full' location="${tuscany.acceptance.tomcat.zipped}" />
+ <echo level="error" message="${tuscany.acceptance.tomcat.zipped} file not found here:'${tuscany.acceptance.tomcat.zipped.full}'" />
+ <echo level="error" message="Either place zip file there or change ${user.home}/build.properties in home dir to include 'tuscany.acceptance.tomcat.zipped' property to where zip is located. " />
+ <fail />
+ </target>
+
+
+ <target name="tuscany.tomcat.unzipWindows" if="isWindows" depends='init,check.for.zip' description='Just unzip tomcat' unless='tomcat.is.available'>
+ <unzip src="${tuscany.acceptance.tomcat.zipped}" dest="${tuscany.acceptance.target.dir}" />
+ </target>
+ <target name="tuscany.tomcat.unzipUnix" if="isUnix" depends='init,check.for.zip' description='Just unzip tomcat' unless='tomcat.is.available'>
+ <mkdir dir="${tuscany.acceptance.target.dir}" />
+ <gunzip src="${tuscany.acceptance.tomcat.zipped}" dest="${tuscany.acceptance.target.dir}/temp.tar"/>
+ <!-- Exec tar because ant builtin tar does not preserve execute permissions. -->
+ <exec executable="tar" dir="${tuscany.acceptance.target.dir}">
+ <arg value="xf"/>
+ <arg value="temp.tar"/>
+ </exec>
+ <delete file="${tuscany.acceptance.target.dir}/temp.tar"/>
+ </target>
+ <target name="tuscany.tomcat.unzipMac" if="isMac" depends='init,check.for.zip' description='Just unzip tomcat' unless='tomcat.is.available'>
+ <antcall target="tuscany.tomcat.unzipUnix" /> <!-- just use unix for now -->
+ </target>
+
+ <target name="prepareTomcat" depends='tuscany.tomcat.unzipWindows,tuscany.tomcat.unzipUnix,tuscany.tomcat.unzipMac,tuscany.tomcat.fixup,tuscany.deploy.das.standalone' description='Unzip tomcat, fix it up, and deploy samples'>
+ <dirname property='tuscany.acceptance.tc.dir.full' file="${tuscany.acceptance.tc.dir}/bin" />
+ <echo level="info" message="Tomcat fixed up here: ${tuscany.acceptance.tc.dir.full}" />
+
+ </target>
+ <target name="startTestServer" depends='prepareTomcat' description='start server prepared to run tests'>
+ <waitfor maxwait="1" maxwaitunit="second" checkevery="200" timeoutproperty="tuscany.tomcat.notstarted" >
+ <http url="http://localhost:8080"/>
+ </waitfor>
+ <condition property="tuscany.tomcat.alreadystarted">
+ <not>
+ <istrue value="${tuscany.tomcat.notstarted}"/>
+ </not>
+ </condition>
+ <antcall target="startTomcat" />
+ </target>
+
+ <target name="tuscany.tomcat.fixup" depends='tuscany.tomcat.fixserverconfig' description='Fix up tomcat for tuscany.'>
+ <mkdir dir="${tuscany.acceptance.target.dir}" />
+
+ <copy todir="${tuscany.acceptance.tc.bin.dir}" flatten='true'>
+ <fileset dir="${tuscany.maven.repos.dir}">
+ <patternset refid="tuscany.acceptance.emf.dependencies" />
+ </fileset>
+ <fileset dir="${tuscany.maven.repos.dir}">
+ <patternset refid="tuscany.acceptance.tc.specsdoimpl" />
+ </fileset>
+ <fileset dir="${tuscany.acceptance.das.samples.advancedweb.dir}">
+ <include name="**/*.war" />
+ </fileset>
+ <fileset dir="${tuscany.maven.repos.dir}">
+ <patternset> <!-- for Derby and DAS support -->
+ <include name="**/${tuscany.acceptance.groupId}/das/tuscany-das-rdb/${tuscany.acceptance.version}/tuscany-das-rdb-${tuscany.acceptance.version}.jar" />
+ <include name="**/org/apache/derby/derby/10.1.2.1/derby-10.1.2.1.jar" />
+ </patternset>
+ </fileset>
+ <fileset dir="${tuscany.maven.repos.dir}">
+ <patternset refid="tuscany.acceptance.common.dependencies" />
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- DAS standalone target -->
+ <target name="tuscany.deploy.das.standalone" description='Deploy DAS stand alone sample to tomcat.'>
+ <copy todir="${tuscany.acceptance.tc.dir}/webapps" flatten='true'>
+ <fileset dir="${tuscany.acceptance.das.samples.companyweb.dir}">
+ <include name="**/*.war" />
+ </fileset>
+ <fileset dir="${tuscany.acceptance.das.samples.advancedweb.dir}">
+ <include name="**/*.war" />
+ </fileset>
+ <!-- lresende - using the right name on the build now, don't need to clean up -->
+ <!-- chainedmapper>
+ <flattenmapper/>
+ <globmapper from="*-1.0-SNAPSHOT.war" to="*.war"/>
+ </chainedmapper -->
+ </copy>
+
+ <!-- Create directory for the derby database -->
+ <property name="tuscany.acceptance.target.databases.dir" value='${tuscany.acceptance.tc.dir}/Databases' />
+ <mkdir dir="${tuscany.acceptance.target.databases.dir}" />
+
+ <!-- Copy over the Derby database -->
+ <!-- lresende - we now use the dbConfig, and don't need to copy canned database here -->
+ <!-- copy todir="${tuscany.acceptance.target.databases.dir}">
+ <fileset dir="${tuscany.acceptance.das.samples.companyweb.dir}">
+ <include name="**/dastest/**" />
+ </fileset>
+ <fileset dir="${tuscany.acceptance.das.samples.advancedweb.dir}">
+ <include name="**/ajaxdastest/**" />
+ </fileset>
+ </copy -->
+ </target>
+
+
+ <!-- provide a convenient -Djava.ext.dirs= to run j2se samples -->
+ <target name="j2se" description='create a java extensions directory to run J2SE tuscany applications.'>
+ <property name="tuscany.acceptance.j2se.dir" value='${tuscany.acceptance.target.dir}/j2se' />
+ <mkdir dir="${tuscany.acceptance.j2se.dir}" />
+ <copy todir="${tuscany.acceptance.j2se.dir}" flatten='true'>
+ <fileset dir="${tuscany.maven.repos.dir}">
+ <patternset refid="tuscany.acceptance.common.dependencies" />
+ </fileset>
+ <fileset dir="${tuscany.maven.repos.dir}">
+ <patternset refid="tuscany.acceptance.emf.dependencies" />
+ <patternset refid="tuscany.acceptance.tc.specsdoimpl" />
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="backup.server.xml" depends="init" unless='tuscany.acceptance.tomcat.serverxmlorg.available'>
+ <copy file='${tuscany.acceptance.tc.dir}/conf/server.xml' tofile='${tuscany.acceptance.tc.dir}/conf/server.xml.original' />
+ </target>
+ <target name="backup.context.xml" depends="init" unless='tuscany.acceptance.tomcat.contextxmlorg.available'>
+ <copy file='${tuscany.acceptance.tc.dir}/conf/context.xml' tofile='${tuscany.acceptance.tc.dir}/conf/context.xml.original' />
+ </target>
+ <target name="tuscany.tomcat.fixserverconfig" depends='tuscany.tomcat.fixserverxml,tuscany.tomcat.fixcontextxml' description='Add listeners' />
+ <target name="tuscany.tomcat.fixserverxml" depends='init,backup.server.xml' unless='tuscany.acceptance.tomcat.serverxmlorg.available'>
+ <property name="tuscany.acceptance.tomcat.serverxmlorg.available" value='true' />
+
+<!-- KJW save results to server_temp.xml -->
+ <!-- DO NOTHING AT THIS TIME
+ <xslt processor="trax"
+ in="${tuscany.acceptance.tc.dir}/conf/server.xml.original"
+ style="server.xsl"
+ out="${tuscany.acceptance.tc.dir}/conf/server_temp.xml">
+ </xslt>
+ -->
+
+
+<!--KJW modify server.xml to include derby database resource -->
+ <echo level="info" message="Running datasource.xsl" />
+ <xslt processor="trax"
+ in="${tuscany.acceptance.tc.dir}/conf/server.xml.original" style="datasource.xsl"
+ out="${tuscany.acceptance.tc.dir}/conf/server.xml">
+ <param name="database_location" expression="jdbc:derby:../Databases/dastest"/>
+ <param name="database_location_ajax" expression="jdbc:derby:../Databases/ajaxdastest"/>
+ </xslt>
+
+
+ </target>
+ <target name="tuscany.tomcat.fixcontextxml" depends='init,backup.context.xml' unless='tuscany.acceptance.tomcat.contextxmlorg.available'>
+ <property name="tuscany.acceptance.tomcat.contextxmlorg.available" value='true' />
+ <!-- DO NOTHING AT THIS TIME
+ <xslt
+ in="${tuscany.acceptance.tc.dir}/conf/context.xml.original" style="context.xsl"
+ out="${tuscany.acceptance.tc.dir}/conf/context.xml">
+
+ </xslt>
+ -->
+ </target>
+
+ <target name="startTomcatWindows" if="isWindows" unless='tuscany.tomcat.alreadystarted' >
+ <exec spawn='true' vmlauncher="false" failonerror='false' dir="${tuscany.acceptance.tc.dir}\bin" executable="cmd.exe" >
+ <arg line="/C start &quot; Tomcat running ${tuscany.acceptance.tc.dir}&quot; catalina run &amp;&amp; exit" />
+ </exec>
+ </target>
+ <target name="startTomcatUnix" if="isUnix" unless='tuscany.tomcat.alreadystarted'>
+ <echo level="info" message="Starting Tomcat"/>
+ <exec spawn='true' vmlauncher="false" failonerror='false' dir="${tuscany.acceptance.tc.dir}/bin" executable="xterm" >
+ <arg line="-e ./catalina.sh run"/>
+ </exec>
+ </target>
+ <target name="startTomcatMac" if="isMac" unless='tuscany.tomcat.alreadystarted' >
+ <antcall target="startTomcatUnix" />
+ </target>
+
+ <target name="tuscany.tomcat.alreadystartedmsg" if="tuscany.tomcat.alreadystarted">
+ <echo level="info" message="Tomcat has been already started! ${tuscany.tomcat.alreadystarted}" />
+ </target>
+ <target name="startTomcat" description="Start up tomcat." depends="tuscany.tomcat.alreadystartedmsg,startTomcatWindows,startTomcatUnix,startTomcatMac" unless='tuscany.tomcat.alreadystarted'>
+ <sleep seconds="10"/> <!-- it's going to at least require this -->
+ <waitfor maxwait="15" maxwaitunit="second" checkevery="200">
+ <http url="http://localhost:8080"/>
+ </waitfor>
+
+ </target>
+
+ <target name="clean" description='Clean out all built artifacts'>
+ <delete dir="${tuscany.acceptance.target.dir}" />
+ </target>
+
+ <target name='setup.TC.antscripts' depends='tuscany.tomcat.unzipWindows,tuscany.tomcat.unzipUnix,tuscany.tomcat.unzipMac'>
+ <!-- Configure the custom Ant tasks for the Manager application -->
+ <taskdef resource="org/apache/catalina/ant/catalina.tasks">
+ <classpath>
+ <fileset dir="${tuscany.acceptance.tc.dir}/server/lib">
+ <include name="*.jar" />
+ </fileset>
+ <fileset dir="${tuscany.acceptance.tc.bin.dir}">
+ <include name="*.jar" />
+ </fileset>
+ <fileset dir="${tuscany.acceptance.tc.dir}/bin">
+ <include name="*.jar" />
+ </fileset>
+ </classpath>
+ </taskdef>
+
+ </target>
+
+</project>
+
+
diff --git a/das-java/trunk/samples/testing/tomcat/company-webapp/pom.xml b/das-java/trunk/samples/testing/tomcat/company-webapp/pom.xml
new file mode 100644
index 0000000000..cb4ad55a52
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/company-webapp/pom.xml
@@ -0,0 +1,80 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-samples-testing-tomcat</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>tuscany-das-samples-testing-tomcat-company-webapp</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Testing DAS Sample - Company-webapp</name>
+ <description>Testing Tomcat DAS end user test</description>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>1.9</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>jakarta-regexp</groupId>
+ <artifactId>jakarta-regexp</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-jakarta-regexp</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-xslp</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000000..9597d92eb3
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,353 @@
+
+ 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.
+
+===============================================================================================================
+
+Other components and dependencies under Apache Software License 2.0 :
+
+ log4j-1.2.14.jar - Apache Logging Services
+ derby 10.2.2.0.jar - Apache Derby
+ stax-api-1.0.1.jar - The Streaming API for XML (StAX)
+ wstx-asl-3.2.0.jar - WoodStox StAX implementation
+ standard-1.1.1.jar - The Apache Jackarta Taglibs
+ jstl-1.1.2.jar - The Apache Jackarta Taglibs
+ *.tld - The Apache Jackarta Taglibs
+
+===============================================================================================================
+
+
+Apache Tuscany SDO for Java Subcomponents
+=========================================:
+
+The Tuscany SDO for Java release includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar)
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+
+For the Eclipse EMF components
+(codegen-2.2.3.jar
+codegen-ecore-2.2.3.jar
+common-2.2.3.jar
+ecore-2.2.3.jar
+ecore-change-2.2.3.jar
+ecore-xmi-2.2.3.jar
+xsd-2.2.3.jar)
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED 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. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+===================================================================================================
diff --git a/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..e9d98fc7f5
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,32 @@
+Apache Tuscany SDO for Java
+Copyright 2006, 2007 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other successful
+ASF projects. While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be fully endorsed
+by the ASF.
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE.txt file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+The terms and conditions governing the distribution may refer to the AL or other license
+agreements, notices or terms and conditions. Some of these other license agreements may
+include (but are not limited to):
+
+ . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html)
+
+It is your obligation to read and accept all such terms and conditions prior to use of the
+distribution. If term or condition is provided, please contact the Apache Software Foundation
+to determine what terms and conditions govern that particular distribution.
+
+This product also includes software developed by the Open Service Oriented Architecture organisation
+(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this
+distribution.
diff --git a/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README
new file mode 100644
index 0000000000..9b26d1690a
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/das-java/trunk/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java b/das-java/trunk/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java
new file mode 100644
index 0000000000..faa92d6994
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java
@@ -0,0 +1,249 @@
+/*
+ * 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.test.das;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+public class DasTestCase extends TestCase {
+ public static final String testUrl = "http://localhost:8080/sample-company-webapp/";
+
+ protected WebClient _webClient;
+ protected URL _url;
+
+ protected void setUp() throws Exception {
+ //New HTMLunit web client
+ _webClient = new WebClient();
+ _webClient.setRedirectEnabled(true);
+
+ // Going to have the WebClient connect to this URL
+ _url = new URL(testUrl);
+
+ }
+
+ public void testHomepage() throws Exception {
+ final String TEST_CASE = "HomePage";
+ System.out.print("Running:" + TEST_CASE + "\t\t\t");
+
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+ //System.out.println(page.getTitleText());
+
+ String responseText = page.asText();
+ //System.out.println("html-->\n" + responseText);
+ //check page header
+ assertTrue(-1 != responseText.indexOf("Tuscany DAS Companies WEB Example"));
+ //check table headers
+ assertTrue(-1 != responseText.indexOf("ID"));
+ assertTrue(-1 != responseText.indexOf("Name"));
+ assertTrue(-1 != responseText.indexOf("Department_ID"));
+ assertTrue(-1 != responseText.indexOf("Department_Name"));
+ //check companies values
+ //assertTrue(-1 != responseText.indexOf("51"));
+ assertTrue(-1 != responseText.indexOf("ACME Publishing"));
+ //assertTrue(-1 != responseText.indexOf("53"));
+ assertTrue(-1 != responseText.indexOf("Do-rite plumbing"));
+ //assertTrue(-1 != responseText.indexOf("53"));
+ assertTrue(-1 != responseText.indexOf("MegaCorp"));
+ //check departments
+ assertTrue(-1 != responseText.indexOf("Default Name 2"));
+ assertTrue(-1 != responseText.indexOf("Default Name 3"));
+ assertTrue(-1 != responseText.indexOf("Default Name 4"));
+ assertTrue(-1 != responseText.indexOf("Default Name 5"));
+ assertTrue(-1 != responseText.indexOf("Default Name 6"));
+ assertTrue(-1 != responseText.indexOf("Default Name 7"));
+ assertTrue(-1 != responseText.indexOf("Default Name 8"));
+
+ System.out.println("SUCCESS!!!");
+ }
+
+
+ public void testAllCompanies() throws Exception{
+ final String TEST_CASE = "AllCompanies";
+ System.out.print("Running:" + TEST_CASE + "\t\t\t");
+
+ // Get the first page
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+
+ // Get the form that we are dealing with and within that form,
+ // find the submit button and the field that we want to change.
+ final HtmlForm form = (HtmlForm) page.getForms().get(0);
+ final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doFill");
+ // Now submit the form by clicking the button
+ final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click();
+
+ //verify the resultPage
+ String responseText = resultPage.asText();
+ //System.out.println("html-->\n" + responseText);
+ // check table headers
+ assertTrue(-1 != responseText.indexOf("ID"));
+ assertTrue(-1 != responseText.indexOf("Name"));
+ //check table values
+ //assertTrue(-1 != responseText.indexOf("51"));
+ assertTrue(-1 != responseText.indexOf("ACME Publishing"));
+ //assertTrue(-1 != responseText.indexOf("52"));
+ assertTrue(-1 != responseText.indexOf("Do-rite plumbing"));
+ //assertTrue(-1 != responseText.indexOf("53"));
+ assertTrue(-1 != responseText.indexOf("MegaCorp"));
+
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testAllCompaniesDepartments() throws Exception{
+ final String TEST_CASE = "AllCompaniesDepartments";
+ System.out.print("Running:" + TEST_CASE + "\t\t");
+
+ // Get the first page
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+
+ // Get the form that we are dealing with and within that form,
+ // find the submit button and the field that we want to change.
+ final HtmlForm form = (HtmlForm) page.getForms().get(0);
+ final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doFillAll");
+ // Now submit the form by clicking the button
+ final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click();
+
+ //verify the resultPage
+ String responseText = resultPage.asText();
+ //System.out.println("html-->\n" + responseText);
+ //check table headers
+ assertTrue(-1 != responseText.indexOf("ID"));
+ assertTrue(-1 != responseText.indexOf("Name"));
+ assertTrue(-1 != responseText.indexOf("Department_ID"));
+ assertTrue(-1 != responseText.indexOf("Department_Name"));
+ //check companies values
+ //assertTrue(-1 != responseText.indexOf("51"));
+ assertTrue(-1 != responseText.indexOf("ACME Publishing"));
+ //assertTrue(-1 != responseText.indexOf("53"));
+ assertTrue(-1 != responseText.indexOf("Do-rite plumbing"));
+ //assertTrue(-1 != responseText.indexOf("53"));
+ assertTrue(-1 != responseText.indexOf("MegaCorp"));
+ //check departments
+ assertTrue(-1 != responseText.indexOf("Default Name 2"));
+ assertTrue(-1 != responseText.indexOf("Default Name 3"));
+ assertTrue(-1 != responseText.indexOf("Default Name 4"));
+ assertTrue(-1 != responseText.indexOf("Default Name 5"));
+ assertTrue(-1 != responseText.indexOf("Default Name 6"));
+ assertTrue(-1 != responseText.indexOf("Default Name 7"));
+ assertTrue(-1 != responseText.indexOf("Default Name 8"));
+
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testAddDepartmentToFirstCompany() throws Exception{
+ final String TEST_CASE = "AddDepartmentToFirstCompany";
+ System.out.print("Running:" + TEST_CASE + "\t");
+
+ // Get the first page
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+
+ // Get the form that we are dealing with and within that form,
+ // find the submit button and the field that we want to change.
+ final HtmlForm form = (HtmlForm) page.getForms().get(0);
+ final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doAddDepartment");
+ // Now submit the form by clicking the button
+ final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click();
+
+ //verify the resultPage
+ String responseText = resultPage.asText();
+ //System.out.println("html-->\n" + responseText);
+ //check new department
+ assertTrue(-1 != responseText.indexOf("8"));
+
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testChangeCompanyDepartmentNames() throws Exception{
+ final String TEST_CASE = "ChangeCompanyDepartmentNames";
+ System.out.print("Running:" + TEST_CASE + "\t");
+
+ // Get the first page
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+
+ // Get the form that we are dealing with and within that form,
+ // find the submit button and the field that we want to change.
+ final HtmlForm form = (HtmlForm) page.getForms().get(0);
+ final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doChangeDepartmentNames");
+ // Now submit the form by clicking the button
+ final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click();
+
+ //verify the resultPage
+ String responseText = resultPage.asText();
+ //System.out.println("html-->\n" + responseText);
+ //check update departments
+ assertTrue(-1 != responseText.indexOf("Dept-"));
+ //also, check to not have old departments names (default name)
+ assertTrue(-1 == responseText.indexOf("Default Name"));
+
+ System.out.println("SUCCESS!!!");
+ }
+
+ public void testDeleteCompanyOneDepartments() throws Exception{
+ final String TEST_CASE = "DeleteCompanyOneDepartments";
+ System.out.print("Running:" + TEST_CASE + "\t");
+
+ // Get the first page
+ final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
+
+ // Get the form that we are dealing with and within that form,
+ // find the submit button and the field that we want to change.
+ final HtmlForm form = (HtmlForm) page.getForms().get(0);
+ final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doDeleteDepartments");
+ // Now submit the form by clicking the button
+ final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click();
+
+ //verify the resultPage
+ String responseText = resultPage.asText();
+ //System.out.println("html-->\n" + responseText);
+ //check that al the company 1 departments are gone..
+ assertTrue(-1 == responseText.indexOf("Default Name 2"));
+ assertTrue(-1 == responseText.indexOf("Default Name 3"));
+ assertTrue(-1 == responseText.indexOf("Default Name 4"));
+ assertTrue(-1 == responseText.indexOf("Default Name 5"));
+ assertTrue(-1 == responseText.indexOf("Default Name 6"));
+ assertTrue(-1 == responseText.indexOf("Default Name 7"));
+ assertTrue(-1 == responseText.indexOf("Default Name 8"));
+
+ System.out.println("SUCCESS!!!");
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ DasTestCase t = new DasTestCase();
+ try{
+ t.testHomepage();
+ t.testAllCompanies();
+ t.testAllCompaniesDepartments();
+ t.testAddDepartmentToFirstCompany();
+ t.testChangeCompanyDepartmentNames();
+ t.testDeleteCompanyOneDepartments();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/das-java/trunk/samples/testing/tomcat/context.xsl b/das-java/trunk/samples/testing/tomcat/context.xsl
new file mode 100644
index 0000000000..35a78a43a5
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/context.xsl
@@ -0,0 +1,51 @@
+<!--
+ 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.
+ -->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output indent="yes" />
+
+ <xsl:param name="classname"/>
+ <!-- xsl:template match="node() | @*">
+ <xsl:copy>
+ <xsl:apply-templates select="node() | @*"/>
+ </xsl:copy>
+ </xsl:template -->
+ <xsl:template
+ match="@* | * | comment() | processing-instruction() | text()">
+ <xsl:copy>
+ <xsl:apply-templates
+ select="@* | * | comment() | processing-instruction() | text()" />
+ </xsl:copy>
+ </xsl:template>
+
+<!--
+ <xsl:template match="Context">
+ <Context>
+ <xsl:apply-templates select="@*" />
+ <Listener className="org.apache.tuscany.tomcat.lifecycle.listener.TomcatWebAppLifecycleListener" />
+ <xsl:apply-templates
+ select="@* | * | comment() | processing-instruction() | text()" />
+ </Context>
+ </xsl:template>
+-->
+
+ <!-- xsl:template match="/">
+ <xsl:apply-templates select="node() | @*" />
+ </xsl:template -->
+</xsl:stylesheet>
diff --git a/das-java/trunk/samples/testing/tomcat/datasource.xsl b/das-java/trunk/samples/testing/tomcat/datasource.xsl
new file mode 100644
index 0000000000..ffd17f3271
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/datasource.xsl
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+ -->
+
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
+
+<xsl:output method="xml" indent="yes"/>
+
+ <xsl:param name="database_location"/>
+ <xsl:param name="database_location_ajax"/>
+
+<!--Add derby database resource-->
+<xsl:template match="GlobalNamingResources">
+
+ <xsl:copy>
+ <!--Copy existing-->
+ <xsl:apply-templates select="@* | node()" />
+
+ <xsl:comment> Global Datasource for Derby dastest database </xsl:comment>
+ <xsl:text>
+ </xsl:text>
+ <!--Append this-->
+ <Resource name="jdbc/dastest"
+ type="javax.sql.DataSource" auth="Container"
+ description="Derby database for DAS Company sample"
+ maxActive="100" maxIdle="30" maxWait="10000"
+ username="" password=""
+ driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
+ url="{$database_location};create=true"/>
+ <Resource name="jdbc/ajaxdastest"
+ type="javax.sql.DataSource" auth="Container"
+ description="Derby database for Ajax DAS Web sample"
+ maxActive="100" maxIdle="30" maxWait="10000"
+ username="" password=""
+ driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
+ url="{$database_location_ajax};create=true"/>
+ </xsl:copy>
+
+</xsl:template>
+
+<!--Copy everything!-->
+<xsl:template match="node() | @*">
+ <xsl:copy>
+ <xsl:apply-templates select="@* | node()" />
+ </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet> \ No newline at end of file
diff --git a/das-java/trunk/samples/testing/tomcat/pom.xml b/das-java/trunk/samples/testing/tomcat/pom.xml
new file mode 100644
index 0000000000..6ab37dccab
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/pom.xml
@@ -0,0 +1,112 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-samples</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>tuscany-das-samples-testing-tomcat</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Testing in Tomcat</name>
+
+ <modules>
+ <module>company-webapp</module>
+ <module>advanced-webapp</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ <testResources>
+ <testResource>
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**/*.componentType</include>
+ </includes>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </testResource>
+ </testResources>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>prepareTomcat</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <ant inheritRefs='true' antfile="build.xml" dir="${basedir}/.." target="startTestServer">
+ <property name="user.home" value="${user.home}" />
+ <property name="target.dir" value="${basedir}/../target" />
+
+ <!-- property name="tuscany.maven.repos.dir" value="${maven.local.repo}"/ -->
+ </ant>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>cleanupTomcat</id>
+ <phase>clean</phase>
+ <configuration>
+ <tasks>
+ <ant inheritRefs='true' antfile="build.xml" dir="${basedir}/.." target="clean">
+ <property name="target.dir" value="${basedir}/target" />
+ </ant>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <defaultGoal>test</defaultGoal>
+ </build>
+</project>
diff --git a/das-java/trunk/samples/testing/tomcat/readme.htm b/das-java/trunk/samples/testing/tomcat/readme.htm
new file mode 100644
index 0000000000..e7fd28a4ac
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/readme.htm
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+<!--
+ 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.
+ -->
+<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <meta content="text/css" http-equiv="Content-Style-Type"><title>Tuscany End User Sample Testing</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" -->
+<style type="text/css" media="all">
+@import url("../../../css/maven-base.css");
+@import url("../../../css/maven-theme.css");
+@import url("../../../css/site.css");
+</style><link rel="stylesheet" href="./css/print.css" type="text/css" media="print"></head>
+<body>
+<h2>Tuscany End User Sample Testing</h2>
+<h3>Initial Setup</h3>&nbsp;
+&nbsp; &nbsp;Most of the following only needs to be done once
+unless noted otherwise.<br>
+<ul>
+<li>Be sure JAVA_HOME variable is pointing to a Java JDK directory.</li>
+<li>Follow the steps to build Tuscany DAS Companyweb sample application from <a target="_blank" href="http://incubator.apache.org/tuscany/das-java-developer-guide.html">DAS Java Developer Guide</a>.</li>
+
+<li>Change directory
+to <span style="font-weight: bold;">java/das/samples/testing/tomcat</span>.</li>
+
+<li>Download
+Tomcat Core 6.0.<span style="font-style: italic;"><span style="color: rgb(255, 102, 102);">xx</span>&nbsp;</span>zip
+for Windows or &nbsp;tar.gz for Linux &nbsp;from <a href="http://tomcat.apache.org/download-60.cgi" target="_blank">Apache
+Tomcat</a>.</li>
+
+<li>You can place the tomcat distribution in your java/samples/das/testing/tomcat directory or, alternatively, you can create/edit {user home}/build.properties to
+change the property <b>tuscany.acceptance.tomcat.zipped</b> to tell the build
+environment where the tomcat distribution zip file is located. </li>
+<li>You may have to edit build.xml &nbsp;to change the property <span style="font-weight: bold;">tuscany.acceptance.tomcat.version</span>
+to match the&nbsp;<span style="font-style: italic;"><span style="color: rgb(255, 102, 102);">xx</span></span>
+to the specific version that you downloaded.</li>
+</ul>
+
+<h3>&nbsp;Running</h3>In
+the <span style="font-weight: bold;">java/das/samples/testing/tomcat </span>
+directory<b> </b>run maven:<br><code>mvn</code><br><h3>Explanation</h3>Maven&nbsp;does
+the following:<br><ul><li>Unpacks the
+Tomcat distribution into the target directory to ensure a pristine
+environment.</li><li>It adds the appropriate Tuscany and it
+dependencies jars into Tomcat <a href="../../companyweb/readme.htm#Tomcat_Setup" target="_blank"><small><span style="font-style: italic;">(for more&nbsp; details)</span></small></a></li><li>Does
+the necessary changes
+to Tomcat's configuration as required.&nbsp;<a href="../../companyweb/readme.htm#Tomcat_Setup" target="_blank"><small><span style="font-style: italic;">(for more&nbsp; details)</span></small></a></li><li>Deploys
+Tuscany's DAS sample war files into Tomcat.</li><li>Starts
+Tomcat (You should see another window running Tomcat)&nbsp;</li><li>Begins
+running HTML unit tests that should closely match running the samples
+as a user would.</li></ul>If all goes well at the end you
+should see:<br>
+<pre>[INFO] ----------------------------------------------------------------------------
+[INFO] Reactor Summary:
+[INFO] ----------------------------------------------------------------------------
+[INFO] Tuscany Testing in Tomcat .............................. SUCCESS [0.961s]
+[INFO] Tuscany Testing Tomcat DAS Sample - Companyweb ......... SUCCESS [1:09.771s]
+[INFO] Tuscany Testing Ajax DAS Web Sample .................... SUCCESS [47.458s]
+[INFO] ----------------------------------------------------------------------------
+[INFO] ----------------------------------------------------------------------------
+[INFO] BUILD SUCCESSFUL<br>
+[INFO] ----------------------------------------------------------------------------
+[INFO] Total time: 1 minute 59 seconds
+[INFO] Finished at: Sun Jun 10 01:23:19 VET 2007
+[INFO] Final Memory: 9M/17M
+[INFO] ----------------------------------------------------------------------------<br>
+</pre><h3>Cleanup</h3>Close
+the Tomcat window and issue <code>mvn clean</code>.<p><b><font size="4">Note</font></b></p>
+<p>Because the html unit tests execute multiple user actions that change the contents of the database tables, is recommended
+that you always run these tests in a clean environment (after a mvn clean),
+otherwise you may experience failure on some tests as the expected result data might have been affected by previous test runs.</p>
+
+</body></html> \ No newline at end of file
diff --git a/das-java/trunk/samples/testing/tomcat/server.xsl b/das-java/trunk/samples/testing/tomcat/server.xsl
new file mode 100644
index 0000000000..b53d1d50c7
--- /dev/null
+++ b/das-java/trunk/samples/testing/tomcat/server.xsl
@@ -0,0 +1,51 @@
+<!--
+ 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.
+ -->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output indent="yes" />
+
+ <xsl:param name="classname"/>
+ <!-- xsl:template match="node() | @*">
+ <xsl:copy>
+ <xsl:apply-templates select="node() | @*"/>
+ </xsl:copy>
+ </xsl:template -->
+ <xsl:template
+ match="@* | * | comment() | processing-instruction() | text()">
+ <xsl:copy>
+ <xsl:apply-templates
+ select="@* | * | comment() | processing-instruction() | text()" />
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="Host">
+ <Host>
+ <xsl:attribute name="className">
+ <xsl:text>org.apache.tuscany.tomcat.TuscanyHost</xsl:text>
+ </xsl:attribute>
+ <xsl:apply-templates select="@*" />
+ <xsl:apply-templates
+ select="@* | * | comment() | processing-instruction() | text()" />
+ </Host>
+ </xsl:template>
+
+ <!-- xsl:template match="/">
+ <xsl:apply-templates select="node() | @*" />
+ </xsl:template -->
+</xsl:stylesheet>
diff --git a/das-java/trunk/samples/transaction/build.xml b/das-java/trunk/samples/transaction/build.xml
new file mode 100644
index 0000000000..5289215be5
--- /dev/null
+++ b/das-java/trunk/samples/transaction/build.xml
@@ -0,0 +1,46 @@
+<!--
+ * 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.
+-->
+<project name="transaction" default="run">
+ <property name="test.class" value="org.apache.tuscany.samples.das.tx.sample.MoneyTransfer" />
+ <property name="test.jar" value="sample-transaction.jar" />
+
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <arg value="commit"/>
+ <arg value="1200"/>
+ <classpath>
+ <pathelement path="${classpath}"/>
+ <fileset dir="../../lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ <pathelement location="mysql-connector-java-5.0.4.jar"/>
+ <pathelement location="commons-logging-1.0.4.jar"/>
+ <pathelement location="geronimo-jta_1.1_spec-1.1.jar"/>
+ <pathelement location="geronimo-transaction-2.0.1.jar"/>
+ <pathelement location="geronimo-j2ee-connector_1.5_spec-1.1.1.jar"/>
+ <pathelement location="tuscany-das-sample-dbconfig-1.0-SNAPSHOT.jar"/>
+ <pathelement path="${test.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+</project>
+
diff --git a/das-java/trunk/samples/transaction/pom.xml b/das-java/trunk/samples/transaction/pom.xml
new file mode 100644
index 0000000000..f6e50d779e
--- /dev/null
+++ b/das-java/trunk/samples/transaction/pom.xml
@@ -0,0 +1,148 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-samples</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>tuscany-das-sample-transaction</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany DAS J2SE Transaction Sample Using Transaction Manager</name>
+ <description>Sample use of RDB DAS in a J2SE application with Transaction Manager</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das-rdb</artifactId>
+ <version>${das.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.das.samples</groupId>
+ <artifactId>tuscany-das-sample-dbconfig</artifactId>
+ <version>${das.version}</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.0.4</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.components</groupId>
+ <artifactId>geronimo-transaction</artifactId>
+ <version>2.0.1</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>mx4j</artifactId>
+ <groupId>mx4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-jelly-tags-velocity</artifactId>
+ <groupId>commons-jelly</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>velocity</artifactId>
+ <groupId>velocity</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-core</artifactId>
+ <groupId>org.apache.geronimo.modules</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-kernel</artifactId>
+ <groupId>org.apache.geronimo.modules</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-system</artifactId>
+ <groupId>org.apache.geronimo.modules</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-j2ee</artifactId>
+ <groupId>org.apache.geronimo.modules</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <!-- this will place the java source files inside the jar -->
+ <build>
+ <finalName>sample-transaction</finalName>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.samples.das.tx.sample.MoneyTransfer</mainClass>
+ <addClasspath>true</addClasspath>
+ <!-- classpathPrefix>../../lib/</classpathPrefix -->
+ </manifest>
+
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/das-java/trunk/samples/transaction/readme.htm b/das-java/trunk/samples/transaction/readme.htm
new file mode 100644
index 0000000000..6cf450d41a
--- /dev/null
+++ b/das-java/trunk/samples/transaction/readme.htm
@@ -0,0 +1,449 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+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>Tuscany RDB DAS Sample</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Author>IBM_User</o:Author>
+ <o:LastAuthor>IBM_User</o:LastAuthor>
+ <o:Revision>59</o:Revision>
+ <o:TotalTime>329</o:TotalTime>
+ <o:Created>2007-09-05T11:09:00Z</o:Created>
+ <o:LastSaved>2007-09-19T11:43:00Z</o:LastSaved>
+ <o:Pages>1</o:Pages>
+ <o:Words>593</o:Words>
+ <o:Characters>3384</o:Characters>
+ <o:Company>IBM</o:Company>
+ <o:Lines>28</o:Lines>
+ <o:Paragraphs>7</o:Paragraphs>
+ <o:CharactersWithSpaces>3970</o:CharactersWithSpaces>
+ <o:Version>10.3501</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:Compatibility>
+ <w:ApplyBreakingRules/>
+ <w:UseFELayout/>
+ </w:Compatibility>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![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-margin-top-alt:auto;
+ margin-right:0in;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ mso-outline-level:1;
+ font-size:24.0pt;
+ font-family:"Times New Roman";
+ font-weight:bold;}
+h2
+ {mso-margin-top-alt:auto;
+ margin-right:0in;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ mso-outline-level:2;
+ font-size:18.0pt;
+ font-family:"Times New Roman";
+ font-weight:bold;}
+a:link, span.MsoHyperlink
+ {color:blue;
+ text-decoration:underline;
+ text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+ {color:blue;
+ text-decoration:underline;
+ text-underline:single;}
+p
+ {mso-margin-top-alt:auto;
+ margin-right:0in;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:SimSun;}
+@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;}
+-->
+</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]-->
+<meta name=CREATED content="20070704;1002817">
+<meta name=CHANGEDBY content="a a">
+<meta name=CHANGED content="20070704;2123396">
+<!-- <pre><a name="header-text">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
+&quot;License&quot;); 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
+&quot;AS IS&quot; 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. </a></pre>
+
+-->
+</head>
+
+<body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<h1 style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'>RDB DAS Transaction Sample<o:p></o:p></span></h1>
+
+<h2 style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'><o:p>&nbsp;</o:p></span></h2>
+
+<h2 style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'>Introduction<o:p></o:p></span></h2>
+
+<p style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'>This stand-alone sample demonstrates the RDB Data Access Service
+transaction management with external Transaction Manager. This example uses Geronimo
+<span style='mso-spacerun:yes'> </span>as the transaction manager. <o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><b><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><o:p>&nbsp;</o:p></span></b></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><b><span lang=PT-BR
+style='font-size:18.0pt;mso-ansi-language:PT-BR'>Example</span></b><span
+lang=PT-BR style='font-size:18.0pt;mso-ansi-language:PT-BR'><o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'>In this MoneyTransfer example,user entered amount will be withdrawn from
+one of his bankaccount using one call to das.applyChanges(dataGraph1) and same
+amount will<span style='mso-spacerun:yes'>  </span>be deposited to his another
+account using another call to das.applyChanges(dataGraph2). Based on whether
+user selects commit/rollback, these 2 applyChanges() will behave identically.
+i.e. both will commit or both will rollback, but partial transaction will not
+happen. Example build.xml - sets for transfer of 1200 from Account1 to Account2
+[commit].<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><b><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><o:p>&nbsp;</o:p></span></b></p>
+
+<h2 style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'>Building and Running<o:p></o:p></span></h2>
+
+<p style='margin:0in;margin-bottom:.0001pt'><b><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'> </span></span></b><span
+lang=PT-BR style='mso-ansi-language:PT-BR'>From binary distribution, <b>base
+directory</b> is {DAS_ROOT}\ samples\transaction. Refer to below settings from
+this base directory.<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'>1]BankAccounts.xml available in sample-transaction.jar, is the DAS
+config file. Note that, as transaction is externally managed, this uses
+managedtx=false setting.<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'><o:p>&nbsp;</o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'>2]MySQL server should be running. The example uses MySQL DB (with innoDB
+ON to support transaction). Database <b>dastest, </b>table <b>bankaccount</b> and
+data will be created during sample run. For this preconfigured
+BankAccountDBConfig.xml available in sample-transaction.jar, will be used. User
+needs to set correct values for url, login etc. in this.<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'><o:p>&nbsp;</o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'>3] Apache Ant latest version should be installed.Download Apache Ant
+latest version on and extract into folder &lt;apache_ant_folder&gt;. You can
+find it here: <a href="http://ant.apache.org/bindownload.cgi">http://ant.apache.org/bindownload.cgi</a>.Add
+&lt;apache_ant_folder&gt;/bin directory to your OS path variable.<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'><o:p>&nbsp;</o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'>4] From <b>base directory </b>run-<span style='mso-spacerun:yes'> 
+</span>ant<o:p></o:p></span></p>
+
+<h2 style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'><o:p>&nbsp;</o:p></span></h2>
+
+<p style='margin:0in;margin-bottom:.0001pt'><span lang=PT-BR style='mso-ansi-language:
+PT-BR'>The sample will run and output the following: <o:p></o:p></span></p>
+
+<div style='border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .5pt;
+padding:1.0pt 4.0pt 1.0pt 4.0pt'>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>Buildfile: build.xml<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><o:p>&nbsp;</o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>run:<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+INIT database<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+INIT transaction manager<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+Wed Sep 19 17:09:42 IST 2007 DEBUG: Executing XA statement: XA START<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'> </span>0x01000000000000004bceb90109b6b0f3000000000000000000000000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>000000000000000000000000000000000000000000000000000,0x00000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>00000000000000000000000000000000000000000000000000000000000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>0000000000000000000000,0x4765526f<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+Get a connection<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+Before transaction, table is:<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]<span
+style='mso-spacerun:yes'>     </span>id<span style='mso-spacerun:yes'>     
+</span>name<span style='mso-spacerun:yes'>    </span>balance<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]<span
+style='mso-spacerun:yes'>     </span>1<span style='mso-spacerun:yes'>      
+</span>John Feng<span style='mso-spacerun:yes'>       </span>1200<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]<span
+style='mso-spacerun:yes'>     </span>2<span style='mso-spacerun:yes'>      
+</span>John Feng<span style='mso-spacerun:yes'>       </span>0<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+Begin a transaction<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+Update the table - 2 accounts<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+*commit* the transaction<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+Wed Sep 19 17:09:45 IST 2007 DEBUG: Executing XA statement: XA END 0<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>x01000000000000004bceb90109b6b0f300000000000000000000000000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>0000000000000000000000000000000000000000000000000,0x0000000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>00000000000000000000000000000000000000000000000000000000000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>00000000000000000000,0x4765526f<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+Wed Sep 19 17:09:45 IST 2007 DEBUG: Executing XA statement: XA PREPA<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>RE 0x01000000000000004bceb90109b6b0f30000000000000000000000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>00000000000000000000000000000000000000000000000000000,0x000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>00000000000000000000000000000000000000000000000000000000000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>000000000000000000000000,0x4765526f<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+Wed Sep 19 17:09:45 IST 2007 DEBUG: Executing XA statement: XA COMMI<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>T 0x01000000000000004bceb90109b6b0f300000000000000000000000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>0000000000000000000000000000000000000000000000000000,0x0000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>00000000000000000000000000000000000000000000000000000000000000000000000000000000<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>00000000000000000000000,0x4765526f<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+After transaction, table is:<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]<span
+style='mso-spacerun:yes'>     </span>id<span style='mso-spacerun:yes'>     
+</span>name<span style='mso-spacerun:yes'>    </span>balance<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]<span
+style='mso-spacerun:yes'>     </span>1<span style='mso-spacerun:yes'>      
+</span>John Feng<span style='mso-spacerun:yes'>       </span>0<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]<span
+style='mso-spacerun:yes'>     </span>2<span style='mso-spacerun:yes'>      
+</span>John Feng<span style='mso-spacerun:yes'>       </span>1200<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+Cleanup<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]
+End MoneyTransfer<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><span style='mso-spacerun:yes'>     </span>[java]<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'><o:p>&nbsp;</o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>BUILD SUCCESSFUL<o:p></o:p></span></p>
+
+<p style='margin:0in;margin-bottom:.0001pt;border:none;mso-border-alt:solid windowtext .5pt;
+padding:0in;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>Total time: 8 seconds<o:p></o:p></span></p>
+
+</div>
+
+<p style='margin:0in;margin-bottom:.0001pt'><b><span lang=PT-BR
+style='mso-ansi-language:PT-BR'>Observation:</span></b><span lang=PT-BR
+style='mso-ansi-language:PT-BR'> The build.xml ant file only works on DAS Java binary
+distribution.<o:p></o:p></span></p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java
new file mode 100644
index 0000000000..fbcbe1a5f7
--- /dev/null
+++ b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java
@@ -0,0 +1,67 @@
+/*
+ * 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.databaseSetup;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+
+import org.apache.tuscany.das.rdb.dbconfig.DBConfig;
+import org.apache.tuscany.das.rdb.dbconfig.DBConfigUtil;
+import org.apache.tuscany.das.rdb.dbconfig.DBInitializer;
+import org.apache.tuscany.samples.das.tx.manager.GeronimoTransactionManagerUtil;
+
+/**
+ * Setup database, XA resources required by the sample
+ *
+ *
+ */
+public class DatabaseSetupUtil {
+ private static DBConfig dbConfig = null;
+ /**
+ * Constructor for DatabaseSetupUtil.
+ */
+ public DatabaseSetupUtil(String dbConfigFile) throws Exception {
+ //create database tables, data
+ DBInitializer dbInitializer = new DBInitializer(dbConfigFile);
+ dbInitializer.refreshDatabaseData();
+ //read DAS Config
+ dbConfig = DBConfigUtil.loadDBConfig(ClassLoader.getSystemResourceAsStream(dbConfigFile));
+ }
+
+ public static DBConfig getDBConfig() {
+ return DatabaseSetupUtil.dbConfig;
+ }
+
+ public static void main(String[] args) throws Exception{
+ //test program
+ new DatabaseSetupUtil("BankAccountDBConfig.xml");
+ GeronimoTransactionManagerUtil tmUtil = new GeronimoTransactionManagerUtil();
+ tmUtil.initTransactionManager();
+ tmUtil.startTransaction();
+ Connection conn = tmUtil.getConnection();
+
+ ResultSet rs = conn.createStatement().executeQuery("select id, balance from bankaccount");
+ while(rs.next()){
+ System.out.println("result row: "+rs.getInt(1)+","+rs.getString(2));
+ }
+
+ tmUtil.commitTransaction();
+
+ }
+}
diff --git a/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java
new file mode 100644
index 0000000000..ee106bec0c
--- /dev/null
+++ b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java
@@ -0,0 +1,118 @@
+/*
+ * 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.tx.manager;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
+import org.apache.geronimo.transaction.manager.XidFactoryImpl;
+
+/**
+ * A <code>TransactionManager</code> that delegates to a Geronimo JTA transaction manager. This class serves as a
+ * wrapper for initializing the Geronimo TM as a system service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class GeronimoTransactionManagerService implements TransactionManager {
+ private TransactionManager transactionManager;
+ private int timeout = 250;
+
+ public GeronimoTransactionManagerService() {
+ }
+
+ /**
+ * Returns the transaction timeout in seconds
+ *
+ * @return the transaction timeout in seconds
+ */
+ public int getTimeout() {
+ return timeout;
+ }
+
+ /**
+ * Sets the transaction timeout in seconds
+ */
+ public void setTimeout(int timeout) {
+ this.timeout = timeout;
+ }
+
+ public void init() throws Exception {
+ XidFactoryImpl factory = new XidFactoryImpl();
+ transactionManager = new TransactionManagerImpl(timeout, factory, null);
+ }
+
+ public void begin() throws NotSupportedException, SystemException {
+ transactionManager.begin();
+ }
+
+ public void commit() throws HeuristicMixedException,
+ HeuristicRollbackException,
+ IllegalStateException,
+ RollbackException,
+ SecurityException,
+ SystemException {
+ transactionManager.commit();
+ }
+
+ public TransactionManager getTransactionManager() {
+ return transactionManager;
+ }
+
+ public int getStatus() throws SystemException {
+ return transactionManager.getStatus();
+ }
+
+ public Transaction getTransaction() throws SystemException {
+ return transactionManager.getTransaction();
+ }
+
+ public void resume(Transaction transaction)
+ throws IllegalStateException, InvalidTransactionException, SystemException {
+ transactionManager.resume(transaction);
+ }
+
+ public void rollback() throws IllegalStateException, SecurityException, SystemException {
+ transactionManager.rollback();
+ }
+
+ public void setRollbackOnly() throws IllegalStateException, SystemException {
+ transactionManager.setRollbackOnly();
+ }
+
+ public void setTransactionTimeout(int i) throws SystemException {
+ transactionManager.setTransactionTimeout(i);
+ }
+
+ public Transaction suspend() throws SystemException {
+ return transactionManager.suspend();
+ }
+
+ public void begin(long timeout) throws NotSupportedException, SystemException {
+ transactionManager.begin();
+ return;
+ }
+
+}
diff --git a/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java
new file mode 100644
index 0000000000..084e735117
--- /dev/null
+++ b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java
@@ -0,0 +1,122 @@
+/*
+ * 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.tx.manager;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import javax.sql.XAConnection;
+import javax.sql.XADataSource;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.apache.geronimo.transaction.manager.XidFactory;
+import org.apache.geronimo.transaction.manager.XidFactoryImpl;
+import org.apache.tuscany.das.rdb.dbconfig.DBConfig;
+import org.apache.tuscany.samples.das.databaseSetup.DatabaseSetupUtil;
+
+import com.mysql.jdbc.jdbc2.optional.MysqlXADataSource;
+
+public class GeronimoTransactionManagerUtil {
+ private GeronimoTransactionManagerService service;
+ private static XADataSource xads;
+ private static XAConnection xaconn = null;
+ private static XAResource xares = null;
+ private static XidFactory xidFact = null;
+ private static Xid xid = null;
+
+ public void initTransactionManager() {
+ // Get a transction manager
+ try {
+ xidFact = new XidFactoryImpl();
+ // creates an instance of Geronimo TM Service
+ service = new GeronimoTransactionManagerService();
+ service.init();
+ service.begin();
+ initDataSource();
+ initXAConnection();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ private void initDataSource() {
+ //setup XADataSource
+ xads = new MysqlXADataSource();
+ try {
+ DBConfig dbcfg = DatabaseSetupUtil.getDBConfig();
+ ((MysqlXADataSource) xads).setUser(dbcfg.getConnectionInfo().getConnectionProperties().getUserName());
+ ((MysqlXADataSource) xads).setPassword(dbcfg.getConnectionInfo().getConnectionProperties().getPassword());
+ ((MysqlXADataSource) xads).setUrl(dbcfg.getConnectionInfo().getConnectionProperties().getDatabaseURL());
+ ((MysqlXADataSource) xads).setURL(dbcfg.getConnectionInfo().getConnectionProperties().getDatabaseURL());
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ private void initXAConnection() throws SQLException{
+ DBConfig dbcfg = DatabaseSetupUtil.getDBConfig();
+ xaconn = xads.getXAConnection(dbcfg.getConnectionInfo().getConnectionProperties().getUserName(),
+ dbcfg.getConnectionInfo().getConnectionProperties().getPassword());
+ }
+
+ public void startTransaction() throws Exception {
+ try{
+ //create XAResource
+ xid= xidFact.createXid();
+ xares = xaconn.getXAResource();
+ xares.setTransactionTimeout(250); //something
+ xares.start(xid, XAResource.TMNOFLAGS);
+ return;
+ }catch(Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ public void commitTransaction() throws Exception {
+ xares.end(xid, XAResource.TMSUCCESS);
+ xares.prepare(xid);
+ xares.commit(xid, false); //onePhase=true/false
+ }
+
+ public void rollbackTransaction() throws Exception {
+ xares.end(xid, XAResource.TMFAIL);
+ xares.prepare(xid);
+ xares.rollback(xid);
+ }
+
+ public Connection getConnection() throws SQLException {
+ return xaconn.getConnection();
+ }
+
+ /**
+ * cleanup
+ */
+ public void cleanup() throws Exception{
+ xaconn.close();
+ xid = null;
+ xares = null;
+ xaconn = null;
+ xads = null;
+ service.commit();
+ }
+}
diff --git a/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java
new file mode 100644
index 0000000000..650f60f089
--- /dev/null
+++ b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java
@@ -0,0 +1,193 @@
+/*
+ * 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.tx.sample;
+
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.samples.das.databaseSetup.DatabaseSetupUtil;
+import org.apache.tuscany.samples.das.tx.manager.GeronimoTransactionManagerUtil;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Sample using Geronimo TM to execute multiple DAS applyChanges() under one transaction.
+ *
+ */
+public class MoneyTransfer {
+
+ private static final String USAGE = "usage: java MoneyTransfer [commit|rollback] [transferAmount]";
+ private static final String SQL_REQUEST = "select id, name, balance from bankaccount";
+ private static Connection conn = null;
+ private static DAS das = null;
+
+ private static void printTable() {
+ try {
+ Statement stmt = conn.createStatement();
+ ResultSet rset = stmt.executeQuery(SQL_REQUEST);
+ int numcols = rset.getMetaData().getColumnCount();
+ for (int i = 1; i <= numcols; i++) {
+ System.out.print("\t" + rset.getMetaData().getColumnName(i));
+ }
+ System.out.println();
+ while (rset.next()) {
+ for (int i = 1; i <= numcols; i++) {
+ System.out.print("\t" + rset.getString(i));
+ }
+ System.out.println("");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) {
+ GeronimoTransactionManagerUtil tmUtil = null;
+
+ if (args.length != 2 || (!args[0].equals("commit") && !args[0].equals("rollback"))) {
+ System.out.println(USAGE + "\n");
+ System.exit(1);
+ }
+
+ String completion = args[0];
+ float transferAmount = 0;
+ try {
+ transferAmount = Float.parseFloat(args[1]);
+ } catch (NumberFormatException e) {
+ System.out.println(USAGE);
+ System.out.println("[transferAmount] has to be a float\n");
+ System.exit(1);
+ }
+
+ System.out.println("INIT database");
+ try{
+ new DatabaseSetupUtil("BankAccountDBConfig.xml");
+ }catch(Exception e){
+ e.printStackTrace();
+ System.exit(1);
+ }
+
+ try {
+ System.out.println("INIT transaction manager");
+ tmUtil = new GeronimoTransactionManagerUtil();
+ tmUtil.initTransactionManager();
+ tmUtil.startTransaction();
+ } catch (Exception e) {
+ System.out.println("Exception of type :" + e.getClass().getName() + " has been thrown");
+ System.out.println("Exception message :" + e.getMessage());
+ e.printStackTrace();
+ System.exit(1);
+ }
+
+ try {
+ System.out.println("Get a connection");
+ conn = tmUtil.getConnection();
+ conn.setAutoCommit(false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("Before transaction, table is:");
+ printTable();
+
+ try {
+ System.out.println("Begin a transaction");
+ init(); //initialize DAS instance
+ System.out.println("Update the table - 2 accounts");
+ withdrawFromBankAccount1(transferAmount);
+ depositToBankAccount2(transferAmount);
+
+ if (completion.equals("commit")) {
+ System.out.println("*commit* the transaction");
+ tmUtil.commitTransaction();
+ } else {
+ System.out.println("*rollback* the transaction");
+ tmUtil.rollbackTransaction();
+ }
+ } catch (Exception e) {
+ System.out.println("Exception of type :" + e.getClass().getName() + " has been thrown");
+ System.out.println("Exception message :" + e.getMessage());
+ e.printStackTrace();
+ System.exit(1);
+ }
+
+ System.out.println("After transaction, table is:");
+ printTable();
+
+ System.out.println("Cleanup");
+ try {
+ tmUtil.cleanup();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("End MoneyTransfer\n");
+ System.exit(0);
+ }
+
+ private static void init(){
+ try{
+ das = DAS.FACTORY.createDAS(getConfig("BankAccounts.xml"), conn);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Withdraw asked amount from account1
+ * @return
+ */
+ public static final void withdrawFromBankAccount1(float transferAmount) {
+ Command read = das.getCommand("BankAccount1Data");
+ DataObject root = read.executeQuery();
+ DataObject account1 = (DataObject)root.getList("BANKACCOUNT").get(0);
+ float currentBalance = account1.getFloat("BALANCE");
+ float newBalance = currentBalance - transferAmount;
+ account1.setFloat("BALANCE", newBalance);
+ das.applyChanges(root);
+ }
+
+ /**
+ * Deposit asked amount into account2
+ * @return
+ */
+ public static final void depositToBankAccount2(float transferAmount) {
+ Command read = das.getCommand("BankAccount2Data");
+ DataObject root = read.executeQuery();
+ DataObject account2 = (DataObject)root.getList("BANKACCOUNT").get(0);
+ float currentBalance = account2.getFloat("BALANCE");
+ float newBalance = currentBalance + transferAmount;
+ account2.setFloat("BALANCE", newBalance);
+ das.applyChanges(root);
+ }
+
+ /**Utilities
+ *
+ * @param fileName
+ * @return
+ */
+ private static InputStream getConfig(String fileName) {
+ MoneyTransfer jdbcExample = new MoneyTransfer();
+ return jdbcExample.getClass().getClassLoader().getResourceAsStream(fileName);
+ }
+}
diff --git a/das-java/trunk/samples/transaction/src/main/resources/BankAccountDBConfig.xml b/das-java/trunk/samples/transaction/src/main/resources/BankAccountDBConfig.xml
new file mode 100644
index 0000000000..1ade9f2341
--- /dev/null
+++ b/das-java/trunk/samples/transaction/src/main/resources/BankAccountDBConfig.xml
@@ -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.
+ -->
+<DBConfig xmlns="http:///org.apache.tuscany.das.rdb/dbconfig.xsd">
+ <ConnectionInfo>
+ <ConnectionProperties
+ driverClass="com.mysql.jdbc.Driver"
+ databaseURL="jdbc:mysql://localhost/dastest?createDatabaseIfNotExist=true"
+ userName="root"
+ password="mypwd"/>
+ </ConnectionInfo>
+
+ <Table name="BANKACCOUNT" SQLCreate="CREATE TABLE BANKACCOUNT (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(30), BALANCE float )type=InnoDB">
+ <row>1, 'John Feng', 1200</row>
+ <row>2, 'John Feng', 0</row>
+ </Table>
+
+</DBConfig>
diff --git a/das-java/trunk/samples/transaction/src/main/resources/BankAccounts.xml b/das-java/trunk/samples/transaction/src/main/resources/BankAccounts.xml
new file mode 100644
index 0000000000..09c1a5bb04
--- /dev/null
+++ b/das-java/trunk/samples/transaction/src/main/resources/BankAccounts.xml
@@ -0,0 +1,30 @@
+<?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 managedtx="false" />
+
+ <Command name="BankAccount1Data" SQL="select ID, NAME, BALANCE from BANKACCOUNT where ID=1" kind="Select"/>
+ <Command name="BankAccount2Data" SQL="select ID, NAME, BALANCE from BANKACCOUNT where ID=2" kind="Select"/>
+
+ <Table tableName="BANKACCOUNT">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+</Config>