summaryrefslogtreecommitdiffstats
path: root/das-cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-16 06:46:29 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-16 06:46:29 +0000
commitc5846d0e19e3b5fd9d818d714fea2df3f3ef90eb (patch)
treedac6ae1624ccc49913032c37610440f2a8b2e855 /das-cpp
parent580265475dca3952d6e243b1edeb5243df998c23 (diff)
Cleaning up SVN structure, moving das trunk to das-cpp/trunk.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@880626 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'das-cpp')
-rw-r--r--das-cpp/trunk/GettingStarted.html228
-rw-r--r--das-cpp/trunk/README_ANT_INSTALL332
-rw-r--r--das-cpp/trunk/VSExpress/tuscany_das/Build/Build.vcproj102
-rw-r--r--das-cpp/trunk/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj627
-rw-r--r--das-cpp/trunk/VSExpress/tuscany_das/das_test/das_test.vcproj254
-rw-r--r--das-cpp/trunk/VSExpress/tuscany_das/tuscany_das.sln36
-rw-r--r--das-cpp/trunk/VSExpress/tuscany_das/tuscany_das.suobin0 -> 240640 bytes
-rw-r--r--das-cpp/trunk/antscripts/OpenPGP.jarbin0 -> 36696 bytes
-rw-r--r--das-cpp/trunk/antscripts/TuscanyMSVC8DevStudioCCompiler.jarbin0 -> 2871 bytes
-rw-r--r--das-cpp/trunk/antscripts/compile-targets.xml315
-rw-r--r--das-cpp/trunk/antscripts/platform.properties39
-rw-r--r--das-cpp/trunk/antscripts/system.xml582
-rw-r--r--das-cpp/trunk/build.xml248
-rw-r--r--das-cpp/trunk/runtime/core/build.xml147
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/Command.h60
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/CommandPtr.h34
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/Config.h46
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/DAS.h55
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/DASCommandNotFoundException.h41
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/DASFactory.h51
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/DASInvalidPropertyNameException.h41
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/DASInvalidTypeNameException.h41
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/DASNullPointerException.h41
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/DataGraphPrinter.h53
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/RefCountingObject.h73
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/RefCountingPointer.h103
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/SDODataObjectWrapper.h45
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/StringWrapper.h60
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/ApplyChanges.h82
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/Column.h79
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/ColumnData.h67
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/CommandImpl.h57
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/ConfigImpl.h89
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/Connection.h67
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/CreatedDataObject.h55
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASColumnNotFoundException.h43
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASDataObject.h81
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASFactoryImpl.h49
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASImpl.h79
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidColumnNameException.h43
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidRelationshipNameException.h43
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidSDOTypeException.h43
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidSQLTypeException.h43
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidTableNameException.h43
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASOptimisticConcurrencyControlException.h43
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DASPrimaryKeyNotFoundException.h43
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/DeletedDataObject.h49
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/GraphBuilder.h59
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h67
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/KeyPair.h60
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/ModifiedDataObject.h62
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/ODBCTypeHelper.h51
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/PKObject.h77
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/PreparedStatement.h51
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/ReadCommandImpl.h52
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/Relationship.h73
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/RelationshipStatement.h72
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/RelationshipWrapper.h58
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSet.h101
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSetMetaData.h75
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSetPtr.h38
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/SQLException.h51
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/Statement.h72
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/StatementPtr.h36
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/Table.h84
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/TableData.h66
-rw-r--r--das-cpp/trunk/runtime/core/include/apache/das/rdb/das_constants.h23
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/Command.cpp36
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/Config.cpp43
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/DAS.cpp38
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/DASCommandNotFoundException.cpp30
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/DASFactory.cpp42
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/DASInvalidPropertyNameException.cpp30
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/DASInvalidTypeNameException.cpp30
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/DASNullPointerException.cpp30
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/DataGraphPrinter.cpp171
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/RefCountingObject.cpp234
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/RefCountingPointer.cpp261
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/SDODataObjectWrapper.cpp44
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/StringWrapper.cpp148
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/ApplyChanges.cpp568
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/Column.cpp114
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/ColumnData.cpp849
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/CommandImpl.cpp67
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/ConfigImpl.cpp334
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/Connection.cpp214
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/CreatedDataObject.cpp107
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASColumnNotFoundException.cpp32
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASDataObject.cpp259
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASFactoryImpl.cpp43
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASImpl.cpp161
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidColumnNameException.cpp32
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidRelationshipNameException.cpp32
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidSDOTypeException.cpp32
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidSQLTypeException.cpp32
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidTableNameException.cpp32
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASOptimisticConcurrencyControlException.cpp32
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DASPrimaryKeyNotFoundException.cpp32
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/DeteledDataObject.cpp41
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/GraphBuilder.cpp213
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp302
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/KeyPair.cpp72
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/ModifiedDataObject.cpp141
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/ODBCTypeHelper.cpp108
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/PKObject.cpp168
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/PreparedStatement.cpp42
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/ReadCommandImpl.cpp47
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/Relationship.cpp206
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/RelationshipStatement.cpp128
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/RelationshipWrapper.cpp117
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/ResultSet.cpp356
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp216
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/SQLException.cpp40
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/Statement.cpp107
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/Table.cpp236
-rw-r--r--das-cpp/trunk/runtime/core/src/apache/das/rdb/TableData.cpp98
-rw-r--r--das-cpp/trunk/runtime/test/build.xml73
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testCompositeRelationship.xml35
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testCreateOperation.xml41
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testDeleteOperation.xml41
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testIncompleteCompositeRelationship1.xml35
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testIncompleteCompositeRelationship2.xml34
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testKeyPairColumnTypeNotEqual.xml37
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testManyRelationship1.xml29
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testManyRelationship2.xml29
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testModifyOperation.xml41
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testOCC1.xml43
-rw-r--r--das-cpp/trunk/runtime/test/rsc/testOCC2.xml43
-rw-r--r--das-cpp/trunk/runtime/test/src/main.cpp843
-rw-r--r--das-cpp/trunk/samples/CompanySample/Readme.html148
-rw-r--r--das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample.sln19
-rw-r--r--das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample.suobin0 -> 61952 bytes
-rw-r--r--das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample/CompanySample.vcproj180
-rw-r--r--das-cpp/trunk/samples/CompanySample/build.xml134
-rw-r--r--das-cpp/trunk/samples/CompanySample/rsc/sampleConfig.xml35
-rw-r--r--das-cpp/trunk/samples/CompanySample/src/main.cpp175
-rw-r--r--das-cpp/trunk/samples/build.xml68
-rw-r--r--das-cpp/trunk/tools/ant_cpptasks/build.xml75
-rw-r--r--das-cpp/trunk/tools/ant_cpptasks/tuscanyAntCompilers/TuscanyMSVC8DevStudioCCompiler.java227
-rw-r--r--das-cpp/trunk/tools/build.xml95
140 files changed, 15207 insertions, 0 deletions
diff --git a/das-cpp/trunk/GettingStarted.html b/das-cpp/trunk/GettingStarted.html
new file mode 100644
index 0000000000..c7aae47b5d
--- /dev/null
+++ b/das-cpp/trunk/GettingStarted.html
@@ -0,0 +1,228 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
+ <TITLE>Tuscany - Getting Started</TITLE>
+ <META NAME="GENERATOR" CONTENT="BrOffice.org 2.0 (Win32)">
+ <META NAME="CREATED" CONTENT="20070623;19202290">
+ <META NAME="CHANGEDBY" CONTENT="a a">
+ <META NAME="CHANGED" CONTENT="20070626;1131872">
+ <!-- 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 HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+ <STYLE>
+ <!--
+ TD P { color: #000000; font-family: "Verdana", "Helvetica", "Arial", sans-serif; font-size: 12pt }
+ H1 { color: #000000 }
+ P { color: #000000; font-family: "Verdana", "Helvetica", "Arial", sans-serif; font-size: 12pt }
+ H2 { background: #dddddd; border: 1px solid #999999; padding-top: 0.11cm; padding-bottom: 0.11cm; padding-left: 0.16cm; padding-right: 0.11cm; color: #990000 }
+ H3 { color: #000000 }
+ A:link { color: #3366aa; text-decoration: none }
+ -->
+ </STYLE>
+</HEAD>
+<BODY LANG="en-US" TEXT="#000000" LINK="#3366aa" DIR="LTR" STYLE="border: none; padding: 0cm">
+<DIV ID="bodyColumn" DIR="LTR">
+ <P ><BR><BR>
+ </P>
+ <DIV ID="contentBox" DIR="LTR">
+ <H1 ><FONT SIZE=6 STYLE="font-size: 28pt">Tuscany -
+ Getting Started - DAS C++</FONT></H1>
+ <P >This document describes what is needed to install
+ Tuscany DAS for C++. If you haven't already done so, the first step
+ is to download the DAS C++ from its repository:
+ <A HREF="https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/" TARGET="_blank">https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/</A>.
+ </P>
+ <H2 >Contents</H2>
+ <OL>
+ <LI><P STYLE="margin-bottom: 0cm"><A HREF="#requirements">System
+ Requirements</A>
+ </P>
+ <LI><P STYLE="margin-bottom: 0cm"><A HREF="#Installing">Installing
+ Tuscany DAS C++ on Windows.</A></P>
+ <LI><P STYLE="margin-bottom: 0cm"><A HREF="#samples">Samples</A>
+ </P>
+ <LI><P ><A HREF="#help">Getting Help</A>
+ </P>
+ </OL>
+ <H2 ><A NAME="requirements"></A>System Requirements</H2>
+ <P >In order to use Tuscany DAS there are some minimum
+ requirements:</P>
+ <TABLE WIDTH=896 BORDER=1 CELLPADDING=2 CELLSPACING=0>
+ <COL WIDTH=150>
+ <COL WIDTH=736>
+ <TR>
+ <TD WIDTH=150>
+ <P ><B>Software</B></P>
+ </TD>
+ <TD WIDTH=736>
+ <P ><B>Download Link</B></P>
+ </TD>
+ </TR>
+ <TR>
+ <TD WIDTH=150>
+ <P >Operating systems:
+ </P>
+ <UL>
+ <LI><P >Windows XP SP2
+ </P>
+ </UL>
+ </TD>
+ <TD WIDTH=736></TD>
+ </TR>
+ <TR>
+ <TD WIDTH=150>
+ <P >Tuscany SDO C++ (from the trunk)</P>
+ </TD>
+ <TD WIDTH=736>
+ <P >To compile and install Tuscany SDO C++ follow
+ the instructions on
+ <A HREF="https://svn.apache.org/repos/asf/incubator/tuscany/cpp/sdo/GettingStarted.html">https://svn.apache.org/repos/asf/incubator/tuscany/cpp/sdo/GettingStarted.html</A><FONT COLOR="#000000">
+ page. But instead of download the source from Tuscany downloads
+ page, download the SDO C++ source from the trunk:
+ <A HREF="https://svn.apache.org/repos/asf/incubator/tuscany/cpp/sdo/" TARGET="_blank">https://svn.apache.org/repos/asf/incubator/tuscany/cpp/sdo/</A></FONT></P>
+ </TD>
+ </TR>
+ <TR>
+ <TD WIDTH=150>
+ <P >libxml2 version 2.6.20
+ </P>
+ </TD>
+ <TD WIDTH=736>
+ <P >You need to download and install libxml2, iconv
+ and zlib from <A HREF="http://www.zlatkovic.com/libxml.en.html">http://www.zlatkovic.com/libxml.en.html</A>.
+ Please read the installation notes for libxml2 particularly
+ regarding it's pre-req's iconv and zlib on Windows.
+ </P>
+ </TD>
+ </TR>
+ <TR>
+ <TD WIDTH=150>
+ <P >iconv latest version</P>
+ </TD>
+ <TD WIDTH=736>
+ <P >You can find iconv for windows here:
+ <A HREF="http://sourceforge.net/project/downloading.php?groupname=gnuwin32&amp;filename=libiconv-1.9.2-1-lib.zip">http://sourceforge.net/project/downloading.php?groupname=gnuwin32&amp;filename=libiconv-1.9.2-1-lib.zip</A>&amp;use_mirror=ufpr</P>
+ </TD>
+ </TR>
+ </TABLE>
+ <H2 ><A NAME="Installing"></A>Installing and Compiling
+ Tuscany DAS C++ on Windows</H2>
+ <h3>1. Downloading the Source Code</h3>
+ <OL>
+ <P STYLE="margin-bottom: 0cm">1.1 Download the
+ contents under
+ <A HREF="https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/">https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/</A><FONT COLOR="#000000">
+ into directory &lt;tuscany_das_cpp&gt;.</FONT></P>
+ </OL>
+ <h3>2. Preparing Environment</h3>
+ <OL>
+ <P STYLE="margin-bottom: 0cm">2.1 The following
+ environment variables are required:
+ </P>
+ <UL>
+ <LI><P STYLE="margin-bottom: 0cm">TUSCANY_SDOCPP=&lt;path
+ to tuscany sdo for c++ directory&gt;
+ </P>
+ <LI><P STYLE="margin-bottom: 0cm">LIBXML2_HOME=&lt;path
+ to libxml2 directory&gt;
+ </P>
+ <LI><P >ICONV_HOME=&lt;path to iconv directory&gt;</P>
+ </UL>
+ </OL>
+ <h3>3. Compiling using Visual Studio Express</h3>
+ <OL START=3>
+ <P STYLE="margin-bottom: 0cm">3.1 Build the source
+ using Visual Studio Express solution under directory
+ &lt;tuscany_das_cpp&gt;/VSExpress/tuscany_das/.</P>
+ </OL>
+ <h3>4. Compiling using Apache Ant (does not compile test cases yet)</h3>
+ <OL START=3>
+ <P STYLE="margin-bottom: 0cm">4.1 Follow the instructions on &lt;tuscany_das_cpp&gt;/README_ANT_INSTALL to set up Apache Ant correctly.</P>
+ <P STYLE="margin-bottom: 0cm">4.2 Execute the following command on &lt;tuscany_das_cpp&gt; directory: <OL><P>ant</P></OL></P>
+ </OL>
+ <h3>5. Installing</h3>
+ <OL>
+ <P STYLE="margin-bottom: 0cm">5.1 Set environment
+ variable TUSCANY_DASCPP=&lt;tuscany_das_cpp&gt;/deploy/</P></LI>
+ </OL>
+
+ <H2 >Test Cases</H2>
+ <H3 >Setup</H3>
+ <UL>
+ <LI><P ><SPAN STYLE="text-decoration: none">Download
+ the latest version of Postgres Core and ODBC Driver. You can find it
+ here: <A HREF="http://www.postgresql.org/download/">http://www.postgresql.org/download/</A>.</SPAN></P>
+ <LI><P ><SPAN STYLE="text-decoration: none">Install both, Postgres Core and ODBC Driver, on your OS.</SPAN></P>
+ <LI><P >The test cases access a data source using DSN, das_test by default access a DSN named "DAStestcases" using "postgres" user with "tuscany" password. However this settings can be modified on getConnection function defined on &lt;tuscany_das_cpp&gt;/runtime/test/src/main.cpp:
+<P STYLE="margin-left: 2cm; margin-bottom: 0cm"><FONT SIZE=2>...<BR>std::string
+ dsn = <FONT COLOR="#800000">&quot;DAStestcases&quot;</FONT><FONT COLOR="#000000">;</FONT><BR><FONT COLOR="#000000">std::string
+ user = <FONT COLOR="#800000">&quot;postgres&quot;</FONT><FONT COLOR="#000000">;</FONT><BR><FONT COLOR="#000000">std::string
+ password = <FONT COLOR="#800000">&quot;tuscany&quot;</FONT<FONT COLOR="#000000">;</FONT><BR><FONT COLOR="#000000">...</FONT></FONT></FONT></P>
+
+ </UL>
+ <H3>Running</H3>
+ <OL>
+ <P >To run test cases you
+ just need to execute the file:
+ </P>
+ <UL>
+ <P STYLE="margin-bottom: 0cm">&lt;tuscany_das_cpp&gt;/VSExpress/tuscany_das/das_test/Debug/das_test.exe
+ </P>
+ </UL>
+ <P >The output of all tests must show &ldquo;OK&rdquo;.</P>
+ </OL>
+ <h3>Requirements:</h3>
+ <UL>
+ <LI><P >Postgres server must be running accepting connection from localhost.</P>
+ </UL>
+
+
+ <H2><A NAME="samples"></A>Samples</H2>
+ <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=2>
+ <TR>
+ <TD>
+ <P >CompanySample</P>
+ </TD>
+ <TD>
+ <P >This sample shows how to load data from a RDB
+ source, using RDB DAS, into a SDO graph, then retrieve data
+ from it, modify the graph and update the data source based on the modified graph.
+ </P>
+ </TD>
+ </TR>
+ </TABLE>
+ <H2 ><A NAME="help"></A>Getting Help</H2>
+ <P >Any problem with this release can be reported to
+ the Tuscany <A HREF="http://cwiki.apache.org/TUSCANY/mailing-lists.html" TARGET="_blank">mailing
+ lists</A> or create a JIRA issue
+ at&nbsp;<A HREF="http://issues.apache.org/jira/browse/Tuscany" TARGET="_blank">http://issues.apache.org/jira/browse/Tuscany</A>.</P>
+ <P >&nbsp;</P>
+ <TABLE CELLPADDING=2 CELLSPACING=2>
+ <TR>
+ <TD>
+ <P >Thank you for your interest in Tuscany.</P>
+ <P ><EM><STRONG>-The Tuscany Development Team</STRONG></EM>
+ </P>
+ </TD>
+ </TR>
+ </TABLE>
+ </DIV>
+</DIV>
+</BODY>
+</HTML> \ No newline at end of file
diff --git a/das-cpp/trunk/README_ANT_INSTALL b/das-cpp/trunk/README_ANT_INSTALL
new file mode 100644
index 0000000000..b1f0cce2ec
--- /dev/null
+++ b/das-cpp/trunk/README_ANT_INSTALL
@@ -0,0 +1,332 @@
+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.
+
+Using ant to build TuscanyDAS Native
+
+This guide shows how to build TuscanyDAS Native with apache ant.
+Above all, using ant will standardize the build system across
+all platforms, obviating the need to support both automake and
+microsoft VC projects. The ant build process is still in its beta
+and will be formalized for Release M4. Currently the only item
+remaining is to write an ant build file for the samples.
+
+
+Required Software to build TuscanySDO Native with ant
+=====================================================
+
+Java:
+ Most Linux, Mac, and Windows systems come with Java
+ Java 1.4.2 or later
+
+Ant:
+ Ant comes installed with almost all Linux distributions
+ version 1.6 or later
+ Download: http://ant.apache.org/
+
+antcontrib:
+ version 1.0b3 or later
+ Download: http://ant-contrib.sourceforge.net/
+
+antcontrib cpptasks.jar
+ version 1.0b4 or later
+ Download: http://ant-contrib.sourceforge.net/
+ Information: http://ant-contrib.sourceforge.net/cc.html
+
+
+Installation Instructions
+=========================
+
+Linux/Mac
+---------
+
+Make sure JAVA_HOME is set before starting.
+
+Install ant according to http://ant.apache.org/manual/index.html.
+
+Set the ANT_HOME variable to the directory where you install ant.
+export ANT_HOME="/home/your/ant"
+
+Add $ANT_HOME/bin to your path.
+export PATH="${PATH}:${ANT_HOME}/bin"
+
+The optional ant tasks included in antcontrib and cpptasks are needed to
+compile Tuscany Native with ant. Additional ant tasks (antcontrib and cpptasks)
+should be installed in $ANT_HOME/lib
+So place the antcontrib and cpptasks jars there.
+
+If you dont have write access to $ANT_HOME/lib, do the following:
+- create ${user.home}/.ant/lib
+- place the jars here
+
+Typically its a good idea to avoid adding optional ant tasks to your classpath,
+this can be problematic.
+
+Since the antcontrib compiler adaptor for microsoft msvc 8 has several bugs, we've
+written our own. Even though this compiler is for Windows, it is referenced in the
+ant build scripts and thus needs to be added to the classpath even for Linux/Mac.
+Add the TuscanyMSVC8DevStudioCCompiler jar to your classpath.
+export CLASSPATH="${CLASSPATH}:/TuscanySourceDir/antscripts/TuscanyMSVC8DevStudioCCompiler.jar"
+
+Windows
+-------
+
+Make sure JAVA_HOME is set before starting.
+
+Install ant according to http://ant.apache.org/manual/index.html.
+
+Set the ANT_HOME variable to the directory where you install ant.
+set ANT_HOME=c:\ant
+
+Add %ANT_HOME%\bin to your path.
+set PATH=%PATH%;%ANT_HOME%\bin
+
+The optional ant tasks included in antcontrib and cpptasks are needed to
+compile Tuscany Native with ant. Additional ant tasks (antcontrib and cpptasks)
+should be installed in %ANT_HOME%\lib
+So place the antcontrib and cpptasks jars there.
+
+If you dont have write access to %ANT_HOME%\lib, do the following:
+- create %user.home%\.ant\lib
+- place the jars here
+
+Typically its a good idea to avoid adding optional ant tasks to your classpath,
+this can be problematic.
+
+Since the antcontrib compiler adaptor for microsoft msvc 8 has several bugs, we've
+written our own, namely TuscanyMSVC8DevStudioCCompiler. The Tuscany MSVC8 adaptor
+just makes sure that the correct parameters are passed to the compiler.
+Add the TuscanyMSVC8DevStudioCCompiler jar to your classpath.
+set CLASSPATH=%CLASSPATH%:c:\TuscanySourceDir\antscripts\TuscanyMSVC8DevStudioCCompiler.jar
+
+USAGE
+=====
+
+From the TuscanyDAS Native root source directory, the entire application can be
+compiled, linked, and installed by simply executing ant with no targets. This will
+execute the default "all" target.
+
+# ant
+
+The ant build system will scan your environment variables and ant configuration file
+and try to autoconfigure everything needed to build. The environment variables can be
+overridden by the ant configuration file: antscripts/platform.properties. The only
+configuration that is mandatory to build TuscanyDAS Native is the location of libxml2 and TuscanySDO.
+
+To configure the location of libxml2, do one of the following:
+ export LIBXML2_LIB=/libxml2/lib/dir
+ export LIBXML2_INCLUDE=/libxml2/include/dir
+ -- OR --
+ edit antscripts/platform.properties
+ platform.libxml2.lib.dir=/libxml2/lib/dir
+ platform.libxml2.include.dir=/libxml2/include/dir
+
+To configure the location of TuscanySDO, do one of the following:
+ export TUSCANY_SDOCPP=/tuscanySDOHome/
+ -- OR --
+ edit antscripts/platform.properties
+ platform.tuscany.sdo.home.dir=/tuscanySDOHome/
+
+The platform.properties configuration always overrides environment variables.
+See the CONFIGURATION section below for more information.
+
+To compile in debug mode, add the following define to the ant command line or
+edit the platform.properties file as seen in the CONFIGURATION section below.
+
+# ant -Ddebug=true
+
+The TuscanySDO Native ant build process is hierarchical. Currently there are
+build scripts in the following locations, which can all be invoked from the
+root TuscanySDO directory:
+ TUSCANY_DAS_SRC_ROOT/build.xml
+ TUSCANY_DAS_SRC_ROOT/runtime/core/build.xml
+
+For a listing of public targets for any build.xml file, execute the following:
+(display shown for the root src directory)
+
+# ant -p
+Buildfile: build.xml
+
+Main targets:
+
+ all build and install all TuscanyDASNative source code and documentation
+ build Build all TuscanyDASNative source code and documentation
+ clean Clean all TuscanyDASNative compiled source code
+ samples Build and install all TuscanyDASNative samples
+ install Install TuscanyDASNative libraries and headers
+ test Build and run all tests
+ distribution Create a source and bin distribution structure
+ pack.distribution Pack the bin and source distribution into .zip and .tar.gz files. Also generates the .asc and .md5 files
+Default target: all
+
+
+Public targets are those that have descriptions and are usually the only ones needed for
+compiling, installing and cleaning. For more avanced use, the private targets can be seen
+
+by looking at the actual build.xml file.
+
+
+GENERATING A PROJECT DISTRIBUTION
+=================================
+
+To create a src and bin distribution of Tuscany DAS subproject, there must be set some properties on platform.properties files:
+
+Property Required Example Description
+-------- -------- ------- -----------
+
+platform.public.key.path Yes "E:/gnupg/trustdb.gpg" The public key ring file path
+
+platform.secret.key.path Yes "E:/gnupg/secring.gpg" The secret key ring file path
+
+platform.key.id Yes "148CAFB2" The key id used to sign the distribution files
+
+platform.tuscanyDAS.distribution.dir NO "C:\distribution\" The folder where the distribution files will be generated, default=tuscanyDAS.root.dir/distribution
+
+platform.tuscanyDAS.release.file.name NO "tuscany_das_native-1.0-incubator-M4-" The beginning of src and bin packed distribution file name, default="tuscany_cpp_das".
+ TUSCANY_DASCPP_RELEASE_NAME env var may be used as an alternative
+
+Also is required the bcpg-jdk<latest_version>-<latest_version>.jar and
+jce-jdk<latest_version>-<latest_version>.jar files defines on classpath.
+Both can be found at http://www.bouncycastle.org/latest_releases.html
+
+Use the "distribution" target to generate the src and bin distribution
+file structure under platform.tuscanySDO.distribution.dir folder. Then
+use the "pack.distribution" target to pack the bin and src distribution
+folders as .zip and .tar.gz and generate their .asc and .md5 files. A
+password must be set on the command line when using pack.distribution
+target, this password is used to sign the packed distribution files with
+the secret key defined on platform.secret.key.path
+
+Make sure an 1.6 JRE version is set in your JAVA_HOME when signing the
+distribution.
+
+Usage:
+ant distribution
+// do whatever you want on the generated distribution files
+ant pack.distribution -Dpassword="123456"
+
+
+
+CONFIGURATION
+==============
+
+The following explains how to configure the TuscanyDAS Native ant build system.
+The build system is configured either by environment variables and/or by the
+antscripts/platform.properties file. Some options can only be configured via the
+platform.properties file. If an option can be configured in both places, the option
+specified in the platform.properties file overrides the environment variable.
+
+The TuscanyDAS Native ant build system is capable of automatically configuring
+everything except the location of the libxml2 and TuscanySDO libraries. All other configuration
+options can be determined.
+
+From anywhere there is a TuscanyDAS Native build.xml file, the current system
+configuration can be displayed by executing the display.system ant target as
+follows:
+
+# ant display.system
+Buildfile: build.xml
+
+check.sdo:
+
+display.system:
+ [echo]
+ [echo] TuscanyDAS paths
+ [echo] tuscanyDAS.root.dir= /home/Adriano/Tuscany/cpp/das
+ [echo] tuscanyDAS.root.src.dir= /home/Adriano/Tuscany/cpp/das/runtime
+ [echo] tuscanyDAS.install.dir= /home/Adriano/Tuscany/cpp/das/deploy
+ [echo] tuscanyDAS.library.version= ''
+ [echo] tuscanyDAS.release.file.name= 'tuscany_das_cpp-1.0-incubator-M4-'
+
+ [echo]
+ [echo] TuscanyDAS compiler configuration
+ [echo] compiler.name= 'msvc8'
+ [echo] debug.compile= 'false'
+ [echo] lib.ext= '.lib'
+ [echo] dll.ext= '.dll'
+ [echo] lib.prefix= ''
+ [echo] object.ext= '.obj'
+ [echo] exe.ext= '.exe'
+ [echo] script.ext= '.bat'
+ [echo] external.definitions.file= ''
+ [echo]
+ [echo] sdo location
+ [echo] tuscany.sdo.home.dir= /home/Adriano/Tuscany/cpp/sdo/deploy
+ [echo]
+
+BUILD SUCCESSFUL
+Total time: 0 second
+
+Compilation configuration
+-------------------------
+
+The compilation options can all be determined by the ant build system by
+examining the platform. The values can only be overriden by editing the
+platform.properties file. Following is a list of the options and their
+default values:
+
+platform.lib.ext= (Defaults to ".so" for Unix and ".lib" for Windows)
+platform.dll.ext= (Defaults to "" for Unix and ".dll" for Windows. Not used for Unix)
+platform.exe.ext= (Defaults to "" for Unix and ".exe" for Windows)
+platform.object.ext= (Defaults to ".o" for Unix and ".obj" for Windows)
+platform.script.ext= (Defaults to ".sh" for Unix and ".bat" for Windows)
+platform.compiler.name= (Defaults to "g++" for Unix and "msvc8" for Windows)
+platform.debug.compile= (Defaults to "false" for both Unix and Windows)
+
+To configure ant to use a compiler other than g++ or msvc, or to add your own
+ant tasks/definitions, specify a path for the platform.external.definitions.file
+and platform.compiler.name in the platform.properties configuration file. This
+is especially useful for compiling on other platforms like AIX or Solaris.
+
+Tuscany DAS installation path
+-----------------------------
+
+The Tuscany DAS installation directory can be configured as follows:
+ export TUSCANY_DASCPP=/tuscany/das/native/install/dir
+ -- OR --
+ edit antscripts/platform.properties
+ platform.tuscanyDAS.install.dir=/tuscany/das/native/install/dir
+
+The Tuscany DAS installation directory defaults to:
+ TUSCANY_DAS_SRC_ROOT/deploy
+
+Tuscany SDO Configuration
+-------------------------
+
+TuscanySDO:
+If not specified, then the the build will fail.
+
+ export TUSCANY_SDOCPP=/tuscanySDOHome/
+ -- OR --
+ edit antscripts/platform.properties
+ platform.libxml2.lib.dir=/libxml2/library/directory
+ platform.libxml2.include.dir=/libxml2/include/directory
+
+
+3rd Party configuration
+-----------------------
+
+LIBXML2:
+If not specified, then the the build will fail.
+
+ export LIBXML2_LIB=/libxml2/library/directory
+ export LIBXML2_INCLUDE=/libxml2/include/directory
+ -- OR --
+ edit antscripts/platform.properties
+ platform.tuscany.sdo.home.dir=/tuscanySDOHome/
+
+
+
diff --git a/das-cpp/trunk/VSExpress/tuscany_das/Build/Build.vcproj b/das-cpp/trunk/VSExpress/tuscany_das/Build/Build.vcproj
new file mode 100644
index 0000000000..57fbfcc137
--- /dev/null
+++ b/das-cpp/trunk/VSExpress/tuscany_das/Build/Build.vcproj
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="Build"
+ ProjectGUID="{78511C3F-18E5-44FC-928D-BFAAA4A8BCBE}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="10"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/das-cpp/trunk/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj b/das-cpp/trunk/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj
new file mode 100644
index 0000000000..0f46db37f8
--- /dev/null
+++ b/das-cpp/trunk/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj
@@ -0,0 +1,627 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="das_runtime"
+ ProjectGUID="{964F3F93-8D1C-46BE-9724-2313CE7380AA}"
+ RootNamespace="das_runtime"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/sdo_runtime.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/D_VC80_UPGRADE=0x0600 /EHsc /GR /DWIN32 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NON_CONFORMING_SWPRINTF"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\runtime\core\include;&quot;$(TUSCANY_SDOCPP)\include&quot;;&quot;$(LIBXML2_HOME)\include&quot;;&quot;$(ICONV_HOME)\include&quot;"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/sdo_runtime.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\Release/tuscany_das.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/sdo_runtime.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="deploy"
+ CommandLine="..\..\..\runtime\core\src\deploy.bat ..\..\..\ Release"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine=""
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/sdo_runtime.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/D_VC80_UPGRADE=0x0600 /c /nologo /EHsc /Od /Gd /D_DEBUG /MDd /GR /DWIN32 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NON_CONFORMING_SWPRINTF"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\runtime\core\include;&quot;$(TUSCANY_SDOCPP)\include&quot;;&quot;$(LIBXML2_HOME)\include&quot;;&quot;$(ICONV_HOME)\include&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="3"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=""
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CallingConvention="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\Debug/tuscany_das.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/das_runtime.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="deploy"
+ CommandLine="..\..\..\runtime\core\src\deploy.bat ..\..\..\ Debug"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <Filter
+ Name="apache::das"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\Command.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\Config.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DAS.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DASCommandNotFoundException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DASFactory.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DASInvalidPropertyNameException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DASInvalidTypeNameException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DASNullPointerException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\DataGraphPrinter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\RefCountingObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\RefCountingPointer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\SDODataObjectWrapper.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\StringWrapper.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="apache::das::rdb"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ApplyChanges.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Column.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ColumnData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\CommandImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ConfigImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Connection.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\CreatedDataObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASColumnNotFoundException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASDataObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASFactoryImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASInvalidColumnNameException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASInvalidRelationshipNameException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASInvalidSDOTypeException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASInvalidSQLTypeException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASInvalidTableNameException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASOptimisticConcurrencyControlException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DASPrimaryKeyNotFoundException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\DeteledDataObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\GraphBuilder.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\GraphBuilderMetaData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\KeyPair.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ModifiedDataObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ODBCTypeHelper.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\PKObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\PreparedStatement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ReadCommandImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Relationship.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\RelationshipStatement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\RelationshipWrapper.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ResultSet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\ResultSetMetaData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\SQLException.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Statement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\Table.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\apache\das\rdb\TableData.cpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <Filter
+ Name="apache::das"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\Command.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\CommandPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\Config.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DAS.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DASCommandNotFoundException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DASFactory.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DASInvalidPropertyNameException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DASInvalidTypeNameException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DASNullPointerException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\DataGraphPrinter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\RefCountingObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\RefCountingPointer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\SDODataObjectWrapper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\StringWrapper.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="apache::das::rdb"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ApplyChanges.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Column.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ColumnData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\CommandImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ConfigImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Connection.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\CreatedDataObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\das_constants.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASColumnNotFoundException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASDataObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASFactoryImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASInvalidColumnNameException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASInvalidRelationshipNameException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASInvalidSDOTypeException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASInvalidSQLTypeException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASInvalidTableNameException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASOptimisticConcurrencyControlException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DASPrimaryKeyNotFoundException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\DeletedDataObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\GraphBuilder.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\GraphBuilderMetaData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\KeyPair.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ModifiedDataObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ODBCTypeHelper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\PKObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\PreparedStatement.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ReadCommandImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Relationship.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\RelationshipStatement.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\RelationshipWrapper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ResultSet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ResultSetMetaData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\ResultSetPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\SQLException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Statement.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\StatementPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\Table.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\include\apache\das\rdb\TableData.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/das-cpp/trunk/VSExpress/tuscany_das/das_test/das_test.vcproj b/das-cpp/trunk/VSExpress/tuscany_das/das_test/das_test.vcproj
new file mode 100644
index 0000000000..cd4c052bc5
--- /dev/null
+++ b/das-cpp/trunk/VSExpress/tuscany_das/das_test/das_test.vcproj
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="das_test"
+ ProjectGUID="{277D86C4-0113-49EE-A351-0D32FF2E1EF3}"
+ RootNamespace="das_test"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/Zm200"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(ICONV_HOME)\include&quot;;&quot;$(LIBXML2_INCLUDE)&quot;;&quot;$(TUSCANY_SDOCPP)/include&quot;;../../../deploy/include"
+ PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Debug/das_test.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ DebugInformationFormat="4"
+ CallingConvention="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkLibraryDependencies="true"
+ AdditionalDependencies="tuscany_das.lib tuscany_sdo.lib odbc32.lib $(NOINHERIT)"
+ OutputFile=".\Debug/das_test.exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="&quot;$(ICONV_HOME)\lib&quot;;&quot;$(LIBXML2_LIB)&quot;;&quot;$(TUSCANY_SDOCPP)/lib&quot;;../../../deploy/lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/das_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ OutputFile=".\Debug/das_test.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="4"
+ AdditionalIncludeDirectories="&quot;$(ICONV_HOME)\include&quot;;&quot;$(LIBXML2_INCLUDE)&quot;;&quot;$(TUSCANY_SDOCPP)/include&quot;;../../../deploy/include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="false"
+ RuntimeLibrary="2"
+ PrecompiledHeaderFile=".\Release/das_test.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_das.lib tuscany_sdo.lib odbc32.lib $(NOINHERIT)"
+ OutputFile=".\Release/das_test.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="&quot;$(ICONV_HOME)\lib&quot;;&quot;$(LIBXML2_LIB)&quot;;&quot;$(TUSCANY_SDOCPP)/lib&quot;;../../../deploy/lib"
+ ProgramDatabaseFile=".\Release/das_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\runtime\test\src\main.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ >
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testCompositeRelationship.xml"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testCreateOperation.xml"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testDeleteOperation.xml"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testIncompleteCompositeRelationship1.xml"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testIncompleteCompositeRelationship2.xml"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testKeyPairColumnTypeNotEqual.xml"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testManyRelationship1.xml"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testManyRelationship2.xml"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testModifyOperation.xml"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testOCC1.xml"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\test\rsc\testOCC2.xml"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/das-cpp/trunk/VSExpress/tuscany_das/tuscany_das.sln b/das-cpp/trunk/VSExpress/tuscany_das/tuscany_das.sln
new file mode 100644
index 0000000000..375765fd9d
--- /dev/null
+++ b/das-cpp/trunk/VSExpress/tuscany_das/tuscany_das.sln
@@ -0,0 +1,36 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "das_runtime", "das_runtime\das_runtime.vcproj", "{964F3F93-8D1C-46BE-9724-2313CE7380AA}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "das_test", "das_test\das_test.vcproj", "{277D86C4-0113-49EE-A351-0D32FF2E1EF3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Build", "Build\Build.vcproj", "{78511C3F-18E5-44FC-928D-BFAAA4A8BCBE}"
+ ProjectSection(ProjectDependencies) = postProject
+ {277D86C4-0113-49EE-A351-0D32FF2E1EF3} = {277D86C4-0113-49EE-A351-0D32FF2E1EF3}
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA} = {964F3F93-8D1C-46BE-9724-2313CE7380AA}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA}.Debug|Win32.Build.0 = Debug|Win32
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA}.Release|Win32.ActiveCfg = Release|Win32
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA}.Release|Win32.Build.0 = Release|Win32
+ {277D86C4-0113-49EE-A351-0D32FF2E1EF3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {277D86C4-0113-49EE-A351-0D32FF2E1EF3}.Debug|Win32.Build.0 = Debug|Win32
+ {277D86C4-0113-49EE-A351-0D32FF2E1EF3}.Release|Win32.ActiveCfg = Release|Win32
+ {277D86C4-0113-49EE-A351-0D32FF2E1EF3}.Release|Win32.Build.0 = Release|Win32
+ {78511C3F-18E5-44FC-928D-BFAAA4A8BCBE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {78511C3F-18E5-44FC-928D-BFAAA4A8BCBE}.Debug|Win32.Build.0 = Debug|Win32
+ {78511C3F-18E5-44FC-928D-BFAAA4A8BCBE}.Release|Win32.ActiveCfg = Release|Win32
+ {78511C3F-18E5-44FC-928D-BFAAA4A8BCBE}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/das-cpp/trunk/VSExpress/tuscany_das/tuscany_das.suo b/das-cpp/trunk/VSExpress/tuscany_das/tuscany_das.suo
new file mode 100644
index 0000000000..090100b89b
--- /dev/null
+++ b/das-cpp/trunk/VSExpress/tuscany_das/tuscany_das.suo
Binary files differ
diff --git a/das-cpp/trunk/antscripts/OpenPGP.jar b/das-cpp/trunk/antscripts/OpenPGP.jar
new file mode 100644
index 0000000000..cdd3f570d1
--- /dev/null
+++ b/das-cpp/trunk/antscripts/OpenPGP.jar
Binary files differ
diff --git a/das-cpp/trunk/antscripts/TuscanyMSVC8DevStudioCCompiler.jar b/das-cpp/trunk/antscripts/TuscanyMSVC8DevStudioCCompiler.jar
new file mode 100644
index 0000000000..2d90d74c60
--- /dev/null
+++ b/das-cpp/trunk/antscripts/TuscanyMSVC8DevStudioCCompiler.jar
Binary files differ
diff --git a/das-cpp/trunk/antscripts/compile-targets.xml b/das-cpp/trunk/antscripts/compile-targets.xml
new file mode 100644
index 0000000000..6c9a1b0e6d
--- /dev/null
+++ b/das-cpp/trunk/antscripts/compile-targets.xml
@@ -0,0 +1,315 @@
+<?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='compiler-targets'>
+
+ <import file="./system.xml"/>
+
+ <!--
+ Do a cpp compilation.
+ Inherits from "Tuscany-BaseCompiler", which has an include path of:
+ ${tuscanyDAS.root.src.dir}/core/src
+ @param objdir - directory where the object files will be written
+ @param srcdir - directory where the source files are located.
+ @param infiles - a space seperated list of the files to compile
+ @param custom-cc-elements - any extra cpp elements, may also be extra <includepath> elements
+ -->
+ <macrodef name="cpp-compile">
+ <attribute name="objdir" default="."/>
+ <attribute name="srcdir" default="."/>
+ <attribute name="infiles" default="*.cpp"/>
+ <element name="custom-cc-elements" optional="true"/>
+ <sequential>
+ <mkdir dir='@{objdir}'/>
+ <cc subsystem='console'
+ objdir='@{objdir}'
+ debug='${debug.compile}'>
+ <compiler refid='${compiler.name}-Compiler'/>
+ <fileset dir='@{srcdir}' includes='@{infiles}'/>
+ <custom-cc-elements/>
+ </cc>
+
+ </sequential>
+ </macrodef>
+
+ <!--
+ Do a cpp link which results in either a library (linktype of plugin, shared, or static)
+ or an executable (linktype of executable).
+ Inherits from "Tuscany-BaseLinker"
+ @param outfile - name of the library to create, OS prefixes and suffixes will be added
+ @param destdir - directory where the library will be written
+ @param infiles - a space seperated list of the object files to link
+ @param linktype - executable, plugin, shared, static
+ @param custom-ld-elements - any extra cpp elements, may also be extra <libset> elements
+ -->
+ <macrodef name="cpp-link">
+ <attribute name="outfile" default="out"/>
+ <attribute name="outdir" default="."/>
+ <attribute name="indir" default="${env}"/>
+ <attribute name="infiles" default="*${object.ext}"/>
+ <attribute name="linktype" default="shared"/>
+ <element name="custom-ld-elements" optional="true"/>
+ <sequential>
+ <mkdir dir='@{outdir}'/>
+ <cc link='@{linktype}'
+ subsystem='console'
+ outfile='@{outdir}/@{outfile}'
+ debug='${debug.compile}'>
+ <linker refid='${compiler.name}-Linker'/>
+ <fileset dir='@{indir}' includes='@{infiles}'/>
+ <custom-ld-elements/>
+ </cc>
+ <!--<cpp-embed-manifest dir="@{outdir}" file="@{outfile}" outtype="@{outtype}"/>-->
+ </sequential>
+ </macrodef>
+
+ <!--
+ Do a cpp build which compiles and links, resulting in either a library (linktype
+ of plugin, shared, or static) or an executable (linktype of executable).
+ Inherits from both "Tuscany-BaseCompiler" and "Tuscany-BaseLinker"
+ @param srcdir - directory where the source files are located.
+ @param infiles - a space seperated list of the source files to compile and link
+ @param outdir - directory where the output file will be written
+ @param outfile - name of the library or binary to create, OS prefixes and suffixes may be added
+ @param outtype - executable, plugin, shared, static
+ @param custom-build-elements - any extra elements needed for compiling or linking
+ may also be extra <includepath> or <libset> elements
+ -->
+ <macrodef name="cpp-build">
+ <attribute name="srcdir" default="."/>
+ <attribute name="infiles" default="**/*.cpp"/>
+ <attribute name="outdir" default="."/>
+ <attribute name="outfile" default="out"/>
+ <attribute name="outtype" default="shared"/>
+ <element name="custom-build-elements" optional="true"/>
+ <sequential>
+ <mkdir dir='@{outdir}'/>
+ <cc outtype='@{outtype}'
+ subsystem='console'
+ objdir='@{outdir}'
+ outfile='@{outdir}/@{outfile}'
+ debug='${debug.compile}'>
+ <compiler refid='${compiler.name}-Compiler'/>
+ <linker refid='${compiler.name}-Linker'/>
+ <fileset dir='@{srcdir}' includes='@{infiles}'/>
+<compilerarg value="/D_VC80_UPGRADE=0x0600"/>
+ <custom-build-elements/>
+ </cc>
+ <!--<cpp-embed-manifest dir="@{outdir}" file="@{outfile}" outtype="@{outtype}"/>-->
+ </sequential>
+ </macrodef>
+
+ <!--
+ Install a single file
+ @param file - file to install
+ @param srcdir - directory of file to install
+ @param destdir - Where to install the file
+ @param executable - set permissions to executable, defaults true
+ -->
+ <macrodef name="cpp-install-file">
+ <attribute name="srcfile"/>
+ <attribute name="srcdir" default="."/>
+ <attribute name="destfile" default="@{srcfile}"/>
+ <attribute name="destdir"/>
+ <attribute name="executable" default="true"/>
+ <sequential>
+ <mkdir dir="@{destdir}"/>
+ <copy file="@{srcdir}/@{srcfile}" tofile="@{destdir}/@{destfile}" overwrite='true'/>
+ <if>
+ <equals arg1="@{executable}" arg2="true"/>
+ <then>
+ <chmod file="@{destdir}/@{destfile}" perm="755"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Install multiple files
+ @param files - space seperated list of files to install
+ @param srcdir - location of files to install
+ @param destdir - Where to install files
+ @param executable - set permissions to executable, defaults false
+ -->
+ <macrodef name="cpp-install-files">
+ <attribute name="files" default="*.*"/>
+ <attribute name="srcdir" default="."/>
+ <attribute name="destdir"/>
+ <attribute name="executable" default="false"/>
+ <sequential>
+ <mkdir dir="@{destdir}"/>
+ <copy todir="@{destdir}" overwrite='true'>
+ <fileset dir="@{srcdir}" includes="@{files}"/>
+ </copy>
+ <if>
+ <equals arg1="@{executable}" arg2="true"/>
+ <then>
+ <chmod file="@{destdir}/@{files}" perm="755"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Install a library
+ @param lib - library to install
+ @param srcdir - directory of file to install
+ @param destdir - Where to install the file
+ @param executable - set permissions to executable, defaults true
+ -->
+ <macrodef name="cpp-install-lib">
+ <attribute name="lib"/>
+ <attribute name="srcdir" default="."/>
+ <attribute name="destrootdir"/>
+ <attribute name="version" default="${tuscanyDAS.library.version}"/>
+ <sequential>
+ <cpp-install-file
+ srcfile="${lib.prefix}@{lib}${lib.ext}"
+ srcdir="@{srcdir}"
+ destfile="${lib.prefix}@{lib}${lib.ext}@{version}"
+ destdir="@{destrootdir}/lib"/>
+ <if>
+ <os family="windows"/>
+ <then>
+ <cpp-install-file
+ srcfile="${lib.prefix}@{lib}${dll.ext}"
+ srcdir="@{srcdir}"
+ destfile="${lib.prefix}@{lib}${dll.ext}@{version}"
+ destdir="@{destrootdir}/bin"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+
+
+
+
+ <!--
+ Create a symlink on unix and mac only
+ @param lib - library file to install
+ @param srclibdir - location of library files to install
+ @param destlibdir - Where to install library files
+ -->
+ <macrodef name="cpp-symlink">
+ <attribute name="linkdir" default=""/>
+ <attribute name="resourcedir" default="."/>
+ <attribute name="link"/>
+ <attribute name="resource"/>
+ <sequential>
+ <if>
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ <then>
+ <mkdir dir="@{linkdir}"/>
+ <symlink
+ link="@{linkdir}/@{link}"
+ resource="@{resourcedir}/@{resource}"
+ overwrite="true"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Delete files from a directory, and possible delete the directory
+ @param files - space seperated list of files to delete
+ @param headerdir - directory where files to delete are
+ @param quiet - verbosity, "true" or "false"
+ @param rmdir - delete the directory after deleting files, "true" or "false"
+ @param custom-delete-elements - anything else you need done additionally
+ -->
+ <macrodef name="cpp-clean-files">
+ <attribute name="files" default="*.*"/>
+ <attribute name="dir" default="."/>
+ <attribute name="quiet" default="true"/>
+ <attribute name="rmdir" default="false"/>
+ <element name="custom-delete-elements" optional="true"/>
+ <sequential>
+ <delete quiet="@{quiet}">
+ <fileset dir="@{dir}" includes="@{files}"/>
+ </delete>
+ <if>
+ <equals arg1="@{rmdir}" arg2="true"/>
+ <then>
+ <delete dir="@{dir}"/>
+ </then>
+ </if>
+ <custom-delete-elements/>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Embed the manifest in the library or executable on Windows only
+ Uses the Microsoft manifest tool "mt"
+ @param dir - the directory where the lib/exe resides
+ @param file - the filename with no suffixes or prefixes
+ @param outtype - the outtype that's passed to the cc task, used to create the filename
+ -->
+ <macrodef name="cpp-embed-manifest">
+ <attribute name="dir"/>
+ <attribute name="file"/>
+ <attribute name="outtype"/>
+ <sequential>
+ <if>
+ <os family="windows"/>
+ <then>
+ <if>
+ <equals arg1="@{outtype}" arg2="executable"/>
+ <then>
+ <property name="file.name" value="@{file}${exe.ext}"/>
+ </then>
+ </if>
+ <property name="file.name" value="${lib.prefix}@{file}${dll.ext}"/>
+
+ <exec executable="mt">
+ <arg line="-manifest @{dir}/${file.name}.manifest -outputresource:@{dir}/${file.name};2"/>
+ </exec>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Delete a library from a root library directory, and possible delete the directory
+ On windows, it will delete both bin/<library>.dll and lib/<library>.lib
+ On Unix, it will delete lib/<library>
+ @param lib - library to delete
+ @param librootdir - directory where the library to delete is located
+ @param quiet - verbosity, "true" or "false"
+ -->
+ <macrodef name="cpp-clean-lib">
+ <attribute name="lib"/>
+ <attribute name="librootdir"/>
+ <attribute name="quiet" default="true"/>
+ <attribute name="version" default="${tuscanyDAS.library.version}"/>
+ <sequential>
+ <delete quiet="@{quiet}" file="@{librootdir}/lib/${lib.prefix}@{lib}${lib.ext}@{version}"/>
+ <if>
+ <os family="windows"/>
+ <then>
+ <delete quiet="@{quiet}" file="@{librootdir}/bin/${lib.prefix}@{lib}${dll.ext}@{version}"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+</project>
diff --git a/das-cpp/trunk/antscripts/platform.properties b/das-cpp/trunk/antscripts/platform.properties
new file mode 100644
index 0000000000..4017b8bd71
--- /dev/null
+++ b/das-cpp/trunk/antscripts/platform.properties
@@ -0,0 +1,39 @@
+# 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.
+
+platform.lib.ext=
+platform.dll.ext=
+platform.exe.ext=
+platform.object.ext=
+platform.script.ext=
+platform.compiler.name=
+platform.debug.compile=
+platform.external.definitions.file=
+
+platform.tuscanyDAS.root.dir=
+platform.tuscanyDAS.install.dir=
+platform.tuscanyDAS.release.file.name=
+platform.tuscanyDAS.distribution.dir=
+
+platform.public.key.path=
+platform.secret.key.path=
+platform.key.id=
+
+platform.axis2c.home.dir=
+platform.libxml2.lib.dir=
+platform.libxml2.include.dir=
+platform.tuscany.sdo.home.dir=
diff --git a/das-cpp/trunk/antscripts/system.xml b/das-cpp/trunk/antscripts/system.xml
new file mode 100644
index 0000000000..453dff3a71
--- /dev/null
+++ b/das-cpp/trunk/antscripts/system.xml
@@ -0,0 +1,582 @@
+<?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="system-import">
+
+ <property file="${basedir}/antscripts/platform.properties"/>
+ <property environment="env"/>
+
+ <!-- These 3 lines pull in antcontrib and cctasks -->
+ <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+ <taskdef resource="cpptasks.tasks"/>
+ <typedef resource="cpptasks.types"/>
+
+ <typedef onerror="ignore" name="signer" classname="org.apache.commons.openpgp.ant.OpenPgpSignerTask" classpath="${basedir}/antscripts/OpenPGP.jar"/>
+
+ <!--
+ Configure the tuscanyDAS.root.dir
+ Take the override value from platform.properties if set
+ -->
+ <if>
+ <and>
+ <isset property="platform.tuscanyDAS.root.dir"/>
+ <length string="${platform.tuscanyDAS.root.dir}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="tuscanyDAS.root.dir" location="${platform.tuscanyDAS.root.dir}"/>
+ </then>
+ <else>
+ <property name="tuscanyDAS.root.dir" location="."/>
+ </else>
+ </if>
+
+ <property name="tuscanyDAS.root.src.dir" location="${tuscanyDAS.root.dir}/runtime"/>
+
+ <!--
+ Configure the tuscanyDAS.install.dir
+ Take the override value from platform.properties if set
+ Else take it from the env var TUSCANY_DASCPP
+ Else use a default of ${tuscanyDAS.root.dir}/deploy
+ -->
+ <if>
+ <and>
+ <isset property="platform.tuscanyDAS.install.dir"/>
+ <length string="${platform.tuscanyDAS.install.dir}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="tuscanyDAS.install.dir" location="${platform.tuscanyDAS.install.dir}"/>
+ </then>
+ <elseif>
+ <isset property="env.TUSCANY_DASCPP"/>
+ <then>
+ <property name="tuscanyDAS.install.dir" location="${env.TUSCANY_DASCPP}"/>
+ </then>
+ </elseif>
+ <else>
+ <property name="tuscanyDAS.install.dir" location="${tuscanyDAS.root.dir}/deploy"/>
+ </else>
+ </if>
+
+ <!--
+ Configure the version for all tuscanyDAS libraries
+ If on windows, set it to empty
+ Else take the override value from platform.properties if set
+ Else default it to "0.0.0"
+ -->
+ <if>
+ <os family="windows"/>
+ <then>
+ <property name="tuscanyDAS.library.version" value=""/>
+ </then>
+ <elseif>
+ <and>
+ <isset property="platform.tuscanyDAS.library.version"/>
+ <length string="${platform.tuscanyDAS.library.version}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="tuscanyDAS.library.version" value="${platform.tuscanyDAS.library.version}"/>
+ </then>
+ </elseif>
+ <else>
+ <property name="tuscanyDAS.library.version" value=".0.0.0"/>
+ </else>
+ </if>
+
+<!--
+ Configure tuscanyDAS.release.file.name that defines the generated packed file used on releases
+ Take the override value from platform.properties if set
+ Else take it from env var TUSCANY_DASCPP_RELEASE_NAME
+ If both are not defined, use as default "tuscany_das_cpp" name
+ -->
+ <if>
+ <and>
+ <isset property="platform.tuscanyDAS.release.file.name"/>
+ <length string="${platform.tuscanyDAS.release.file.name}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="tuscanyDAS.release.file.name" value="${platform.tuscanyDAS.release.file.name}"/>
+ </then>
+ <elseif>
+ <and>
+ <isset property="env.TUSCANY_DASCPP_RELEASE_NAME"/>
+ <length string="${env.TUSCANY_DASCPP_RELEASE_NAME}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="tuscanyDAS.release.file.name" value="${env.TUSCANY_DASCPP_RELEASE_NAME}"/>
+ </then>
+ </elseif>
+ <else>
+ <property name="tuscanyDAS.release.file.name" value="tuscany_das_cpp"/>
+ </else>
+ </if>
+
+<!--
+ Configure distribution.dir that defines where the distribution files will be placed
+ Take the override value from platform.properties if set
+ Else assumes ${basedir}/distribution as the distribution folder
+ -->
+ <if>
+ <and>
+ <isset property="platform.tuscanyDAS.distribution.dir"/>
+ <length string="${platform.tuscanyDAS.distribution.dir}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="distribution.dir" location="${platform.tuscanyDAS.distribution.dir}"/>
+ </then>
+ <else>
+ <property name="distribution.dir" value="${basedir}/distribution"/>
+ </else>
+ </if>
+
+
+
+
+ <!--
+ Configure ${enable_sdo} and ${axis2c.home.dir}, which is needed to compile the ws extension
+ Take the override value from platform.properties if set
+ Else take it from the env var AXIS2C_HOME
+ -->
+ <target name="check.sdo">
+ <if>
+ <and>
+ <isset property="platform.libxml2.lib.dir"/>
+ <isset property="platform.libxml2.include.dir"/>
+ <isset property="platform.tuscany.sdo.home.dir"/>
+ <length string="${platform.libxml2.lib.dir}" when="greater" length="0" trim="true"/>
+ <length string="${platform.tuscany.sdo.home.dir}" when="greater" length="0" trim="true"/>
+ <length string="${platform.libxml2.include.dir}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="enable_sdo" value="true"/>
+ <property name="libxml2.lib.dir" location="${platform.libxml2.lib.dir}"/>
+ <property name="libxml2.include.dir" location="${platform.libxml2.include.dir}"/>
+ <property name="tuscany.sdo.home.dir" location="${platform.tuscany.sdo.home.dir}"/>
+ <condition property="iconv.home.dir" value="${platform.iconv.home.dir}">
+ <os family="windows"/>
+ </condition>
+ </then>
+ <elseif>
+ <and>
+ <isset property="env.LIBXML2_LIB"/>
+ <isset property="env.LIBXML2_INCLUDE"/>
+ <isset property="env.TUSCANY_SDOCPP"/>
+ </and>
+ <then>
+ <property name="enable_sdo" value="true"/>
+ <property name="libxml2.lib.dir" location="${env.LIBXML2_LIB}"/>
+ <property name="libxml2.include.dir" location="${env.LIBXML2_INCLUDE}"/>
+ <property name="tuscany.sdo.home.dir" location="${env.TUSCANY_SDOCPP}"/>
+ <condition property="iconv.home.dir" value="${env.ICONV_HOME}">
+ <os family="windows"/>
+ </condition>
+ </then>
+ </elseif>
+ <else>
+ <fail message="Unable to find sdo installation, must be set by TUSCANY_SDOCPP, LIBXML2_LIB and LIBXML2_INCLUDE or in platform.properties file"/>
+ </else>
+ </if>
+ </target>
+
+ <!--
+ Load key id, public and secret key path from platform.properties files into key.id, public.key.path and secret.key.path variables respectively
+ Also checks if the user defined the password on the command line
+ -->
+ <target name="check.keys">
+ <if>
+ <and>
+ <isset property="platform.public.key.path"/>
+ <isset property="platform.key.id"/>
+ <isset property="platform.secret.key.path"/>
+ <length string="${platform.public.key.path}" when="greater" length="0" trim="true"/>
+ <length string="${platform.key.id}" when="greater" length="0" trim="true"/>
+ <length string="${platform.secret.key.path}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="public.key.path" location="${platform.public.key.path}"/>
+ <property name="secret.key.path" location="${platform.secret.key.path}"/>
+ <property name="key.id" value="${platform.key.id}"/>
+ </then>
+ <else>
+ <fail message="The public, secret and key id must be defined on platform.properties file"/>
+ </else>
+ </if>
+ <if>
+ <and>
+ <isset property="password"/>
+ <length string="${password}" when="greater" length="0" trim="true"/> </and>
+ <then>
+ <property name="secret.key.password" value="${password}"/>
+ </then>
+ <else>
+ <fail message='Secret key password was not properly set. Add on the ant command line, for example, -Dpassword="123"'/>
+ </else>
+ </if>
+ </target>
+
+ <!--
+ Configure the debug.compile flag
+ Try looking first on the command line
+ Then take the override value from platform.properties if set
+ Else its false
+ -->
+ <if>
+ <isset property="debug"/>
+ <then>
+ <!-- Tests if its set on the ant command line "ant -Ddebug=true" -->
+ <if>
+ <istrue value="${debug}"/>
+ <then>
+ <property name="debug.compile" value="true"/>
+ </then>
+ </if>
+ </then>
+ <elseif>
+ <and>
+ <isset property="platform.debug.compile"/>
+ <istrue value="${platform.debug.compile}"/>
+ <length string="${platform.debug.compile}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="debug.compile" value="true"/>
+ </then>
+ </elseif>
+ </if>
+ <property name="debug.compile" value="false"/>
+
+ <!--
+ Configure the compiler.name
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.compiler.name"/>
+ <length string="${platform.compiler.name}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="compiler.name" value="${platform.compiler.name}"/>
+ </then>
+ <else>
+ <condition property="compiler.name" value="msvc8">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="compiler.name" value="g++">
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ </condition>
+ </else>
+ </if>
+
+ <!--
+ Configure the lib.ext
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.lib.ext"/>
+ <length string="${platform.lib.ext}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="lib.ext" value="${platform.lib.ext}"/>
+ </then>
+ <else>
+ <condition property="lib.ext" value=".lib">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="lib.ext" value=".dylib">
+ <os family="mac"/>
+ </condition>
+
+ <condition property="lib.ext" value=".so">
+ <os family="unix"/>
+ </condition>
+ </else>
+ </if>
+
+ <!--
+ Configure the dll.ext, used for windows only
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.dll.ext"/>
+ <length string="${platform.dll.ext}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="dll.ext" value="${platform.dll.ext}"/>
+ </then>
+ <else>
+ <condition property="dll.ext" value=".dll">
+ <os family="windows"/>
+ </condition>
+
+ <property name="dll.ext" value=""/>
+
+ </else>
+ </if>
+
+ <!--
+ Configure the lib.prefix
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.lib.prefix"/>
+ <length string="${platform.lib.prefix}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="lib.prefix" value="${platform.lib.prefix}"/>
+ </then>
+ <else>
+ <condition property="lib.prefix" value="">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="lib.prefix" value="lib">
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ </condition>
+ </else>
+ </if>
+
+
+
+ <!--
+ Configure the object.ext
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.object.ext"/>
+ <length string="${platform.object.ext}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="object.ext" value="${platform.object.ext}"/>
+ </then>
+ <else>
+ <condition property="object.ext" value=".obj">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="object.ext" value=".o">
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ </condition>
+ </else>
+ </if>
+
+
+ <!--
+ Configure the exe.ext
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.exe.ext"/>
+ <length string="${platform.exe.ext}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="exe.ext" value="${platform.exe.ext}"/>
+ </then>
+ <else>
+ <condition property="exe.ext" value=".exe">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="exe.ext" value="">
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ </condition>
+ </else>
+ </if>
+
+
+ <!--
+ Configure the script.ext
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.script.ext"/>
+ <length string="${platform.script.ext}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="script.ext" value="${platform.script.ext}"/>
+ </then>
+ <else>
+ <condition property="script.ext" value=".bat">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="script.ext" value=".sh">
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ </condition>
+ </else>
+ </if>
+
+
+ <condition property="windows" value="true">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="mac" value="true">
+ <os family="mac"/>
+ </condition>
+
+ <!--
+ Base compiler definition
+ For now the base compiler is empty.
+ -->
+ <compiler id="Tuscany-BaseCompiler" multithreaded="true" exceptions="true" rtti="true"/>
+
+ <!--
+ Specific compiler definitions
+ The compilerarg location functionality completely omits the arg: antcontrib bug 1794857
+ -->
+
+ <!-- MSVC compilers for windows -->
+ <compiler id="msvc-Compiler" extends="Tuscany-BaseCompiler" name="msvc">
+ <defineset define="WIN32,_CRT_SECURE_NO_DEPRECATE,_CRT_NON_CONFORMING_SWPRINTFS"/>
+ </compiler>
+
+ <!-- MSVC compilers for windows
+ The standard msvc ant contrib cc task compiler doesnt work so well,
+ so we made our own until the bugs are resolved. The actual implementation
+ of TuscanyDASMSVC8DevStudioCCompiler is in TuscanyDAS/tools/ant_cpptasks
+ -->
+
+ <compiler id="msvc8-Compiler"
+ extends="Tuscany-BaseCompiler"
+ classname="tuscany.antCompilers.das.TuscanyMSVC8DevStudioCCompiler">
+
+ <defineset define="WIN32,_CRT_SECURE_NO_DEPRECATE,_CRT_NON_CONFORMING_SWPRINTFS"/>
+ </compiler>
+
+
+ <!-- g++ compiler for most Unix platforms -->
+ <compiler id="g++-Compiler" extends="Tuscany-BaseCompiler" name="g++"/>
+
+ <!-- g++ compiler for most Unix platforms
+ Used for cross compilation with the -m32 flag -->
+ <compiler id="g++m32-Compiler" extends="Tuscany-BaseCompiler" name="g++">
+ <compilerarg value="-m32"/>
+ </compiler>
+
+ <!-- g++ compiler for Apple mac -->
+ <compiler id="mac_g++-Compiler" extends="Tuscany-BaseCompiler" name="g++">
+ <defineset define="IS_DARWIN"/>
+ </compiler>
+
+ <!--
+ Base linker definition
+ -->
+ <linker id="Tuscany-BaseLinker">
+ <syslibset if="windows" libs="kernel32,user32,ws2_32"/>
+ </linker>
+
+ <!--
+ Specific linker definitions
+ -->
+ <linker id="msvc-Linker" extends="Tuscany-BaseLinker" name="msvc"/>
+ <linker id="msvc8-Linker" extends="Tuscany-BaseLinker" name="msvc"/>
+ <linker id="g++-Linker" extends="Tuscany-BaseLinker" name="g++"/>
+ <linker id="g++m32-Linker" extends="Tuscany-BaseLinker" name="g++">
+ <linkerarg value="-m32"/>
+ </linker>
+
+ <if>
+ <and>
+ <isset property="platform.external.definitions.file"/>
+ <length string="${platform.external.definitions.file}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="external.definitions.file" value="${platform.external.definitions.file}"/>
+ <import file="${external.definitions.file}"/>
+ </then>
+ </if>
+ <property name="external.definitions.file" value=""/>
+
+ <target name="display.system" depends="check.sdo">
+
+ <!-- Tuscany paths, etc -->
+ <echo message=" "/>
+ <echo message="TuscanyDAS paths"/>
+ <echo message=" tuscanyDAS.root.dir= ${tuscanyDAS.root.dir}"/>
+ <echo message=" tuscanyDAS.root.src.dir= ${tuscanyDAS.root.src.dir}"/>
+ <echo message=" tuscanyDAS.install.dir= ${tuscanyDAS.install.dir}"/>
+ <echo message=" tuscanyDAS.library.version= '${tuscanyDAS.library.version}'"/>
+ <echo message=" tuscanyDAS.release.file.name= '${tuscanyDAS.release.file.name}'"/>
+
+ <!-- compilers, libs, etc -->
+ <echo message=" "/>
+ <echo message="TuscanyDAS compiler configuration"/>
+ <echo message=" compiler.name= '${compiler.name}'"/>
+ <echo message=" debug.compile= '${debug.compile}'"/>
+ <echo message=" lib.ext= '${lib.ext}'"/>
+ <echo message=" dll.ext= '${dll.ext}'"/>
+ <echo message=" lib.prefix= '${lib.prefix}'"/>
+ <echo message=" object.ext= '${object.ext}'"/>
+ <echo message=" exe.ext= '${exe.ext}'"/>
+ <echo message=" script.ext= '${script.ext}'"/>
+ <echo message=" external.definitions.file= '${external.definitions.file}'"/>
+
+ <!-- libxml2 -->
+ <if>
+ <isset property="enable_sdo"/>
+ <then>
+ <echo message=" "/>
+ <echo message="sdo location"/>
+ <echo message=" tuscany.sdo.home.dir= ${tuscany.sdo.home.dir}"/>
+ </then>
+ </if>
+
+ <!-- axis2c -->
+ <if>
+ <isset property="enable_ws"/>
+ <then>
+ <echo message=" "/>
+ <echo message="axis2c location"/>
+ <echo message=" axis2c.home.dir= ${axis2c.home.dir}"/>
+ </then>
+ </if>
+
+ <echo message=" "/>
+
+ </target>
+
+</project>
diff --git a/das-cpp/trunk/build.xml b/das-cpp/trunk/build.xml
new file mode 100644
index 0000000000..81e4a78866
--- /dev/null
+++ b/das-cpp/trunk/build.xml
@@ -0,0 +1,248 @@
+<?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="TuscanyDASNative" default="all" basedir=".">
+<property name="test.dir" location="runtime/test"/>
+<property name="samples.dir" location="samples"/>
+<property name="tools.dir" location="tools"/>
+
+ <!--
+ This is the root level ant build.xml file for TuscanyDAS Native
+ Nothing is actually performed here, it just delegates to subdirectory
+ build.xml files. Common scripts used by all ant build files can be
+ found in the ant subdirectory.
+ -->
+
+ <import file="antscripts/system.xml"/>
+
+ <property name="distribution.bin.dir" location="${distribution.dir}/bin"/>
+ <property name="distribution.src.dir" location="${distribution.dir}/src"/>
+ <property name="pack.dir" location="${distribution.dir}"/>
+ <property name="runtime.das.dir" value="runtime/core"/>
+
+ <!--
+ Public targets
+ -->
+
+ <target name="all" description="build and install all TuscanyDASNative source code and documentation">
+ <antcall target="build"/>
+ <antcall target="install"/>
+ </target>
+
+ <target name="build" description="Build all TuscanyDASNative source code and documentation">
+ <antcall target="build.das"/>
+ </target>
+
+ <target name="pack.distribution" description="Build all TuscanyDASNative source code and documentation" depends="check.keys">
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}bin.zip"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}src.zip"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}bin.tar.gz"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}src.tar.gz"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}bin.zip.md5"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}src.zip.md5"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}bin.tar.gz.md5"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}src.tar.gz.md5"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}bin.zip.asc"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}src.zip.asc"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}bin.tar.gz.asc"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanyDAS.release.file.name}src.tar.gz.asc"/>
+ <delete quiet="true" dir="${pack.dir}/${tuscanyDAS.release.file.name}bin"/>
+ <delete quiet="true" dir="${pack.dir}/${tuscanyDAS.release.file.name}src"/>
+
+ <!--Packs the bin distribution-->
+ <mkdir dir="${pack.dir}/${tuscanyDAS.release.file.name}bin"/>
+ <copy todir="${pack.dir}/${tuscanyDAS.release.file.name}bin">
+ <fileset dir="${distribution.bin.dir}" includes="**"/>
+ </copy>
+
+ <if>
+ <os family="windows"/>
+ <then>
+ <zip destfile="${pack.dir}/${tuscanyDAS.release.file.name}bin.zip" level="9">
+ <fileset dir="${pack.dir}" includes="${tuscanyDAS.release.file.name}bin/"/>
+ </zip>
+ </then>
+ <else>
+
+ <tar destfile="${pack.dir}/${tuscanyDAS.release.file.name}bin.tar.gz" compression="gzip" longfile="gnu">
+ <fileset dir="${pack.dir}" includes="${tuscanyDAS.release.file.name}bin/"/>
+ </tar>
+
+ </else>
+ </if>
+
+ <delete quiet="true" dir="${pack.dir}/${tuscanyDAS.release.file.name}bin"/>
+
+ <!--Packs the src distribution-->
+ <mkdir dir="${pack.dir}/${tuscanyDAS.release.file.name}src"/>
+ <copy todir="${pack.dir}/${tuscanyDAS.release.file.name}src">
+ <fileset dir="${distribution.src.dir}" includes="**"/>
+ </copy>
+
+ <if>
+ <os family="windows"/>
+ <then>
+ <zip destfile="${pack.dir}/${tuscanyDAS.release.file.name}src.zip" level="9">
+ <fileset dir="${pack.dir}" includes="${tuscanyDAS.release.file.name}src/"/>
+ </zip>
+
+ <!--Generate the checksum files-->
+ <checksum forceOverwrite="yes" file="${pack.dir}/${tuscanyDAS.release.file.name}bin.zip" fileext=".md5"/>
+ <checksum forceOverwrite="yes" file="${pack.dir}/${tuscanyDAS.release.file.name}src.zip" fileext=".md5"/>
+
+ <signer asciiarmor="true" artefact="${pack.dir}/${tuscanyDAS.release.file.name}bin.zip" secring="${secret.key.path}" pubring="${public.key.path}" password="${secret.key.password}" keyid="${key.id}"/>
+ <signer asciiarmor="true" artefact="${pack.dir}/${tuscanyDAS.release.file.name}src.zip" secring="${secret.key.path}" pubring="${public.key.path}" password="${secret.key.password}" keyid="${key.id}"/>
+
+ </then>
+ <else>
+
+ <tar destfile="${pack.dir}/${tuscanyDAS.release.file.name}src.tar.gz" compression="gzip" longfile="gnu">
+ <fileset dir="${pack.dir}" includes="${tuscanyDAS.release.file.name}src/"/>
+ </tar>
+
+ <!--Generate the checksum files-->
+ <checksum forceOverwrite="yes" file="${pack.dir}/${tuscanyDAS.release.file.name}bin.tar.gz" fileext=".md5"/>
+ <checksum forceOverwrite="yes" file="${pack.dir}/${tuscanyDAS.release.file.name}src.tar.gz" fileext=".md5"/>
+
+ <signer asciiarmor="true" artefact="${pack.dir}/${tuscanyDAS.release.file.name}bin.tar.gz" secring="${secret.key.path}" pubring="${public.key.path}" password="${secret.key.password}" keyid="${key.id}"/>
+ <signer asciiarmor="true" artefact="${pack.dir}/${tuscanyDAS.release.file.name}src.tar.gz" secring="${secret.key.path}" pubring="${public.key.path}" password="${secret.key.password}" keyid="${key.id}"/>
+
+ </else>
+ </if>
+
+ <delete quiet="true" dir="${pack.dir}/${tuscanyDAS.release.file.name}src"/>
+
+ </target>
+
+ <target name="test" description="Run DAS tests">
+ <ant target="all" antfile="${test.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="distribution" description="Generate all TuscanyDASNative distribution structure">
+ <antcall target="distribution.das"/>
+ </target>
+
+ <target name="install" description="Install TuscanyDASNative libraries and headers">
+ <antcall target="install.das"/>
+ <!--antcall target="install.docs"/-->
+ </target>
+
+ <target name="clean" description="Clean all TuscanyDASNative compiled source code">
+ <antcall target="clean.das"/>
+ <antcall target="clean.test"/>
+ <antcall target="clean.samples"/>
+ <delete dir="deploy" quiet="true"/>
+ </target>
+
+ <target name="tools" description="Build and Install all TuscanyDASNative tools">
+ <antcall target="build.tools"/>
+ </target>
+
+<target name="samples" description="Build and Install all TuscanyDASNative samples">
+ <antcall target="build.samples"/>
+</target>
+
+<target name="tests" description="Build and run all TuscanyDASNative tests">
+ <ant target="all" antfile="${test.dir}/build.xml" inheritAll="false"/>
+</target>
+
+
+ <!--
+ Internal targets
+ They can still be called, they're just not described, so wont show up in "ant -p"
+ Using antfile and inheritAll="false" to maintain the subdir build.xml basedir settings
+ -->
+
+ <target name="build.tools">
+ <ant target="all" antfile="${tools.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="build.das">
+ <ant target="build" antfile="${runtime.das.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="generate.docs">
+ <!--ant target="generate.docs" antfile="${runtime.das.dir}/build.xml" inheritAll="false"/-->
+ </target>
+
+ <target name="install.das">
+ <ant target="install" antfile="${runtime.das.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="distribution.das">
+ <delete dir="${distribution.dir}" quiet="true"/>
+ <antcall target="clean"/>
+
+ <!-- Create source distribution -->
+ <copy
+ overwrite="true"
+ todir="${distribution.src.dir}">
+ <fileset dir="." excludes="deploy/ distribution/ **/VSExpress/ antscripts/OpenPGP.jar"/>
+ </copy>
+
+ <antcall target="tools"/>
+ <antcall target="all"/>
+ <antcall target="samples"/>
+
+ <!-- Create bin distribution -->
+ <copy
+ overwrite="true"
+ todir="${distribution.bin.dir}">
+ <fileset dir="${tuscanyDAS.install.dir}"/>
+ </copy>
+ <copy
+ overwrite="true"
+ todir="${distribution.dir}/bin/antscripts">
+ <fileset dir="antscripts" excludes="OpenPGP.jar"/>
+ </copy>
+
+ <ant target="distribution" antfile="${samples.dir}/build.xml"/>
+
+ <delete includeemptydirs="true">
+ <fileset dir="${distribution.dir}" includes="**/VSExpress"/>
+ </delete>
+
+ </target>
+
+ <target name="clean.das">
+ <ant target="clean" antfile="${runtime.das.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="clean.tools">
+ <ant target="clean" antfile="${tools.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+<target name="clean.test">
+ <ant target="clean" antfile="${test.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="build.samples">
+ <ant target="all" antfile="${samples.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="clean.samples">
+ <ant target="clean" antfile="${samples.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="clean.distribution">
+ <delete dir="${distribution.dir}/" quiet="true"/>
+ </target>
+
+</project>
diff --git a/das-cpp/trunk/runtime/core/build.xml b/das-cpp/trunk/runtime/core/build.xml
new file mode 100644
index 0000000000..ae448d0628
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/build.xml
@@ -0,0 +1,147 @@
+<?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="TuscanyDASNative_core" default="all" basedir="../..">
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+ <!--
+ Notice that the basedir for this project is set to the TuscanyDAS root dir
+ This makes path setting in system.xml much simpler, but we'll just have to
+ set a property here to this directory.
+ -->
+ <property name="this.dir" location="${basedir}/runtime/core"/>
+ <property name="das.base.dir" value="apache/das"/>
+
+ <property name="das.dir" location="${this.dir}/src/${das.base.dir}"/>
+ <property name="das.lib.dir" location="${das.dir}/.libs"/>
+
+<path id="all.src.path">
+ <pathelement location="${das.base.dir}"/>
+ <pathelement location="${das.base.dir}/rdb"/>
+ </path>
+ <property name="all.src.path" refid="all.src.path" />
+
+
+ <property name="tuscany.das.lib" value="tuscany_das"/>
+
+ <!--
+ Public targets
+ -->
+ <target name="all" description="compile, link, and install all TuscanyDASNative source code">
+ <antcall target="build.das"/>
+ <antcall target="install.das"/>
+ </target>
+
+ <target name="build" description="compile and link all TuscanyDASNative source code">
+ <antcall target="build.das"/>
+ <antcall target="install.das"/>
+ </target>
+
+ <target name="install" description="Install TuscanyDASNative libraries and headers">
+ <antcall target="install.das"/>
+ </target>
+
+ <target name="clean" description="Clean all TuscanyDASNative core compiled source code">
+ <antcall target="clean.das"/>
+ </target>
+
+ <!--
+ Internal targets
+ They can still be called, they're just not described, so wont show up in "ant -p"
+ -->
+
+ <!-- build -->
+
+ <target name="build.das" depends="check.sdo" if="enable_sdo">
+ <cpp-build
+ srcdir="${das.dir}"
+ outdir="${das.lib.dir}"
+ outtype="static"
+ outfile="${tuscany.das.lib}">
+ <custom-build-elements>
+
+ <includepath path="${tuscany.das.home.dir}/include"/>
+ <includepath path="${iconv.home.dir}/include"/>
+ <includepath path="${tuscany.sdo.home.dir}/include"/>
+ <includepath path="${libxml2.include.dir}"/>
+ <includepath path="${this.dir}/include"/>
+
+ <libset dir="${libxml2.lib.dir}" libs="libxml2"/>
+ <libset dir="${tuscany.sdo.home.dir}/lib" libs="tuscany_sdo"/>
+ <libset libs="odbc32"/>
+
+ </custom-build-elements>
+ </cpp-build>
+ <cpp-build
+ srcdir="${das.dir}"
+ outdir="${das.lib.dir}"
+ outfile="${tuscany.das.lib}">
+ <custom-build-elements>
+
+ <includepath path="${tuscany.das.home.dir}/include"/>
+ <includepath path="${iconv.home.dir}/include"/>
+ <includepath path="${tuscany.sdo.home.dir}/include"/>
+ <includepath path="${libxml2.include.dir}"/>
+ <includepath path="${this.dir}/include"/>
+
+ <libset dir="${libxml2.lib.dir}" libs="libxml2"/>
+ <libset dir="${tuscany.sdo.home.dir}/lib" libs="tuscany_sdo"/>
+ <libset libs="odbc32"/>
+
+ </custom-build-elements>
+ </cpp-build>
+
+</target>
+
+ <!-- install -->
+
+ <target name="install.das" depends="check.sdo" if="enable_sdo">
+ <cpp-install-lib
+ lib="${tuscany.das.lib}"
+ srcdir="${das.lib.dir}"
+ destrootdir="${tuscanyDAS.install.dir}"/>
+ <cpp-symlink
+ linkdir="${tuscanyDAS.install.dir}/lib"
+ link="${lib.prefix}${tuscany.das.lib}${lib.ext}"
+ resource="${lib.prefix}${tuscany.das.lib}${lib.ext}${tuscanyDAS.library.version}"/>
+ <cpp-install-files
+ srcdir="${this.dir}/include/${das.base.dir}"
+ files="**/*.h"
+ destdir="${tuscanyDAS.install.dir}/include/${das.base.dir}"/>
+ </target>
+
+
+ <!-- clean -->
+
+ <target name="clean.das">
+ <cpp-clean-files
+ dir="${tuscanyDAS.install.dir}/include/${das.base.dir}"
+ rmdir="true"/>
+ <cpp-clean-lib
+ lib="${tuscany.das.lib}"
+ librootdir="${tuscanyDAS.install.dir}"/>
+ <cpp-clean-files
+ dir="${das.lib.dir}"
+ rmdir="true"/>
+ </target>
+
+
+</project>
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/Command.h b/das-cpp/trunk/runtime/core/include/apache/das/Command.h
new file mode 100644
index 0000000000..f7a6645826
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/Command.h
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+#ifndef COMMAND_H
+#define COMMAND_H
+
+#include "apache/das/RefCountingObject.h"
+
+#include "commonj/sdo/DataObject.h"
+
+#include <string>
+
+namespace apache {
+ namespace das {
+
+class Command;
+typedef RefCountingObject<Command> CommandObject;
+
+/**
+ * A Command is used to execute a read or write to a database
+ */
+class Command : public CommandObject {
+
+ public:
+ Command(void);
+ virtual ~Command(void);
+
+ /**
+ * Performs the function defined by the command
+ */
+ //void execute(void);
+
+ /**
+ * Performs the function defined by the command and return the results in the root DataObject
+ *
+ * @return the root DataObject
+ */
+ virtual commonj::sdo::DataObjectPtr executeQuery(void);
+
+};
+
+ };
+};
+
+#endif //COMMAND_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/CommandPtr.h b/das-cpp/trunk/runtime/core/include/apache/das/CommandPtr.h
new file mode 100644
index 0000000000..60d4082adb
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/CommandPtr.h
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+#ifndef COMMAND_PTR_H
+#define COMMAND_PTR_H
+
+#include "apache/das/RefCountingPointer.h"
+
+namespace apache {
+ namespace das {
+
+ class Command;
+ typedef RefCountingPointer<Command> CommandPtr;
+
+ };
+};
+
+#endif //COMMAND_PTR_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/Config.h b/das-cpp/trunk/runtime/core/include/apache/das/Config.h
new file mode 100644
index 0000000000..aab771c02c
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/Config.h
@@ -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.
+ */
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include <string>
+
+namespace apache {
+ namespace das {
+
+class Config {
+
+ private:
+ std::string uri;
+
+ public:
+ Config(void);
+ Config(const Config& config);
+ Config(std::string xmlFile);
+ virtual ~Config(void);
+
+ virtual std::string getURI(void) const;
+ virtual void setURI(std::string uri);
+
+};
+
+ };
+};
+
+#endif //CONFIG_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/DAS.h b/das-cpp/trunk/runtime/core/include/apache/das/DAS.h
new file mode 100644
index 0000000000..ed5269a813
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/DAS.h
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+#ifndef D_A_S_H
+#define D_A_S_H
+
+#include "apache/das/DASFactory.h"
+#include "apache/das/Command.h"
+#include "apache/das/CommandPtr.h"
+
+#include "commonj/sdo/DataObject.h"
+
+namespace apache {
+ namespace das {
+
+class DASFactory;
+class Config;
+
+class DAS {
+
+ private:
+ static DASFactory* FACTORY;
+
+ public:
+ static DASFactory* getFACTORY(void);
+
+ DAS(void);
+ virtual ~DAS(void);
+
+ virtual const Config& getConfig(void) const = 0;
+ virtual CommandPtr getCommand(std::string commandName);
+ virtual void applyChanges(commonj::sdo::DataObjectPtr root) = 0;
+
+};
+
+ };
+};
+
+#endif //D_A_S_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/DASCommandNotFoundException.h b/das-cpp/trunk/runtime/core/include/apache/das/DASCommandNotFoundException.h
new file mode 100644
index 0000000000..055a157167
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/DASCommandNotFoundException.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_COMMAND_NOT_FOUND_EXCEPTION_H
+#define DAS_COMMAND_NOT_FOUND_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+
+class DASCommandNotFoundException : public std::exception {
+
+ public:
+ DASCommandNotFoundException(std::string message = "");
+ virtual ~DASCommandNotFoundException(void);
+
+};
+
+ };
+};
+
+#endif //DAS_COMMAND_NOT_FOUND_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/DASFactory.h b/das-cpp/trunk/runtime/core/include/apache/das/DASFactory.h
new file mode 100644
index 0000000000..e326d3f171
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/DASFactory.h
@@ -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.
+ */
+#ifndef D_A_S_FACTORY_H
+#define D_A_S_FACTORY_H
+
+#include <windows.h>
+#include <sql.h>
+#include <string>
+
+#include "apache/das/DAS.h"
+#include "apache/das/rdb/Connection.h"
+
+namespace apache {
+ namespace das {
+
+class Config;
+
+class DAS;
+
+class DASFactory {
+
+ public:
+ DASFactory(void);
+ virtual ~DASFactory(void);
+ virtual DAS* createDAS(rdb::Connection& connection);
+ virtual DAS* createDAS(const Config& config, rdb::Connection& connection);
+ virtual DAS* createDAS(const Config& config);
+
+
+};
+
+ };
+};
+
+#endif //D_A_S_FACTORY_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/DASInvalidPropertyNameException.h b/das-cpp/trunk/runtime/core/include/apache/das/DASInvalidPropertyNameException.h
new file mode 100644
index 0000000000..60490301ed
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/DASInvalidPropertyNameException.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_PROPERTY_NAME_EXCEPTION_H
+#define DAS_INVALID_PROPERTY_NAME_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+
+class DASInvalidPropertyNameException : public std::exception {
+
+ public:
+ DASInvalidPropertyNameException(std::string message = "");
+ virtual ~DASInvalidPropertyNameException(void);
+
+};
+
+ };
+};
+
+#endif //DAS_INVALID_PROPERTY_NAME_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/DASInvalidTypeNameException.h b/das-cpp/trunk/runtime/core/include/apache/das/DASInvalidTypeNameException.h
new file mode 100644
index 0000000000..06aea94a09
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/DASInvalidTypeNameException.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_TYPE_NAME_EXCEPTION_H
+#define DAS_INVALID_TYPE_NAME_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+
+class DASInvalidTypeNameException : public std::exception {
+
+ public:
+ DASInvalidTypeNameException(std::string message = "");
+ virtual ~DASInvalidTypeNameException(void);
+
+};
+
+ };
+};
+
+#endif //DAS_INVALID_TYPE_NAME_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/DASNullPointerException.h b/das-cpp/trunk/runtime/core/include/apache/das/DASNullPointerException.h
new file mode 100644
index 0000000000..ab9b0a37ea
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/DASNullPointerException.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_NULL_POINTER_EXCEPTION_H
+#define DAS_NULL_POINTER_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+
+class DASNullPointerException : public std::exception {
+
+ public:
+ DASNullPointerException(std::string message = "");
+ virtual ~DASNullPointerException(void);
+
+};
+
+ };
+};
+
+#endif //DAS_NULL_POINTER_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/DataGraphPrinter.h b/das-cpp/trunk/runtime/core/include/apache/das/DataGraphPrinter.h
new file mode 100644
index 0000000000..2c1c63c4eb
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/DataGraphPrinter.h
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+#ifndef DATA_GRAPH_PRINTER_H
+#define DATA_GRAPH_PRINTER_H
+
+#include <ostream>
+
+#include "apache/das/StringWrapper.h"
+
+#include "commonj/sdo/DataObject.h"
+
+namespace apache {
+ namespace das {
+
+class DataGraphPrinter {
+ private:
+ commonj::sdo::DataObjectPtr root;
+ unsigned int tabCount;
+ std::ostream* out;
+
+ std::string getTab(int count) const;
+ void printDataGraph(commonj::sdo::DataObjectPtr dataObject, bool ref = false);
+
+ public:
+ DataGraphPrinter(commonj::sdo::DataObjectPtr root);
+ virtual ~DataGraphPrinter(void);
+
+ virtual void print(std::ostream& out);
+ virtual void printMetaData(std::ostream& out);
+
+};
+
+ };
+};
+
+#endif //DATA_GRAPH_PRINTER_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/RefCountingObject.h b/das-cpp/trunk/runtime/core/include/apache/das/RefCountingObject.h
new file mode 100644
index 0000000000..c69bcf6e34
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/RefCountingObject.h
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+#ifndef REF_COUNTING_OBJECT_H
+#define REF_COUNTING_OBJECT_H
+
+#include <iostream>
+#include <list>
+
+#include "apache/das/RefCountingPointer.h"
+
+namespace apache {
+ namespace das {
+
+/**
+ * RefcountingObject is the base class for all objects in SDO
+ * These objects keep a count of references to themselves, then
+ * free themselves when they are unused.
+ */
+template <class T>
+ class RefCountingObject
+ {
+
+ public:
+ RefCountingObject();
+ RefCountingObject(const RefCountingObject<T>& rc);
+ T& operator=(const T& rc);
+ virtual ~RefCountingObject();
+/**
+ * Add to the reference count - a new pointer has been created.
+ */
+ void addRef(RefCountingPointer<T>* refPtr);
+/**
+ * Subtract from the the reference count - a reference has dropped.
+ */
+ virtual void releaseRef(RefCountingPointer<T>* refPtr);
+
+/**
+ * Print contents to stream
+ */
+ virtual std::ostream& printSelf(std::ostream &os);
+
+ protected:
+ virtual void free(void);
+
+ private:
+ bool freed;
+ unsigned int refCount;
+ std::list<RefCountingPointer<T>*>* refPtrs;
+
+ };
+
+ };
+};
+
+
+#endif //REF_COUNTING_OBJECT_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/RefCountingPointer.h b/das-cpp/trunk/runtime/core/include/apache/das/RefCountingPointer.h
new file mode 100644
index 0000000000..22a2ef7f08
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/RefCountingPointer.h
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+#ifndef REF_COUNTING_POINTER_H
+#define REF_COUNTING_POINTER_H
+
+#include <iostream>
+
+#include "apache/das/DASNullPointerException.h"
+
+namespace apache {
+ namespace das {
+
+ template <class T>
+class RefCountingPointer {
+
+ public:
+ /*SDO_API*/ RefCountingPointer(T* realPtr = 0, bool objectOwner = true);
+ RefCountingPointer(const RefCountingPointer<T>& rhs, bool objectOwner = true);
+ /*SDO_API*/ RefCountingPointer(T& rhs, bool objectOwner = true);
+ /*SDO_API*/ virtual ~RefCountingPointer(void);
+ /*SDO_API*/ RefCountingPointer& operator=(const RefCountingPointer<T>& rhs);
+
+ /*SDO_API*/ bool operator==(RefCountingPointer<T>& test) const;
+ /*SDO_API*/ T* operator->() const;
+ /*SDO_API*/ T& operator*() const;
+ /*SDO_API*/ bool operator!() const;
+ bool isObjectOwner(void) const;
+
+#ifdef MFT
+ // MFT == member function templates
+ // Notes on the items below.
+ // In our code, we use subclasses to expose the API, and super
+ // classes to implement. E,g DataObject and DataObjectImpl.
+ // In some cases, we know that the DataObject given to us is a
+ // DataObjectImpl, and cast it. With RefCountingPointers, however,
+ // the cast cannot work, as the RefCountingPointer to the superclass
+ // is not related to the RCP to the subclass. Recent changes in the
+ // C++ language allow this to work by defining an operator which
+ // causes a pointer of the other type to be returned, as long as pointee
+ // is acceptable as a parameter to the cosntructor of the other type
+ // of pointer. This works in C++.NET, but not in C++6:
+ operator RefCountingPointer<otherType>()
+ {
+ return RefCountingPointer<otherType>(pointee);
+ }
+
+ // Since we are using C6, a possible workround is to provide a method
+ // which returns the dumb pointer, then construct a pointer to the
+ // base class from the pointer returned. This is that the operator T* does.
+ // The code in DataObject could be simpler if we used C7,and we should
+ // discusss changing.
+#else
+ operator T*() {return pointee;}
+#endif
+
+ template <class otherType>
+ operator RefCountingPointer<otherType>()
+ {
+ return RefCountingPointer<otherType>(pointee);
+ }
+
+ friend std::ostream& operator<< (std::ostream &os, const RefCountingPointer<T>& ptr)
+ {
+ if (!ptr)
+ {
+ os << "NULL" << std::endl;
+ }
+ else
+ {
+ ptr->printSelf(os);
+ }
+
+ return os;
+ }
+
+ private:
+ T *pointee;
+ bool objectOwner;
+ void init();
+
+};
+
+ };
+};
+
+#endif //REF_COUNTING_POINTER_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/SDODataObjectWrapper.h b/das-cpp/trunk/runtime/core/include/apache/das/SDODataObjectWrapper.h
new file mode 100644
index 0000000000..e3653640a7
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/SDODataObjectWrapper.h
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+#ifndef SDO_DATA_OBJECT_WRAPPER_H
+#define SDO_DATA_OBJECT_WRAPPER_H
+
+#include <string>
+
+#include "commonj/sdo/DataObject.h"
+
+namespace apache {
+ namespace das {
+
+class SDODataObjectWrapper {
+
+ private:
+ commonj::sdo::DataObjectPtr dataObject;
+
+ public:
+ SDODataObjectWrapper(commonj::sdo::DataObjectPtr dataObject);
+ virtual ~SDODataObjectWrapper(void);
+
+ std::string getString(std::string propertyName) const;
+
+};
+
+ };
+};
+
+#endif //SDO_DATA_OBJECT_WRAPPER_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/StringWrapper.h b/das-cpp/trunk/runtime/core/include/apache/das/StringWrapper.h
new file mode 100644
index 0000000000..626f2f81e5
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/StringWrapper.h
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+#ifndef STRING_WRAPPER_H
+#define STRING_WRAPPER_H
+
+#include <string>
+#include <ctype.h>
+#include <sstream>
+
+#include "commonj/sdo/DataObject.h"
+
+namespace apache {
+ namespace das {
+
+class StringWrapper {
+
+ private:
+ std::string str;
+
+ public:
+ static std::string toString(const int& t);
+ static std::string toString(const double& t);
+ static std::string toString(const long double& t);
+ static std::string toString(const float& t);
+ static std::string toString(const wchar_t& t);
+ static std::string toString(const long& t);
+ static std::string toString(const unsigned int& t);
+ static std::string toString(const unsigned char& t);
+
+ StringWrapper(std::string str);
+ StringWrapper(commonj::sdo::DataObjectPtr dataObject, std::string propertyName);
+
+ std::string toLower(void) const;
+ std::string toUpper(void) const;
+ bool isValidRDBName(void) const;
+ std::string getString(void) const;
+ void defineOnDataObject(commonj::sdo::DataObjectPtr dataObject, std::string propertyName) const;
+
+};
+
+ };
+};
+
+#endif //STRING_WRAPPER_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/ApplyChanges.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ApplyChanges.h
new file mode 100644
index 0000000000..88b6195315
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ApplyChanges.h
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+#ifndef APPLY_CHANGES_H
+#define APPLY_CHANGES_H
+
+#include <list>
+#include <string>
+
+#include "apache/das/rdb/DASImpl.h"
+#include "apache/das/rdb/ConfigImpl.h"
+#include "apache/das/rdb/Relationship.h"
+#include "apache/das/rdb/KeyPair.h"
+#include "apache/das/rdb/ModifiedDataObject.h"
+#include "apache/das/rdb/DeletedDataObject.h"
+#include "apache/das/rdb/CreatedDataObject.h"
+#include "apache/das/rdb/DASPrimaryKeyNotFoundException.h"
+
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/ChangeSummary.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASDataObject;
+class CreatedDataObject;
+class DeletedDataObject;
+class ConfigImpl;
+class DASImpl;
+
+class ApplyChanges {
+
+ private:
+ commonj::sdo::DataObjectPtr root;
+ const ConfigImpl* config;
+ std::map<std::string, const Relationship*> relationships;
+ std::map<std::string, const Table*> tables;
+ std::map<std::string, std::list<DASDataObject*>*> dasDataObjects;
+ std::list<DASDataObject*> stack;
+ std::list<DASDataObject*> updateOrderList;
+ commonj::sdo::ChangeSummaryPtr summary;
+
+ void processRootDataObject(commonj::sdo::DataObjectPtr dataObject);
+ DASDataObject& processDataObject(commonj::sdo::DataObjectPtr dataObject);
+ DeletedDataObject& processDeletedDataObject(commonj::sdo::DataObjectPtr dataObject);
+ CreatedDataObject& processCreatedDataObject(commonj::sdo::DataObjectPtr dataObject);
+ ModifiedDataObject& processModifiedDataObject(commonj::sdo::DataObjectPtr dataObject);
+ DASDataObject* getDASDataObject(commonj::sdo::DataObjectPtr dataObject) const;
+ void addDataObject(DASDataObject& dataObject);
+ void processMetadata(commonj::sdo::DataObjectPtr dataObject);
+ bool isInStack(const DASDataObject& dasDataObject);
+ const Table& getTable(commonj::sdo::DataObjectPtr dataObject);
+ const Relationship& getRelationship(DASDataObject& parentDataObject, DASDataObject& dataObject) const;
+
+ public:
+ ApplyChanges(DASImpl& das, commonj::sdo::DataObjectPtr root);
+ ~ApplyChanges(void);
+
+};
+
+ };
+ };
+};
+
+#endif //APPLY_CHANGES_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/Column.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/Column.h
new file mode 100644
index 0000000000..f162287f25
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/Column.h
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+#ifndef COLUMN_H
+#define COLUMN_H
+
+#include <windows.h>
+#include <sql.h>
+#include <sqlext.h>
+#include <string>
+#include <list>
+
+#include "apache/das/rdb/Table.h"
+#include "apache/das/rdb/DASInvalidColumnNameException.h"
+#include "apache/das/DASInvalidPropertyNameException.h"
+#include "apache/das/StringWrapper.h"
+#include "apache/das/rdb/das_constants.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class Table;
+
+class Column {
+
+ friend class Table;
+
+ private:
+ bool pk;
+ std::string columnName;
+ std::string propertyName;
+ SQLSMALLINT sqlType;
+ Table* containerTable;
+ bool managed;
+ bool collision;
+
+ void setContainerTable(Table* containerTable);
+
+ public:
+ Column(const Column& column);
+ Column(std::string columnName, SQLSMALLINT sqlType);
+ virtual ~Column(void);
+
+ void setPropertyName(std::string propertyName);
+ void setPK(bool pk);
+ void setCollision(bool collision);
+ void setManaged(bool managed);
+
+ bool isPK(void) const;
+ std::string getPropertyName(void) const;
+ SQLSMALLINT getSQLType(void) const;
+ Table* getContainerTable(void) const;
+ std::string getName(void) const;
+ bool isCollision(void) const;
+ bool isManaged(void) const;
+
+};
+
+ };
+ };
+};
+
+#endif //COLUMN_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/ColumnData.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ColumnData.h
new file mode 100644
index 0000000000..8b25e74c19
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ColumnData.h
@@ -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.
+ */
+#ifndef COLUMN_DATA_H
+#define COLUMN_DATA_H
+
+#include <windows.h>
+#include <sql.h>
+#include <sqlext.h>
+#include <string>
+
+#include "apache/das/StringWrapper.h"
+#include "apache/das/rdb/DASInvalidSQLTypeException.h"
+#include "apache/das/rdb/Column.h"
+#include "apache/das/rdb/TableData.h"
+
+#include "commonj/sdo/Setting.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class TableData;
+
+class ColumnData {
+
+ private:
+ const Column* column;
+ void* data;
+
+ public:
+ ColumnData(const Column& column, ResultSetPtr resultSet);
+ ColumnData(const Column& column, const commonj::sdo::Setting& setting);
+ ColumnData(const Column& column, commonj::sdo::DataObjectPtr dataObject);
+ virtual ~ColumnData(void);
+
+ bool operator==(const ColumnData& columnData) const;
+ bool operator!=(const ColumnData& columnData) const;
+ bool operator<(const ColumnData& columnData) const;
+ bool operator>(const ColumnData& columnData) const;
+ const Column& getColumn(void) const;
+ std::string toSQL(void) const;
+
+ void populateDataGraph(TableData& tableData) const;
+
+};
+
+ };
+ };
+};
+
+#endif //COLUMN_DATA_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/CommandImpl.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/CommandImpl.h
new file mode 100644
index 0000000000..c96af3d939
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/CommandImpl.h
@@ -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.
+ */
+#ifndef COMMAND_IMPL_H
+#define COMMAND_IMPL_H
+
+#include <string>
+
+#include "apache/das/Command.h"
+#include "apache/das/rdb/Connection.h"
+
+#include "commonj/sdo/DataObject.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASImpl;
+
+class CommandImpl : public Command {
+
+ protected:
+ DASImpl* das;
+ std::string sql;
+ StatementPtr statement;
+
+ public:
+ CommandImpl(DASImpl& das, std::string sqlString);
+ virtual ~CommandImpl(void);
+ virtual commonj::sdo::DataObjectPtr executeQuery(void);
+ virtual DASImpl& getDAS(void);
+ virtual void close(void);
+
+};
+
+ };
+ };
+};
+
+#endif //COMMAND_IMPL_H
+
+
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/ConfigImpl.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ConfigImpl.h
new file mode 100644
index 0000000000..d0805b06f2
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ConfigImpl.h
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+#ifndef CONFIG_IMPL_H
+#define CONFIG_IMPL_H
+
+#include <list>
+#include <map>
+
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+#include "commonj/sdo/XSDHelper.h"
+#include "commonj/sdo/XMLHelper.h"
+#include "commonj/sdo/HelperProvider.h"
+#include "commonj/sdo/DataObject.h"
+
+#include "apache/das/Config.h"
+#include "apache/das/SDODataObjectWrapper.h"
+#include "apache/das/DASCommandNotFoundException.h"
+#include "apache/das/DAS.h"
+#include "apache/das/rdb/Table.h"
+#include "apache/das/rdb/Column.h"
+#include "apache/das/rdb/Relationship.h"
+#include "apache/das/rdb/RelationshipWrapper.h"
+#include "apache/das/DataGraphPrinter.h"
+
+class Column;
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class Table;
+
+class ConfigImpl : public ::apache::das::Config {
+
+ private:
+ std::map<std::string, const Relationship*>* relationships;
+ std::map<std::string, const Table*>* tables;
+ bool convOverConfig;
+ std::map<std::string, std::string>* commands;
+
+ Table& newTable(Table& table);
+ Relationship& newRelationship(Relationship& relationship);
+
+ public:
+ ConfigImpl(void);
+ ConfigImpl(const Config& config);
+ ConfigImpl(std::string xmlFile);
+ virtual ~ConfigImpl(void);
+
+ Table& addTable(std::string tableName);
+ Table& addTable(const Table& table);
+ Relationship& addRelationship(std::string pkTableName, std::string fkTableName, std::string name = "");
+ Relationship& addRelationship(const Relationship& relationship);
+
+ const std::map<std::string, Relationship*>& getRelationships(void) const;
+ const std::map<std::string, Table*>& getTables(void) const;
+ const Table* getTableByTypeName(std::string typeName) const;
+ std::string getCommand(std::string commandName) const;
+
+ DAS& getDAS(void) const;
+ bool isConvOverConfig(void) const;
+
+ const Table* getTable(std::string tableName) const;
+ const Relationship* getRelationship(std::string pkTableName, std::string fkTableName) const;
+
+};
+
+ };
+ };
+};
+
+#endif //CONFIG_IMPL_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/Connection.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/Connection.h
new file mode 100644
index 0000000000..6507c3786e
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/Connection.h
@@ -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.
+ */
+#ifndef CONNECTION_H
+#define CONNECTION_H
+
+#include <windows.h>
+#include <sql.h>
+#include <sqlext.h>
+
+#include <string>
+#include <list>
+#include <iostream>
+#include <algorithm>
+
+#include "apache/das/rdb/StatementPtr.h"
+#include "apache/das/rdb/Statement.h"
+#include "apache/das/rdb/SQLException.h"
+
+using std::string;
+using std::exception;
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class Connection {
+
+ private:
+ SQLHDBC connection;
+ SQLHENV environment;
+ std::list<StatementPtr*> statements;
+
+ void setAutoCommit(bool autoCommit);
+
+ public:
+ Connection(string dsn, string user, string password);
+ Connection(string connectString);
+ virtual ~Connection(void);
+ SQLHDBC getODBCConnection(void) const;
+ void commit(void);
+ void rollback(void);
+ StatementPtr createStatement(void);
+ //PreparedStatement& prepareStatement(string sql);
+
+};
+
+ };
+ };
+};
+
+#endif //CONNECTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/CreatedDataObject.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/CreatedDataObject.h
new file mode 100644
index 0000000000..54ef73b729
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/CreatedDataObject.h
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+#ifndef CREATED_DATA_OBJECT_H
+#define CREATED_DATA_OBJECT_H
+
+#include "apache/das/rdb/DASDataObject.h"
+
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SettingList.h"
+#include "commonj/sdo/ChangeSummary.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ModifiedDataObject;
+
+class CreatedDataObject : public DASDataObject {
+
+ private:
+ std::string statement;
+
+ public:
+ CreatedDataObject(const Table& table, commonj::sdo::DataObjectPtr dataObject,
+ commonj::sdo::ChangeSummaryPtr changeSummary);
+
+ ~CreatedDataObject(void);
+
+ std::string getStatement(void) const;
+ void printStmt(void);
+
+};
+
+ };
+ };
+};
+
+#endif //CREATED_DATA_OBJECT_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASColumnNotFoundException.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASColumnNotFoundException.h
new file mode 100644
index 0000000000..9ebaebc1b9
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASColumnNotFoundException.h
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_COLUMN_NOT_FOUND_EXCEPTION_H
+#define DAS_COLUMN_NOT_FOUND_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASColumnNotFoundException : public std::exception {
+
+ public:
+ DASColumnNotFoundException(std::string message = "");
+ virtual ~DASColumnNotFoundException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_COLUMN_NOT_FOUND_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASDataObject.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASDataObject.h
new file mode 100644
index 0000000000..39a5248f67
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASDataObject.h
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+#ifndef DAS_DATA_OBJECT_H
+#define DAS_DATA_OBJECT_H
+
+#include "apache/das/rdb/PKObject.h"
+//#include "apache/das/rdb/Statement.h"
+#include "apache/das/rdb/RelationshipStatement.h"
+
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SettingList.h"
+#include "commonj/sdo/ChangeSummary.h"
+#include "apache/das/rdb/DASOptimisticConcurrencyControlException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ColumnData;
+class Table;
+class RelationshipStatement;
+
+class DASDataObject : public PKObject {
+
+ private:
+ commonj::sdo::DataObjectPtr dataObject;
+ commonj::sdo::ChangeSummaryPtr changeSummary;
+ std::list<std::string> updateStatements;
+ std::map<std::string, RelationshipStatement*> fks;
+ std::list<RelationshipStatement*> dependencies;
+ bool occChecked;
+
+ public:
+ DASDataObject(const Table& table, commonj::sdo::DataObjectPtr dataObject,
+ commonj::sdo::ChangeSummaryPtr changeSummary);
+
+ ~DASDataObject(void);
+
+ const commonj::sdo::DataObjectPtr getDataObject(void) const;
+ std::string getWhereStmt(void) const;
+ RelationshipStatement& addFK(const Relationship& relationship, const KeyDataList* keyDataList);
+
+ virtual std::string getStatement(void) const;
+ virtual void addDependency(RelationshipStatement& relationshipStatement);
+
+ virtual void execute(StatementPtr stmt);
+ virtual void printStmt(void);
+
+ virtual bool isOCCChecked(void) const;
+ virtual void setOCCChecked(bool occChecked);
+ virtual long getOldOCC(void) const;
+ virtual long getNewOCC(void) const;
+
+};
+
+ };
+ };
+};
+
+#include "apache/das/rdb/Table.h"
+#include "apache/das/StringWrapper.h"
+#include "apache/das/rdb/ColumnData.h"
+
+#endif //DAS_DATA_OBJECT_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASFactoryImpl.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASFactoryImpl.h
new file mode 100644
index 0000000000..bed088f246
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASFactoryImpl.h
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+#ifndef D_A_S_FACTORY_IMPL_H
+#define D_A_S_FACTORY_IMPL_H
+
+#include <windows.h>
+#include <sql.h>
+#include <sqlext.h>
+
+#include "apache/das/DAS.h"
+#include "apache/das/rdb/DASImpl.h"
+#include "apache/das/DASFactory.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASFactoryImpl : public DASFactory {
+
+ public:
+ DASFactoryImpl(void);
+ virtual ~DASFactoryImpl(void);
+ DAS* createDAS(Connection& connection);
+ DAS* createDAS(const Config& config, rdb::Connection& connection);
+ DAS* createDAS(const Config& config);
+
+};
+
+ };
+ };
+};
+
+#endif //D_A_S_FACTORY_IMPL_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASImpl.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASImpl.h
new file mode 100644
index 0000000000..36fac709e7
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASImpl.h
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+#ifndef D_A_S_IMPL_H
+#define D_A_S_IMPL_H
+
+#include <windows.h>
+#include <sql.h>
+#include <map>
+#include <string>
+#include <cctype>
+#include <list>
+
+#include "apache/das/rdb/ApplyChanges.h"
+#include "apache/das/rdb/ConfigImpl.h"
+#include "apache/das/DAS.h"
+#include "apache/das/rdb/Connection.h"
+#include "apache/das/rdb/DASFactoryImpl.h"
+#include "apache/das/rdb/ReadCommandImpl.h"
+#include "apache/das/CommandPtr.h"
+
+#include "commonj/sdo/DataFactory.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ConfigImpl;
+class CommandImpl;
+class ReadCommandImpl;
+
+class DASImpl : public DAS {
+
+ private:
+ static DASFactory* FACTORY;
+
+ Connection* connection;
+ std::list<CommandPtr*>* createdCommands;
+ ConfigImpl* config;
+
+ public:
+ static DASFactory& getFACTORY(void);
+
+ DASImpl(const Config& config, Connection& inConnection);
+ DASImpl(Connection& inConnection);
+ DASImpl(const Config& config);
+ virtual ~DASImpl(void);
+
+ Connection* getConnection(void);
+ void setConnection(Connection* aConnection);
+ const ::apache::das::Config& getConfig(void) const;
+ void releaseResources(void);
+ CommandPtr createCommand(std::string sql);
+ void closeConnection(void);
+ void applyChanges(commonj::sdo::DataObjectPtr root);
+ CommandPtr getCommand(std::string commandName);
+
+};
+
+ };
+ };
+};
+
+#endif //D_A_S_IMPL_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidColumnNameException.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidColumnNameException.h
new file mode 100644
index 0000000000..2052a50c27
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidColumnNameException.h
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_COLUMN_NAME_EXCEPTION_H
+#define DAS_INVALID_COLUMN_NAME_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASInvalidColumnNameException : public std::exception {
+
+ public:
+ DASInvalidColumnNameException(std::string message = "");
+ virtual ~DASInvalidColumnNameException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_INVALID_COLUMN_NAME_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidRelationshipNameException.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidRelationshipNameException.h
new file mode 100644
index 0000000000..58276365ff
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidRelationshipNameException.h
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_RELATIONSHIP_NAME_EXCEPTION_H
+#define DAS_INVALID_RELATIONSHIP_NAME_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASInvalidRelationshipNameException : public std::exception {
+
+ public:
+ DASInvalidRelationshipNameException(std::string = "");
+ virtual ~DASInvalidRelationshipNameException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_INVALID_RELATIONSHIP_NAME_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidSDOTypeException.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidSDOTypeException.h
new file mode 100644
index 0000000000..245184d44a
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidSDOTypeException.h
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_SDO_TYPE_EXCEPTION_H
+#define DAS_INVALID_SQL_TYPE_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASInvalidSDOTypeException : public std::exception {
+
+ public:
+ DASInvalidSDOTypeException(std::string message = "");
+ virtual ~DASInvalidSDOTypeException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_INVALID_SDO_TYPE_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidSQLTypeException.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidSQLTypeException.h
new file mode 100644
index 0000000000..cf9735bb50
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidSQLTypeException.h
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_SQL_TYPE_EXCEPTION_H
+#define DAS_INVALID_SQL_TYPE_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASInvalidSQLTypeException : public std::exception {
+
+ public:
+ DASInvalidSQLTypeException(std::string message = "");
+ virtual ~DASInvalidSQLTypeException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_INVALID_SQL_TYPE_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidTableNameException.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidTableNameException.h
new file mode 100644
index 0000000000..14e831d7be
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASInvalidTableNameException.h
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_INVALID_TABLE_NAME_EXCEPTION_H
+#define DAS_INVALID_TABLE_NAME_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASInvalidTableNameException : public std::exception {
+
+ public:
+ DASInvalidTableNameException(std::string message = "");
+ virtual ~DASInvalidTableNameException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_INVALID_TABLE_NAME_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASOptimisticConcurrencyControlException.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASOptimisticConcurrencyControlException.h
new file mode 100644
index 0000000000..ca183d819d
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASOptimisticConcurrencyControlException.h
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_OPTIMISTIC_CONCURRENCY_CONTROL_EXCEPTION_H
+#define DAS_OPTIMISTIC_CONCURRENCY_CONTROL_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASOptimisticConcurrencyControlException : public std::exception {
+
+ public:
+ DASOptimisticConcurrencyControlException(std::string message = "");
+ virtual ~DASOptimisticConcurrencyControlException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_OPTIMISTIC_CONCURRENCY_CONTROL_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASPrimaryKeyNotFoundException.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASPrimaryKeyNotFoundException.h
new file mode 100644
index 0000000000..779d1ca2f0
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DASPrimaryKeyNotFoundException.h
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef DAS_PRIMARY_KEY_NOT_FOUND_EXCEPTION_H
+#define DAS_PRIMARY_KEY_NOT_FOUND_EXCEPTION_H
+
+#include <stdexcept>
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASPrimaryKeyNotFoundException : public std::exception {
+
+ public:
+ DASPrimaryKeyNotFoundException(std::string message = "");
+ virtual ~DASPrimaryKeyNotFoundException(void);
+
+};
+
+ };
+ };
+};
+
+#endif //DAS_PRIMARY_KEY_NOT_FOUND_EXCEPTION_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/DeletedDataObject.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DeletedDataObject.h
new file mode 100644
index 0000000000..dc18d68bbc
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/DeletedDataObject.h
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+#ifndef DELETED_DATA_OBJECT_H
+#define DELETED_DATA_OBJECT_H
+
+#include "apache/das/rdb/DASDataObject.h"
+
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SettingList.h"
+#include "commonj/sdo/ChangeSummary.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ColumnData;
+
+class DeletedDataObject : public DASDataObject {
+
+ public:
+ DeletedDataObject(const Table& table, commonj::sdo::DataObjectPtr dataObject, commonj::sdo::ChangeSummaryPtr changeSummary);
+ ~DeletedDataObject(void);
+
+ std::string getStatement(void) const;
+
+};
+
+ };
+ };
+};
+
+#endif //DELETED_DATA_OBJECT_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/GraphBuilder.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/GraphBuilder.h
new file mode 100644
index 0000000000..4baaf838e2
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/GraphBuilder.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+#ifndef GRAPH_BUILDER_H
+#define GRAPH_BUILDER_H
+
+#include "apache/das/rdb/ResultSet.h"
+#include "apache/das/rdb/ConfigImpl.h"
+#include "apache/das/rdb/TableData.h"
+#include "apache/das/rdb/das_constants.h"
+#include "apache/das/rdb/GraphBuilderMetaData.h"
+
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataGraphImpl.h"
+#include "commonj/sdo/DataObject.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class TableData;
+class GraphBuilderMetaData;
+
+class GraphBuilder {
+ private:
+ ResultSet* resultSet;
+ GraphBuilderMetaData* graphBuilderMetaData;
+ commonj::sdo::DataObjectPtr root;
+ std::map<std::string, std::list<TableData*>*> tablesData;
+
+ public:
+ GraphBuilder(const ConfigImpl& config, ResultSetPtr resultSet);
+ virtual ~GraphBuilder(void);
+
+ commonj::sdo::DataObjectPtr GraphBuilder::getRoot(void) const;
+
+
+};
+
+ };
+ };
+};
+
+#endif //GRAPH_BUILDER_META_DATA_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h
new file mode 100644
index 0000000000..ecc287b302
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/GraphBuilderMetaData.h
@@ -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.
+ */
+#ifndef GRAPH_BUILDER_META_DATA_H
+#define GRAPH_BUILDER_META_DATA_H
+
+#include <string>
+#include <map>
+#include <list>
+
+#include "apache/das/rdb/ResultSet.h"
+#include "apache/das/rdb/Table.h"
+#include "apache/das/rdb/ConfigImpl.h"
+#include "apache/das/rdb/Relationship.h"
+#include "apache/das/rdb/KeyPair.h"
+#include "apache/das/rdb/ResultSetMetaData.h"
+#include "apache/das/rdb/das_constants.h"
+
+#include "commonj/sdo/DataFactory.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ConfigImpl;
+
+class GraphBuilderMetaData {
+
+ private:
+ const ResultSetMetaData* resultSetMetaData;
+ std::map<std::string, Table*>* graphTables;
+ std::map<std::string, Relationship*>* relationships;
+ const ConfigImpl* config;
+
+ public:
+ GraphBuilderMetaData(const ConfigImpl& config, const ResultSetMetaData& resultSet);
+ virtual ~GraphBuilderMetaData(void);
+
+ const ResultSetMetaData& getResultSetMetaData(void) const;
+ std::map<std::string, Table*>& getTables(void) const;
+ const ConfigImpl& getConfig(void) const;
+ Table* getTable(std::string tableName) const;
+ std::map<std::string, Relationship*>& getRelationships(void) const;
+ commonj::sdo::DataFactoryPtr createGraph(void) const;
+
+};
+
+ };
+ };
+};
+
+#endif //GRAPH_BUILDER_META_DATA_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/KeyPair.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/KeyPair.h
new file mode 100644
index 0000000000..67b4f0c252
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/KeyPair.h
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+#ifndef KEY_PAIR_H
+#define KEY_PAIR_H
+
+#include <map>
+#include <string>
+
+#include "apache/das/StringWrapper.h"
+#include "apache/das/rdb/DASInvalidColumnNameException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class Relationship;
+
+class KeyPair {
+
+ friend class Relationship;
+
+ private:
+ std::string pkColumnName;
+ std::string fkColumnName;
+ Relationship* relationship;
+
+ void setRelationship(Relationship* relationship);
+
+ public:
+ KeyPair(const KeyPair& keyPair);
+ KeyPair(std::string pkColumnName, std::string fkColumnName);
+ virtual ~KeyPair(void);
+
+ std::string getPKColumnName(void) const;
+ std::string getFKColumnName(void) const;
+ Relationship* getRelationship(void) const;
+
+};
+
+ };
+ };
+};
+
+#endif //KEY_PAIR_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/ModifiedDataObject.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ModifiedDataObject.h
new file mode 100644
index 0000000000..ccdd69e3f5
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ModifiedDataObject.h
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+#ifndef MODIFIED_DATA_OBJECT_H
+#define MODIFIED_DATA_OBJECT_H
+
+#include "apache/das/rdb/DASDataObject.h"
+//#include "apache/das/rdb/RelationshipStatement.h"
+
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SettingList.h"
+#include "commonj/sdo/ChangeSummary.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ColumnData;
+class Table;
+
+class ModifiedDataObject : public DASDataObject {
+
+ private:
+ std::string sets;
+
+ public:
+ ModifiedDataObject(const Table& table, commonj::sdo::DataObjectPtr dataObject,
+ commonj::sdo::ChangeSummaryPtr changeSummary);
+
+ ~ModifiedDataObject(void);
+
+ std::string getStatement(void) const;
+ //bool isPKModified(void) const;
+
+
+};
+
+ };
+ };
+};
+
+#include "apache/das/rdb/Table.h"
+#include "apache/das/StringWrapper.h"
+#include "apache/das/rdb/ColumnData.h"
+
+#endif //MODIFIED_DATA_OBJECT_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/ODBCTypeHelper.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ODBCTypeHelper.h
new file mode 100644
index 0000000000..0b9f29922d
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ODBCTypeHelper.h
@@ -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.
+ */
+#ifndef ODBC_TYPE_HELPER_H
+#define ODBC_TYPE_HELPER_H
+
+#include <windows.h>
+#include <sql.h>
+#include <sqlext.h>
+#include <string>
+
+#include "commonj/sdo/Type.h"
+
+#include "apache/das/StringWrapper.h"
+#include "apache/das/rdb/das_constants.h"
+#include "apache/das/rdb/DASInvalidSQLTypeException.h"
+#include "apache/das/rdb/DASInvalidSDOTypeException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ODBCTypeHelper {
+
+ public:
+ static const std::string getSDOType(SQLSMALLINT sqlType);
+ static const SQLSMALLINT getSQLType(std::string sqlTypeName);
+ static const SQLSMALLINT getSQLType(const commonj::sdo::Type& type);
+
+};
+
+ };
+ };
+};
+
+#endif //ODBC_TYPE_HELPER_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/PKObject.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/PKObject.h
new file mode 100644
index 0000000000..ef308bfdc2
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/PKObject.h
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+#ifndef PK_OBJECT_H
+#define PK_OBJECT_H
+
+#include <list>
+#include <map>
+#include <string>
+#include <stdexcept>
+
+#include "commonj/sdo/DataObject.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ColumnData;
+class ResultSet;
+class GraphBuilder;
+class Table;
+
+typedef std::map<std::string, ColumnData*> KeyDataList;
+
+class PKObject {
+
+ private:
+ const Table* table;
+ KeyDataList* primaryKeys;
+
+ protected:
+ void addPrimaryKey(std::string columnName, ColumnData& columnData);
+
+ public:
+ PKObject(const Table& table);
+ virtual ~PKObject(void);
+
+ const Table& getTable(void) const;
+
+ bool operator==(const PKObject& pkObject) const;
+ bool operator==(const KeyDataList* primaryKeyList) const;
+ bool operator!=(const PKObject& pkObject) const;
+ bool operator!=(const KeyDataList* primaryKeyList) const;
+ bool operator<(const PKObject& pkObject) const;
+ bool operator<(const KeyDataList* primaryKeyList) const;
+
+ const KeyDataList& getPrimaryKeys(void) const;
+ bool isPK(std::string columnName) const;
+
+};
+
+class KeyDataCmp {
+ public:
+ bool operator() (const KeyDataList* keyDataList1, const KeyDataList* keyDataList2 ) const;
+};
+
+ };
+ };
+};
+
+
+#endif //PK_OBJECT_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/PreparedStatement.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/PreparedStatement.h
new file mode 100644
index 0000000000..57f9fc89bd
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/PreparedStatement.h
@@ -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.
+ */
+
+#ifndef PREPARED_STATEMENT_H
+#define PREPARED_STATEMENT_H
+
+#include<vector>
+
+#include "apache/das/rdb/Statement.h"
+
+using std::vector;
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class PreparedStatement : Statement {
+
+ private:
+ string sql;
+ vector<int> positions;
+
+ public:
+ PreparedStatement(Connection& connection, SQLHSTMT statementHandle, string sql);
+ ~PreparedStatement(void);
+
+ void setInt(int index, int elem);
+
+};
+
+ };
+ };
+};
+
+#endif //PREPARED_STATEMENT_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/ReadCommandImpl.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ReadCommandImpl.h
new file mode 100644
index 0000000000..9d16dcbca9
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ReadCommandImpl.h
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+#ifndef READ_COMMAND_IMPL_H
+#define READ_COMMAND_IMPL_H
+
+#include <list>
+
+#include "apache/das/rdb/GraphBuilder.h"
+#include "apache/das/rdb/CommandImpl.h"
+#include "apache/das/rdb/das_constants.h"
+
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/ChangeSummary.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ReadCommandImpl : public CommandImpl {
+
+ public:
+ commonj::sdo::DataObjectPtr buildGraph(ResultSetPtr resultSet);
+
+
+ ReadCommandImpl(DASImpl& das, std::string sqlString);
+ ~ReadCommandImpl(void);
+ commonj::sdo::DataObjectPtr executeQuery(void);
+
+};
+
+ };
+ };
+};
+
+#endif //READ_COMMAND_IMPL_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/Relationship.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/Relationship.h
new file mode 100644
index 0000000000..8fb76a845f
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/Relationship.h
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+#ifndef RELATIONSHIP_H
+#define RELATIONSHIP_H
+
+#include <string>
+#include <map>
+
+#include "apache/das/rdb/KeyPair.h"
+#include "apache/das/rdb/ConfigImpl.h"
+#include "apache/das/rdb/DASInvalidTableNameException.h"
+#include "apache/das/rdb/DASInvalidRelationshipNameException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class Relationship {
+
+ friend class ConfigImpl;
+
+ private:
+ std::string relationshipName;
+ std::string pkTableName;
+ std::string fkTableName;
+ bool many;
+ std::map<std::string, const KeyPair*>* keyPairs;
+
+ KeyPair& newKeyPair(KeyPair& keyPair);
+
+
+ public:
+ Relationship(const Relationship& relationship);
+ Relationship(std::string pkTableName, std::string fkTableName, std::string relationshipName = "");
+ virtual ~Relationship(void);
+
+ KeyPair& addKeyPair(std::string pkColumnName, std::string fkColumnName);
+ KeyPair& addKeyPair(const KeyPair& keyPair);
+ void setMany(bool many);
+
+ std::string getPKTableName(void) const;
+ std::string getFKTableName(void) const;
+ std::string getName(void) const;
+ bool isMany(void) const;
+
+ const std::map<std::string, const KeyPair*>& getKeyPairs(void) const;
+ const KeyPair* getKeyPair(std::string pkColumnName, std::string fkColumnName) const;
+ std::list<const KeyPair*>* getKeyPair(std::string columnName, bool pkColumn = true) const;
+ bool containsColumn(std::string columnName, bool pkColumn = true) const;
+
+};
+
+ };
+ };
+};
+
+#endif //RELATIONSHIP_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/RelationshipStatement.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/RelationshipStatement.h
new file mode 100644
index 0000000000..17ab918a4f
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/RelationshipStatement.h
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+#ifndef RELATIONSHIP_STATEMENT_H
+#define RELATIONSHIP_STATEMENT_H
+
+#include <list>
+#include <string>
+
+//#include "apache/das/rdb/Table.h"
+//#include "apache/das/rdb/DASDataObject.h"
+//#include "apache/das/rdb/Relationship.h"
+#include "apache/das/rdb/StatementPtr.h"
+#include "apache/das/rdb/DASOptimisticConcurrencyControlException.h"
+#include "apache/das/rdb/PKObject.h"
+#include "apache/das/rdb/KeyPair.h"
+
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/ChangeSummary.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class DASDataObject;
+class Table;
+class Relationship;
+
+class RelationshipStatement {
+
+ private:
+ const Relationship* relationship;
+ DASDataObject* dataObject;
+ const KeyDataList* keyDataList;
+ bool executed;
+
+ public:
+ RelationshipStatement(const Relationship& relationship, const KeyDataList* keyDataList = 0);
+ ~RelationshipStatement(void);
+
+ void setFKList(const KeyDataList* keyDataList);
+ void setDASDataObject(DASDataObject& dataObject);
+
+ void execute(StatementPtr stmt);
+ bool isUnset(void) const;
+ DASDataObject& getDASDataObject(void) const;
+
+};
+
+
+
+ };
+ };
+};
+
+#endif //RELATIONSHIP_STATEMENT_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/RelationshipWrapper.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/RelationshipWrapper.h
new file mode 100644
index 0000000000..d402ab3ae3
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/RelationshipWrapper.h
@@ -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.
+ */
+#ifndef RELATIONSHIP_WRAPPER_H
+#define RELATIONSHIP_WRAPPER_H
+
+#include <string>
+#include <map>
+#include <list>
+
+#include "apache/das/rdb/Relationship.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class RelationshipWrapper {
+
+ private:
+ std::list<std::list<Relationship*>*> relationshipLists;
+ const std::map<std::string, Relationship*>* relationships;
+
+ public:
+ RelationshipWrapper(void);
+ ~RelationshipWrapper(void);
+
+ std::list<Relationship*>& getRelationshipsByTableName(const std::map<std::string,
+ Relationship*>& relationships, std::string tableName,
+ bool pkTable = true);
+
+ std::list<Relationship*>& getRelationshipsByTableName(const std::list<
+ Relationship*>& relationships, std::string tableName,
+ bool pkTable = true);
+
+ void free(std::list<Relationship*>& relationshipList);
+
+};
+
+ };
+ };
+};
+
+#endif //RELATIONSHIP_WRAPPER_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSet.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSet.h
new file mode 100644
index 0000000000..672a4797d5
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSet.h
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+#ifndef RESULT_SET_H
+#define RESULT_SET_H
+
+#include <windows.h>
+#include <sql.h>
+#include <sqlext.h>
+#include <string>
+
+#include "apache/das/rdb/StatementPtr.h"
+#include "apache/das/RefCountingObject.h"
+#include "apache/das/rdb/ResultSetMetaData.h"
+#include "apache/das/rdb/DASInvalidSQLTypeException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class Statement;
+class ResultSetMetaData;
+class ResultSet;
+
+typedef RefCountingObject<ResultSet> ResultSetObject;
+
+class ResultSet : public ResultSetObject {
+
+ private:
+ ResultSetMetaData* metaData;
+ StatementPtr stmt;
+
+ std::string getSQLString(unsigned int columnIndex) const;
+ std::wstring getSQLWString(unsigned int columnIndex) const;
+
+ public:
+ ResultSet(StatementPtr aStmt);
+ virtual ~ResultSet(void);
+
+ const ResultSetMetaData& getResultSetMetaData(void) const;
+ StatementPtr getStatement(void) const;
+
+ SQLCHAR getSQLChar(unsigned int columnIndex) const;
+ SQLCHAR getSQLChar(std::string tableName, std::string columnName) const;
+
+ std::string getSQLVarchar(unsigned int columnIndex) const;
+ std::string getSQLVarchar(std::string tableName, std::string columnName) const;
+
+ SQLWCHAR getSQLWChar(unsigned int columnIndex) const;
+ SQLWCHAR getSQLWChar(std::string tableName, std::string columnName) const;
+
+ std::wstring getSQLWVarchar(unsigned int columnIndex) const;
+ std::wstring getSQLWVarchar(std::string tableName, std::string columnName) const;
+
+ SQLREAL getSQLReal(unsigned int columnIndex) const;
+ SQLREAL getSQLReal(std::string tableName, std::string columnName) const;
+
+ SQLFLOAT getSQLFloat(unsigned int columnIndex) const;
+ SQLFLOAT getSQLFloat(std::string tableName, std::string columnName) const;
+
+ SQLDOUBLE getSQLDouble(unsigned int columnIndex) const;
+ SQLDOUBLE getSQLDouble(std::string tableName, std::string columnName) const;
+
+ std::string getSQLDecimal(unsigned int columnIndex) const;
+ std::string getSQLDecimal(std::string tableName, std::string columnName) const;
+
+ SQLINTEGER getSQLInteger(unsigned int columnIndex) const;
+ SQLINTEGER getSQLInteger(std::string tableName, std::string columnName) const;
+
+ SQLSMALLINT getSQLSmallInt(unsigned int columnIndex) const;
+ SQLSMALLINT getSQLSmallInt(std::string tableName, std::string columnName) const;
+
+ bool isNull(unsigned int columnIndex) const;
+ bool isNull(std::string tableName, std::string columnName) const;
+
+ unsigned int getRowCount(void) const;
+
+ bool next(void);
+
+};
+
+ };
+ };
+};
+
+#endif //RESULT_SET_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSetMetaData.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSetMetaData.h
new file mode 100644
index 0000000000..8275412caa
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSetMetaData.h
@@ -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.
+ */
+#ifndef RESULT_SET_META_DATA_H
+#define RESULT_SET_META_DATA_H
+
+#include <string>
+#include <map>
+
+#include "apache/das/rdb/Statement.h"
+#include "apache/das/rdb/ResultSet.h"
+#include "apache/das/rdb/DASColumnNotFoundException.h"
+#include "apache/das/rdb/DASInvalidSQLTypeException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ResultSet;
+
+class ResultSetMetaData {
+
+ private:
+ const ResultSet* resultSet;
+ std::map<std::string, unsigned int> columnsIndexes;
+
+ static SQLSMALLINT getSQLCType(SQLSMALLINT sqlType);
+
+ public:
+ ResultSetMetaData(const ResultSet& aResultSet);
+ virtual ~ResultSetMetaData(void);
+
+ const ResultSet& getResultSet(void) const;
+
+ std::string getSQLTypeName(unsigned int columnIndex) const;
+ std::string getSQLTypeName(std::string tableName, std::string columnName) const;
+
+ std::string getColumnName(unsigned int columnIndex) const;
+ unsigned int getColumnIndex(std::string tableName, std::string columnName) const;
+
+ std::string getTableName(unsigned int columnIndex) const;
+ std::string getTableName(std::string tableName, std::string columnName) const;
+
+ SQLSMALLINT getSQLType(unsigned int columnIndex) const;
+ SQLSMALLINT getSQLType(std::string tableName, std::string columnName) const;
+
+ SQLSMALLINT getSQLCType(unsigned int columnIndex) const;
+ SQLSMALLINT getSQLCType(std::string tableName, std::string columnName) const;
+
+ unsigned int getColumnCount(void) const;
+
+ bool containsColumn(std::string tableName, std::string columnName) const;
+
+};
+
+ };
+ };
+};
+
+#endif //RESULT_SET_META_DATA_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSetPtr.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSetPtr.h
new file mode 100644
index 0000000000..fe62a59a94
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/ResultSetPtr.h
@@ -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.
+ */
+
+/* $Rev: 452786 $ $Date: 2006-10-04 08:57:36 +0100 (Wed, 04 Oct 2006) $ */
+
+#ifndef RESULT_SET_PTR_H
+#define RESULT_SET_PTR_H
+
+#include "apache/das/RefCountingPointer.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ class ResultSet;
+ typedef ::apache::das::RefCountingPointer<ResultSet> ResultSetPtr;
+
+ };
+ };
+};
+
+#endif //RESULT_SET_PTR_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/SQLException.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/SQLException.h
new file mode 100644
index 0000000000..3ac52de7c0
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/SQLException.h
@@ -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.
+ */
+
+#ifndef SQL_EXCEPTION_H
+#define SQL_EXCEPTION_H
+
+#include <string>
+#include <windows.h>
+#include <sql.h>
+
+using std::exception;
+using std::string;
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class SQLException : public exception {
+
+ private:
+ SQLRETURN returnCode;
+
+ public:
+ SQLException(SQLRETURN returnCode, std::string errorText);
+ ~SQLException();
+
+ virtual SQLRETURN getODBCReturnCode(void) const;
+
+};
+
+ };
+ };
+};
+
+#endif;
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/Statement.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/Statement.h
new file mode 100644
index 0000000000..956f3e5d5c
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/Statement.h
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+#ifndef STATEMENT_H
+#define STATEMENT_H
+
+#include <list>
+#include <windows.h>
+#include <sql.h>
+
+#include "apache/das/StringWrapper.h"
+#include "apache/das/rdb/ResultSetPtr.h"
+#include "apache/das/rdb/Connection.h"
+#include "apache/das/rdb/ResultSet.h"
+
+using std::string;
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ResultSet;
+class Statement;
+class Connection;
+
+typedef RefCountingObject<Statement> StatementObject;
+
+class Statement : public StatementObject {
+
+ friend class ResultSet;
+
+ private:
+ SQLHSTMT statementHandle;
+ ResultSetPtr resultSet;
+ Connection* connection;
+
+ protected:
+ string queryString;
+
+ ResultSetPtr createResultSet(void);
+ std::string getError(void) const;
+
+ public:
+ Statement(Connection& connection, SQLHSTMT statementHandle);
+ virtual ~Statement(void);
+ virtual SQLHSTMT getODBCStatement(void) const;
+ virtual ResultSetPtr executeQuery(string sql);
+ virtual void close(void);
+ virtual Connection& getConnection(void) const;
+
+};
+
+ };
+ };
+};
+
+#endif //STATEMENT_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/StatementPtr.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/StatementPtr.h
new file mode 100644
index 0000000000..38980e0877
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/StatementPtr.h
@@ -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.
+ */
+
+#ifndef STATEMENT_PTR_H
+#define STATEMENT_PTR_H
+
+#include "apache/das/RefCountingPointer.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ class Statement;
+ typedef ::apache::das::RefCountingPointer<Statement> StatementPtr;
+
+ };
+ };
+};
+
+#endif //STATEMENT_PTR_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/Table.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/Table.h
new file mode 100644
index 0000000000..4847dc0d25
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/Table.h
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+#ifndef TABLE_H
+#define TABLE_H
+
+#include <map>
+#include <list>
+#include <string>
+#include <stdexcept>
+#include <algorithm>
+
+#include "apache/das/rdb/das_constants.h"
+#include "apache/das/rdb/RelationshipWrapper.h"
+#include "apache/das/rdb/Relationship.h"
+#include "apache/das/rdb/KeyPair.h"
+#include "apache/das/rdb/ResultSet.h"
+#include "apache/das/rdb/Column.h"
+#include "apache/das/rdb/DASImpl.h"
+#include "apache/das/rdb/ODBCTypeHelper.h"
+#include "apache/das/DASInvalidTypeNameException.h"
+
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataObject.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class Column;
+class GraphBuilderMetaData;
+
+class Table {
+
+ private:
+ std::map<std::string, const Column*>* columns;
+ std::string tableName;
+ std::string typeName;
+
+ Column& newColumn(Column& column);
+
+ public:
+ Table(std::string tableName);
+ Table(std::string tableName, std::string typeName);
+ Table(const Table& table);
+ virtual ~Table(void);
+
+ Column& addColumn(std::string columnName, SQLSMALLINT sqlType);
+ Column& addColumn(const Column& column);
+ void setTypeName(std::string typeName);
+
+ std::string getTypeName(void) const;
+ std::string getTableName(void) const;
+ const Column* getColumn(std::string columnName) const;
+ Column* getColumn(std::string columnName);
+ const Column* getColumnByProperty(std::string propertyName) const;
+ const std::map<std::string, const Column*>& getColumns(void) const;
+ unsigned int getPKColumnCount(void) const;
+ const Column* getOCCColumn(void) const;
+
+ void createGraph(const GraphBuilderMetaData& graphBuilderMetaData, commonj::sdo::DataFactoryPtr dataFactory) const;
+
+};
+
+ };
+ };
+ };
+
+#endif //TABLE_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/TableData.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/TableData.h
new file mode 100644
index 0000000000..12fdd73c74
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/TableData.h
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+#ifndef TABLE_DATA_H
+#define TABLE_DATA_H
+
+#include <list>
+#include <map>
+#include <string>
+#include <stdexcept>
+
+#include "apache/das/rdb/PKObject.h"
+#include "apache/das/rdb/Table.h"
+
+#include "commonj/sdo/DataObject.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+class ColumnData;
+class ResultSet;
+class GraphBuilder;
+class Table;
+
+typedef std::map<std::string, ColumnData*> KeyDataList;
+
+class TableData : public PKObject {
+
+ protected:
+ commonj::sdo::DataObjectPtr dataObject;
+ std::map<std::string, ColumnData*> columnsData;
+
+ public:
+ TableData(const Table& table, ResultSetPtr resultSet);
+ virtual ~TableData(void);
+
+ bool hasPK(void) const;
+ commonj::sdo::DataObjectPtr getGraphObject(void) const;
+
+ ColumnData* getColumnData(std::string columnName) const;
+
+ void populateDataGraph(GraphBuilder& graphBuilder);
+
+};
+
+ };
+ };
+};
+
+#endif //TABLE_DATA_H
diff --git a/das-cpp/trunk/runtime/core/include/apache/das/rdb/das_constants.h b/das-cpp/trunk/runtime/core/include/apache/das/rdb/das_constants.h
new file mode 100644
index 0000000000..e85f6548c2
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/include/apache/das/rdb/das_constants.h
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+#define DAS_ROOT_NAME "DAS_ROOT"
+#define DAS_NAMESPACE "apache.das"
+#define SDO_NAMESPACE "commonj.sdo"
+#define SQL_NULL_VALUE "NULL"
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/Command.cpp b/das-cpp/trunk/runtime/core/src/apache/das/Command.cpp
new file mode 100644
index 0000000000..2301a59d32
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/Command.cpp
@@ -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.
+ */
+
+#include "apache/das/Command.h"
+
+namespace apache {
+ namespace das {
+
+Command::Command(void) {}
+
+Command::~Command(void) {
+ CommandObject::free();
+}
+
+commonj::sdo::DataObjectPtr Command::executeQuery(void) {
+ return 0;
+};
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/Config.cpp b/das-cpp/trunk/runtime/core/src/apache/das/Config.cpp
new file mode 100644
index 0000000000..73dd60779e
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/Config.cpp
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+#include "apache/das/Config.h"
+
+namespace apache {
+ namespace das {
+
+Config::Config(void) {}
+
+Config::Config(const Config& config) {
+ this->uri = config.uri;
+}
+
+Config::Config(std::string xmlFile) {}
+
+Config::~Config(void) {}
+
+std::string Config::getURI(void) const {
+ return uri;
+}
+
+void Config::setURI(std::string uri) {
+ this->uri = uri;
+}
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/DAS.cpp b/das-cpp/trunk/runtime/core/src/apache/das/DAS.cpp
new file mode 100644
index 0000000000..662bca9974
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/DAS.cpp
@@ -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.
+ */
+#include "apache/das/DAS.h"
+#include "apache/das/rdb/DASFactoryImpl.h"
+
+namespace apache {
+ namespace das {
+
+DASFactory* DAS::FACTORY = 0;
+
+DAS::DAS(void) {}
+
+DASFactory* DAS::getFACTORY(void) {
+ return FACTORY;
+}
+
+DAS::~DAS(void) {}
+
+CommandPtr DAS::getCommand(std::string commandName) { return CommandPtr(0); }
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/DASCommandNotFoundException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/DASCommandNotFoundException.cpp
new file mode 100644
index 0000000000..66954e3ac0
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/DASCommandNotFoundException.cpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/DASCommandNotFoundException.h"
+
+namespace apache {
+ namespace das {
+
+DASCommandNotFoundException::DASCommandNotFoundException(std::string message) : std::exception(message.c_str()) {}
+
+DASCommandNotFoundException::~DASCommandNotFoundException(void) {}
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/DASFactory.cpp b/das-cpp/trunk/runtime/core/src/apache/das/DASFactory.cpp
new file mode 100644
index 0000000000..d6f671181f
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/DASFactory.cpp
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/DASFactory.h"
+
+namespace apache {
+ namespace das {
+
+DASFactory::DASFactory(void) {}
+
+DASFactory::~DASFactory(void) {}
+
+DAS* DASFactory::createDAS(rdb::Connection& connection) {
+ return 0;
+}
+
+DAS* DASFactory::createDAS(const Config& config, rdb::Connection& connection) {
+ return 0;
+}
+
+DAS* DASFactory::createDAS(const Config& config) {
+ return 0;
+}
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/DASInvalidPropertyNameException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/DASInvalidPropertyNameException.cpp
new file mode 100644
index 0000000000..dcb963ea4e
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/DASInvalidPropertyNameException.cpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/DASInvalidPropertyNameException.h"
+
+namespace apache {
+ namespace das {
+
+ DASInvalidPropertyNameException::DASInvalidPropertyNameException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidPropertyNameException::~DASInvalidPropertyNameException(void) {}
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/DASInvalidTypeNameException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/DASInvalidTypeNameException.cpp
new file mode 100644
index 0000000000..5a4c0fcb2a
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/DASInvalidTypeNameException.cpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/DASInvalidTypeNameException.h"
+
+namespace apache {
+ namespace das {
+
+DASInvalidTypeNameException::DASInvalidTypeNameException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidTypeNameException::~DASInvalidTypeNameException(void) {}
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/DASNullPointerException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/DASNullPointerException.cpp
new file mode 100644
index 0000000000..35d05c9894
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/DASNullPointerException.cpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/DASNullPointerException.h"
+
+namespace apache {
+ namespace das {
+
+DASNullPointerException::DASNullPointerException(std::string message) : std::exception(message.c_str()) {}
+
+DASNullPointerException::~DASNullPointerException(void) {}
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/DataGraphPrinter.cpp b/das-cpp/trunk/runtime/core/src/apache/das/DataGraphPrinter.cpp
new file mode 100644
index 0000000000..46041731db
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/DataGraphPrinter.cpp
@@ -0,0 +1,171 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/DataGraphPrinter.h"
+
+namespace apache {
+ namespace das {
+
+DataGraphPrinter::DataGraphPrinter(commonj::sdo::DataObjectPtr root) {
+ this->root = root;
+}
+
+DataGraphPrinter::~DataGraphPrinter(void) {}
+
+void DataGraphPrinter::printMetaData(std::ostream& out) {
+ tabCount = 0;
+ const commonj::sdo::TypeList& typeList = root->getDataFactory()->getTypes();
+
+ for (unsigned int i = 0 ; i < typeList.size() ; i++) {
+ out << std::endl << "[" << typeList[i].getName();
+
+ const commonj::sdo::Type* base = typeList[i].getBaseType();
+ /*out << "{";
+ out << " baseType = " << ((base == 0) ? "NULL" : base->getName());
+ out << " uri = " << typeList[i].getURI();
+ out << " abstractType = " << typeList[i].isAbstractType();
+ out << " changeSummaryType = " << typeList[i].isChangeSummaryType();
+ out << " dataObjectType = " << typeList[i].isDataObjectType();
+ out << " dataType = " << typeList[i].isDataType();
+ out << " openType = " << typeList[i].isOpenType();
+ out << " sequencedType = " << typeList[i].isSequencedType() << " } ";*/
+ out << "]" << std::endl;
+
+ commonj::sdo::PropertyList propertyList = typeList[i].getProperties();
+
+ for (unsigned int j = 0 ; j < propertyList.size() ; j++) {
+
+ out << propertyList[j].getName() << std::endl;
+ /*out << "{";
+ out << " type = " << propertyList[j].getType().getName();
+ out << " alias = " << propertyList[j].getAlias();
+ out << " aliasCount = " << propertyList[j].getAliasCount();
+ out << " contaiment = " << propertyList[j].isContainment();
+ out << " defaulted = " << propertyList[j].isDefaulted();
+ out << " many = " << propertyList[j].isMany();
+ out << " readOnly = " << propertyList[j].isReadOnly();
+ out << " reference = " << propertyList[j].isReference();
+ out << "}" << std::endl;*/
+
+ }
+
+ }
+
+ out << std::endl;
+
+}
+
+void DataGraphPrinter::printDataGraph(commonj::sdo::DataObjectPtr dataObject, bool ref) {
+ std::ostream& out = *this->out;
+ commonj::sdo::PropertyList& propertyList = dataObject->getType().getProperties();
+ out << getTab(tabCount) << "[" << dataObject->getType().getURI() << "." << dataObject->getType().getName() << "]";
+ tabCount++;
+
+ for (unsigned int i = 0 ; i < propertyList.size() ; i++) {
+
+ if (propertyList[i].isMany()) {
+ out << getTab(tabCount) << ((propertyList[i].isReference()) ? "-> " : "") << "[" << propertyList[i].getType().getName() << " LIST]";
+ tabCount++;
+ commonj::sdo::DataObjectList& objectList = dataObject->getList(propertyList[i]);
+
+ for (unsigned int j = 0 ; j < objectList.size() ; j++) {
+
+ if (objectList[j]->getType().isDataType()) {
+ std::string typeName = objectList[j]->getType().getName();
+
+ if (typeName == "String") {
+ wchar_t* buf = new wchar_t[200];
+ int copied = dataObject->getString((((std::string) propertyList[j].getName()) + "[" + StringWrapper::toString(j) + "]").c_str(), buf, 200);
+ buf[copied] = 0;
+ std::wstring wstr = buf;
+ std::string str(wstr.begin(), wstr.end());
+ str.assign(wstr.begin(), wstr.end());
+
+
+ out << getTab(tabCount) << str << " : " << objectList[j]->getType().getName();
+ delete [] buf;
+ } else if (typeName == "Integer") {
+ out << getTab(tabCount) << dataObject->getInt((((std::string) propertyList[j].getName()) + "[" + StringWrapper::toString(j) + "]").c_str()) << " : " << objectList[j]->getType().getName();
+ }
+
+ } else if (!ref) {
+ printDataGraph(objectList[j], propertyList[i].isReference());
+ }
+
+ }
+
+ if (objectList.size() == 0) {
+ out << getTab(tabCount) << "--empty--";
+ }
+
+ tabCount--;
+
+ } else {
+ commonj::sdo::DataObjectPtr actual = dataObject->getDataObject(propertyList[i]);
+ if (actual) {
+ std::string typeName = actual->getType().getName();
+ if (typeName == "String") {
+ wchar_t* buf = new wchar_t[200];
+ int copied = dataObject->getString(propertyList[i], buf, 200);
+ buf[copied] = 0;
+ std::wstring wstr = buf;
+ std::string str(wstr.begin(), wstr.end());
+ str.assign(wstr.begin(), wstr.end());
+
+ out << getTab(tabCount) << ((propertyList[i].isReference()) ? "-> " : "") << str << " : " << actual->getType().getName();
+ delete [] buf;
+ } else if (typeName == "Int") {
+ out << getTab(tabCount) << dataObject->getInt(propertyList[i]) << " : " << actual->getType().getName();
+ } else if (typeName == "Boolean") {
+ out << getTab(tabCount) << dataObject->getBoolean(propertyList[i]) << " : " << actual->getType().getName();
+ }
+
+ } else {
+ out << getTab(tabCount) << "NULL : " << propertyList[i].getType().getName();
+ }
+
+ }
+
+ if (propertyList.size() == 0) {
+ out << getTab(tabCount) << "--empty--";
+ }
+
+ }
+
+ tabCount--;
+
+}
+
+void DataGraphPrinter::print(std::ostream& out) {
+ tabCount = 0;
+ this->out = &out;
+ printDataGraph(root);
+ out << std::endl;
+
+}
+
+std::string DataGraphPrinter::getTab(int count) const {
+ std::string ret;
+ ret.append(count* 3, ' ');
+ return "\n" + ret;
+
+}
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/RefCountingObject.cpp b/das-cpp/trunk/runtime/core/src/apache/das/RefCountingObject.cpp
new file mode 100644
index 0000000000..ae090d8383
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/RefCountingObject.cpp
@@ -0,0 +1,234 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/RefCountingObject.h"
+#include "apache/das/rdb/Connection.h"
+#include "apache/das/rdb/Statement.h"
+#include "apache/das/rdb/ReadCommandImpl.h"
+#include "apache/das/Command.h"
+#include "apache/das/CommandPtr.h"
+
+namespace apache {
+ namespace das {
+
+template <class T>
+RefCountingObject<T>::RefCountingObject()
+{
+ refCount = 0;
+ freed = false;
+ refPtrs = new std::list<RefCountingPointer<T>*>();
+}
+
+template <class T>
+RefCountingObject<T>::RefCountingObject(const RefCountingObject<T>& rc)
+{
+ refCount = 0;
+ freed = false;
+ refPtrs = new std::list<RefCountingPointer<T>*>();
+}
+template <class T>
+T& RefCountingObject<T>::operator=(const T& rc)
+{
+ return *this;
+}
+template <class T>
+RefCountingObject<T>::~RefCountingObject()
+{
+ if (!freed) {
+ throw std::logic_error("Function RefCountingObjec<T>::free() must be invoked before deleting this object!");
+ }
+
+ delete refPtrs;
+
+}
+
+template <class T>
+void RefCountingObject<T>::free(void) {
+ std::list<RefCountingPointer<T>*>::iterator it;
+
+ while (!refPtrs->empty()) {
+ RefCountingPointer<T>* aux = *refPtrs->begin();
+ refPtrs->erase(refPtrs->begin());
+ *aux = 0;
+
+ }
+
+ freed = true;
+
+}
+
+template <class T>
+void RefCountingObject<T>::addRef(RefCountingPointer<T>* refPtr)
+
+{
+ if ((*refPtr).isObjectOwner()) {
+ refCount++;
+ }
+
+ refPtrs->push_front(refPtr);
+
+}
+template <class T>
+void RefCountingObject<T>::releaseRef(RefCountingPointer<T>* refPtr)
+{
+ std::list<RefCountingPointer<T>*>::iterator it;
+ bool found = false;
+
+ for (it = refPtrs->begin() ; it != refPtrs->end() ; it++) {
+
+ if (refPtr == *it) {
+ found = true;
+ break;
+
+ }
+
+ }
+
+ if (found) {
+
+ if ((*it)->isObjectOwner()) {
+ refCount--;
+ }
+
+ refPtrs->erase(it);
+
+ if (refCount == 0) {
+ delete this;
+ }
+
+ }
+
+}
+
+template <class T>
+std::ostream& RefCountingObject<T>::printSelf(std::ostream &os)
+{
+ os << "RefCountingObject: reference count = " << refPtrs->size() << std::endl;
+ return os;
+}
+
+ // officially, there is nothing here- but if I dont use the overrides in
+ // the templates, then they dont get generated.
+ void Test ()
+ {
+
+#if defined(WIN32) || defined (_WINDOWS)
+ /* 1) construct */
+
+ rdb::Connection conn("", "", "");
+ /*rdb::Connection* conn1 = new rdb::Connection("", "", "");
+ delete conn1;*/
+ rdb::StatementObject* fptr = new rdb::StatementObject();
+ rdb::StatementObject statement;
+ rdb::Statement* s = new rdb::Statement(conn, 0);
+ delete s;
+ rdb::StatementObject* fptr2 = new rdb::StatementObject(statement);
+ fptr->releaseRef(0);
+ fptr->addRef(0);
+ delete fptr;
+
+ rdb::StatementPtr stmt = conn.createStatement();
+ rdb::ResultSetObject* rs1 = new rdb::ResultSetObject();
+ rdb::ResultSetObject rs2;
+ delete rs1;
+ rs2.releaseRef(0);
+ rs2.addRef(0);
+ {
+ CommandPtr stmt = *(new CommandPtr(new rdb::ReadCommandImpl(*(new rdb::DASImpl(conn)), "")));
+ CommandObject* rs1 = new CommandObject();
+ CommandObject rs2;
+ delete rs1;
+ rs2.releaseRef(0);
+ rs2.addRef(0);
+ }
+
+ ///* Use the T* and * */
+ //DataObject* dof = dptr;
+ //DataObject& dor = *dptr;
+ //
+ //if (dptr2 == dptr || !dptr){}
+ //
+ //
+ //ChangeSummaryPtr cptr = dptr->getChangeSummary();
+ //cptr = dptr->getChangeSummary();
+ //ChangeSummaryPtr cptr2 = cptr;
+ //
+ //ChangeSummary* cof = cptr;
+ //ChangeSummary& cop = *cptr;
+ //
+ //
+ //if (cptr2 == cptr || !cptr){}
+ //
+ //cptr->endLogging();
+ //
+ //SequencePtr sptr = dptr->getSequence();
+ //sptr = dptr->getSequence();
+ //SequencePtr sptr2 = sptr;
+ //
+ //Sequence* sof = sptr;
+ //Sequence& sop = *sptr;
+ //
+ //
+ //if (sptr2 == sptr || !sptr){}
+ //
+ //sptr->getBooleanValue(0);
+ //
+ //
+ //// Generate code for XMLDocumentPtr
+ //XMLDocumentPtr xmldocptr1 = 0;
+ //XMLDocumentPtr xmldocptr2 = xmldocptr1;
+ //xmldocptr1 = xmldocptr2;
+ //if (xmldocptr2 == xmldocptr1 || !xmldocptr1){}
+ //XMLDocument* xmldocp = xmldocptr1;
+ //XMLDocument& xmldocref = *xmldocptr2;
+ //xmldocptr1->getEncoding();
+
+ //// Generate code for XSDHelperPtr
+ //XSDHelperPtr xsdhptr1 = 0;
+ //XSDHelperPtr xsdhptr2 = xsdhptr1;
+ //xsdhptr1 = xsdhptr2;
+ //if (xsdhptr2 == xsdhptr1 || !xsdhptr1){}
+ //XSDHelper* xsdhp = xsdhptr1;
+ //XSDHelper& xsdhref = *xsdhptr2;
+ //xsdhptr1->define("dummy");
+
+ //// Generate code for XMLHelperPtr
+ //XMLHelperPtr xmlhptr1 = 0;
+ //XMLHelperPtr xmlhptr2 = xmlhptr1;
+ //xmlhptr1 = xmlhptr2;
+ //if (xmlhptr2 == xmlhptr1 || !xmlhptr1){}
+ //XMLHelper* xmlhp = xmlhptr1;
+ //XMLHelper& xmlhref = *xmlhptr2;
+ //xmlhptr1->load("dummy");
+
+ //// Generate code for DataGraphPtr
+ //DataGraphPtr dgptr1 = 0;
+ //DataGraphPtr dgptr2 = dgptr1;
+ //dgptr1 = dgptr2;
+ //if (dgptr2 == dgptr1 || !dgptr1){}
+ //DataGraph* dghp = dgptr1;
+ //DataGraph& dgref = *dgptr2;
+ //dgptr1->getRootObject();
+
+#endif
+
+ }
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/RefCountingPointer.cpp b/das-cpp/trunk/runtime/core/src/apache/das/RefCountingPointer.cpp
new file mode 100644
index 0000000000..3a55bbab30
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/RefCountingPointer.cpp
@@ -0,0 +1,261 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/RefCountingPointer.h"
+#include "apache/das/rdb/Statement.h"
+#include "apache/das/rdb/Connection.h"
+#include "apache/das/rdb/ReadCommandImpl.h"
+#include "apache/das/Command.h"
+#include "apache/das/CommandPtr.h"
+
+namespace apache {
+ namespace das {
+
+template<class T>
+void RefCountingPointer<T>::init()
+{
+ if (pointee == 0) return;
+ pointee->addRef(this);
+}
+
+template<class T>
+/*SDO_API*/ RefCountingPointer<T>::RefCountingPointer(T* realPtr, bool objectOwner)
+:pointee(realPtr)
+{
+ this->objectOwner = objectOwner;
+ init();
+}
+
+template<class T>
+/*SDO_API*/ RefCountingPointer<T>::RefCountingPointer(T& realPtr, bool objectOwner)
+:pointee(&realPtr)
+{
+ this->objectOwner = objectOwner;
+ init();
+}
+
+template<class T>
+RefCountingPointer<T>::RefCountingPointer(const RefCountingPointer<T>& rhs, bool objectOwner)
+: pointee(rhs.pointee)
+{
+ this->objectOwner = objectOwner;
+ init();
+}
+
+template<class T>
+/*SDO_API*/ RefCountingPointer<T>::~RefCountingPointer(void)
+{
+ if (pointee)pointee->releaseRef(this);
+}
+
+template<class T>
+/*SDO_API*/ RefCountingPointer<T>& RefCountingPointer<T>::operator=(const RefCountingPointer<T>& rhs)
+{
+ if (pointee != rhs.pointee)
+ {
+ T *oldP = pointee;
+ pointee = rhs.pointee;
+ init();
+ if (oldP) oldP->releaseRef(this);
+ }
+ return *this;
+}
+
+//RefCountingPointer& operator=(const RefCountingObject<T>& rhs)
+//{
+// if (pointee != &rhs)
+// {
+// T *oldP = pointee;
+// pointee = &pointee;
+// init();
+// if (oldP) oldP->releaseRef(this);
+// }
+// return *this;
+//}
+//
+//RefCountingPointer& operator=(const RefCountingObject<T>* rhs)
+//{
+// if (pointee != rhs)
+// {
+// T *oldP = pointee;
+// pointee = rhs;
+// init();
+// if (oldP) oldP->releaseRef(this);
+// }
+// return *this;
+//}
+
+template<class T>
+/*SDO_API*/ bool RefCountingPointer<T>::operator!() const
+{
+ return (pointee == 0);
+}
+
+template<class T>
+/*SDO_API*/ bool RefCountingPointer<T>::operator==(RefCountingPointer<T>& test) const
+{
+ return (pointee == test.pointee);
+}
+
+template<class T>
+/*SDO_API*/ T* RefCountingPointer<T>::operator->() const
+{
+ if (pointee == 0)
+ throw DASNullPointerException();
+ return pointee;
+}
+
+template<class T>
+/*SDO_API*/ T& RefCountingPointer<T>::operator*() const
+{
+ return *pointee;
+}
+
+template<class T>
+bool RefCountingPointer<T>::isObjectOwner(void) const {
+ return objectOwner;
+}
+
+
+ // officially, there is nothing here- but if I dont use the overrides in
+ // the templates, then they dont get generated.
+ void Test2()
+ {
+
+#if defined(WIN32) || defined (_WINDOWS)
+ {
+ /* 1) construct */
+ rdb::Connection* conn = new rdb::Connection("","","");
+ rdb::StatementPtr fptr = conn->createStatement();
+ rdb::StatementPtr a(new rdb::Statement(*conn, 0));
+ rdb::Statement& st = *(new rdb::Statement(*conn, 0));
+ rdb::StatementPtr* c = new rdb::StatementPtr(st);
+ c->isObjectOwner();
+
+ /* 2) use the & operator= */
+ fptr = conn->createStatement();
+
+ /* 3) copy */
+ rdb::StatementPtr fptr2 = fptr;
+
+ /* 4) use the == and ! */
+ if (fptr2 == fptr || !fptr){}
+
+ /* 5) Use the T* and * */
+ rdb::Statement* dmsf = fptr;
+ rdb::Statement& dmsr = *fptr;
+
+ /* 1) construct */
+ rdb::StatementPtr dfptr(fptr);
+
+ /* 3) copy */
+ rdb::StatementPtr dfptr2 = dfptr;
+
+ /* 2) use the & operator= */
+ dfptr = dfptr2;
+
+ /* 4) use the == and ! */
+ if (dfptr2 == dfptr || !dfptr){}
+
+ /* 5) Use the T* and * */
+ rdb::Statement* ddmsf = dfptr;
+ rdb::Statement& ddmsr = *dfptr;
+
+ /* 6) Use the -> */
+ dfptr->close();
+
+ /* and again to catch the = */
+ fptr = conn->createStatement();
+ delete fptr2;
+
+ }
+ {
+ /* 1) construct */
+ rdb::Connection* conn = new rdb::Connection("","","");
+ rdb::StatementPtr fptr = conn->createStatement();
+ rdb::ResultSetPtr a(new rdb::ResultSet(fptr));
+ rdb::ResultSetPtr b(new rdb::ResultSet(fptr));
+ rdb::ResultSet& st = *(new rdb::ResultSet(fptr));
+ rdb::ResultSetPtr* c = new rdb::ResultSetPtr(st);
+ c->isObjectOwner();
+ /* 2) use the & operator= */
+ a = b;
+
+ /* 3) copy */
+ rdb::ResultSetPtr d = a;
+
+ a = new rdb::ResultSet(fptr);
+ a = *(new rdb::ResultSet(fptr));
+
+ /* 4) use the == and ! */
+ if (a == b || !b){}
+
+ /* 5) Use the T* and * */
+ rdb::ResultSet* dmsf = a;
+ rdb::ResultSet& dmsr = *b;
+
+ /* 6) Use the -> */
+ a->getStatement();
+
+ /* and again to catch the = */
+ delete c;
+
+
+ }
+
+ {
+ /* 1) construct */
+ rdb::Connection* conn = new rdb::Connection("","","");
+ CommandPtr fptr = *(new CommandPtr());
+ CommandPtr a(*(new rdb::ReadCommandImpl(*(new rdb::DASImpl(*conn)), "")));
+ CommandPtr b(*(new rdb::ReadCommandImpl(*(new rdb::DASImpl(*conn)), "")));
+ Command& st = *(new rdb::ReadCommandImpl(*(new rdb::DASImpl(*conn)), ""));
+ CommandPtr* c = new CommandPtr(st);
+ c->isObjectOwner();
+ /* 2) use the & operator= */
+ a = b;
+
+ /* 3) copy */
+ CommandPtr d = a;
+
+ a = new rdb::ReadCommandImpl(*(new rdb::DASImpl(*conn)), "");
+ a = *(new rdb::ReadCommandImpl(*(new rdb::DASImpl(*conn)), ""));
+
+ /* 4) use the == and ! */
+ if (a == b || !b){}
+
+ /* 5) Use the T* and * */
+ CommandObject* dmsf = a;
+ CommandObject& dmsr = *b;
+
+ /* 6) Use the -> */
+ a->executeQuery();
+
+ /* and again to catch the = */
+ delete c;
+
+
+ }
+
+#endif
+
+ }
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/SDODataObjectWrapper.cpp b/das-cpp/trunk/runtime/core/src/apache/das/SDODataObjectWrapper.cpp
new file mode 100644
index 0000000000..32c7183c2a
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/SDODataObjectWrapper.cpp
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+#include "apache/das/SDODataObjectWrapper.h"
+
+namespace apache {
+ namespace das {
+
+SDODataObjectWrapper::SDODataObjectWrapper(commonj::sdo::DataObjectPtr dataObject) {
+ this->dataObject = dataObject;
+}
+
+SDODataObjectWrapper::~SDODataObjectWrapper(void) {}
+
+std::string SDODataObjectWrapper::getString(std::string propertyName) const {
+ wchar_t* buff = new wchar_t[dataObject->getLength(propertyName.c_str())];
+ int copied = dataObject->getString(propertyName.c_str(), buff, 200);
+ std::wstring wstr(buff, copied);
+ std::string str(wstr.begin(), wstr.end());
+ str.assign(wstr.begin(), wstr.end());
+
+ delete [] buff;
+
+ return str;
+
+}
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/StringWrapper.cpp b/das-cpp/trunk/runtime/core/src/apache/das/StringWrapper.cpp
new file mode 100644
index 0000000000..b3726f510b
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/StringWrapper.cpp
@@ -0,0 +1,148 @@
+/*
+ * 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.
+ */
+#include "apache/das/StringWrapper.h"
+
+namespace apache {
+ namespace das {
+
+StringWrapper::StringWrapper(std::string str) : str(str) {}
+
+StringWrapper::StringWrapper(commonj::sdo::DataObjectPtr dataObject, std::string propertyName) {
+ unsigned int length = dataObject->getLength(propertyName);
+ wchar_t* buffer = new wchar_t[length];
+ dataObject->getString(propertyName, buffer, length);
+
+ std::wstring wstr(buffer, 0, length);
+ this->str = std::string(wstr.begin(), wstr.end());
+ delete buffer;
+
+}
+
+std::string StringWrapper::toLower(void) const {
+ std::string str = this->str;
+ unsigned int length = str.length();
+
+ for(int i=0; i != length; i++) {
+ str[i] = tolower(str[i]);
+ }
+
+ return str;
+
+}
+
+std::string StringWrapper::toUpper(void) const {
+ std::string str = this->str;
+ unsigned int length = str.length();
+
+ for(int i=0; i != length; i++) {
+ str[i] = toupper(str[i]);
+ }
+
+ return str;
+
+}
+
+bool StringWrapper::isValidRDBName(void) const {
+
+ if (str.find(' ') != -1 || str.find('\t') != -1 || str.find('\n') != -1 || str.find('\r') != -1) {
+ return false;
+ } else {
+ return true;
+ }
+
+}
+
+std::string StringWrapper::toString(const double& t) {
+ std::stringstream ss;
+ ss << t;
+
+ return ss.str();
+
+}
+
+std::string StringWrapper::toString(const float& t) {
+ std::stringstream ss;
+ ss << t;
+
+ return ss.str();
+
+}
+
+std::string StringWrapper::toString(const long double& t) {
+ std::stringstream ss;
+ ss << t;
+
+ return ss.str();
+
+}
+
+std::string StringWrapper::toString(const unsigned char& t) {
+ std::stringstream ss;
+ ss << t;
+
+ return ss.str();
+
+}
+
+std::string StringWrapper::toString(const wchar_t& t) {
+ std::stringstream ss;
+ ss << t;
+
+ return ss.str();
+
+}
+
+std::string StringWrapper::toString(const int& t) {
+ std::stringstream ss;
+ ss << t;
+
+ return ss.str();
+
+}
+
+std::string StringWrapper::toString(const long& t) {
+ std::stringstream ss;
+ ss << t;
+
+ return ss.str();
+
+}
+
+std::string StringWrapper::getString(void) const {
+ return str;
+}
+
+
+std::string StringWrapper::toString(const unsigned int& t) {
+ std::stringstream ss;
+ ss << t;
+
+ return ss.str();
+
+}
+
+void StringWrapper::defineOnDataObject(commonj::sdo::DataObjectPtr dataObject, std::string propertyName) const {
+ std::wstring wstr(str.begin(), str.end());
+ dataObject->setString(propertyName, wstr.c_str(), wstr.size());
+
+}
+
+
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/ApplyChanges.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ApplyChanges.cpp
new file mode 100644
index 0000000000..eea9d81e35
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ApplyChanges.cpp
@@ -0,0 +1,568 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/ApplyChanges.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ApplyChanges::ApplyChanges(DASImpl& das, commonj::sdo::DataObjectPtr root) : summary(root->getChangeSummary()) {
+ this->config = (const ConfigImpl*) &das.getConfig();
+ this->root = root;
+ processRootDataObject(root);
+ StatementPtr stmt = *das.getConnection()->createStatement();
+
+ try {
+
+ for (std::list<DASDataObject*>::iterator it = updateOrderList.begin() ;
+ it != updateOrderList.end() ; it++) {
+
+ (*it)->execute(stmt);
+
+ }
+
+ stmt->executeQuery("commit");
+
+ } catch (...) {
+ stmt->executeQuery("rollback");
+ throw;
+
+ }
+
+}
+
+ApplyChanges::~ApplyChanges(void) {
+
+ for (std::map<std::string, const Relationship*>::iterator relationshipsIterator = relationships.begin() ;
+ relationshipsIterator != relationships.end() ; relationshipsIterator++) {
+
+ delete relationshipsIterator->second;
+
+ }
+
+ for (std::map<std::string, const Table*>::iterator tablesIterator = tables.begin() ;
+ tablesIterator != tables.end() ; tablesIterator++) {
+
+ delete tablesIterator->second;
+
+ }
+
+ for (std::map<std::string, std::list<DASDataObject*>*>::iterator dasDataObjectsIterator = dasDataObjects.begin() ;
+ dasDataObjectsIterator != dasDataObjects.end() ; dasDataObjectsIterator++) {
+
+ std::list<DASDataObject*>* list = dasDataObjectsIterator->second;
+
+ for (std::list<DASDataObject*>::iterator listIterator = list->begin() ;
+ listIterator != list->end() ; listIterator++) {
+
+ delete *listIterator;
+
+ }
+
+ delete list;
+
+ }
+
+}
+
+void ApplyChanges::processRootDataObject(commonj::sdo::DataObjectPtr dataObject) {
+ commonj::sdo::ChangedDataObjectList& changedObjects = summary->getChangedDataObjects();
+ std::list<commonj::sdo::DataObjectPtr> createdObjects;
+ std::list<commonj::sdo::DataObjectPtr> deletedObjects;
+ std::list<commonj::sdo::DataObjectPtr> modifiedObjects;
+
+ for (unsigned int i = 0 ; i < changedObjects.size() ; i++) {
+
+ if (changedObjects[i] == root) {
+ continue;
+ }
+
+ processMetadata(changedObjects[i]);
+
+ if (summary->isCreated(changedObjects[i])) {
+ createdObjects.push_back(changedObjects[i]);
+
+ } else if (summary->isDeleted(changedObjects[i])) {
+ deletedObjects.push_back(changedObjects[i]);
+
+ } else {
+ modifiedObjects.push_back(changedObjects[i]);
+ }
+
+ //const commonj::sdo::SettingList& setting = summary->getOldValues(changedObjects[i]);
+
+ }
+
+ std::list<commonj::sdo::DataObjectPtr>::iterator deletedIterator;
+ for (deletedIterator = deletedObjects.begin() ; deletedIterator != deletedObjects.end() ; deletedIterator++) {
+ processDeletedDataObject(*deletedIterator);
+ }
+
+ std::list<commonj::sdo::DataObjectPtr>::iterator createdIterator;
+ for (createdIterator = createdObjects.begin() ; createdIterator != createdObjects.end() ; createdIterator++) {
+ processCreatedDataObject(*createdIterator);
+ }
+
+ std::list<commonj::sdo::DataObjectPtr>::iterator modifiedIterator;
+ for (modifiedIterator = modifiedObjects.begin() ; modifiedIterator != modifiedObjects.end() ; modifiedIterator++) {
+ processModifiedDataObject(*modifiedIterator);
+ }
+
+}
+
+DASDataObject& ApplyChanges::processDataObject(commonj::sdo::DataObjectPtr dataObject) {
+
+ if (summary->isCreated(dataObject)) {
+ return processCreatedDataObject(dataObject);
+ } else if (summary->isDeleted(dataObject)) {
+ return processDeletedDataObject(dataObject);
+ } else {
+ return processModifiedDataObject(dataObject);
+ }
+
+}
+
+void ApplyChanges::processMetadata(commonj::sdo::DataObjectPtr dataObject) {
+ const commonj::sdo::Type& type = dataObject->getType();
+ std::map<std::string, const Table*>::iterator it = tables.find((std::string) type.getName());
+
+ if (it != tables.end()) {
+ return;
+ }
+
+ const Table* configTable = config->getTableByTypeName((std::string) type.getName());
+ commonj::sdo::PropertyList properties = type.getProperties();
+ const std::map<std::string, const Column*>* configTableColumns;
+ std::map<std::string, const Column*>* configTableColumnsByPropertyName = 0;
+ Table* table;
+ unsigned int pkColumnCount = 0;
+ unsigned int pkFoundCount = 0;
+
+ if (configTable != 0) {
+ table = new Table(configTable->getTableName(), configTable->getTypeName());
+ configTableColumns = &configTable->getColumns();
+ configTableColumnsByPropertyName = new std::map<std::string, const Column*>();
+ pkColumnCount = configTable->getPKColumnCount();
+
+ for (std::map<std::string, const Column*>::const_iterator configTableColumnsIterator = configTableColumns->begin() ;
+ configTableColumnsIterator != configTableColumns->end() ; configTableColumnsIterator++) {
+
+ configTableColumnsByPropertyName->insert(
+ std::make_pair(configTableColumnsIterator->second->getPropertyName(),
+ configTableColumnsIterator->second));
+
+ }
+
+ } else {
+ table = new Table((std::string) type.getName());
+ }
+
+ for (unsigned int j = 0 ; j < properties.size() ; j++) {
+
+ if (properties[j].getType().isDataType()) {
+
+ if (configTable != 0) {
+ std::map<std::string, const Column*>::const_iterator configTableColumnsIterator =
+ configTableColumnsByPropertyName->find(properties[j].getName());
+
+ if (configTableColumnsIterator != configTableColumnsByPropertyName->end()) {
+ const Column& column = *configTableColumnsIterator->second;
+
+ if (column.isPK()) {
+ pkFoundCount++;
+ }
+
+ table->addColumn(column);
+
+ } else {
+ table->addColumn(properties[j].getName(), ODBCTypeHelper::getSQLType(properties[j].getType()));
+ }
+
+ } else {
+ table->addColumn(properties[j].getName(), ODBCTypeHelper::getSQLType(properties[j].getType()));
+ }
+
+ } else {
+ const Table* fkTable = config->getTableByTypeName(properties[j].getType().getName());
+ std::string fkTableName;
+
+ if (fkTable == 0) {
+ fkTableName = properties[j].getType().getName();
+ } else {
+ fkTableName = fkTable->getTableName();
+ }
+
+ const Relationship* relationship = config->getRelationship(table->getTableName(), fkTableName);
+
+ if (relationship == 0) {
+ Relationship* aux = new Relationship(table->getTableName(), fkTableName);
+ aux->addKeyPair("ID", table->getTableName() + "_ID");
+ relationships.insert(std::make_pair(table->getTableName() + "." + fkTableName, aux));
+
+ } else {
+ relationships.insert(std::make_pair(table->getTableName() + "." + fkTableName, new Relationship(*relationship)));
+ }
+
+ }
+
+ }
+
+ if (pkColumnCount == 0 || pkColumnCount > pkFoundCount) {
+ Column* column = table->getColumn("ID");
+
+ if (column == 0) {
+ throw DASPrimaryKeyNotFoundException((std::string) "No PK found on Type " + type.getURI() + "." + type.getName());
+ }
+
+ column->setPK(true);
+
+ }
+
+ if (configTableColumnsByPropertyName != 0) {
+ delete configTableColumnsByPropertyName;
+ }
+
+ tables.insert(std::make_pair(type.getName(), table));
+
+}
+
+bool ApplyChanges::isInStack(const DASDataObject& dasDataObject) {
+
+ for (std::list<DASDataObject*>::const_iterator it = stack.begin() ; stack.end() != it ; it++) {
+
+ if ((*it)->getDataObject() == dasDataObject.getDataObject()) {
+ return true;
+ }
+
+ }
+
+ return false;
+
+}
+
+const Table& ApplyChanges::getTable(commonj::sdo::DataObjectPtr dataObject) {
+ std::string typeName = dataObject->getType().getName();
+ std::map<std::string, const Table*>::const_iterator it = tables.find(typeName);
+
+ if (it == tables.end()) {
+ processMetadata(dataObject);
+ }
+
+ it = tables.find(typeName);
+
+ return *it->second;
+
+}
+
+CreatedDataObject& ApplyChanges::processCreatedDataObject(commonj::sdo::DataObjectPtr dataObject) {
+ DASDataObject* dasDB = getDASDataObject(dataObject);
+ //dataObject->printSelf(std::cout);
+
+ if (dasDB != 0) {
+ return (CreatedDataObject&) *dasDB;
+ }
+
+ CreatedDataObject* createdDataObject = new CreatedDataObject(
+ getTable(dataObject), dataObject, summary);
+
+ updateOrderList.push_back(createdDataObject);
+ addDataObject(*createdDataObject);
+ commonj::sdo::PropertyList properties = dataObject->getInstanceProperties();
+
+ for (unsigned int i = 0 ; i < properties.size() ; i++) {
+
+ if (properties[i].getType().isDataObjectType()) {
+
+ if (properties[i].isMany()) {
+ commonj::sdo::DataObjectList& dataObjectList = dataObject->getList(properties[i]);
+
+ for (unsigned int j = 0 ; j < dataObjectList.size() ; j++) {
+ DASDataObject& dob = processDataObject(dataObjectList[j]);
+ RelationshipStatement& rs = dob.addFK(getRelationship(*createdDataObject, dob), &createdDataObject->getPrimaryKeys());
+ dob.addDependency(rs);
+
+ }
+
+ } else {
+ commonj::sdo::DataObjectPtr dao = dataObject->getDataObject(properties[i]);
+ DASDataObject& dob = processDataObject(dao);
+ dob.addFK(getRelationship(*createdDataObject, dob), &createdDataObject->getPrimaryKeys());
+ RelationshipStatement& rs = dob.addFK(getRelationship(*createdDataObject, dob), &createdDataObject->getPrimaryKeys());
+ dob.addDependency(rs);
+
+ }
+
+ }
+
+ }
+
+ return *createdDataObject;
+
+}
+
+const Relationship& ApplyChanges::getRelationship(DASDataObject& parentDataObject, DASDataObject& dataObject) const {
+ std::map<std::string, const Relationship*>::const_iterator relatIt = relationships.
+ find(parentDataObject.getTable().getTableName() + "." + dataObject.getTable().getTableName());
+
+ return *relatIt->second;
+
+}
+
+DeletedDataObject& ApplyChanges::processDeletedDataObject(commonj::sdo::DataObjectPtr dataObject) {
+ DASDataObject* dasDB = getDASDataObject(dataObject);
+ //dataObject->printSelf(std::cout);
+
+ if (dasDB != 0) {
+ return (DeletedDataObject&) *dasDB;
+ }
+
+ DeletedDataObject* deletedDataObject = new DeletedDataObject(
+ getTable(dataObject), dataObject, summary);
+
+ const commonj::sdo::SettingList& setting = summary->getOldValues(dataObject);
+
+ for (int i = 0 ; i < setting.size() ; i++) {
+
+ if (setting[i].isSet() && setting[i].getProperty().getType().isDataObjectType()) {
+ commonj::sdo::DataObjectPtr containedDataObject = setting[i].getDataObjectValue();
+
+ if (!summary->isDeleted(containedDataObject)) {
+ DASDataObject& modDO = processDataObject(containedDataObject);
+ RelationshipStatement& rs = modDO.addFK(getRelationship(*deletedDataObject, modDO), 0);
+ deletedDataObject->addDependency(rs);
+
+ }
+
+ }
+
+ }
+
+ addDataObject(*deletedDataObject);
+ updateOrderList.push_back(deletedDataObject);
+
+ return *deletedDataObject;
+
+}
+
+DASDataObject* ApplyChanges::getDASDataObject(commonj::sdo::DataObjectPtr dataObject) const {
+ std::map<std::string, std::list<DASDataObject*>*>::const_iterator it = dasDataObjects.find((std::string) dataObject->getType().getName());
+
+ if (it != dasDataObjects.end()) {
+ std::list<DASDataObject*>& list = *it->second;
+ std::list<DASDataObject*>::iterator it2;
+
+ for (it2 = list.begin() ; it2 != list.end() ; it2++) {
+
+ if ((*it2)->getDataObject() == dataObject) {
+ return *it2;
+ }
+
+ }
+
+ }
+
+ return 0;
+
+}
+
+ModifiedDataObject& ApplyChanges::processModifiedDataObject(commonj::sdo::DataObjectPtr dataObject) {
+ DASDataObject* dasDB = getDASDataObject(dataObject);
+ //dataObject->printSelf(std::cout);
+
+ if (dasDB != 0) {
+ return (ModifiedDataObject&) *dasDB;
+ }
+
+ ModifiedDataObject* modifiedDataObject = new ModifiedDataObject(
+ getTable(dataObject), dataObject, summary);
+
+ updateOrderList.push_back(modifiedDataObject);
+ addDataObject(*modifiedDataObject);
+
+ if (summary->isModified(dataObject)) {
+ std::map<const commonj::sdo::Property*, std::list<commonj::sdo::DataObjectPtr>*> manyOldValuedProperties;
+ std::map<const commonj::sdo::Property*, commonj::sdo::DataObjectPtr> singleOldValuedProperties;
+ commonj::sdo::PropertyList props = dataObject->getInstanceProperties();
+ const commonj::sdo::SettingList& setting = summary->getOldValues(dataObject);
+
+ for (int i = 0 ; i < setting.size() ; i++) {
+ const commonj::sdo::Property& prop = setting[i].getProperty();
+
+ if (prop.getType().isDataObjectType()) {
+
+ if (!setting[i].isNull() && setting[i].isSet()) {
+ commonj::sdo::DataObjectPtr oldDO = setting[i].getDataObjectValue();
+ //oldDO->printSelf(std::cout);
+ //std::cout << std::endl;
+
+ if (prop.isMany()) {
+ std::map<const commonj::sdo::Property*, std::list<commonj::sdo::DataObjectPtr>*>::iterator manyIt =
+ manyOldValuedProperties.find(&prop);
+
+ std::list<commonj::sdo::DataObjectPtr>* list;
+
+ if (manyIt == manyOldValuedProperties.end()) {
+ list = new std::list<commonj::sdo::DataObjectPtr>();
+ manyOldValuedProperties.insert(std::make_pair(&prop, list));
+
+ } else {
+ list = manyIt->second;
+ }
+
+ list->push_back(oldDO);
+
+ } else {
+ singleOldValuedProperties.insert(std::make_pair(&prop, oldDO));
+ }
+
+ }
+
+ }
+ }
+
+ for (unsigned int i = 0 ; i < props.size() ; i++) {
+
+ if (props[i].getType().isDataObjectType()) {
+
+ if (props[i].isMany()) {
+
+ if (!dataObject->isSet(props[i]) || !dataObject->isNull(props[i])) {
+ commonj::sdo::DataObjectList& doList = dataObject->getList(props[i]);
+
+ for (unsigned int j = 0 ; j < doList.size() ; j++) {
+ commonj::sdo::DataObjectPtr dob = doList[j];
+
+ if (summary->isCreated(dob)) {
+ CreatedDataObject& createdDO = processCreatedDataObject(dob);
+ RelationshipStatement& rs = createdDO.addFK(getRelationship(*modifiedDataObject, createdDO), &modifiedDataObject->getPrimaryKeys());
+ modifiedDataObject->addDependency(rs);
+
+ } else {
+ std::map<const commonj::sdo::Property*, std::list<commonj::sdo::DataObjectPtr>*>::iterator manyIt =
+ manyOldValuedProperties.find(&props[i]);
+
+ bool existsOldDO = false;
+
+ if (manyIt != manyOldValuedProperties.end()) {
+ std::list<commonj::sdo::DataObjectPtr>& list = *manyIt->second;
+
+ for (std::list<commonj::sdo::DataObjectPtr>::iterator listIt = list.begin() ;
+ listIt != list.end() ; listIt++) {
+
+ if (*listIt == dob) {
+ existsOldDO = true;
+ list.erase(listIt);
+ break;
+
+ }
+
+ }
+
+ }
+
+ if (!existsOldDO) {
+ ModifiedDataObject& modDO = processModifiedDataObject(dob);
+ RelationshipStatement& rs = modDO.addFK(getRelationship(*modifiedDataObject, modDO), &modifiedDataObject->getPrimaryKeys());
+ modifiedDataObject->addDependency(rs);
+
+ }
+
+ }
+
+ }
+
+ }
+
+ } else {
+
+ if (!dataObject->isSet(props[i]) || !dataObject->isNull(props[i])) {
+ commonj::sdo::DataObjectPtr dob = dataObject->getDataObject(props[i]);
+
+ if (summary->isCreated(dob)) {
+ CreatedDataObject& createdDO = processCreatedDataObject(dob);
+ RelationshipStatement& rs = createdDO.addFK(getRelationship(*modifiedDataObject, createdDO), &modifiedDataObject->getPrimaryKeys());
+ modifiedDataObject->addDependency(rs);
+
+ } else {
+ std::map<const commonj::sdo::Property*, commonj::sdo::DataObjectPtr>::iterator singleIt =
+ singleOldValuedProperties.find(&props[i]);
+
+ if (singleIt == singleOldValuedProperties.end() || singleIt->second != dob) {
+ ModifiedDataObject& modDO = processModifiedDataObject(dob);
+ RelationshipStatement& rs = modDO.addFK(getRelationship(*modifiedDataObject, modDO), &modifiedDataObject->getPrimaryKeys());
+ modifiedDataObject->addDependency(rs);
+
+
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ for (std::map<const commonj::sdo::Property*, std::list<commonj::sdo::DataObjectPtr>*>::iterator manyIt = manyOldValuedProperties.begin() ;
+ manyIt != manyOldValuedProperties.end() ; manyIt++) {
+
+ std::list<commonj::sdo::DataObjectPtr>* list = manyIt->second;
+
+ for (std::list<commonj::sdo::DataObjectPtr>::const_iterator listIt = list->begin() ;
+ listIt != list->end() ; listIt++) {
+
+ ModifiedDataObject& modDO = processModifiedDataObject(*listIt);
+ RelationshipStatement& rs = modDO.addFK(getRelationship(*modifiedDataObject, modDO), 0);
+ modDO.addDependency(rs);
+
+ }
+
+ delete list;
+
+ }
+
+ }
+
+ return *modifiedDataObject;
+
+}
+
+void ApplyChanges::addDataObject(DASDataObject& dataObject) {
+ std::list<DASDataObject*>* list;
+ std::string typeName = dataObject.getDataObject()->getType().getName();
+ std::map<std::string, std::list<DASDataObject*>*>::iterator it =
+ dasDataObjects.find(typeName);
+
+ if (it == dasDataObjects.end()) {
+ list = new std::list<DASDataObject*>();
+ dasDataObjects.insert(std::make_pair(typeName, list));
+
+ } else {
+ list = it->second;
+ }
+
+ list->push_back(&dataObject);
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/Column.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/Column.cpp
new file mode 100644
index 0000000000..44b2a5dd99
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/Column.cpp
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/Column.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+Column::Column(const Column& column) {
+ this->columnName = column.columnName;
+ this->propertyName = column.propertyName;
+ this->sqlType = column.sqlType;
+ this->containerTable = column.containerTable;
+ this->pk = column.pk;
+ managed = column.managed;
+ collision = column.collision;
+
+}
+
+Column::Column(std::string columnName, SQLSMALLINT sqlType) {
+ StringWrapper columnNameWrapper(columnName);
+ columnName = columnNameWrapper.toUpper();
+ managed = true;
+ collision = false;
+
+ if (!columnNameWrapper.isValidRDBName()) {
+ throw DASInvalidColumnNameException("Column name must not contain whitespace characters!");
+ }
+
+ this->columnName = columnName;
+ this->propertyName = columnName;
+ this->sqlType = sqlType;
+ containerTable = 0;
+ pk = false;
+
+}
+
+Column::~Column(void) {}
+
+void Column::setCollision(bool collision) {
+ this->collision = collision;
+}
+
+void Column::setManaged(bool managed) {
+ this->managed = managed;
+}
+
+bool Column::isCollision(void) const {
+ return collision;
+}
+
+bool Column::isManaged(void) const {
+ return managed;
+}
+
+void Column::setContainerTable(Table* containerTable) {
+ this->containerTable = containerTable;
+}
+
+Table* Column::getContainerTable(void) const {
+ return containerTable;
+}
+
+std::string Column::getName(void) const {
+ return columnName;
+}
+
+SQLSMALLINT Column::getSQLType(void) const {
+ return sqlType;
+}
+
+void Column::setPropertyName(std::string propertyName) {
+ StringWrapper propertyNameWrapper(propertyName);
+ propertyName = propertyNameWrapper.toUpper();
+
+ if (!propertyNameWrapper.isValidRDBName()) {
+ throw DASInvalidPropertyNameException("Property name must not contain whitespace characters!");
+ }
+
+ this->propertyName = propertyName;
+
+}
+
+std::string Column::getPropertyName(void) const {
+ return propertyName;
+}
+
+void Column::setPK(bool pk) {
+ this->pk = pk;
+}
+
+bool Column::isPK(void) const {
+ return pk;
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/ColumnData.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ColumnData.cpp
new file mode 100644
index 0000000000..653119c367
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ColumnData.cpp
@@ -0,0 +1,849 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/ColumnData.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ColumnData::ColumnData(const Column& column, ResultSetPtr resultSet) {
+ this->column = &column;
+
+ if (column.getContainerTable() == 0) {
+ throw std::invalid_argument("Column table not set");
+ }
+
+ /*if (resultSet->isNull(column.getContainerTable()->getTableName(), column.getName())) {
+ data = 0;
+
+ } else {*/
+
+ switch (column.getSQLType()) {
+
+ case SQL_INTEGER :
+ {
+ SQLINTEGER sqlInteger = resultSet->getSQLInteger(
+ column.getContainerTable()->getTableName(), column.getName());
+
+ data = new SQLINTEGER;
+ SQLINTEGER* aux = (SQLINTEGER*) data;
+ *aux = sqlInteger;
+
+ }
+
+ break;
+
+ case SQL_SMALLINT :
+ {
+ SQLSMALLINT sqlSmallInt = resultSet->getSQLSmallInt(
+ column.getContainerTable()->getTableName(), column.getName());
+
+ data = new SQLSMALLINT;
+ SQLSMALLINT* aux = (SQLSMALLINT*) data;
+ *aux = sqlSmallInt;
+
+ }
+
+ break;
+
+ /*case SQL_BIGINT :
+ {
+ SQL_BIGINT sqlInteger = resultSet->getSQLInteger(
+ column.getContainerTable()->getTableName(), column.getName());
+
+ data = new SQL_BIGINT;
+ SQL_BIGINT* aux = (SQL_BIGINT*) data;
+ *aux = sqlInteger;
+
+ }
+
+ break;*/
+
+ case SQL_CHAR :
+ {
+ SQLCHAR sqlChar = resultSet->getSQLChar(column.getContainerTable()->getTableName(),
+ column.getName());
+
+ data = new SQLCHAR;
+ SQLCHAR* aux = (SQLCHAR*) data;
+ *aux= sqlChar;
+ }
+
+ break;
+
+ case SQL_WCHAR :
+ {
+ SQLWCHAR sqlWChar = resultSet->getSQLWChar(column.getContainerTable()->getTableName(),
+ column.getName());
+
+ data = new SQLWCHAR;
+ SQLWCHAR* aux = (SQLWCHAR*) data;
+ *aux= sqlWChar;
+ }
+
+ break;
+
+ case SQL_DOUBLE :
+ {
+ SQLDOUBLE sqlDouble = resultSet->getSQLDouble(column.getContainerTable()->getTableName(),
+ column.getName());
+
+ data = new SQLDOUBLE;
+ SQLDOUBLE* aux = (SQLDOUBLE*) data;
+ *aux = sqlDouble;
+ }
+
+ break;
+
+ case SQL_FLOAT :
+ {
+ SQLFLOAT sqlFloat = resultSet->getSQLFloat(column.getContainerTable()->getTableName(),
+ column.getName());
+
+ data = new SQLFLOAT;
+ SQLFLOAT* aux = (SQLFLOAT*) data;
+ *aux = sqlFloat;
+ }
+
+ break;
+
+ case SQL_REAL :
+ {
+ SQLREAL sqlReal = resultSet->getSQLReal(column.getContainerTable()->getTableName(),
+ column.getName());
+
+ data = new SQLREAL;
+ SQLREAL* aux = (SQLREAL*) data;
+ *aux = sqlReal;
+ }
+
+ break;
+
+ case SQL_VARCHAR :
+ {
+ std::string varchar = resultSet->getSQLVarchar(column.getContainerTable()->getTableName(),
+ column.getName());
+
+ data = new std::string(varchar.begin(), varchar.end());
+ std::string* aux = (std::string*) data;
+ (*aux).assign(varchar.begin(), varchar.end());
+ }
+
+ break;
+
+ case SQL_WVARCHAR :
+ {
+ std::wstring wvarchar = resultSet->getSQLWVarchar(column.getContainerTable()->getTableName(),
+ column.getName());
+
+ std::wstring* aux = new std::wstring();
+ *aux = wvarchar;
+ data = aux;
+
+ }
+
+ break;
+
+ default :
+ throw DASInvalidSQLTypeException();
+
+ }
+
+ //}
+
+}
+
+ColumnData::ColumnData(const Column& column, const commonj::sdo::Setting& setting) {
+ this->column = &column;
+
+ if (column.getContainerTable() == 0) {
+ throw std::invalid_argument("Column table not set");
+ }
+
+ if (!setting.isSet() || setting.isNull()) {
+ data = 0;
+ } else {
+
+ switch (column.getSQLType()) {
+
+ case SQL_INTEGER :
+ {
+ SQLINTEGER sqlInteger = setting.getIntValue();
+
+ data = new SQLINTEGER;
+ SQLINTEGER* aux = (SQLINTEGER*) data;
+ *aux = sqlInteger;
+
+ }
+
+ break;
+
+ case SQL_SMALLINT :
+ {
+ SQLSMALLINT sqlSmallInt = setting.getIntValue();
+
+ data = new SQLSMALLINT;
+ SQLSMALLINT* aux = (SQLSMALLINT*) data;
+ *aux = sqlSmallInt;
+
+ }
+
+ break;
+
+ case SQL_CHAR :
+ {
+ SQLCHAR sqlChar = setting.getCharacterValue();
+
+ data = new SQLCHAR;
+ SQLCHAR* aux = (SQLCHAR*) data;
+ *aux= sqlChar;
+ }
+
+ break;
+
+ case SQL_WCHAR :
+ {
+ SQLWCHAR sqlWChar = setting.getCharacterValue();
+
+ data = new SQLWCHAR;
+ SQLWCHAR* aux = (SQLWCHAR*) data;
+ *aux= sqlWChar;
+ }
+
+ break;
+
+ case SQL_DOUBLE :
+ {
+ SQLDOUBLE sqlDouble = setting.getDoubleValue();
+
+ data = new SQLDOUBLE;
+ SQLDOUBLE* aux = (SQLDOUBLE*) data;
+ *aux = sqlDouble;
+ }
+
+ break;
+
+ case SQL_FLOAT :
+ {
+ SQLFLOAT sqlFloat = setting.getDoubleValue();
+
+ data = new SQLFLOAT;
+ SQLFLOAT* aux = (SQLFLOAT*) data;
+ *aux = sqlFloat;
+ }
+
+ break;
+
+ case SQL_REAL :
+ {
+ SQLREAL sqlReal = setting.getFloatValue();
+
+ data = new SQLREAL;
+ SQLREAL* aux = (SQLREAL*) data;
+ *aux = sqlReal;
+ }
+
+ break;
+
+ case SQL_VARCHAR :
+ {
+ unsigned int length = setting.getLength();
+ wchar_t* buffer = new wchar_t[length];
+ setting.getStringValue(buffer, length);
+ //buffer[length] = 0;
+
+ std::wstring wstr(buffer, 0, length);
+ std::string* str = new std::string(wstr.begin(), wstr.end());
+ str->assign(wstr.begin(), wstr.end());
+
+ data = str;
+
+ delete [] buffer;
+
+ }
+
+ break;
+
+ case SQL_WVARCHAR :
+ {
+ unsigned int length = setting.getLength();
+ wchar_t* buffer = new wchar_t[length];
+ setting.getStringValue(buffer, length);
+ //buffer[length] = 0;
+
+ data = new std::wstring(buffer, 0, length);
+
+ delete [] buffer;
+
+ }
+
+ break;
+
+ default :
+ throw DASInvalidSQLTypeException();
+
+ }
+
+ }
+
+}
+
+ColumnData::ColumnData(const Column& column, commonj::sdo::DataObjectPtr dataObject) {
+ this->column = &column;
+
+ if (column.getContainerTable() == 0) {
+ throw std::invalid_argument("Column table not set");
+ }
+
+ if (!dataObject->isSet(column.getPropertyName().c_str()) || dataObject->isNull(column.getPropertyName().c_str())) {
+ data = 0;
+
+ } else {
+
+ switch (column.getSQLType()) {
+
+ case SQL_INTEGER :
+ {
+ SQLINTEGER sqlInteger = dataObject->getInt(column.getPropertyName().c_str());
+
+ data = new SQLINTEGER;
+ SQLINTEGER* aux = (SQLINTEGER*) data;
+ *aux = sqlInteger;
+
+ }
+
+ break;
+
+ case SQL_SMALLINT :
+ {
+ SQLSMALLINT sqlSmallInt = dataObject->getInt(column.getPropertyName().c_str());
+
+ data = new SQLSMALLINT;
+ SQLSMALLINT* aux = (SQLSMALLINT*) data;
+ *aux = sqlSmallInt;
+
+ }
+
+ break;
+
+ case SQL_CHAR :
+ {
+ SQLCHAR sqlChar = dataObject->getCharacter(column.getPropertyName().c_str());
+
+ data = new SQLCHAR;
+ SQLCHAR* aux = (SQLCHAR*) data;
+ *aux= sqlChar;
+ }
+
+ break;
+
+ case SQL_WCHAR :
+ {
+ SQLWCHAR sqlWChar = dataObject->getCharacter(column.getPropertyName().c_str());
+
+ data = new SQLWCHAR;
+ SQLWCHAR* aux = (SQLWCHAR*) data;
+ *aux= sqlWChar;
+ }
+
+ break;
+
+ case SQL_DOUBLE :
+ {
+ SQLDOUBLE sqlDouble = dataObject->getDouble(column.getPropertyName().c_str());
+
+ data = new SQLDOUBLE;
+ SQLDOUBLE* aux = (SQLDOUBLE*) data;
+ *aux = sqlDouble;
+ }
+
+ break;
+
+ case SQL_FLOAT :
+ {
+ SQLFLOAT sqlFloat = dataObject->getDouble(column.getPropertyName().c_str());
+
+ data = new SQLFLOAT;
+ SQLFLOAT* aux = (SQLFLOAT*) data;
+ *aux = sqlFloat;
+ }
+
+ break;
+
+ case SQL_REAL :
+ {
+ SQLREAL sqlReal = dataObject->getFloat(column.getPropertyName().c_str());
+
+ data = new SQLREAL;
+ SQLREAL* aux = (SQLREAL*) data;
+ *aux = sqlReal;
+ }
+
+ break;
+
+ case SQL_VARCHAR :
+ {
+ unsigned int length = dataObject->getLength(column.getPropertyName().c_str());
+ wchar_t* buffer = new wchar_t[length];
+ dataObject->getString(column.getPropertyName().c_str(), buffer, length);
+
+ std::wstring wstr(buffer, 0, length);
+ std::string* str = new std::string(wstr.begin(), wstr.end());
+ str->assign(wstr.begin(), wstr.end());
+
+ data = str;
+
+ delete [] buffer;
+
+ }
+
+ break;
+
+ case SQL_WVARCHAR :
+ {
+ unsigned int length = dataObject->getLength(column.getPropertyName().c_str());
+ wchar_t* buffer = new wchar_t[length];
+ dataObject->getString(column.getPropertyName().c_str(), buffer, length);
+
+ data = new std::wstring(buffer, 0, length);
+
+ delete [] buffer;
+
+ }
+
+ break;
+
+ default :
+ throw DASInvalidSQLTypeException();
+
+ }
+
+ }
+
+}
+
+ColumnData::~ColumnData(void) {
+ delete data;
+}
+
+std::string ColumnData::toSQL(void) const {
+
+ if (data == 0) {
+ return "NULL";
+ } else {
+
+ switch (column->getSQLType()) {
+
+ case SQL_INTEGER :
+ return StringWrapper::toString(*((SQLINTEGER*) data));
+
+ case SQL_SMALLINT :
+ return StringWrapper::toString(*((SQLSMALLINT*) data));
+
+ case SQL_CHAR :
+ return '\'' + StringWrapper::toString(*((SQLCHAR*) data)) + '\'';
+
+ case SQL_WCHAR :
+ return '\'' + StringWrapper::toString(*((SQLWCHAR*) data)) + '\'';
+
+ case SQL_DOUBLE :
+ return StringWrapper::toString(*((SQLDOUBLE*) data));
+
+ case SQL_FLOAT :
+ return StringWrapper::toString(*((SQLFLOAT*) data));
+
+ case SQL_REAL :
+ return StringWrapper::toString(*((SQLREAL*) data));
+
+ case SQL_VARCHAR :
+ {
+ std::string str = *((std::string*) data);
+ return '\'' + str + '\'';
+
+ }
+
+ case SQL_WVARCHAR :
+ {
+ std::wstring wstr = *((std::wstring*) data);
+ std::string str(wstr.begin(), wstr.end());
+ str.assign(wstr.begin(), wstr.end());
+ return '\'' + str + '\'';
+
+ }
+
+ default :
+ throw DASInvalidSQLTypeException();
+
+ }
+
+ }
+
+}
+
+void ColumnData::populateDataGraph(TableData& tableData) const {
+ try {
+ tableData.getGraphObject()->getType().getPropertyIndex(column->getPropertyName().c_str());
+
+ } catch (commonj::sdo::SDOPropertyNotFoundException&) {
+ return;
+ }
+
+ if (data == 0) {
+ tableData.getGraphObject()->setNull(column->getPropertyName().c_str());
+
+ } else {
+
+ switch (column->getSQLType()) {
+
+ case SQL_INTEGER :
+ tableData.getGraphObject()->setInt(column->getPropertyName().c_str(), (long) *((SQLINTEGER*) data));
+
+ break;
+
+ case SQL_SMALLINT :
+ tableData.getGraphObject()->setInt(column->getPropertyName().c_str(), (long) *((SQLSMALLINT*) data));
+
+ break;
+
+ case SQL_CHAR :
+ tableData.getGraphObject()->setCharacter(column->getPropertyName().c_str(), (wchar_t) *((SQLCHAR*) data));
+
+ break;
+
+ case SQL_WCHAR :
+ tableData.getGraphObject()->setCharacter(column->getPropertyName().c_str(), (wchar_t) *((SQLWCHAR*) data));
+
+ break;
+
+ case SQL_FLOAT :
+ tableData.getGraphObject()->setDouble(column->getPropertyName().c_str(), (long double) *((SQLFLOAT*) data));
+
+ case SQL_DOUBLE :
+ tableData.getGraphObject()->setDouble(column->getPropertyName().c_str(), (long double) *((SQLDOUBLE*) data));
+
+ break;
+
+ case SQL_REAL :
+ tableData.getGraphObject()->setFloat(column->getPropertyName().c_str(), (float) *((SQLREAL*) data));
+
+ break;
+
+ case SQL_VARCHAR :
+ {
+ std::string* varchar = (std::string*) data;
+ std::wstring wstr(varchar->begin(), varchar->end());
+ wstr.assign(varchar->begin(), varchar->end());
+
+ tableData.getGraphObject()->setString(column->getPropertyName().c_str(),
+ wstr.c_str(), wstr.size());
+ }
+
+ break;
+
+ case SQL_WVARCHAR :
+ {
+ std::wstring* wvarchar = (std::wstring*) data;
+
+ tableData.getGraphObject()->setString(column->getPropertyName().c_str(),
+ (*wvarchar).c_str(), (*wvarchar).size());
+ }
+
+ break;
+
+ default :
+ throw DASInvalidSQLTypeException();
+
+ }
+
+ }
+
+}
+
+bool ColumnData::operator==(const ColumnData& columnData) const {
+
+ if (column->getSQLType() != columnData.column->getSQLType()) {
+ throw DASInvalidSQLTypeException("Different sql types!");
+ }
+
+ if (data == 0) {
+ return false;
+ }
+
+ switch (column->getSQLType()) {
+
+ case SQL_INTEGER :
+
+ if (*((SQLINTEGER*) columnData.data) == *((SQLINTEGER*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_SMALLINT :
+
+ if (*((SQLSMALLINT*) columnData.data) == *((SQLSMALLINT*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_CHAR :
+
+ if (*((SQLCHAR*) columnData.data) == *((SQLCHAR*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_WCHAR :
+
+ if (*((SQLWCHAR*) columnData.data) == *((SQLWCHAR*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_DOUBLE :
+ if (*((SQLDOUBLE*) columnData.data) == *((SQLDOUBLE*) data)) {
+ return true;
+ }
+
+ case SQL_FLOAT :
+ if (*((SQLFLOAT*) columnData.data) == *((SQLFLOAT*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_REAL :
+
+ if (*((SQLREAL*) columnData.data) == *((SQLREAL*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_VARCHAR :
+ if (*((std::string*) columnData.data) == *((std::string*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_WVARCHAR :
+ if (*((std::wstring*) columnData.data) == *((std::wstring*) data)) {
+ return true;
+ }
+
+ break;
+
+ default :
+ throw DASInvalidSQLTypeException();
+
+ }
+
+ return false;
+
+}
+
+bool ColumnData::operator!=(const ColumnData& columnData) const {
+ return !(*this == columnData);
+}
+
+const Column& ColumnData::getColumn(void) const {
+ return *column;
+}
+
+bool ColumnData::operator<(const ColumnData& columnData) const {
+
+ if (column->getSQLType() != columnData.column->getSQLType()) {
+ throw DASInvalidSQLTypeException("Different sql types!");
+ }
+
+ if (data == 0) {
+ return false;
+ }
+
+ switch (column->getSQLType()) {
+
+ case SQL_SMALLINT :
+
+ if (*((SQLSMALLINT*) columnData.data) > *((SQLSMALLINT*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_INTEGER :
+
+ if (*((SQLINTEGER*) columnData.data) > *((SQLINTEGER*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_CHAR :
+
+ if (*((SQLCHAR*) columnData.data) > *((SQLCHAR*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_WCHAR :
+
+ if (*((SQLWCHAR*) columnData.data) > *((SQLWCHAR*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_DOUBLE :
+ if (*((SQLDOUBLE*) columnData.data) > *((SQLDOUBLE*) data)) {
+ return true;
+ }
+
+ case SQL_FLOAT :
+ if (*((SQLFLOAT*) columnData.data) > *((SQLFLOAT*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_REAL :
+
+ if (*((SQLREAL*) columnData.data) > *((SQLREAL*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_VARCHAR :
+ if (*((std::string*) columnData.data) > *((std::string*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_WVARCHAR :
+ if (*((std::wstring*) columnData.data) > *((std::wstring*) data)) {
+ return true;
+ }
+
+ break;
+
+ default :
+ throw DASInvalidSQLTypeException();
+
+ }
+
+ return false;
+
+}
+
+bool ColumnData::operator>(const ColumnData& columnData) const {
+
+ if (column->getSQLType() != columnData.column->getSQLType()) {
+ throw DASInvalidSQLTypeException("Different sql types!");
+ }
+
+ if (data == 0) {
+ return false;
+ }
+
+ switch (column->getSQLType()) {
+
+ case SQL_INTEGER :
+
+ if (*((SQLINTEGER*) columnData.data) < *((SQLINTEGER*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_SMALLINT :
+
+ if (*((SQLSMALLINT*) columnData.data) < *((SQLSMALLINT*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_CHAR :
+
+ if (*((SQLCHAR*) columnData.data) < *((SQLCHAR*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_WCHAR :
+
+ if (*((SQLWCHAR*) columnData.data) < *((SQLWCHAR*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_DOUBLE :
+ if (*((SQLDOUBLE*) columnData.data) < *((SQLDOUBLE*) data)) {
+ return true;
+ }
+
+ case SQL_FLOAT :
+ if (*((SQLFLOAT*) columnData.data) < *((SQLFLOAT*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_REAL :
+
+ if (*((SQLREAL*) columnData.data) < *((SQLREAL*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_VARCHAR :
+ if (*((std::string*) columnData.data) < *((std::string*) data)) {
+ return true;
+ }
+
+ break;
+
+ case SQL_WVARCHAR :
+ if (*((std::wstring*) columnData.data) < *((std::wstring*) data)) {
+ return true;
+ }
+
+ break;
+
+ default :
+ throw DASInvalidSQLTypeException();
+
+ }
+
+ return false;
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/CommandImpl.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/CommandImpl.cpp
new file mode 100644
index 0000000000..193d3e1108
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/CommandImpl.cpp
@@ -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.
+ */
+#include "apache/das/rdb/CommandImpl.h"
+#include "apache/das/rdb/DASImpl.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+CommandImpl::CommandImpl(DASImpl& das, std::string sqlString) {
+ this->das = &das;
+ statement = das.getConnection()->createStatement();
+ sql = sqlString;
+
+ //statement = new Statement();
+
+ //try {
+ /*URL url = getClass().getResource("/xml/sdoJava.xsd");
+ if (url == null) {
+ //throw new RuntimeException("Could not find resource: xml/sdoJava.xsd");
+ }
+
+ InputStream inputStream = url.openStream();
+ XSDHelper.INSTANCE.define(inputStream, url.toString());
+ inputStream.close();*/
+ //} catch (IOException ex) {
+ // throw new RuntimeException(ex);
+ //}
+
+}
+
+CommandImpl::~CommandImpl() {}
+
+DASImpl& CommandImpl::getDAS(void) {
+ return *das;
+}
+
+commonj::sdo::DataObjectPtr CommandImpl::executeQuery(void) {
+ statement->executeQuery(sql);
+
+ return commonj::sdo::DataObjectPtr(0);
+
+}
+
+void CommandImpl::close(void) {
+ statement->close();
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/ConfigImpl.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ConfigImpl.cpp
new file mode 100644
index 0000000000..20c7871ba4
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ConfigImpl.cpp
@@ -0,0 +1,334 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/ConfigImpl.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ConfigImpl::ConfigImpl(void) {
+ relationships = new std::map<std::string, const Relationship*>();
+ tables = new std::map<std::string, const Table*>();
+ commands = new std::map<std::string, std::string>();
+
+ convOverConfig = false;
+
+}
+
+ConfigImpl::ConfigImpl(const Config& config) : Config(config) {
+ ConfigImpl& thisConfig = (ConfigImpl&) config;
+ tables = new std::map<std::string, const Table*>();
+ relationships = new std::map<std::string, const Relationship*>();
+ commands = new std::map<std::string, std::string>(*thisConfig.commands);
+
+ std::map<std::string, const Table*>::iterator tableIterator;
+ std::map<std::string, const Relationship*>::iterator relationshipIterator;
+ std::map<std::string, std::string>::iterator commandIterator;
+
+ this->convOverConfig = thisConfig.convOverConfig;
+
+ for (tableIterator = thisConfig.tables->begin() ; tableIterator != thisConfig.tables->end() ;
+ tableIterator++) {
+
+ tables->insert(std::make_pair(tableIterator->first, new Table(*tableIterator->second)));
+
+ }
+
+ for (relationshipIterator = thisConfig.relationships->begin() ;
+ relationshipIterator != thisConfig.relationships->end() ; relationshipIterator++) {
+
+ relationships->insert(std::make_pair(relationshipIterator->first,
+ new Relationship(*relationshipIterator->second)));
+
+ }
+
+}
+
+ConfigImpl::ConfigImpl(std::string xmlFile) {
+ relationships = new std::map<std::string, const Relationship*>();
+ tables = new std::map<std::string, const Table*>();
+ commands = new std::map<std::string, std::string>();
+
+ convOverConfig = false;
+
+ commonj::sdo::DataFactoryPtr dataFactory = commonj::sdo::DataFactory::getDataFactory();
+ dataFactory->addType(DAS_NAMESPACE, "RootType");
+ dataFactory->addType(DAS_NAMESPACE, "Table");
+ dataFactory->addType(DAS_NAMESPACE, "Relationship");
+ dataFactory->addType(DAS_NAMESPACE, "KeyPair");
+ dataFactory->addType(DAS_NAMESPACE, "Column");
+ dataFactory->addType(DAS_NAMESPACE, "Config");
+ dataFactory->addType(DAS_NAMESPACE, "Command");
+
+ const commonj::sdo::Type& rootType = dataFactory->getType(DAS_NAMESPACE, "RootType");
+ const commonj::sdo::Type& table = dataFactory->getType(DAS_NAMESPACE, "Table");
+ const commonj::sdo::Type& relationship = dataFactory->getType(DAS_NAMESPACE, "Relationship");
+ const commonj::sdo::Type& keyPair = dataFactory->getType(DAS_NAMESPACE, "KeyPair");
+ const commonj::sdo::Type& column = dataFactory->getType(DAS_NAMESPACE, "Column");
+ const commonj::sdo::Type& config = dataFactory->getType(DAS_NAMESPACE, "Config");
+ const commonj::sdo::Type& command = dataFactory->getType(DAS_NAMESPACE, "Command");
+
+ dataFactory->addPropertyToType(rootType, "Config", config);
+
+ dataFactory->addPropertyToType(table, "Column", column, true, false, true);
+ dataFactory->addPropertyToType(table, "tableName", SDO_NAMESPACE, "String", false, false, true);
+ dataFactory->addPropertyToType(table, "typeName", SDO_NAMESPACE, "String", false, false, true);
+
+ dataFactory->addPropertyToType(config, "Table", table, true, false, true);
+ dataFactory->addPropertyToType(config, "Relationship", relationship, true, false, true);
+ dataFactory->addPropertyToType(config, "Command", command, true, false, true);
+ dataFactory->addPropertyToType(config, "uri", SDO_NAMESPACE, "String", false, false, true);
+ dataFactory->setDefault(SDO_NAMESPACE, "String", "uri", "");
+
+ dataFactory->addPropertyToType(command, "name", SDO_NAMESPACE, "String", false, false, true);
+ dataFactory->addPropertyToType(command, "SQL", SDO_NAMESPACE, "String", false, false, true);
+
+ dataFactory->addPropertyToType(relationship, "KeyPair", keyPair, true, false, true);
+ dataFactory->addPropertyToType(relationship, "name", SDO_NAMESPACE, "String", false, false, true);
+ dataFactory->addPropertyToType(relationship, "primaryKeyTable", SDO_NAMESPACE, "String", false, false, true);
+ dataFactory->addPropertyToType(relationship, "foreignKeyTable", SDO_NAMESPACE, "String", false, false, true);
+ dataFactory->addPropertyToType(relationship, "many", SDO_NAMESPACE, "Boolean", false, false, true);
+ dataFactory->setDefault(relationship, "many", true);
+
+ dataFactory->addPropertyToType(keyPair, "primaryKeyColumn", SDO_NAMESPACE, "String", false, false, true);
+ dataFactory->addPropertyToType(keyPair, "foreignKeyColumn", SDO_NAMESPACE, "String", false, false, true);
+
+ dataFactory->addPropertyToType(column, "columnName", SDO_NAMESPACE, "String", false, false, true);
+ dataFactory->addPropertyToType(column, "sqlType", SDO_NAMESPACE, "String", false, false, true);
+ dataFactory->addPropertyToType(column, "propertyName", SDO_NAMESPACE, "String", false, false, true);
+ dataFactory->addPropertyToType(column, "primaryKey", SDO_NAMESPACE, "Boolean", false, false, true);
+ dataFactory->addPropertyToType(column, "primaryKey", SDO_NAMESPACE, "Boolean", false, false, true);
+ dataFactory->addPropertyToType(column, "collision", SDO_NAMESPACE, "Boolean", false, false, true);
+ dataFactory->addPropertyToType(column, "managed", SDO_NAMESPACE, "Boolean", false, false, true);
+ dataFactory->setDefault(column, "primaryKey", false);
+ dataFactory->setDefault(column, "collision", false);
+ dataFactory->setDefault(column, "managed", true);
+
+ dataFactory->resolve();
+
+ commonj::sdo::XMLHelperPtr xmlh = commonj::sdo::HelperProvider::getXMLHelper(dataFactory);
+ commonj::sdo::XMLDocumentPtr doc = xmlh->loadFile(xmlFile.c_str(), DAS_NAMESPACE);
+ commonj::sdo::DataObjectPtr root = doc->getRootDataObject();
+
+ commonj::sdo::DataObjectList& tableList = root->getList("Table");
+
+ for (unsigned int i = 0 ; i < tableList.size() ; i++) {
+ std::string tableName = SDODataObjectWrapper(tableList[i]).getString("tableName");
+
+ if (tableName != "") {
+ Table& table = addTable(tableName);
+ std::string typeName = SDODataObjectWrapper(tableList[i]).getString("typeName");
+
+ if (typeName != "") {
+ table.setTypeName(typeName);
+ }
+
+ commonj::sdo::DataObjectList& columnList = tableList[i]->getList("Column");
+
+ for (unsigned int j = 0 ; j < columnList.size() ; j++) {
+ std::string columnName = SDODataObjectWrapper(columnList[j]).getString("columnName");
+ std::string sqlType = SDODataObjectWrapper(columnList[j]).getString("sqlType");
+
+ if (columnName != "" && sqlType != "") {
+ Column& column = table.addColumn(columnName, ODBCTypeHelper::getSQLType(sqlType));
+ std::string propertyName = SDODataObjectWrapper(columnList[j]).getString("propertyName");
+
+ if (propertyName != "") {
+ column.setPropertyName(propertyName);
+ }
+
+ column.setPK(columnList[j]->getBoolean("primaryKey"));
+ column.setManaged(columnList[j]->getBoolean("managed"));
+ column.setCollision(columnList[j]->getBoolean("collision"));
+
+ }
+
+
+ }
+
+ }
+
+ }
+
+ commonj::sdo::DataObjectList& relationshipList = root->getList("Relationship");
+
+ for (unsigned int i = 0 ; i < relationshipList.size() ; i++) {
+ std::string primaryKeyTable = SDODataObjectWrapper(relationshipList[i]).getString("primaryKeyTable");
+ std::string foreignKeyTable = SDODataObjectWrapper(relationshipList[i]).getString("foreignKeyTable");
+ std::string name = SDODataObjectWrapper(relationshipList[i]).getString("name");;
+
+ Relationship& relationship = addRelationship(primaryKeyTable, foreignKeyTable);
+ relationship.setMany(relationshipList[i]->getBoolean("many"));
+
+ commonj::sdo::DataObjectList& keyPairList = relationshipList[i]->getList("KeyPair");
+
+ for (unsigned int i = 0 ; i < keyPairList.size() ; i++) {
+ std::string primaryKeyColumn = SDODataObjectWrapper(keyPairList[i]).getString("primaryKeyColumn");
+ std::string foreignKeyColumn = SDODataObjectWrapper(keyPairList[i]).getString("foreignKeyColumn");
+ relationship.addKeyPair(primaryKeyColumn, foreignKeyColumn);
+
+ }
+
+ }
+
+ commonj::sdo::DataObjectList& commandList = root->getList("Command");
+
+ for (unsigned int i = 0 ; i < commandList.size() ; i++) {
+ std::string name = SDODataObjectWrapper(commandList[i]).getString("name");
+ std::string sql = SDODataObjectWrapper(commandList[i]).getString("SQL");
+
+ commands->insert(std::make_pair(name, sql));
+
+ }
+
+ setURI(StringWrapper(root, "uri").getString());
+
+}
+
+ConfigImpl::~ConfigImpl(void) {
+ std::map<std::string, const Table*>::const_iterator tableIterator;
+ std::map<std::string, const Relationship*>::const_iterator relationshipIterator;
+
+ tableIterator = tables->begin();
+ for ( ; tableIterator != tables->end() ;
+ tableIterator++) {
+ delete tableIterator->second;
+ }
+
+ for (relationshipIterator = relationships->begin() ;
+ relationshipIterator != relationships->end() ; relationshipIterator++) {
+ delete relationshipIterator->second;
+ }
+
+ delete relationships;
+ delete tables;
+ delete commands;
+
+}
+
+std::string ConfigImpl::getCommand(std::string commandName) const {
+ std::map<std::string, std::string>::const_iterator it = commands->find(commandName);
+
+ if (it == commands->end()) {
+ throw DASCommandNotFoundException();
+ }
+
+ return it->second;
+
+}
+
+const Table* ConfigImpl::getTableByTypeName(std::string typeName) const {
+ std::map<std::string, const Table*>::const_iterator it;
+
+ for (it = tables->begin() ;
+ it != tables->end() ; it++) {
+
+ if (it->second->getTypeName() == typeName) {
+ return it->second;
+ }
+
+ }
+
+ return 0;
+
+}
+
+Table& ConfigImpl::addTable(std::string tableName) {
+ return newTable(*(new Table(tableName)));
+}
+
+Table& ConfigImpl::addTable(const Table& table) {
+ return newTable(*(new Table(table)));
+}
+
+Table& ConfigImpl::newTable(Table& table) {
+ std::string tableName = table.getTableName();
+ std::map<std::string, const Table*>::iterator tableIterator = tables->find(tableName);
+
+ if (tableIterator == tables->end()) {
+ tables->insert(std::make_pair(tableName, &table));
+
+ return table;
+
+ }
+
+ return (Table&) *tableIterator->second;
+
+}
+
+const std::map<std::string, Relationship*>& ConfigImpl::getRelationships(void) const {
+ return (const std::map<std::string, Relationship*>&) *relationships;
+}
+
+Relationship& ConfigImpl::addRelationship(std::string pkTableName, std::string fkTableName, std::string name) {
+ return newRelationship(*(new Relationship(pkTableName, fkTableName, name)));
+}
+
+Relationship& ConfigImpl::addRelationship(const Relationship& relationship) {
+ return newRelationship(*(new Relationship(relationship)));
+}
+
+Relationship& ConfigImpl::newRelationship(Relationship& relationship) {
+ std::string pkXfk = relationship.getPKTableName() + "." + relationship.getFKTableName();
+ std::map<std::string, const Relationship*>::iterator it = relationships->find(pkXfk);
+
+ if (it == relationships->end()) {
+ relationships->insert(std::make_pair(pkXfk, &relationship));
+
+ return relationship;
+
+ }
+
+ return (Relationship&) *it->second;
+
+}
+
+const Relationship* ConfigImpl::getRelationship(std::string pkTableName, std::string fkTableName) const {
+ std::map<std::string, const Relationship*>::iterator it = relationships->find(pkTableName + "." + fkTableName);
+
+ if (it == relationships->end()) {
+ return 0;
+ }
+
+ return it->second;
+
+}
+
+const std::map<std::string, Table*>& ConfigImpl::getTables(void) const {
+ return (const std::map<std::string, Table*>&) *tables;
+}
+
+bool ConfigImpl::isConvOverConfig(void) const {
+ return convOverConfig;
+}
+
+const Table* ConfigImpl::getTable(std::string tableName) const {
+ std::map<std::string, const Table*>::iterator tableIterator = tables->find(tableName);
+
+ if (tableIterator == tables->end()) {
+ return 0;
+ }
+
+ return tableIterator->second;
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/Connection.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/Connection.cpp
new file mode 100644
index 0000000000..752f70f528
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/Connection.cpp
@@ -0,0 +1,214 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/Connection.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+Connection::Connection(string dsn, string user, string password) {
+ SQLRETURN result;
+
+ SQLINTEGER error;
+ SQLCHAR sqlStat;
+ SQLCHAR * message = 0;
+ SQLSMALLINT messageLength;
+
+ //Alloc environment handle
+ result = SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&environment);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "Error to alloc the environment handle - SQLHENV");
+
+ //Set the environment
+ result = SQLSetEnvAttr(environment, SQL_ATTR_ODBC_VERSION,(void*)SQL_OV_ODBC3, 0);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+ SQLFreeHandle(SQL_HANDLE_ENV, environment);
+ throw SQLException(result, "Error to set the environment handle - SQLHENV");
+ }
+
+ //Allocate connection handle
+ result = SQLAllocHandle(SQL_HANDLE_DBC, environment, &connection);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+ SQLFreeHandle(SQL_HANDLE_ENV, environment);
+ throw SQLException(result, "Error to alloc the connection handle - SQLHDBC");
+ }
+
+ setAutoCommit(false);
+
+ //Connect to the datasource
+ result = SQLConnect(connection, reinterpret_cast<SQLCHAR *>(const_cast<char *> (dsn.c_str())), SQL_NTS,
+ reinterpret_cast<SQLCHAR *>(const_cast<char *> (user.c_str())), SQL_NTS,
+ reinterpret_cast<SQLCHAR *>(const_cast<char *> (password.c_str())), SQL_NTS);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+
+ SQLGetDiagRec(SQL_HANDLE_DBC, connection,1,
+ &sqlStat, &error,message,100,&messageLength);
+
+ SQLFreeHandle(SQL_HANDLE_DBC, connection);
+ SQLFreeHandle(SQL_HANDLE_ENV, environment);
+
+ string error("Error to establish the connection.\nSQLSTATE: ");
+ error += reinterpret_cast<char*>(&sqlStat);
+ throw SQLException(result, error);
+ }
+
+}
+
+Connection::Connection(string connectString) {
+ SQLRETURN result;
+
+ SQLINTEGER error;
+ SQLCHAR sqlStat;
+ SQLCHAR * message = 0;
+ SQLSMALLINT messageLength;
+ SQLCHAR outConnectString[1024];
+
+ //Alloc environment handle
+ result = SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&environment);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "Error to alloc the environment handle - SQLHENV");
+
+ //Set the environment
+ result = SQLSetEnvAttr(environment, SQL_ATTR_ODBC_VERSION,(void*)SQL_OV_ODBC3, 0);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+ SQLFreeHandle(SQL_HANDLE_ENV, environment);
+ throw SQLException(result, "Error to set the environment handle - SQLHENV");
+ }
+
+ //Allocate connection handle
+ result = SQLAllocHandle(SQL_HANDLE_DBC, environment, &connection);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+ SQLFreeHandle(SQL_HANDLE_ENV, environment);
+ throw SQLException(result, "Error to alloc the connection handle - SQLHDBC");
+ }
+
+ setAutoCommit(false);
+
+ //Connect to the datasource
+ result = SQLDriverConnect( connection, 0, (SQLCHAR*) (char*) connectString.c_str(), SQL_NTS,
+ (SQLCHAR*)outConnectString, sizeof(outConnectString),
+ &messageLength, SQL_DRIVER_COMPLETE );
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+
+ SQLGetDiagRec(SQL_HANDLE_DBC, connection,1,
+ &sqlStat, &error,message,100,&messageLength);
+
+ SQLFreeHandle(SQL_HANDLE_DBC, connection);
+ SQLFreeHandle(SQL_HANDLE_ENV, environment);
+
+ string outC = (char*) outConnectString;
+
+ string error("Error to establish the connection.\nSQLSTATE: ");
+ error += reinterpret_cast<char*>(&sqlStat);
+ throw SQLException(result, error);
+ }
+
+}
+
+Connection::~Connection(void){
+ std::list<StatementPtr*>::iterator it;
+
+ for (it = statements.begin() ; it != statements.end() ; it++) {
+
+ if (**it) {
+ delete **it;
+ delete *it;
+
+ }
+
+ }
+
+ SQLDisconnect(connection);
+ SQLFreeHandle(SQL_HANDLE_DBC,connection);
+ SQLFreeHandle(SQL_HANDLE_ENV, environment);
+
+}
+
+SQLHDBC Connection::getODBCConnection(void) const{
+ return connection;
+}
+
+void Connection::commit(void){
+ SQLRETURN result = SQLEndTran(SQL_HANDLE_DBC, connection, SQL_COMMIT);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+ throw SQLException(result, "Commit error");
+ }
+
+}
+
+void Connection::rollback(void){
+ SQLRETURN result = SQLEndTran(SQL_HANDLE_DBC, connection, SQL_ROLLBACK);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+ throw SQLException(result, "Rollback error");
+ }
+
+}
+
+void Connection::setAutoCommit(bool autoCommit){
+ if(autoCommit)
+ SQLSetConnectAttr(connection,SQL_ATTR_AUTOCOMMIT,reinterpret_cast<SQLPOINTER>(SQL_AUTOCOMMIT_ON), SQL_IS_INTEGER );
+ else
+ SQLSetConnectAttr(connection,SQL_ATTR_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF, SQL_IS_INTEGER );
+}
+
+StatementPtr Connection::createStatement(void) {
+ SQLHSTMT statementHandle;
+ SQLRETURN result = SQLAllocHandle(SQL_HANDLE_STMT, connection, &statementHandle);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+ throw SQLException(result, "Error to alloc the statement handle - SQLSTMT");
+ }
+
+ std::list<StatementPtr*>::iterator it;
+
+ for (it = statements.begin() ; it != statements.end() ; ) {
+
+ if (**it) {
+ it++;
+
+ } else {
+ std::list<StatementPtr*>::iterator aux = it;
+ it++;
+ statements.erase(aux);
+
+ }
+
+ }
+
+ Statement* stmt = new Statement(*this, statementHandle);
+ StatementPtr ret(stmt);
+ statements.push_back(new StatementPtr(stmt, false));
+
+ return ret;
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/CreatedDataObject.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/CreatedDataObject.cpp
new file mode 100644
index 0000000000..de24d356d4
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/CreatedDataObject.cpp
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/CreatedDataObject.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+CreatedDataObject::CreatedDataObject(const Table& table, commonj::sdo::DataObjectPtr dataObject,
+ commonj::sdo::ChangeSummaryPtr changeSummary)
+ : DASDataObject(table, dataObject, changeSummary) {
+
+
+ commonj::sdo::PropertyList properties = dataObject->getInstanceProperties();
+ statement.append("insert into ").append(table.getTableName()).append("(");
+ bool containsDataType = false;
+ std::string columns;
+ std::string values;
+
+ for (unsigned int i = 0 ; i < properties.size() ; i++) {
+
+ if (properties[i].getType().isDataType()) {
+
+ if (containsDataType) {
+ columns.append(",");
+ values.append(",");
+
+ }
+
+ containsDataType = true;
+ const Column* column = table.getColumnByProperty(properties[i].getName());
+ ColumnData columnData(*column, dataObject);
+
+ columns.append(column->getName());
+ values.append(columnData.toSQL());
+
+ }
+
+ }
+
+ statement.append(columns).append(") values(").append(values).append(");");
+
+}
+
+CreatedDataObject::~CreatedDataObject(void) {}
+
+std::string CreatedDataObject::getStatement(void) const {
+ return statement;
+}
+
+//void CreatedDataObject::execute(StatementPtr stmt) const {
+// DASDataObject::execute(stmt);
+//
+// std::string statement;
+// statement = statement.append("insert into ").append(getDataObject()->getType().getName()).append("(");
+//
+// stmt->executeQuery(statement);
+//
+//
+//}
+//
+//void CreatedDataObject::execute(StatementPtr stmt) const {
+//
+// for (std::list<RelationshipStatement*>::const_iterator it = dependencies.begin() ;
+// it != dependencies.end() ; it++) {
+//
+// (*it)->execute(stmt);
+//
+// }
+//
+// std::cout << statement << std::endl;
+//
+// if (statement != "") {
+// stmt->executeQuery(statement);
+// }
+//
+//}
+
+void CreatedDataObject::printStmt(void) {
+ /*DASDataObject::printStmt();
+
+ std::string statement;
+ statement = statement.append("insert into ").append(getDataObject()->getType().getName()).append("(").append(columns).append(") values(").append(values).append(");");
+
+ std::cout << statement << std::endl;*/
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASColumnNotFoundException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASColumnNotFoundException.cpp
new file mode 100644
index 0000000000..be40dd89f0
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASColumnNotFoundException.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/rdb/DASColumnNotFoundException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASColumnNotFoundException::DASColumnNotFoundException(std::string message) : std::exception(message.c_str()) {}
+
+DASColumnNotFoundException::~DASColumnNotFoundException(void) {}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASDataObject.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASDataObject.cpp
new file mode 100644
index 0000000000..f04d9dd7a5
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASDataObject.cpp
@@ -0,0 +1,259 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/ModifiedDataObject.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASDataObject::DASDataObject(const Table& table, commonj::sdo::DataObjectPtr dataObject,
+ commonj::sdo::ChangeSummaryPtr changeSummary) : PKObject(table) {
+
+ commonj::sdo::SettingList* settingList = 0;
+ this->changeSummary = changeSummary;
+ occChecked = false;
+ this->dataObject = dataObject;
+ bool modifiedOnGraph = changeSummary->isDeleted(dataObject) || changeSummary->isModified(dataObject);
+
+ if (modifiedOnGraph) {
+ settingList = &changeSummary->getOldValues(dataObject);
+ }
+
+ std::map<std::string, const commonj::sdo::Setting*> settingMap;
+ const std::map<std::string, const Column*> columns = table.getColumns();
+ std::string statement;
+ unsigned int pkColumnCount = table.getPKColumnCount();
+ unsigned int pkCount = 0;
+
+ if (modifiedOnGraph) {
+
+ for (int i = 0 ; i < settingList->size() ; i++) {
+ settingMap.insert(std::make_pair((*settingList)[i].getProperty().getName(), &(*settingList)[i]));
+ }
+
+ }
+
+ for (std::map<std::string, const Column*>::const_iterator columnsIterator = columns.begin() ;
+ columnsIterator != columns.end() && pkColumnCount > pkCount ; columnsIterator++) {
+ const Column& column = *columnsIterator->second;
+
+ if (column.isPK()) {
+
+ if (modifiedOnGraph) {
+
+ std::map<std::string, const commonj::sdo::Setting*>::const_iterator settingIterator =
+ settingMap.find(column.getPropertyName());
+
+ if (settingIterator != settingMap.end()) {
+
+ if (settingIterator->second->isNull() || !settingIterator->second->isSet()) {
+ //throw exception
+ }
+
+ ColumnData* oldPKData = new ColumnData(column, *settingIterator->second);
+ addPrimaryKey(column.getPropertyName(),
+ *(oldPKData));
+
+ continue;
+
+ }
+
+ }
+
+ if (dataObject->isNull(column.getPropertyName()) || !dataObject->isSet(column.getPropertyName())) {
+ //throw exception
+ }
+
+ addPrimaryKey(column.getPropertyName(), *(new ColumnData(column, dataObject)));
+
+ }
+
+ }
+
+}
+
+bool DASDataObject::isOCCChecked(void) const {
+ return occChecked;
+}
+
+void DASDataObject::setOCCChecked(bool occChecked) {
+ this->occChecked = occChecked;
+}
+
+long DASDataObject::getOldOCC(void) const {
+ const Column* occCol = getTable().getOCCColumn();
+
+ if (occCol != 0) {
+
+ try {
+ const commonj::sdo::Setting& setting = changeSummary->getOldValue(dataObject, *dataObject->getInstanceProperty(occCol->getPropertyName()));
+
+ if (!setting.isNull() && setting.isSet()) {
+ return setting.getIntValue();
+ }
+
+ } catch (commonj::sdo::SDOIndexOutOfRangeException&) {
+ return getNewOCC();
+ }
+
+ }
+
+ return 0;
+
+}
+
+long DASDataObject::getNewOCC(void) const {
+ const Column* occCol = getTable().getOCCColumn();
+
+ if (occCol != 0) {
+
+ if (dataObject->isSet(occCol->getPropertyName()) && !dataObject->isNull(occCol->getPropertyName())) {
+ return dataObject->getInt(occCol->getName());
+ }
+
+ }
+
+ return 0;
+
+}
+
+void DASDataObject::printStmt() {
+ std::cout << "[" << getTable().getTableName() << "]" << std::endl;
+
+ for (std::list<std::string>::iterator it = updateStatements.begin() ; it != updateStatements.end() ; it++) {
+ std::cout << *it << std::endl;
+ }
+
+ std::cout << std::endl;
+
+}
+
+DASDataObject::~DASDataObject(void) {
+
+ for (std::map<std::string, RelationshipStatement*>::iterator it = fks.begin() ; it != fks.end() ; it++) {
+ delete it->second;
+ }
+
+}
+
+const commonj::sdo::DataObjectPtr DASDataObject::getDataObject(void) const {
+ return dataObject;
+}
+
+std::string DASDataObject::getWhereStmt(void) const {
+ std::string stmt = "where ";
+ const KeyDataList& pks = getPrimaryKeys();
+ unsigned int i = 1;
+
+ for (KeyDataList::const_iterator it = pks.begin() ; it != pks.end() ; it++) {
+ stmt.append(getTable().getTableName() + "." + it->second->getColumn().getName()).append("=").append(/*"2"*/it->second->toSQL());
+
+ if (i != pks.size()) {
+ stmt.append(" and ");
+ }
+
+ i++;
+
+ }
+
+ if (!isOCCChecked()) {
+ const Column* occCol = getTable().getOCCColumn();
+
+ if (occCol != 0) {
+ stmt.append(" and ").append(occCol->getName()).append("=").append(StringWrapper::toString(getOldOCC()));
+ }
+
+ }
+
+ return stmt;
+
+}
+
+std::string DASDataObject::getStatement(void) const {
+ return "";
+}
+
+RelationshipStatement& DASDataObject::addFK(const Relationship& relationship, const KeyDataList* keyDataList) {
+ std::map<std::string, RelationshipStatement*>::iterator it = fks.find(relationship.getName());
+ RelationshipStatement* relatStmt;
+
+ if (it == fks.end()) {
+ relatStmt = new RelationshipStatement(relationship, keyDataList);
+ relatStmt->setDASDataObject(*this);
+ fks.insert(std::make_pair(relationship.getName(), relatStmt));
+
+ } else if (keyDataList != 0) {
+ relatStmt = it->second;
+ relatStmt->setFKList(keyDataList);
+
+ }
+
+ return *relatStmt;
+
+}
+
+void DASDataObject::execute(StatementPtr stmt) {
+ std::string statement = getStatement();
+
+ if (statement != "") {
+ const Column* occColumn = getTable().getOCCColumn();
+ bool noData = false;
+ ResultSetPtr rs;
+
+ try {
+ rs = stmt->executeQuery(statement);
+
+ } catch (SQLException& ex) {
+
+ if (ex.getODBCReturnCode() == SQL_NO_DATA) {
+ noData = true;
+ } else {
+ throw;
+ }
+
+ }
+
+ if (occColumn != 0 && !isOCCChecked()) {
+
+ if (noData || rs->getRowCount() == 0) {
+ throw DASOptimisticConcurrencyControlException();
+ } else {
+ setOCCChecked(true);
+ }
+
+ }
+
+ }
+
+ for (std::list<RelationshipStatement*>::const_iterator it = dependencies.begin() ;
+ it != dependencies.end() ; it++) {
+
+ (*it)->execute(stmt);
+
+ }
+
+}
+
+void DASDataObject::addDependency(RelationshipStatement& relationshipStatement) {
+ dependencies.push_back(&relationshipStatement);
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASFactoryImpl.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASFactoryImpl.cpp
new file mode 100644
index 0000000000..e28f5e6d3a
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASFactoryImpl.cpp
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/DASFactoryImpl.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASFactoryImpl::DASFactoryImpl(void) {}
+
+DASFactoryImpl::~DASFactoryImpl(void) {}
+
+DAS* DASFactoryImpl::createDAS(Connection& connection) {
+ return new DASImpl(connection);
+}
+
+DAS* DASFactoryImpl::createDAS(const Config& config, Connection& connection) {
+ return new DASImpl(config, connection);
+}
+
+DAS* DASFactoryImpl::createDAS(const Config& config) {
+ return new DASImpl(config);
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASImpl.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASImpl.cpp
new file mode 100644
index 0000000000..eab18ab980
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASImpl.cpp
@@ -0,0 +1,161 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/DASImpl.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASFactory* DASImpl::FACTORY = new DASFactoryImpl();
+
+DASImpl::DASImpl(Connection& inConnection) {
+ /*if (FACTORY == 0) {
+ FACTORY = new DASFactoryImpl();
+ }*/
+
+ createdCommands = new std::list<CommandPtr*>();
+ config = new ConfigImpl();
+ setConnection(&inConnection);
+
+}
+
+DASImpl::DASImpl(const Config& config, Connection& inConnection) {
+ /*if (FACTORY == 0) {
+ FACTORY = new DASFactoryImpl();
+ }*/
+
+ createdCommands = new std::list<CommandPtr*>();
+ this->config = new ConfigImpl(config);
+ setConnection(&inConnection);
+
+}
+
+DASImpl::DASImpl(const Config& config) {
+ /*if (FACTORY == 0) {
+ FACTORY = new DASFactoryImpl();
+ }*/
+
+ createdCommands = new std::list<CommandPtr*>();
+ this->config = new ConfigImpl((ConfigImpl&) config);
+
+}
+
+DASImpl::~DASImpl() {
+ std::list<CommandPtr*>::iterator it;
+
+ for (it = createdCommands->begin() ; it != createdCommands->end() ; it++) {
+ delete **it;
+ delete *it;
+
+ }
+
+ delete createdCommands;
+ delete config;
+
+}
+
+DASFactory& DASImpl::getFACTORY(void) {
+ return *FACTORY;
+}
+
+void DASImpl::setConnection(Connection* aConnection) {
+ connection = aConnection;
+}
+
+Connection* DASImpl::getConnection(void) {
+ return connection;
+}
+
+void DASImpl::releaseResources(void) {
+ closeConnection();
+}
+
+CommandPtr DASImpl::getCommand(std::string commandName) {
+ std::string commandSQL = config->getCommand(commandName);
+
+ return createCommand(commandSQL);
+
+}
+
+CommandPtr DASImpl::createCommand(std::string sql) {
+ CommandPtr command = 0;
+ //trim(inSql);
+ char firstChar = toupper(sql[0]);
+
+ switch (firstChar) {
+ case 'S':
+ command = new ReadCommandImpl(*this, sql);
+ break;
+
+ default :
+ command = new CommandImpl(*this, sql);
+
+ }
+
+ std::list<CommandPtr*>::iterator it;
+
+ for (it = createdCommands->begin() ; it != createdCommands->end() ; ) {
+
+ if (**it) {
+ it++;
+
+ } else {
+ std::list<CommandPtr*>::iterator aux = it;
+ it++;
+ createdCommands->erase(aux);
+
+ }
+
+ }
+
+ createdCommands->push_back(new CommandPtr(command, false));
+ return command;
+
+}
+
+void DASImpl::closeConnection(void) {
+
+ if (connection != 0) {
+
+ //try {
+ delete connection;
+ connection = 0;
+ //} catch (SQLException e) {
+ // throw new RuntimeException(e);
+ //}
+
+ }
+
+}
+
+const ::apache::das::Config& DASImpl::getConfig(void) const {
+ return *((Config*) config);
+}
+
+void DASImpl::applyChanges(commonj::sdo::DataObjectPtr root) {
+ ApplyChanges(*this, root);
+ commonj::sdo::ChangeSummaryPtr csummary = root->getChangeSummary();
+ csummary->endLogging();
+ csummary->beginLogging();
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidColumnNameException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidColumnNameException.cpp
new file mode 100644
index 0000000000..a199a7f0d5
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidColumnNameException.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/rdb/DASInvalidColumnNameException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASInvalidColumnNameException::DASInvalidColumnNameException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidColumnNameException::~DASInvalidColumnNameException(void) {}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidRelationshipNameException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidRelationshipNameException.cpp
new file mode 100644
index 0000000000..9db5b4665a
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidRelationshipNameException.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/rdb/DASInvalidRelationshipNameException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASInvalidRelationshipNameException::DASInvalidRelationshipNameException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidRelationshipNameException::~DASInvalidRelationshipNameException(void) {}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidSDOTypeException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidSDOTypeException.cpp
new file mode 100644
index 0000000000..e924dd9cdf
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidSDOTypeException.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/rdb/DASInvalidSDOTypeException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASInvalidSDOTypeException::DASInvalidSDOTypeException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidSDOTypeException::~DASInvalidSDOTypeException(void) {}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidSQLTypeException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidSQLTypeException.cpp
new file mode 100644
index 0000000000..d7b16547df
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidSQLTypeException.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/rdb/DASInvalidSQLTypeException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASInvalidSQLTypeException::DASInvalidSQLTypeException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidSQLTypeException::~DASInvalidSQLTypeException(void) {}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidTableNameException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidTableNameException.cpp
new file mode 100644
index 0000000000..5f578d2130
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASInvalidTableNameException.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/rdb/DASInvalidTableNameException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ DASInvalidTableNameException::DASInvalidTableNameException(std::string message) : std::exception(message.c_str()) {}
+
+DASInvalidTableNameException::~DASInvalidTableNameException(void) {}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASOptimisticConcurrencyControlException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASOptimisticConcurrencyControlException.cpp
new file mode 100644
index 0000000000..983a1b0def
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASOptimisticConcurrencyControlException.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/rdb/DASOptimisticConcurrencyControlException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASOptimisticConcurrencyControlException::DASOptimisticConcurrencyControlException(std::string message) : std::exception(message.c_str()) {}
+
+DASOptimisticConcurrencyControlException::~DASOptimisticConcurrencyControlException(void) {}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASPrimaryKeyNotFoundException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASPrimaryKeyNotFoundException.cpp
new file mode 100644
index 0000000000..15464c742a
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DASPrimaryKeyNotFoundException.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+#include "apache/das/rdb/DASPrimaryKeyNotFoundException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DASPrimaryKeyNotFoundException::DASPrimaryKeyNotFoundException(std::string message) : std::exception(message.c_str()) {}
+
+DASPrimaryKeyNotFoundException::~DASPrimaryKeyNotFoundException(void) {}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/DeteledDataObject.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DeteledDataObject.cpp
new file mode 100644
index 0000000000..f39d4136bb
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/DeteledDataObject.cpp
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/DeletedDataObject.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+DeletedDataObject::DeletedDataObject(const Table& table, commonj::sdo::DataObjectPtr dataObject,
+ commonj::sdo::ChangeSummaryPtr changeSummary)
+ : DASDataObject(table, dataObject, changeSummary) {}
+
+DeletedDataObject::~DeletedDataObject(void) {}
+
+std::string DeletedDataObject::getStatement(void) const {
+ std::string ret = "delete from ";
+ ret.append(getTable().getTableName()).append(" ").append(getWhereStmt()).append(";");
+
+ return ret;
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/GraphBuilder.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/GraphBuilder.cpp
new file mode 100644
index 0000000000..7676df0291
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/GraphBuilder.cpp
@@ -0,0 +1,213 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/GraphBuilder.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+GraphBuilder::GraphBuilder(const ConfigImpl& config, ResultSetPtr resultSet) {
+ graphBuilderMetaData = new GraphBuilderMetaData(config, resultSet->getResultSetMetaData()) ;
+ commonj::sdo::DataFactoryPtr dataFactory = graphBuilderMetaData->createGraph();
+
+ this->resultSet = resultSet;
+ const std::map<std::string, Table*>& tables = graphBuilderMetaData->getTables();
+
+ while (resultSet->next()) {
+
+ std::map<std::string, Table*>::const_iterator it;
+ for (it = tables.begin() ; it != tables.end() ; it++) {
+ Table* table = it->second;
+
+ std::list<TableData*>* tableList;
+ TableData* tableData = new TableData(*table, resultSet);
+
+ if (!tableData->hasPK()) {
+ delete tableData;
+ continue;
+
+ }
+
+ std::map<std::string, std::list<TableData*>*>::iterator it2 =
+ tablesData.find(table->getTableName());
+
+ if (it2 == tablesData.end()) {
+ tableList = new std::list<TableData*>();
+ tablesData.insert(std::make_pair(table->getTableName(), tableList));
+
+ } else {
+ tableList = it2->second;
+ }
+
+ std::list<TableData*>::const_iterator it3;
+ bool duplicated = false;
+
+ for (it3 = tableList->begin() ; it3 != tableList->end() ; it3++) {
+
+ if (*tableData == **it3) {
+ delete tableData;
+ duplicated = true;
+ break;
+
+ }
+
+ }
+
+ if (!duplicated) {
+ tableList->push_back(tableData);
+ }
+
+ }
+
+ }
+
+ int a = resultSet->getRowCount();
+
+ root = dataFactory->create(config.getURI(), DAS_ROOT_NAME);
+ std::map<std::string, std::list<TableData*>*>::iterator it;
+
+ if (tablesData.size() > 0) {
+
+ for (it = tablesData.begin() ; it != tablesData.end() ; it++) {
+ std::list<TableData*>& tableList = *it->second;
+ std::list<TableData*>::iterator it2;
+
+ for (it2 = tableList.begin() ; it2 != tableList.end() ; it2++) {
+ (*it2)->populateDataGraph(*this);
+ }
+
+ }
+
+ std::map<std::string, Table*>::const_iterator it2;
+ std::map<std::string, Relationship*>& relationships = graphBuilderMetaData->getRelationships();
+ std::map<std::string, std::map<const KeyDataList*, TableData*, KeyDataCmp>*> tablesDataByPK;
+ std::map<std::string, std::list<TableData*>*>::iterator it3;
+ for (it3 = tablesData.begin() ; it3 != tablesData.end() ; it3++) {
+ std::map<const KeyDataList*, TableData*, KeyDataCmp>* tableList = new std::map<const KeyDataList*, TableData*, KeyDataCmp>();
+ std::list<TableData*>::iterator it4;
+
+ for (it4 = it3->second->begin() ; it4 != it3->second->end() ; it4++) {
+ TableData* tableData = *it4;
+ tableList->insert(std::make_pair(&tableData->getPrimaryKeys(), tableData));
+
+ }
+
+ tablesDataByPK.insert(std::make_pair(it3->first, tableList));
+
+ }
+
+ for (it2 = tables.begin() ; it2 != tables.end() ; it2++) {
+ RelationshipWrapper relationshipWrapper;
+ std::list<Relationship*>& fkTableRelationships = relationshipWrapper.getRelationshipsByTableName(relationships, it2->first, false);
+
+ std::list<Relationship*>::iterator relationshipIterator;
+ for (relationshipIterator = fkTableRelationships.begin() ;
+ relationshipIterator != fkTableRelationships.end() ; relationshipIterator++) {
+
+ std::list<TableData*>& fkTablesList =
+ *((std::map<std::string, std::list<TableData*>*>::iterator) tablesData.find(
+ (*relationshipIterator)->getFKTableName()))->second;
+
+ std::map<const KeyDataList*, TableData*, KeyDataCmp>& pkTablesData =
+ *((std::map<std::string, std::map<const KeyDataList*, TableData*, KeyDataCmp>*>::iterator)
+ tablesDataByPK.find((*relationshipIterator)->getPKTableName()))->second;
+
+ std::list<TableData*>::iterator tableDataIterator;
+ for (tableDataIterator = fkTablesList.begin() ; tableDataIterator !=
+ fkTablesList.end() ; tableDataIterator++) {
+
+ TableData& fkTableData = **tableDataIterator;
+ const std::map<std::string, const KeyPair*>& keyPairs = (*relationshipIterator)->getKeyPairs();
+ std::map<std::string, const KeyPair*>::const_iterator keyPairIterator;
+ KeyDataList fksColumnList;
+
+ for (keyPairIterator = keyPairs.begin() ; keyPairIterator != keyPairs.end() ;
+ keyPairIterator++) {
+
+ const KeyPair& keyPair = *keyPairIterator->second;
+ ColumnData* columnData = fkTableData.
+ getColumnData(keyPair.getFKColumnName());
+
+ fksColumnList.insert(std::make_pair(keyPair.getPKColumnName(),
+ columnData));
+
+ }
+
+ std::map<const KeyDataList*, TableData*, KeyDataCmp>::iterator pkTablaDataIterator =
+ pkTablesData.find(&fksColumnList);
+
+ if (pkTablaDataIterator != pkTablesData.end()) {
+ TableData& pkTableData = *pkTablaDataIterator->second;
+
+ if ((*relationshipIterator)->isMany()) {
+ pkTableData.getGraphObject()->getList((*relationshipIterator)->getName().c_str()).
+ append(fkTableData.getGraphObject());
+
+ } else {
+ pkTableData.getGraphObject()->setDataObject((*relationshipIterator)->getName().c_str(),
+ fkTableData.getGraphObject());
+
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ std::map<std::string, std::map<const KeyDataList*, TableData*, KeyDataCmp>*>::iterator tablesDataByPKIterator;
+ for (tablesDataByPKIterator = tablesDataByPK.begin() ; tablesDataByPKIterator !=
+ tablesDataByPK.end() ; tablesDataByPKIterator++) {
+
+ delete tablesDataByPKIterator->second;
+
+ }
+
+ }
+
+}
+
+GraphBuilder::~GraphBuilder(void) {
+ std::map<std::string, std::list<TableData*>*>::iterator it;
+ std::list<TableData*>::iterator it2;
+
+ for (it = tablesData.begin() ; it != tablesData.end() ; it++) {
+ std::list<TableData*>* tableList = it->second;
+
+ for (it2 = tableList->begin() ; it2 != tableList->end() ; it2++) {
+ delete *it2;
+ }
+
+ delete tableList;
+
+ }
+
+ delete graphBuilderMetaData;
+
+}
+
+commonj::sdo::DataObjectPtr GraphBuilder::getRoot(void) const {
+ return root;
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp
new file mode 100644
index 0000000000..81d3962998
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/GraphBuilderMetaData.cpp
@@ -0,0 +1,302 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/GraphBuilderMetaData.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+GraphBuilderMetaData::GraphBuilderMetaData(const ConfigImpl& config, const ResultSetMetaData& resultSetMetaData) {
+ this->resultSetMetaData = &resultSetMetaData;
+ this->config = &config;
+ graphTables = new std::map<std::string, Table*>();
+ const std::map<std::string, Relationship*>& configRelationships = config.getRelationships();
+ relationships = new std::map<std::string, Relationship*>();
+ std::map<std::string, Relationship*>::const_iterator relationshipIterator;
+
+ unsigned int colCount = resultSetMetaData.getColumnCount();
+ std::map<std::string, std::list<Column*>*> tablesColumns;
+
+ for (unsigned int i = 0 ; i < colCount ; i++) {
+ std::string columnName = resultSetMetaData.getColumnName(i);
+ SQLSMALLINT columnSQLType = resultSetMetaData.getSQLType(i);
+ std::string columnTableName = resultSetMetaData.getTableName(i);
+ std::map<std::string, Table*>::iterator tableIterator = graphTables->
+ find(columnTableName);
+
+ Table* table = 0;
+ const Table* configTable = config.getTable(columnTableName);
+
+ if (tableIterator == graphTables->end()) {
+ table = new Table(columnTableName);
+
+ if (configTable != 0) {
+ table->setTypeName(configTable->getTypeName());
+ }
+
+ graphTables->insert(std::make_pair(table->getTableName(), table));
+
+ } else {
+ table = tableIterator->second;
+ }
+
+ if (configTable == 0) {
+ table->addColumn(columnName, columnSQLType);
+ } else {
+ Column* column = (Column*) configTable->getColumn(columnName);
+
+ if (column != 0) {
+ table->addColumn(Column(*column));
+ } else {
+ table->addColumn(columnName, columnSQLType);
+ }
+
+ }
+
+ }
+
+ std::map<std::string, Table*>::iterator tableIterator;
+ for (tableIterator = graphTables->begin() ; tableIterator != graphTables->end() ;
+ tableIterator++) {
+
+ Table& table = *tableIterator->second;
+ const Table* configTable = config.getTable(table.getTableName());
+ bool hasPK = false;
+
+ if (configTable != 0 && configTable->getPKColumnCount() ==
+ table.getPKColumnCount() && configTable->getPKColumnCount() != 0) {
+ hasPK = true;
+
+ }
+
+ const std::map<std::string, const Column*>& tableColumns = table.getColumns();
+ std::map<std::string, const Column*>::const_iterator columnIterator;
+
+ if (!hasPK) {
+ Column* column = table.getColumn("ID");
+
+ if (column != 0) {
+ column->setPK(true);
+ hasPK = true;
+
+ }
+
+
+ }
+
+ if (!hasPK) {
+
+ if (configTable == 0 || configTable->getColumns().size() == 0) {
+
+ for (columnIterator = tableColumns.begin() ;
+ columnIterator != tableColumns.end() ; columnIterator++) {
+ ((Column*) columnIterator->second)->setPK(true);
+ }
+
+ }
+
+ }
+
+ }
+
+ for (relationshipIterator = configRelationships.begin() ;
+ relationshipIterator != configRelationships.end() ; relationshipIterator++) {
+
+ Relationship& relationship = *relationshipIterator->second;
+ bool contains = true;
+ const std::map<std::string, const KeyPair*>& keyPairs = relationship.getKeyPairs();
+ std::map<std::string, const KeyPair*>::const_iterator keyPairIterator;
+ std::map<std::string, Table*>::iterator pkTableIterator =
+ graphTables->find(relationship.getPKTableName());
+
+ std::map<std::string, Table*>::iterator fkTableIterator =
+ graphTables->find(relationship.getFKTableName());
+
+ if (pkTableIterator == graphTables->end() ||
+ fkTableIterator == graphTables->end()) {
+ continue;
+ }
+
+ Table& pkTable = *pkTableIterator->second;
+ Table& fkTable = *fkTableIterator->second;
+
+ for (keyPairIterator = keyPairs.begin() ; keyPairIterator != keyPairs.end() ;
+ keyPairIterator++) {
+
+ const KeyPair& keyPair = *keyPairIterator->second;
+ Column* pkColumn = pkTable.getColumn(keyPair.getPKColumnName());
+ Column* fkColumn = fkTable.getColumn(keyPair.getFKColumnName());
+
+ if (fkColumn == 0 || pkColumn == 0 || !pkColumn->isPK() ||
+ fkColumn->getSQLType() != pkColumn->getSQLType()) {
+
+ contains = false;
+ break;
+
+ }
+
+ }
+
+ if (contains) {
+ relationships->insert(std::make_pair(
+ relationship.getPKTableName() + "." + relationship.getFKTableName(),
+ new Relationship(relationship)));
+
+ }
+
+ }
+
+ for (tableIterator = graphTables->begin() ; tableIterator != graphTables->end() ;
+ tableIterator++) {
+
+ Table& table = *tableIterator->second;
+ const std::map<std::string, const Column*>& tableColumns = table.getColumns();
+ std::map<std::string, const Column*>::const_iterator columnIterator;
+
+ for (columnIterator = tableColumns.begin() ;
+ columnIterator != tableColumns.end() ; columnIterator++) {
+
+ std::string columnName = columnIterator->second->getName();
+
+ if (columnName.size() > 3 &&
+ columnName.substr(columnName.size() - 3, 3) == "_ID") {
+
+ std::string pkTableName = columnName.substr(0, columnName.size() - 3);
+ std::string pkXfk = pkTableName + "." + table.getTableName();
+
+ std::map<std::string, Table*>::iterator pkTableIterator =
+ graphTables->find(pkTableName);
+
+ if (pkTableIterator == graphTables->end()) {
+ continue;
+ }
+
+ Column* pkColumn = pkTableIterator->second->getColumn("ID");
+ if (pkColumn == 0 ||
+ columnIterator->second->getSQLType() != pkColumn->getSQLType()) {
+ continue;
+ }
+
+ std::map<std::string, Relationship*>::iterator relationshipIterator =
+ relationships->find(pkXfk);
+
+ if (relationshipIterator == relationships->end() &&
+ pkColumn->isPK()) {
+
+ if (pkTableIterator->second->getPKColumnCount() == 1) {
+ Relationship* relationship =
+ new Relationship(pkTableName, table.getTableName());
+
+ relationship->addKeyPair("ID", columnName);
+ relationships->insert(std::make_pair(relationship->getName(), relationship));
+
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+}
+
+GraphBuilderMetaData::~GraphBuilderMetaData(void) {
+ std::map<std::string, Table*>::iterator itTables;
+ std::map<std::string, Relationship*>::iterator itRelationships;
+
+ for (itTables = graphTables->begin() ; itTables != graphTables->end() ; itTables++) {
+ delete itTables->second;
+ }
+
+ for (itRelationships = relationships->begin() ; itRelationships != relationships->end() ; itRelationships++) {
+ delete itRelationships->second;
+ }
+
+ delete graphTables;
+ delete relationships;
+
+}
+
+commonj::sdo::DataFactoryPtr GraphBuilderMetaData::createGraph(void) const {
+ commonj::sdo::DataFactoryPtr dataFactory = commonj::sdo::DataFactory::getDataFactory();
+ dataFactory->addType(config->getURI(), DAS_ROOT_NAME);
+ dataFactory->addPropertyToType(config->getURI(), DAS_ROOT_NAME, "ChangeSummary", SDO_NAMESPACE, "ChangeSummary", false, false, true);
+
+ std::map<std::string, Table*>::const_iterator it;
+ std::map<std::string, Relationship*>::const_iterator it2;
+
+ for (it = graphTables->begin() ; it != graphTables->end() ; it++) {
+ Table& table = *(it->second);
+ std::string tableName = table.getTypeName();
+
+ dataFactory->addType(config->getURI(), tableName.c_str());
+ dataFactory->addPropertyToType(config->getURI(), DAS_ROOT_NAME,
+ tableName.c_str(), config->getURI(), tableName.c_str(), true, false, true);
+
+ }
+
+ for (it = graphTables->begin() ; it != graphTables->end() ; it++) {
+ it->second->createGraph(*this, dataFactory);
+ }
+
+ for (it2 = relationships->begin() ; it2 != relationships->end() ; it2++) {
+ const Relationship& relationship = *it2->second;
+
+ dataFactory->addPropertyToType(config->getURI(), relationship.getPKTableName().c_str(),
+ relationship.getName().c_str(), config->getURI(),
+ relationship.getFKTableName().c_str(), relationship.isMany(), false, false);
+
+ }
+
+ return dataFactory;
+
+}
+
+const ResultSetMetaData& GraphBuilderMetaData::getResultSetMetaData(void) const {
+ return *resultSetMetaData;
+}
+
+const ConfigImpl& GraphBuilderMetaData::getConfig(void) const {
+ return *config;
+}
+
+std::map<std::string, Table*>& GraphBuilderMetaData::getTables(void) const {
+ return *graphTables;
+}
+
+Table* GraphBuilderMetaData::getTable(std::string tableName) const {
+ std::map<std::string, Table*>::iterator it = graphTables->find(tableName);
+
+ if (it == graphTables->end()) {
+ return 0;
+ }
+
+ return it->second;
+
+}
+
+std::map<std::string, Relationship*>& GraphBuilderMetaData::getRelationships(void) const {
+ return *relationships;
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/KeyPair.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/KeyPair.cpp
new file mode 100644
index 0000000000..30a895a82f
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/KeyPair.cpp
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/KeyPair.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+KeyPair::KeyPair(const KeyPair& keyPair) {
+ pkColumnName = keyPair.pkColumnName;
+ fkColumnName = keyPair.fkColumnName;
+ relationship = keyPair.relationship;
+
+}
+
+KeyPair::KeyPair(std::string pkColumnName, std::string fkColumnName) {
+ StringWrapper pkColumnNameWrapper(pkColumnName);
+ pkColumnName = pkColumnNameWrapper.toUpper();
+ StringWrapper fkColumnNameWrapper(fkColumnName);
+ fkColumnName = fkColumnNameWrapper.toUpper();
+
+ if (!pkColumnNameWrapper.isValidRDBName()) {
+ throw DASInvalidColumnNameException("PK column name must not contain whitespace characters!");
+ }
+
+ if (!fkColumnNameWrapper.isValidRDBName()) {
+ throw DASInvalidColumnNameException("FK column name must not contain whitespace characters!");
+ }
+
+ this->pkColumnName = pkColumnName;
+ this->fkColumnName = fkColumnName;
+ relationship = 0;
+
+}
+
+KeyPair::~KeyPair(void) {}
+
+std::string KeyPair::getPKColumnName(void) const {
+ return pkColumnName;
+}
+
+std::string KeyPair::getFKColumnName(void) const {
+ return fkColumnName;
+}
+
+void KeyPair::setRelationship(Relationship* relationship) {
+ this->relationship = relationship;
+}
+
+Relationship* KeyPair::getRelationship(void) const {
+ return relationship;
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/ModifiedDataObject.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ModifiedDataObject.cpp
new file mode 100644
index 0000000000..560684a25b
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ModifiedDataObject.cpp
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/ModifiedDataObject.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ModifiedDataObject::ModifiedDataObject(const Table& table, commonj::sdo::DataObjectPtr dataObject,
+ commonj::sdo::ChangeSummaryPtr changeSummary) : DASDataObject(table, dataObject, changeSummary) {
+
+ bool modifiedOnGraph = changeSummary->isCreated(dataObject) || changeSummary->isDeleted(dataObject) || changeSummary->isModified(dataObject);
+ const KeyDataList& columnDataList = getPrimaryKeys();
+ unsigned int pkCount = 0;
+ unsigned int pkColumnCount = columnDataList.size();
+ bool dataTypeModified = false;
+ //pkModified = false;
+
+ if (modifiedOnGraph) {
+ sets.append("update ").append(table.getTableName()).append(" set");
+ commonj::sdo::SettingList& settings = changeSummary->getOldValues(dataObject);
+ /*const KeyDataList& keyDataList = getPrimaryKeys();
+
+ for (KeyDataList::const_iterator pkIt = keyDataList.begin() ; pkIt != keyDataList.end() ; pkIt++) {
+ ColumnData actualColumnData(pkIt->second->getColumn(), dataObject);
+
+ if (actualColumnData != *pkIt->second) {
+ pkModified = true;
+ break;
+
+ }
+
+ }*/
+
+ for (int i = 0 ; i < settings.size() ; i++) {
+
+ if (settings[i].getType().isDataType()) {
+
+ if (dataTypeModified) {
+ sets.append(",");
+ }
+
+ std::string propName = settings[i].getProperty().getName();
+ const Column* column = table.getColumnByProperty(propName);
+
+ if (!column->isCollision() || !column->isManaged()) {
+ dataTypeModified = true;
+ sets.append(" ").append(column->getName()).append("=").append(ColumnData(*column, dataObject).toSQL());
+
+ }
+
+ }
+
+ }
+
+ if (!dataTypeModified) {
+ sets = "";
+ }
+
+ }
+
+}
+
+ModifiedDataObject::~ModifiedDataObject(void) {}
+
+std::string ModifiedDataObject::getStatement(void) const {
+
+ if (sets != "") {
+ std::string ret = sets;
+ const Column* occCol = getTable().getOCCColumn();
+
+ if (occCol != 0 && !isOCCChecked() && occCol->isManaged()) {
+ ret.append(",").append(occCol->getName()).append("=").append(StringWrapper::toString(getNewOCC() + 1));
+ }
+
+ ret.append(" ").append(getWhereStmt()).append(";");
+
+ return ret;
+
+ } else {
+ return "";
+ }
+
+}
+
+//bool ModifiedDataObject::isPKModified(void) const {
+// return pkModified;
+//}
+
+
+//
+//void ModifiedDataObject::printStmt() {
+// DASDataObject::printStmt();
+//
+// if (sets.size() != 0 || fks.size() != 0) {
+// std::string statement;
+// statement.append("update ").append(getTable().getTableName()).append(" set").append(sets);
+//
+// for (std::map<std::string, const ColumnData*>::const_iterator it = fks.begin() ; it != fks.end() ; it++) {
+//
+// statement.append(" ").append(it->first).append("=");
+//
+// if (it->second == 0) {
+// statement.append(SQL_NULL_VALUE);
+// } else {
+// statement.append(it->second->toSQL());
+// }
+//
+// }
+//
+// statement.append(" ").append(whereStmt).append(";");
+//
+// std::cout << statement << std::endl;
+//
+// }
+//
+//}
+
+
+
+
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/ODBCTypeHelper.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ODBCTypeHelper.cpp
new file mode 100644
index 0000000000..aad3c49ad5
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ODBCTypeHelper.cpp
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/ODBCTypeHelper.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+const std::string ODBCTypeHelper::getSDOType(SQLSMALLINT sqlType) {
+
+ switch (sqlType) {
+
+ case SQL_CHAR :
+ case SQL_WCHAR :
+ return "Character";
+
+ case SQL_INTEGER :
+ case SQL_SMALLINT :
+ return "Int";
+
+ case SQL_REAL :
+ return "Float";
+
+ case SQL_FLOAT :
+ case SQL_DOUBLE :
+ return "Double";
+
+ case SQL_VARCHAR :
+ case SQL_WVARCHAR :
+ return "String";
+
+ default :
+ throw DASInvalidSQLTypeException("Invalid sql type: " + sqlType + (std::string) "");
+
+ }
+
+}
+
+const SQLSMALLINT ODBCTypeHelper::getSQLType(const commonj::sdo::Type& type) {
+ std::string typeName = type.getName();
+
+ if ("String" == typeName) {
+ return SQL_WVARCHAR;
+
+ } else if ("Double" == typeName) {
+ return SQL_DOUBLE;
+
+ } else if ("Float" == typeName) {
+ return SQL_REAL;
+
+ } else if ("Int" == typeName) {
+ return SQL_INTEGER;
+
+ } else if ("Character" == typeName) {
+ return SQL_WCHAR;
+
+ } else {
+ throw DASInvalidSDOTypeException((std::string) "Invalid sdo data type: " + type.getURI() + "." + type.getName() + "");
+ }
+
+}
+
+const SQLSMALLINT ODBCTypeHelper::getSQLType(std::string sqlTypeName) {
+ sqlTypeName = StringWrapper(sqlTypeName).toLower();
+
+ if ("varchar" == sqlTypeName) {
+ return SQL_VARCHAR;
+ } else if ("wvarchar" == sqlTypeName) {
+ return SQL_WVARCHAR;
+ } else if ("integer" == sqlTypeName) {
+ return SQL_INTEGER;
+ } else if ("float" == sqlTypeName) {
+ return SQL_FLOAT;
+ } else if ("real" == sqlTypeName) {
+ return SQL_REAL;
+ } else if ("double" == sqlTypeName) {
+ return SQL_DOUBLE;
+ } else if ("char" == sqlTypeName) {
+ return SQL_CHAR;
+ } else if ("wchar" == sqlTypeName) {
+ return SQL_WCHAR;
+ } else if ("smallint" == sqlTypeName) {
+ return SQL_SMALLINT;
+ } else {
+ throw DASInvalidSQLTypeException("sql type does not exist: " + sqlTypeName);
+ }
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/PKObject.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/PKObject.cpp
new file mode 100644
index 0000000000..84133b0980
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/PKObject.cpp
@@ -0,0 +1,168 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/PKObject.h"
+#include "apache/das/rdb/ColumnData.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+PKObject::PKObject(const Table& table) {
+ this->table = &table;
+ primaryKeys = new KeyDataList();
+
+}
+
+PKObject::~PKObject(void) {
+ KeyDataList::const_iterator it;
+
+ for (it = primaryKeys->begin() ; it != primaryKeys->end() ; it++) {
+ delete it->second;
+ }
+
+ delete primaryKeys;
+
+}
+
+void PKObject::addPrimaryKey(std::string columnName, ColumnData& columnData) {
+ primaryKeys->insert(std::make_pair(columnName, &columnData));
+}
+
+const Table& PKObject::getTable(void) const {
+ return *table;
+}
+
+bool PKObject::isPK(std::string columnName) const {
+ KeyDataList::const_iterator it = primaryKeys->find(columnName);
+
+ return it != primaryKeys->end();
+
+}
+
+bool PKObject::operator==(const KeyDataList* primaryKeyList) const {
+
+ if (primaryKeys->size() != primaryKeyList->size()) {
+ return false;
+ }
+
+ KeyDataList::const_iterator it, primaryKeyIterator;
+
+ for (it = primaryKeyList->begin() ; it != primaryKeyList->end() ; it++) {
+ primaryKeyIterator = primaryKeys->find(it->first);
+
+ if (primaryKeyIterator == primaryKeys->end()) {
+ return false;
+
+ } else if (*it->second != *primaryKeyIterator->second) {
+ return false;
+
+ }
+
+ }
+
+ return true;
+
+}
+
+bool PKObject::operator==(const PKObject& pkObject) const {
+ return (*this == pkObject.primaryKeys);
+}
+
+bool PKObject::operator!=(const PKObject& pkObject) const {
+ return !(*this == pkObject);
+}
+
+bool PKObject::operator!=(const KeyDataList* primaryKeyList) const {
+ return !(*this == primaryKeyList);
+}
+
+const KeyDataList& PKObject::getPrimaryKeys(void) const {
+ return *primaryKeys;
+}
+
+bool PKObject::operator<(const PKObject& pkObject) const {
+ return (*this < pkObject.primaryKeys);
+}
+
+bool PKObject::operator<(const KeyDataList* primaryKeyList) const {
+
+ if (primaryKeys->size() < primaryKeyList->size()) {
+ return true;
+ } else if (primaryKeys->size() > primaryKeyList->size()) {
+ return false;
+ }
+
+ KeyDataList::const_iterator it;
+
+ for (it = primaryKeyList->begin() ; it != primaryKeyList->end() ; it++) {
+ KeyDataList::const_iterator primaryKeyIterator =
+ primaryKeys->find(it->first);
+
+ if (primaryKeyIterator != primaryKeys->end()) {
+
+ if (*it->second < *primaryKeyIterator->second) {
+ return true;
+ } else if (*it->second > *primaryKeyIterator->second) {
+ return false;
+ }
+
+ }
+
+ }
+
+ return false;
+
+}
+
+bool KeyDataCmp::operator() ( const KeyDataList* keyDataList1, const KeyDataList* keyDataList2 ) const {
+ if (keyDataList1->size() < keyDataList2->size()) {
+ return true;
+ } else if (keyDataList1->size() > keyDataList2->size()) {
+ return false;
+ }
+
+ KeyDataList::const_iterator it;
+
+ for (it = keyDataList2->begin() ; it != keyDataList2->end() ; it++) {
+ KeyDataList::const_iterator primaryKeyIterator =
+ keyDataList1->find(it->first);
+
+ if (primaryKeyIterator != keyDataList1->end()) {
+
+ if (it->second->getColumn().getSQLType() != primaryKeyIterator->second->getColumn().getSQLType()) {
+ return false;
+ }
+
+ if (*it->second < *primaryKeyIterator->second) {
+ return true;
+ } else if (*it->second > *primaryKeyIterator->second) {
+ return false;
+ }
+
+ }
+
+ }
+
+ return false;
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/PreparedStatement.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/PreparedStatement.cpp
new file mode 100644
index 0000000000..271e340030
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/PreparedStatement.cpp
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/PreparedStatement.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+PreparedStatement::PreparedStatement(Connection& connection, SQLHSTMT statementHandle, string sql)
+ : Statement(connection, statementHandle){
+ this->sql = sql;
+
+ for(unsigned int i = 0; i < sql.size(); i++){
+ if(sql.at(i) == '?')
+ positions.push_back(i);
+ }
+}
+
+
+PreparedStatement::~PreparedStatement(){
+ Statement::~Statement();
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/ReadCommandImpl.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ReadCommandImpl.cpp
new file mode 100644
index 0000000000..c7df40dd57
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ReadCommandImpl.cpp
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/ReadCommandImpl.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ReadCommandImpl::ReadCommandImpl(DASImpl& das, std::string sqlString) : CommandImpl(das, sqlString) {}
+
+ReadCommandImpl::~ReadCommandImpl(void) {}
+
+commonj::sdo::DataObjectPtr ReadCommandImpl::executeQuery(void) {
+ ResultSetPtr results = statement->executeQuery(sql);
+ commonj::sdo::DataObjectPtr root = buildGraph(results);
+ root->getChangeSummary()->beginLogging();
+
+ return root;
+
+}
+
+commonj::sdo::DataObjectPtr ReadCommandImpl::buildGraph(ResultSetPtr resultSet) {
+ GraphBuilder graphBuilder((ConfigImpl&) ((DASImpl*) das)->getConfig(), resultSet);
+
+ return graphBuilder.getRoot();
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/Relationship.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/Relationship.cpp
new file mode 100644
index 0000000000..32c720b49c
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/Relationship.cpp
@@ -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.
+ */
+#include "apache/das/rdb/Relationship.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+Relationship::Relationship(const Relationship& relationship) {
+ many = relationship.many;
+ relationshipName = relationship.relationshipName;
+ pkTableName = relationship.pkTableName;
+ fkTableName = relationship.fkTableName;
+ this->keyPairs = new std::map<std::string, const KeyPair*>();
+
+ std::map<std::string, const KeyPair*>::iterator it;
+ for (it = relationship.keyPairs->begin() ; it != relationship.keyPairs->end() ; it++) {
+ KeyPair* newKP = new KeyPair(*it->second);
+ newKP->setRelationship(this);
+ this->keyPairs->insert(std::make_pair(it->first, newKP));
+
+ }
+
+}
+
+Relationship::Relationship(std::string pkTableName, std::string fkTableName,
+ std::string relationshipName) {
+
+ StringWrapper pkTableNameWrapper(pkTableName);
+ StringWrapper fkTableNameWrapper(fkTableName);
+ StringWrapper relationshipNameWrapper(relationshipName);
+ pkTableName = pkTableNameWrapper.toUpper();
+ fkTableName = fkTableNameWrapper.toUpper();
+
+ if (relationshipName == "") {
+ this->relationshipName = fkTableName;
+ } else {
+
+ if (!relationshipNameWrapper.isValidRDBName()) {
+ throw DASInvalidRelationshipNameException("Relationship name must not contain whitespace characters!");
+ }
+
+ this->relationshipName = relationshipNameWrapper.toUpper();
+
+ }
+
+ if (!pkTableNameWrapper.isValidRDBName()) {
+ throw DASInvalidTableNameException("PK Table name must not contain whitespace characters!");
+ }
+
+ if (!fkTableNameWrapper.isValidRDBName()) {
+ throw DASInvalidTableNameException("FK Table name must not contain whitespace characters!");
+ }
+
+ this->pkTableName = pkTableName;
+ this->fkTableName = fkTableName;
+ many = true;
+ keyPairs = new std::map<std::string, const KeyPair*>();
+
+}
+
+void Relationship::setMany(bool many) {
+ this->many = many;
+}
+
+bool Relationship::isMany(void) const {
+ return many;
+}
+
+KeyPair& Relationship::addKeyPair(std::string pkColumnName, std::string fkColumnName) {
+ KeyPair& newKP = newKeyPair(*(new KeyPair(pkColumnName, fkColumnName)));
+ newKP.setRelationship(this);
+
+ return newKP;
+
+}
+
+KeyPair& Relationship::addKeyPair(const KeyPair& keyPair) {
+ KeyPair& newKP = newKeyPair(*(new KeyPair(keyPair)));
+ newKP.setRelationship(this);
+
+ return newKP;
+
+}
+
+KeyPair& Relationship::newKeyPair(KeyPair& keyPair) {
+ const KeyPair* configKeyPair = getKeyPair(keyPair.getPKColumnName(), keyPair.getFKColumnName());
+
+ if (configKeyPair == 0) {
+ keyPairs->insert(std::make_pair(keyPair.getPKColumnName() + "." + keyPair.getFKColumnName(), &keyPair));
+
+ return keyPair;
+
+ }
+
+ return (KeyPair&) *configKeyPair;
+
+}
+
+std::string Relationship::getName(void) const {
+ return relationshipName;
+}
+
+Relationship::~Relationship(void) {
+ std::map<std::string, const KeyPair*>::iterator it;
+
+ for (it = keyPairs->begin() ; it != keyPairs->end() ; it++) {
+ delete it->second;
+ }
+
+ delete keyPairs;
+
+}
+
+std::string Relationship::getPKTableName(void) const {
+ return pkTableName;
+}
+
+std::string Relationship::getFKTableName(void) const {
+ return fkTableName;
+}
+
+const std::map<std::string, const KeyPair*>& Relationship::getKeyPairs(void) const {
+ return (const std::map<std::string, const KeyPair*>&) *keyPairs;
+}
+
+const KeyPair* Relationship::getKeyPair(std::string pkColumnName, std::string fkColumnName) const {
+ std::map<std::string, const KeyPair*>::iterator it = keyPairs->
+ find(pkColumnName + "." + fkColumnName);
+
+ if (it == keyPairs->end()) {
+ return 0;
+ }
+
+ return it->second;
+
+}
+
+std::list<const KeyPair*>* Relationship::getKeyPair(std::string columnName, bool pkColumn) const {
+ std::map<std::string, const KeyPair*>::const_iterator it;
+ std::list<const KeyPair*>* ret = new std::list<const KeyPair*>();
+
+ for (it = keyPairs->begin() ; it != keyPairs->end() ; it++) {
+ std::string actualColumnName;
+
+ if (pkColumn) {
+ actualColumnName = it->second->getPKColumnName();
+ } else {
+ actualColumnName = it->second->getFKColumnName();
+ }
+
+ if (columnName == actualColumnName) {
+ ret->push_back(it->second);
+ }
+
+ }
+
+ return ret;
+
+}
+
+
+bool Relationship::containsColumn(std::string columnName, bool pkColumn) const {
+ std::map<std::string, const KeyPair*>::const_iterator it;
+
+ for (it = keyPairs->begin() ; it != keyPairs->end() ; it++) {
+
+ if (pkColumn) {
+
+ if (it->second->getPKColumnName() == columnName) {
+ return true;
+ }
+
+ } else {
+
+ if (it->second->getFKColumnName() == columnName) {
+ return true;
+ }
+
+ }
+
+ }
+
+ return false;
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/RelationshipStatement.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/RelationshipStatement.cpp
new file mode 100644
index 0000000000..a7b23727a9
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/RelationshipStatement.cpp
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/RelationshipStatement.h"
+#include "apache/das/rdb/Relationship.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+RelationshipStatement::RelationshipStatement(const Relationship& relationship, const KeyDataList* keyDataList) {
+ this->relationship = &relationship;
+ this->keyDataList = keyDataList;
+ executed = false;
+
+}
+
+void RelationshipStatement::setDASDataObject(DASDataObject& dataObject) {
+ this->dataObject = &dataObject;
+}
+
+RelationshipStatement::~RelationshipStatement(void) {}
+
+bool RelationshipStatement::isUnset(void) const {
+ return keyDataList == 0;
+}
+
+DASDataObject& RelationshipStatement::getDASDataObject(void) const {
+ return *dataObject;
+}
+
+void RelationshipStatement::setFKList(const KeyDataList* keyDataList) {
+ this->keyDataList = keyDataList;
+}
+
+void RelationshipStatement::execute(StatementPtr statement) {
+
+ if (!executed) {
+ const std::map<std::string, const KeyPair*>& keyPairs = relationship->getKeyPairs();
+ std::string stmt;
+ stmt.append("update ").append(relationship->getFKTableName()).append(" set");
+ unsigned int i = 1;
+
+ for (std::map<std::string, const KeyPair*>::const_iterator it = keyPairs.begin() ; it != keyPairs.end() ; it++) {
+ stmt.append(" ").append(it->second->getFKColumnName()).append("=");
+
+ if (keyDataList == 0) {
+ stmt.append(SQL_NULL_VALUE);
+ } else {
+ KeyDataList::const_iterator pkIt = keyDataList->find(it->second->getPKColumnName());
+
+ if (pkIt == keyDataList->end()) {
+ //throw exception
+ }
+
+ stmt.append(pkIt->second->toSQL());
+
+ }
+
+ if (i != keyPairs.size()) {
+ stmt.append(",");
+ }
+
+ i++;
+
+ }
+
+ const Column* occCol = 0;
+ if (!dataObject->isOCCChecked()) {
+ occCol = dataObject->getTable().getOCCColumn();
+
+ if (occCol != 0 && occCol->isManaged()) {
+ stmt.append(occCol->getName()).append("=").append(StringWrapper::toString(dataObject->getNewOCC() + 1));
+ }
+
+ }
+
+
+ stmt.append(" ").append(dataObject->getWhereStmt()).append(";");
+ bool noData = false;
+ ResultSetPtr rs;
+
+ try {
+ rs = statement->executeQuery(stmt);
+ } catch (SQLException& ex) {
+
+ if (ex.getODBCReturnCode() == SQL_NO_DATA) {
+ noData = true;
+ } else {
+ throw;
+ }
+
+ }
+
+ if (!dataObject->isOCCChecked()) {
+
+ if (occCol != 0 && (noData || rs->getRowCount() == 0)) {
+ throw DASOptimisticConcurrencyControlException();
+ } else {
+ dataObject->setOCCChecked(true);
+ }
+
+ }
+
+ executed = true;
+
+ }
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/RelationshipWrapper.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/RelationshipWrapper.cpp
new file mode 100644
index 0000000000..22bc41277a
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/RelationshipWrapper.cpp
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/RelationshipWrapper.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+RelationshipWrapper::RelationshipWrapper(void) {}
+
+RelationshipWrapper::~RelationshipWrapper(void) {
+ std::list<std::list<Relationship*>*>::iterator it;
+
+ for (it = relationshipLists.begin() ; it != relationshipLists.end() ; it++) {
+ delete *it;
+ }
+
+}
+
+std::list<Relationship*>& RelationshipWrapper::getRelationshipsByTableName(
+ const std::map<std::string, Relationship*>& relationships, std::string tableName,
+ bool pkTable) {
+
+ std::list<Relationship*>* relationshipList = new std::list<Relationship*>();
+ std::map<std::string, Relationship*>::const_iterator it;
+
+ for (it = relationships.begin() ; it != relationships.end() ; it++) {
+
+ if (pkTable) {
+
+ if (it->second->getPKTableName() == tableName) {
+ relationshipList->push_back(it->second);
+ }
+
+ } else {
+
+ if (it->second->getFKTableName() == tableName) {
+ relationshipList->push_back(it->second);
+ }
+
+ }
+
+ }
+
+ relationshipLists.push_back(relationshipList);
+
+ return *relationshipList;
+
+}
+
+std::list<Relationship*>& RelationshipWrapper::getRelationshipsByTableName(const std::list<
+ Relationship*>& relationships, std::string tableName,
+ bool pkTable) {
+
+ std::list<Relationship*>* relationshipList = new std::list<Relationship*>();
+ std::list<Relationship*>::const_iterator it;
+
+ for (it = relationships.begin() ; it != relationships.end() ; it++) {
+
+ if (pkTable) {
+
+ if ((*it)->getPKTableName() == tableName) {
+ relationshipList->push_back(*it);
+ }
+
+ } else {
+
+ if ((*it)->getFKTableName() == tableName) {
+ relationshipList->push_back(*it);
+ }
+
+ }
+
+ }
+
+ relationshipLists.push_back(relationshipList);
+
+ return *relationshipList;
+
+}
+
+void RelationshipWrapper::free(std::list<Relationship*>& relationshipList) {
+ std::list<std::list<Relationship*>*>::iterator it;
+
+ for (it = relationshipLists.begin() ; it != relationshipLists.end() ; it++) {
+
+ if (*it == &relationshipList) {
+ delete *it;
+ relationshipLists.erase(it);
+
+ return;
+
+ }
+
+ }
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/ResultSet.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ResultSet.cpp
new file mode 100644
index 0000000000..4870f4fbfa
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ResultSet.cpp
@@ -0,0 +1,356 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/ResultSet.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ResultSet::ResultSet(StatementPtr aStmt) {
+ stmt = aStmt;
+ metaData = new ResultSetMetaData(*this);
+
+}
+
+ResultSet::~ResultSet(void) {
+ ResultSetObject::free();
+ delete metaData;
+
+}
+
+const ResultSetMetaData& ResultSet::getResultSetMetaData(void) const {
+ return *metaData;
+}
+
+StatementPtr ResultSet::getStatement(void) const {
+ return stmt;
+}
+
+SQLINTEGER ResultSet::getSQLInteger(unsigned int columnIndex) const {
+ SQLINTEGER sqlPtr = 0;
+ SQLSMALLINT length = 0;
+ SQLINTEGER aux = 0;
+
+ if (metaData->getSQLType(columnIndex) == SQL_INTEGER) {
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_LONG, &sqlPtr, 0, &aux);
+SQLINTEGER error;
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)){
+SQLCHAR sqlStat;
+
+SQLCHAR * message = new SQLCHAR[100];
+ SQLSMALLINT messageLength;
+ SQLGetDiagRec(SQL_HANDLE_DBC, stmt->getConnection().getODBCConnection(),1,
+ &sqlStat, &error,message,100,&messageLength);
+
+
+
+ string error("Error to establish the connection.\nSQLSTATE: ");
+ error += reinterpret_cast<char*>(&sqlStat);
+ throw SQLException(result, error);
+ }
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "Error on getting database data!");
+
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not integer!");
+ }
+
+ return sqlPtr;
+
+}
+
+SQLINTEGER ResultSet::getSQLInteger(std::string tableName, std::string columnName) const {
+ return getSQLInteger(metaData->getColumnIndex(tableName, columnName));
+}
+
+SQLSMALLINT ResultSet::getSQLSmallInt(unsigned int columnIndex) const {
+ SQLSMALLINT sqlPtr = 0;
+ SQLSMALLINT length = 0;
+ SQLINTEGER aux = 0;
+
+ if (metaData->getSQLType(columnIndex) == SQL_SMALLINT) {
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_SHORT, &sqlPtr, 0, &aux);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "Error on getting database data!");
+
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not integer!");
+ }
+
+ return sqlPtr;
+
+}
+
+SQLSMALLINT ResultSet::getSQLSmallInt(std::string tableName, std::string columnName) const {
+ return getSQLSmallInt(metaData->getColumnIndex(tableName, columnName));
+}
+
+
+SQLWCHAR ResultSet::getSQLWChar(unsigned int columnIndex) const {
+ SQLWCHAR strAux = 0;
+
+ if (metaData->getSQLType(columnIndex) == SQL_WCHAR) {
+ SQLINTEGER length = 0;
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_WCHAR, &strAux, 2, &length);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "Error on getting database data!");
+
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not char!");
+ }
+
+ return strAux;
+
+}
+
+SQLWCHAR ResultSet::getSQLWChar(std::string tableName, std::string columnName) const {
+ return getSQLWChar(metaData->getColumnIndex(tableName, columnName));
+}
+
+SQLCHAR ResultSet::getSQLChar(unsigned int columnIndex) const {
+ SQLCHAR strAux = 0;
+
+ if (metaData->getSQLType(columnIndex) == SQL_CHAR) {
+ SQLINTEGER length = 0;
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_CHAR, &strAux, 2, &length);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "Error on getting database data!");
+
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not char!");
+ }
+
+ return strAux;
+
+}
+
+SQLCHAR ResultSet::getSQLChar(std::string tableName, std::string columnName) const {
+ return getSQLChar(metaData->getColumnIndex(tableName, columnName));
+}
+
+SQLREAL ResultSet::getSQLReal(unsigned int columnIndex) const {
+ SQLREAL ret = 0;
+
+ if (metaData->getSQLType(columnIndex) == SQL_REAL) {
+ SQLREAL real = 0;
+ SQLINTEGER length = 0;
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_FLOAT, &real, 1, &length);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "Error on getting database data!");
+
+ ret = (SQLREAL) real;
+
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not real!");
+ }
+
+ return ret;
+
+}
+
+SQLREAL ResultSet::getSQLReal(std::string tableName, std::string columnName) const {
+ return getSQLReal(metaData->getColumnIndex(tableName, columnName));
+}
+
+SQLFLOAT ResultSet::getSQLFloat(unsigned int columnIndex) const {
+ SQLFLOAT ret = 0;
+
+ if (metaData->getSQLType(columnIndex) == SQL_FLOAT) {
+ SQLDOUBLE data = 0;
+ SQLINTEGER length = 0;
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_DOUBLE, &data, 1, &length);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "error on getting database data!");
+
+ ret = (SQLFLOAT) data;
+
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not float!");
+ }
+
+ return ret;
+
+}
+
+SQLFLOAT ResultSet::getSQLFloat(std::string tableName, std::string columnName) const {
+ return getSQLFloat(metaData->getColumnIndex(tableName, columnName));
+}
+
+SQLDOUBLE ResultSet::getSQLDouble(unsigned int columnIndex) const {
+ double ret = 0;
+
+ if (metaData->getSQLType(columnIndex) == SQL_DOUBLE) {
+ SQLDOUBLE data = 0;
+ SQLINTEGER length = 0;
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_DOUBLE, &data, 1, &length);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "error on getting database data!");
+
+ ret = (SQLDOUBLE) data;
+
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not double!");
+ }
+
+ return ret;
+
+}
+
+SQLDOUBLE ResultSet::getSQLDouble(std::string tableName, std::string columnName) const {
+ return getSQLDouble(metaData->getColumnIndex(tableName, columnName));
+}
+
+std::string ResultSet::getSQLDecimal(unsigned int columnIndex) const {
+
+ if (metaData->getSQLType(columnIndex) == SQL_DECIMAL) {
+ return getSQLString(columnIndex);
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not decimal!");
+ }
+
+}
+
+std::string ResultSet::getSQLDecimal(std::string tableName, std::string columnName) const {
+ return getSQLDecimal(metaData->getColumnIndex(tableName, columnName));
+}
+
+bool ResultSet::isNull(unsigned int columnIndex) const {
+ SQLINTEGER sqlPtr = 0;
+ SQLSMALLINT length = 0;
+ SQLINTEGER aux = 0;
+
+ if (metaData->getSQLType(columnIndex) == SQL_INTEGER) {
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_DEFAULT, &sqlPtr, 0, &aux);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "Error on getting database data!");
+
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not integer!");
+ }
+
+ return aux == SQL_NULL_DATA;
+
+}
+
+bool ResultSet::isNull(std::string tableName, std::string columnName) const {
+ return isNull(metaData->getColumnIndex(tableName, columnName));
+}
+
+bool ResultSet::next(void) {
+ return (SQL_SUCCESS == SQLFetch(stmt->getODBCStatement()));
+}
+
+unsigned int ResultSet::getRowCount(void) const {
+ SQLINTEGER rowCount = 0;
+ SQLRETURN result = SQLRowCount(stmt->getODBCStatement(), &rowCount);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "error on getting row count!");
+
+ return (unsigned int) rowCount;
+
+}
+
+std::string ResultSet::getSQLString(unsigned int columnIndex) const {
+ SQLPOINTER sqlPtr = 0;
+ SQLCHAR strAux[1];
+ SQLINTEGER length = 0;
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_CHAR, &strAux, 1, &length);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "error on getting database data!");
+
+ length++;
+ sqlPtr = new SQLCHAR[length];
+ SQLINTEGER aux = 0;
+ result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_CHAR, sqlPtr, length, &aux);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "error on getting database data!");
+
+ std::string ret = (char*) sqlPtr;
+ delete [] ((SQLCHAR*) sqlPtr);
+
+ return ret;
+
+}
+
+std::wstring ResultSet::getSQLWString(unsigned int columnIndex) const {
+ SQLPOINTER sqlPtr = 0;
+ SQLWCHAR strAux[1];
+ SQLINTEGER length = 0;
+ SQLRETURN result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_WCHAR, &strAux, 1, &length);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "error on getting database data!");
+
+ length++;
+ sqlPtr = new SQLWCHAR[length];
+ SQLINTEGER aux = 0;
+ result = SQLGetData(stmt->getODBCStatement(), columnIndex + 1, SQL_C_WCHAR, sqlPtr, length, &aux);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ throw SQLException(result, "error on getting database data!");
+
+ std::wstring ret = (wchar_t*) sqlPtr;
+ delete [] ((SQLWCHAR*) sqlPtr);
+
+ return ret;
+
+}
+
+std::string ResultSet::getSQLVarchar(unsigned int columnIndex) const {
+
+ if (metaData->getSQLType(columnIndex) == SQL_VARCHAR) {
+ return getSQLString(columnIndex);
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not varchar!");
+ }
+
+}
+
+std::string ResultSet::getSQLVarchar(std::string tableName, std::string columnName) const {
+ return getSQLVarchar(metaData->getColumnIndex(tableName, columnName));
+}
+
+std::wstring ResultSet::getSQLWVarchar(unsigned int columnIndex) const {
+
+ if (metaData->getSQLType(columnIndex) == SQL_WVARCHAR) {
+ return getSQLWString(columnIndex);
+ } else {
+ throw DASInvalidSQLTypeException("Column sql type on index " + columnIndex + (std::string) " is not varchar!");
+ }
+
+}
+
+std::wstring ResultSet::getSQLWVarchar(std::string tableName, std::string columnName) const {
+ return getSQLWVarchar(metaData->getColumnIndex(tableName, columnName));
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp
new file mode 100644
index 0000000000..e17295560e
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/ResultSetMetaData.cpp
@@ -0,0 +1,216 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/ResultSetMetaData.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+ResultSetMetaData::ResultSetMetaData(const ResultSet& aResultSet) {
+ resultSet = &aResultSet;
+ unsigned int columnCount = getColumnCount();
+
+ for (unsigned int i = 0 ; i < columnCount ; i++) {
+ std::string columnName = StringWrapper(getColumnName(i)).toUpper();
+ std::string tableName = StringWrapper(getTableName(i)).toUpper();
+ columnsIndexes.insert(std::make_pair(tableName + "." + columnName, i));
+
+ }
+
+}
+
+ResultSetMetaData::~ResultSetMetaData(void) {}
+
+SQLSMALLINT ResultSetMetaData::getSQLCType(SQLSMALLINT sqlType) {
+
+ switch (sqlType) {
+
+ case SQL_CHAR :
+ return SQL_C_CHAR;
+
+ case SQL_BINARY :
+ return SQL_C_BINARY;
+
+ case SQL_TYPE_DATE :
+ return SQL_C_TYPE_DATE;
+
+ case SQL_DECIMAL :
+ return SQL_C_CHAR;
+
+ case SQL_DOUBLE :
+ return SQL_C_DOUBLE;
+
+ case SQL_FLOAT :
+ return SQL_C_DOUBLE;
+
+ case SQL_INTEGER :
+ return SQL_C_LONG;
+
+ case SQL_LONGVARCHAR :
+ return SQL_C_CHAR;
+
+ case SQL_LONGVARBINARY :
+ return SQL_C_BINARY;
+
+ case SQL_NUMERIC :
+ return SQL_C_CHAR;
+
+ case SQL_REAL :
+ return SQL_C_FLOAT;
+
+ case SQL_SMALLINT :
+ return SQL_C_SHORT;
+
+ case SQL_TYPE_TIME :
+ return SQL_C_TYPE_TIME;
+
+ case SQL_TYPE_TIMESTAMP :
+ return SQL_C_TYPE_TIMESTAMP;
+
+ case SQL_VARCHAR :
+ return SQL_C_CHAR;
+
+ case SQL_VARBINARY :
+ return SQL_C_BINARY;
+
+ default :
+ throw DASInvalidSQLTypeException();
+
+ }
+
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLType(unsigned int columnIndex) const {
+ SQLSMALLINT sqlType = 0;
+ SQLColAttribute(resultSet->getStatement()->getODBCStatement(), columnIndex + 1, SQL_DESC_TYPE, NULL, NULL, NULL, &sqlType);
+
+ return sqlType;
+
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLType(std::string tableName, std::string columnName) const {
+ return getSQLType(getColumnIndex(tableName, columnName));
+}
+
+std::string ResultSetMetaData::getSQLTypeName(unsigned int columnIndex) const {
+ SQLCHAR* sqlPtr = 0;
+ char strAux[1];
+ SQLSMALLINT length = 0;
+ SQLColAttribute(resultSet->getStatement()->getODBCStatement(), columnIndex + 1, SQL_DESC_TYPE_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+ length++;
+ sqlPtr = (SQLCHAR*) new SQLCHAR[length];
+ SQLColAttributeA(resultSet->getStatement()->getODBCStatement(), columnIndex + 1, SQL_DESC_TYPE_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
+
+ std::string ret((char*) sqlPtr);
+ delete [] sqlPtr;
+
+ return StringWrapper(ret).toUpper();
+
+}
+
+std::string ResultSetMetaData::getSQLTypeName(std::string tableName, std::string columnName) const {
+ return getSQLTypeName(getColumnIndex(tableName, columnName));
+}
+
+
+std::string ResultSetMetaData::getColumnName(unsigned int columnIndex) const {
+ SQLCHAR* sqlPtr = 0;
+ char strAux[1];
+ SQLSMALLINT length = 0;
+ SQLColAttribute(resultSet->getStatement()->getODBCStatement(), columnIndex + 1, SQL_DESC_BASE_COLUMN_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+ length++;
+ sqlPtr = (SQLCHAR*) new SQLCHAR[length];
+ SQLColAttributeA(resultSet->getStatement()->getODBCStatement(), columnIndex + 1, SQL_DESC_BASE_COLUMN_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
+
+ std::string ret((char*) sqlPtr);
+ delete [] sqlPtr;
+
+ return StringWrapper(ret).toUpper();
+
+}
+
+unsigned int ResultSetMetaData::getColumnIndex(std::string tableName, std::string columnName) const {
+ tableName = StringWrapper(tableName).toUpper();
+ columnName = StringWrapper(columnName).toUpper();
+ std::map<std::string, unsigned int>::const_iterator it = columnsIndexes.find(tableName + "." + columnName);
+
+ if (it == columnsIndexes.end()) {
+ throw DASColumnNotFoundException("No such column on table " + tableName + ": " + columnName);
+ }
+
+ return it->second;
+
+}
+
+
+std::string ResultSetMetaData::getTableName(unsigned int columnIndex) const {
+ SQLCHAR* sqlPtr = 0;
+ char strAux[1];
+ SQLSMALLINT length = 0;
+ SQLColAttribute(resultSet->getStatement()->getODBCStatement(), columnIndex + 1, SQL_DESC_TABLE_NAME, &strAux, 1, (SQLSMALLINT*) &length, NULL);
+ length++;
+ sqlPtr = (SQLCHAR*) new SQLCHAR[length];
+ SQLColAttributeA(resultSet->getStatement()->getODBCStatement(), columnIndex + 1, SQL_DESC_TABLE_NAME, sqlPtr, length, (SQLSMALLINT*) &length, NULL);
+
+ std::string ret((char*) sqlPtr);
+ delete [] sqlPtr;
+
+ return StringWrapper(ret).toUpper();
+
+}
+
+std::string ResultSetMetaData::getTableName(std::string tableName, std::string columnName) const {
+ return getTableName(getColumnIndex(tableName, columnName));
+}
+
+
+SQLSMALLINT ResultSetMetaData::getSQLCType(unsigned int columnIndex) const {
+ return getSQLCType(getSQLType(columnIndex));
+}
+
+SQLSMALLINT ResultSetMetaData::getSQLCType(std::string tableName, std::string columnName) const {
+ return getSQLCType(getSQLType(getColumnIndex(tableName, columnName)));
+}
+
+unsigned int ResultSetMetaData::getColumnCount(void) const {
+ SQLUINTEGER columnCount = 0;
+ SQLRETURN ret = SQLColAttribute(resultSet->getStatement()->getODBCStatement(), NULL, SQL_DESC_COUNT, NULL, NULL, NULL, &columnCount);
+
+ return (unsigned int) columnCount;
+
+}
+
+bool ResultSetMetaData::containsColumn(std::string tableName, std::string columnName) const {
+ std::map<std::string, unsigned int>::const_iterator it = columnsIndexes.find(tableName + "." + columnName);
+
+ if (it == columnsIndexes.end()) {
+ return false;
+ }
+
+ return true;
+
+}
+
+const ResultSet& ResultSetMetaData::getResultSet(void) const {
+ return *resultSet;
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/SQLException.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/SQLException.cpp
new file mode 100644
index 0000000000..3de09819bd
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/SQLException.cpp
@@ -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.
+ */
+
+#include "apache/das/rdb/SQLException.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+SQLException::SQLException(SQLRETURN returnCode, string errorText)
+ :exception(errorText.c_str()) {
+ this->returnCode = returnCode;
+
+}
+
+SQLException::~SQLException(){}
+
+SQLRETURN SQLException::getODBCReturnCode(void) const {
+ return returnCode;
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/Statement.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/Statement.cpp
new file mode 100644
index 0000000000..62e92cda67
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/Statement.cpp
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/Statement.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+Statement::Statement(Connection& connection, SQLHSTMT statementHandle) : resultSet(0, false) {
+ this->statementHandle = statementHandle;
+ this->connection = &connection;
+
+}
+
+Statement::~Statement(void) {
+ if (!resultSet) {
+ delete resultSet;
+ }
+
+ SQLFreeHandle(SQL_HANDLE_STMT, statementHandle);
+ StatementObject::free();
+
+}
+
+std::string Statement::getError(void) const {
+ SQLCHAR state[5];
+ SQLCHAR message[1000];
+ SQLINTEGER nativeError = 0;
+ SQLSMALLINT messageLength = 0;
+
+ SQLRETURN result = SQLGetDiagRec(SQL_HANDLE_STMT, statementHandle, 1,
+ state, &nativeError, message, 1000, &messageLength);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+ return "";
+ }
+
+ if (messageLength < 1000) {
+ message[messageLength + 1] = 0;
+ }
+
+ std::string ret = (std::string) (char*) state;
+ ret += ": ";
+ ret += StringWrapper::toString((long) nativeError);
+ ret += " - ";
+ ret += (char*) message;
+
+ return ret;
+
+}
+
+Connection& Statement::getConnection(void) const {
+ return *connection;
+}
+
+ResultSetPtr Statement::executeQuery(std::string sql) {
+ queryString = sql;
+ SQLCloseCursor(statementHandle);
+ SQLRETURN result = SQLExecDirect(statementHandle, (SQLCHAR*) (char*) sql.c_str(), SQL_NTS);
+
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+ throw SQLException(result, getError());
+ }
+
+ return createResultSet();
+
+}
+
+ResultSetPtr Statement::createResultSet(void) {
+ if (resultSet) {
+ delete resultSet;
+ }
+
+ ResultSetPtr ret = new ResultSet((StatementPtr) *this);
+ resultSet = ret;
+
+ return ret;
+
+}
+
+void Statement::close(void) {
+ delete this;
+}
+
+HSTMT Statement::getODBCStatement(void) const {
+ return statementHandle;
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/Table.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/Table.cpp
new file mode 100644
index 0000000000..66f905dafd
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/Table.cpp
@@ -0,0 +1,236 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/Table.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+Table::Table(std::string tableName) {
+ tableName = StringWrapper(tableName).toUpper();
+
+ if (tableName.find(' ') != -1 || tableName.find('\t') != -1 || tableName.find('\n') != -1 || tableName.find('\r') != -1) {
+ throw DASInvalidTableNameException("Table name must not contain whitespace characters!");
+ }
+
+ this->tableName = tableName;
+ this->typeName = tableName;
+ this->columns = new std::map<std::string, const Column*>();
+
+}
+
+Table::Table(std::string tableName, std::string typeName) {
+ tableName = StringWrapper(tableName).toUpper();
+
+ if (tableName.find(' ') != -1 || tableName.find('\t') != -1 || tableName.find('\n') != -1 || tableName.find('\r') != -1) {
+ throw DASInvalidTableNameException("Table name must not contain whitespace characters!");
+ }
+
+ this->tableName = tableName;
+ this->typeName = typeName;
+ this->columns = new std::map<std::string, const Column*>();
+
+}
+
+Table::Table(const Table& table) {
+ tableName = table.tableName;
+ typeName = table.typeName;
+ this->columns = new std::map<std::string, const Column*>();
+
+ std::map<std::string, const Column*>::iterator it;
+ for (it = table.columns->begin() ; it != table.columns->end() ; it++) {
+ Column* newColumn = new Column(*it->second);
+ newColumn->setContainerTable(this);
+ columns->insert(std::make_pair(it->first, newColumn));
+
+ }
+
+}
+
+Table::~Table(void) {
+ std::map<std::string, const Column*>::iterator it;
+
+ for (it = columns->begin() ; it != columns->end() ; it++) {
+ delete it->second;
+ }
+
+ delete columns;
+
+}
+
+const Column* Table::getColumnByProperty(std::string propertyName) const {
+
+ for (std::map<std::string, const Column*>::const_iterator it = columns->begin() ;
+ it != columns->end() ; it++) {
+
+ if (it->second->getPropertyName() == propertyName) {
+ return it->second;
+ }
+
+ }
+
+ return 0;
+
+}
+
+std::string Table::getTableName(void) const {
+ return tableName;
+}
+
+Column& Table::addColumn(std::string columnName, SQLSMALLINT sqlType) {
+ Column* column = new Column(columnName, sqlType);
+ return newColumn(*column);
+}
+
+Column& Table::addColumn(const Column& column) {
+ return newColumn(*(new Column(column)));
+}
+
+Column& Table::newColumn(Column& column) {
+ std::string columnName = column.getName();
+ Column* tableColumn = getColumn(columnName);
+
+ if (tableColumn == 0) {
+ columns->insert(std::make_pair(columnName, &column));
+ column.setContainerTable(this);
+
+ return column;
+
+ }
+
+ return *tableColumn;
+
+}
+
+void Table::createGraph(const GraphBuilderMetaData& graphBuilderMetaData, commonj::sdo::DataFactoryPtr dataFactory) const {
+ std::map<std::string, const Column*>::const_iterator it;
+ std::map<std::string, Relationship*>& relationships = graphBuilderMetaData.getRelationships();
+ std::map<std::string, Relationship*>::const_iterator relationshipIterator;
+ std::list<Relationship*> tablePKRelationships;
+ std::list<Relationship*> tableFKRelationships;
+ std::list<std::string> relationshipColumns;
+
+ for (relationshipIterator = relationships.begin() ; relationshipIterator !=
+ relationships.end() ; relationshipIterator++) {
+
+ if (relationshipIterator->second->getFKTableName() == tableName) {
+ const std::map<std::string, const KeyPair*>& keyPairs = relationshipIterator->second->getKeyPairs();
+ std::map<std::string, const KeyPair*>::const_iterator keyPairIterator;
+
+ for (keyPairIterator = keyPairs.begin() ; keyPairIterator !=
+ keyPairs.end() ; keyPairIterator++) {
+
+ relationshipColumns.push_back(keyPairIterator->second->
+ getFKColumnName());
+
+ }
+
+ }
+
+ }
+
+ for (it = columns->begin() ; it != columns->end() ; it++) {
+ const Column& column = *(it->second);
+
+ if (graphBuilderMetaData.getResultSetMetaData().containsColumn(tableName, column.getName())) {
+
+ std::list<std::string>::const_iterator it2 = std::find(relationshipColumns.begin(),
+ relationshipColumns.end(), column.getName());
+
+ if (it2 == relationshipColumns.end()) {
+ dataFactory->addPropertyToType(graphBuilderMetaData.getConfig().getURI(), typeName.c_str(),
+ column.getPropertyName().c_str(), SDO_NAMESPACE,
+ ODBCTypeHelper::getSDOType(column.getSQLType()).c_str() , false,
+ false, true);
+
+ }
+
+ }
+
+ }
+
+}
+
+const Column* Table::getOCCColumn(void) const {
+
+ for (std::map<std::string, const Column*>::const_iterator it = columns->begin() ; it != columns->end() ; it++) {
+
+ if (it->second->isCollision()) {
+ return it->second;
+ }
+
+ }
+
+ return 0;
+
+}
+
+void Table::setTypeName(std::string typeName) {
+ typeName = StringWrapper(typeName).toUpper();
+
+ if (typeName.find(' ') != -1 || typeName.find('\t') != -1 || typeName.find('\n') != -1 || typeName.find('\r') != -1) {
+ throw DASInvalidTypeNameException("Type must not contain whitespace characters!");
+ }
+
+ this->typeName = typeName;
+
+}
+
+Column* Table::getColumn(std::string columnName) {
+ std::map<std::string, const Column*>::const_iterator it = columns->find(columnName);
+
+ if (it == columns->end()) {
+ return 0;
+ }
+
+ return (Column*) it->second;
+
+}
+
+const Column* Table::getColumn(std::string columnName) const {
+ return ((Table*) this)->getColumn(columnName);
+}
+
+std::string Table::getTypeName(void) const {
+ return typeName;
+}
+
+const std::map<std::string, const Column*>& Table::getColumns(void) const {
+ return *columns;
+}
+
+unsigned int Table::getPKColumnCount(void) const {
+ unsigned int count = 0;
+ std::map<std::string, const Column*>::const_iterator it;
+
+ for (it = columns->begin() ; it != columns->end() ; it++) {
+
+ if (it->second->isPK()) {
+ count++;
+ }
+
+ }
+
+ return count;
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/core/src/apache/das/rdb/TableData.cpp b/das-cpp/trunk/runtime/core/src/apache/das/rdb/TableData.cpp
new file mode 100644
index 0000000000..3f6fd68828
--- /dev/null
+++ b/das-cpp/trunk/runtime/core/src/apache/das/rdb/TableData.cpp
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+#include "apache/das/rdb/TableData.h"
+
+namespace apache {
+ namespace das {
+ namespace rdb {
+
+TableData::TableData(const Table& table, ResultSetPtr resultSet) : PKObject(table) {
+ dataObject = 0;
+ const std::map<std::string, const Column*>& columns = table.getColumns();
+ std::map<std::string, const Column*>::const_iterator columnIterator;
+ const ResultSetMetaData& metaData = resultSet->getResultSetMetaData();
+ const KeyDataList& primaryKeys = getPrimaryKeys();
+
+ for (columnIterator = columns.begin() ; columnIterator != columns.end() ;
+ columnIterator++) {
+
+ const Column& column = *columnIterator->second;
+ std::string columnName = column.getName();
+
+ if (metaData.containsColumn(table.getTableName(), columnName)) {
+ ColumnData* columnData = new ColumnData(column, resultSet);
+
+ columnsData.insert(std::make_pair(columnName, columnData));
+
+ if (column.isPK()) {
+ addPrimaryKey(columnName, *columnData);
+ }
+
+ }
+
+ }
+
+}
+
+TableData::~TableData(void) {
+ std::map<std::string, ColumnData*>::iterator it;
+
+ for (it = columnsData.begin() ; it != columnsData.end() ; it++) {
+
+ if (!(it->second->getColumn().isPK())) {
+ delete it->second;
+ }
+
+ }
+
+}
+
+bool TableData::hasPK(void) const {
+ const KeyDataList& primaryKeys = getPrimaryKeys();
+ return (primaryKeys.size() == getTable().getPKColumnCount() && primaryKeys.size() > 0);
+}
+
+commonj::sdo::DataObjectPtr TableData::getGraphObject(void) const {
+ return dataObject;
+}
+
+void TableData::populateDataGraph(GraphBuilder& graphBuilder) {
+ dataObject = graphBuilder.getRoot()->createDataObject(getTable().getTableName().c_str());
+ std::map<std::string, ColumnData*>::iterator it;
+
+ for (it = columnsData.begin() ; it != columnsData.end() ; it++) {
+ it->second->populateDataGraph(*this);
+ }
+
+}
+
+ColumnData* TableData::getColumnData(std::string columnName) const {
+ std::map<std::string, ColumnData*>::const_iterator it = columnsData.find(columnName);
+
+ if (it == columnsData.end()) {
+ return 0;
+ }
+
+ return it->second;
+
+}
+
+ };
+ };
+};
diff --git a/das-cpp/trunk/runtime/test/build.xml b/das-cpp/trunk/runtime/test/build.xml
new file mode 100644
index 0000000000..c1512055ee
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/build.xml
@@ -0,0 +1,73 @@
+<?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="TuscanyDASNative_test" default="all" basedir="../..">
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+ <!--
+ Notice that the basedir for this project is set to the TuscanyDAS root dir
+ This makes path setting in system.xml much simpler, but we'll just have to
+ set a property here to this directory.
+ -->
+ <property name="this.dir" location="${basedir}/runtime/test"/>
+ <property name="das.test.src.dir" location="${this.dir}/src"/>
+ <property name="das.test.build.dir" location="${this.dir}/build"/>
+ <property name="das.test.app" value="das_test"/>
+
+ <!--
+ Public targets
+ -->
+ <target name="all" description="compile, link, and run TuscanyDASNative test suite">
+ <antcall target="build"/>
+ <antcall target="run"/>
+ </target>
+
+ <target name="build" description="compile and link TuscanyDASNative test suite" depends="check.sdo">
+ <cpp-build
+ srcdir="${das.test.src.dir}"
+ infiles="*.cpp"
+ outdir="${das.test.build.dir}"
+ outfile="${das.test.app}"
+ outtype="executable">
+ <custom-build-elements>
+
+ <includepath path="${tuscanyDAS.install.dir}/include"/>
+ <includepath path="${tuscany.sdo.home.dir}/include"/>
+
+ <libset dir="${tuscanyDAS.install.dir}/lib" libs="tuscany_das"/>
+ <libset dir="${tuscany.sdo.home.dir}/lib" libs="tuscany_sdo"/>
+ <libset libs="odbc32"/>
+
+ </custom-build-elements>
+ </cpp-build>
+
+ </target>
+
+ <target name="run" depends="build" description="Run TuscanyDASNative test suite">
+ <exec executable="${das.test.build.dir}/${das.test.app}${exe.ext}" dir="${das.test.build.dir}"/>
+ </target>
+
+ <target name="clean" description="Clean TuscanyDASNative test suite">
+ <delete dir="${das.test.build.dir}" quiet="@{quiet}"/>
+
+ </target>
+
+</project>
diff --git a/das-cpp/trunk/runtime/test/rsc/testCompositeRelationship.xml b/das-cpp/trunk/runtime/test/rsc/testCompositeRelationship.xml
new file mode 100644
index 0000000000..c22799e650
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testCompositeRelationship.xml
@@ -0,0 +1,35 @@
+<?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" uri="test.composite.relationship">
+
+ <Command name="get composite relationship" SQL="SELECT DEPARTMENT.ID, DEPARTMENT.NAME, EMPLOYEE.ID, EMPLOYEE.DEPARTMENT_ID, EMPLOYEE.DEPARTMENT_NAME FROM DEPARTMENT, EMPLOYEE;"/>
+
+ <Table tableName="department">
+ <Column sqlType="integer" columnName="id" primaryKey="true"/>
+ <Column sqlType="varchar" columnName="name" primaryKey="true"/>
+ </Table>
+
+ <Relationship primaryKeyTable="department" foreignKeyTable="employee" many="true">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="department_id"/>
+ <KeyPair primaryKeyColumn="name" foreignKeyColumn="department_name"/>
+ </Relationship>
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/rsc/testCreateOperation.xml b/das-cpp/trunk/runtime/test/rsc/testCreateOperation.xml
new file mode 100644
index 0000000000..c9e8d8a444
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testCreateOperation.xml
@@ -0,0 +1,41 @@
+<?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" uri="test.create.operation"> >
+
+ <Command name="get all tables" SQL="SELECT * FROM company, department, employee;"/>
+
+ <Table tableName="Department">
+ <Column columnName="id" sqlType="integer" primaryKey="true"/>
+ <Column columnName="name" sqlType="varchar" primaryKey="true"/>
+ </Table>
+
+ <Relationship primaryKeyTable="company" foreignKeyTable="department">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="company_id"/>
+ </Relationship>
+
+ <Relationship primaryKeyTable="department" foreignKeyTable="employee">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="department_id"/>
+ <KeyPair primaryKeyColumn="name" foreignKeyColumn="department_name"/>
+ </Relationship>
+
+
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/rsc/testDeleteOperation.xml b/das-cpp/trunk/runtime/test/rsc/testDeleteOperation.xml
new file mode 100644
index 0000000000..fa619fda76
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testDeleteOperation.xml
@@ -0,0 +1,41 @@
+<?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" uri="test.delete.operation">
+
+ <Command name="get all tables" SQL="SELECT * FROM company, department, employee;"/>
+
+ <Table tableName="Department">
+ <Column columnName="id" sqlType="integer" primaryKey="true"/>
+ <Column columnName="name" sqlType="varchar" primaryKey="true"/>
+ </Table>
+
+ <Relationship primaryKeyTable="company" foreignKeyTable="department">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="company_id"/>
+ </Relationship>
+
+ <Relationship primaryKeyTable="department" foreignKeyTable="employee">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="department_id"/>
+ <KeyPair primaryKeyColumn="name" foreignKeyColumn="department_name"/>
+ </Relationship>
+
+
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/rsc/testIncompleteCompositeRelationship1.xml b/das-cpp/trunk/runtime/test/rsc/testIncompleteCompositeRelationship1.xml
new file mode 100644
index 0000000000..b43453d21d
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testIncompleteCompositeRelationship1.xml
@@ -0,0 +1,35 @@
+<?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" uri="test.incomplete.composite.relationship.one">
+
+ <Command name="get incomplete relationship" SQL="SELECT department.id, department.name, employee.id, employee.department_id FROM department, employee;"/>
+
+ <Table tableName="department">
+ <Column sqlType="integer" columnName="id" primaryKey="true"/>
+ <Column sqlType="varchar" columnName="name" primaryKey="true"/>
+ </Table>
+
+ <Relationship primaryKeyTable="department" foreignKeyTable="employee" many="true">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="department_id"/>
+ <KeyPair primaryKeyColumn="name" foreignKeyColumn="department_name"/>
+ </Relationship>
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/rsc/testIncompleteCompositeRelationship2.xml b/das-cpp/trunk/runtime/test/rsc/testIncompleteCompositeRelationship2.xml
new file mode 100644
index 0000000000..a3032f2be0
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testIncompleteCompositeRelationship2.xml
@@ -0,0 +1,34 @@
+<?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" uri="test.incomplete.composite.relationship.two">
+
+ <Command name="get incomplete relationship" SQL="SELECT department.id, department.name, employee.id, employee.department_id, employee.department_name FROM department, employee;"/>
+
+ <Table tableName="department">
+ <Column sqlType="varchar" columnName="name" primaryKey="true"/>
+ </Table>
+
+ <Relationship primaryKeyTable="department" foreignKeyTable="employee" many="true">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="department_id"/>
+ <KeyPair primaryKeyColumn="name" foreignKeyColumn="department_name"/>
+ </Relationship>
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/rsc/testKeyPairColumnTypeNotEqual.xml b/das-cpp/trunk/runtime/test/rsc/testKeyPairColumnTypeNotEqual.xml
new file mode 100644
index 0000000000..3da18378a1
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testKeyPairColumnTypeNotEqual.xml
@@ -0,0 +1,37 @@
+<?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" uri="test.key.pair.column.type.not.equal">
+
+ <Command name="get all employees and departments" SQL="SELECT * FROM department, employee;"/>
+
+ <Table tableName="department">
+ <Column sqlType="integer" columnName="id" primaryKey="true"/>
+ </Table>
+
+ <Table tableName="employee">
+ <Column sqlType="float" columnName="department_id" primaryKey="true"/>
+ </Table>
+
+ <Relationship primaryKeyTable="department" foreignKeyTable="employee" many="true">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="department_id"/>
+ </Relationship>
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/rsc/testManyRelationship1.xml b/das-cpp/trunk/runtime/test/rsc/testManyRelationship1.xml
new file mode 100644
index 0000000000..30ceadf1c0
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testManyRelationship1.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.
+ -->
+
+<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd" uri="test.many.relationship.one">
+
+ <Command name="get company 1 and its departments" SQL="SELECT * FROM company, department where company.id = 1;"/>
+
+ <Relationship primaryKeyTable="company" foreignKeyTable="department" many="true">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="company_id"/>
+ </Relationship>
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/rsc/testManyRelationship2.xml b/das-cpp/trunk/runtime/test/rsc/testManyRelationship2.xml
new file mode 100644
index 0000000000..9fa38c8a79
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testManyRelationship2.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.
+ -->
+
+<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd" uri="test.many.relationship.two">
+
+ <Command name="get company 1 and its departments" SQL="SELECT * FROM company, department where company.id = 1;"/>
+
+ <Relationship primaryKeyTable="company" foreignKeyTable="department" many="false">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="company_id"/>
+ </Relationship>
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/rsc/testModifyOperation.xml b/das-cpp/trunk/runtime/test/rsc/testModifyOperation.xml
new file mode 100644
index 0000000000..59ae0b986a
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testModifyOperation.xml
@@ -0,0 +1,41 @@
+<?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" uri="test.modify.operation">
+
+ <Command name="get all tables" SQL="SELECT * FROM company, department, employee;"/>
+
+ <Table tableName="Department">
+ <Column columnName="id" sqlType="integer" primaryKey="true"/>
+ <Column columnName="name" sqlType="varchar" primaryKey="true"/>
+ </Table>
+
+ <Relationship primaryKeyTable="company" foreignKeyTable="department">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="company_id"/>
+ </Relationship>
+
+ <Relationship primaryKeyTable="department" foreignKeyTable="employee">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="department_id"/>
+ <KeyPair primaryKeyColumn="name" foreignKeyColumn="department_name"/>
+ </Relationship>
+
+
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/rsc/testOCC1.xml b/das-cpp/trunk/runtime/test/rsc/testOCC1.xml
new file mode 100644
index 0000000000..605d1aee83
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testOCC1.xml
@@ -0,0 +1,43 @@
+<?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" uri="test.occ">
+
+ <Command name="get all companies" SQL="SELECT * FROM company;"/>
+
+ <Table tableName="Department">
+ <Column columnName="id" sqlType="integer" primaryKey="true"/>
+ <Column columnName="name" sqlType="varchar" primaryKey="true"/>
+ </Table>
+
+ <Table tableName="company">
+ <Column columnName="occ" sqlType="integer" collision="true" managed="true"/>
+ </Table>
+
+ <Relationship primaryKeyTable="company" foreignKeyTable="department">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="company_id"/>
+ </Relationship>
+
+ <Relationship primaryKeyTable="department" foreignKeyTable="employee">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="department_id"/>
+ <KeyPair primaryKeyColumn="name" foreignKeyColumn="department_name"/>
+ </Relationship>
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/rsc/testOCC2.xml b/das-cpp/trunk/runtime/test/rsc/testOCC2.xml
new file mode 100644
index 0000000000..65fab5927f
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/rsc/testOCC2.xml
@@ -0,0 +1,43 @@
+<?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" uri="test.occ">
+
+ <Command name="get all companies" SQL="SELECT * FROM company;"/>
+
+ <Table tableName="Department">
+ <Column columnName="id" sqlType="integer" primaryKey="true"/>
+ <Column columnName="name" sqlType="varchar" primaryKey="true"/>
+ </Table>
+
+ <Table tableName="company">
+ <Column columnName="occ" sqlType="integer" collision="true" managed="false"/>
+ </Table>
+
+ <Relationship primaryKeyTable="company" foreignKeyTable="department">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="company_id"/>
+ </Relationship>
+
+ <Relationship primaryKeyTable="department" foreignKeyTable="employee">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="department_id"/>
+ <KeyPair primaryKeyColumn="name" foreignKeyColumn="department_name"/>
+ </Relationship>
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/runtime/test/src/main.cpp b/das-cpp/trunk/runtime/test/src/main.cpp
new file mode 100644
index 0000000000..b8f6239680
--- /dev/null
+++ b/das-cpp/trunk/runtime/test/src/main.cpp
@@ -0,0 +1,843 @@
+/*
+ * 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.
+ */
+
+#include <iostream>
+#include <apache/das/rdb/Connection.h>
+#include <apache/das/DAS.h>
+#include <apache/das/rdb/DASImpl.h>
+#include <apache/das/CommandPtr.h>
+#include <apache/das/rdb/ResultSet.h>
+#include <apache/das/rdb/Statement.h>
+#include <apache/das/DASNullPointerException.h>
+#include <apache/das/rdb/DASOptimisticConcurrencyControlException.h>
+#include <apache/das/rdb/das_constants.h>
+#include <apache/das/rdb/Column.h>
+#include <apache/das/rdb/Table.h>
+#include <apache/das/DataGraphPrinter.h>
+#include <commonj/sdo/DataObject.h>
+#include <commonj/sdo/SDORuntimeException.h>
+#include <commonj/sdo/DataFactory.h>
+
+#define TEST_RESOURCE_PATH "../rsc/"
+
+using namespace std;
+using namespace apache::das;
+using namespace apache::das::rdb;
+
+std::string clearDBStatements[] = { "delete from EMPLOYEE",
+ "delete from DEPARTMENT",
+ "delete from COMPANY",
+ "drop table EMPLOYEE",
+ "drop table DEPARTMENT",
+ "drop table COMPANY"
+ };
+
+std::string resetDBStatements[] = { "create table COMPANY ( ID int not null, NAME varchar(20), OCC int, primary key(ID) )",
+ "create table DEPARTMENT ( ID int not null, NAME varchar(20) not null, COMPANY_ID int, foreign key (COMPANY_ID) references company (ID), primary key(ID, NAME) )",
+ "create table EMPLOYEE ( ID int not null, NAME varchar(20), DEPARTMENT_ID int, DEPARTMENT_NAME varchar(20), primary key(ID) )",
+ "insert into COMPANY values (1, 'apache', 0)",
+ "insert into COMPANY values (2, 'acme', 0)",
+ "insert into COMPANY values (3, 'google', 0)",
+ "insert into COMPANY values (4, 'ibm', 0)",
+ "insert into COMPANY values (5, 'yahoo', 0)",
+ "insert into DEPARTMENT values (1, 'department1', 1)",
+ "insert into DEPARTMENT values (2, 'department1', 1)",
+ "insert into DEPARTMENT values (3, 'department2', 2)",
+ "insert into DEPARTMENT values (5, 'department3', 3)",
+ "insert into DEPARTMENT values (4, 'department5', 2)",
+ "insert into DEPARTMENT values (6, 'department6', 3)",
+ "insert into EMPLOYEE values (1, 'adriano', 1, 'department1')",
+ "insert into EMPLOYEE values (2, 'paul', 1, 'department1')",
+ "insert into EMPLOYEE values (3, 'richard', 1, 'department1')",
+ "insert into EMPLOYEE values (4, 'ema', 2, 'department2')",
+ "insert into EMPLOYEE values (5, 'james', 2, 'department2')"
+ };
+
+Connection* getConnection() {
+ Connection* conn;
+
+ try {
+ std::string dsn = "DAStestcases";
+ std::string user = "postgres";
+ std::string password = "tuscany";
+
+ conn = new Connection(dsn, user, password);
+
+ } catch (SQLException& ex) {
+ cout << "couldn't connect to the data source: " << ex.what() << endl;
+ system("PAUSE");
+ exit(1);
+
+ }
+
+ StatementPtr stmt = conn->createStatement();
+
+ for (unsigned int i = 0 ; i < 6 ; i++) {
+
+ try {
+ stmt->executeQuery(clearDBStatements[i]);
+ } catch (SQLException& ex) {cout << ex.what() << endl;}
+
+ }
+
+ for (unsigned int i = 0 ; i < 19 ; i++) {
+
+ try {
+ stmt->executeQuery(resetDBStatements[i]);
+ } catch (SQLException& ex) {cout << ex.what() << endl;}
+
+ }
+
+ stmt->executeQuery("commit");
+
+ return conn;
+
+}
+
+
+void testPointers() {
+ cout << "-------------testPointers--------------" << endl;
+ Connection* conn = getConnection();
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(*conn);
+ Command* comm = new ReadCommandImpl(*das, "select * from COMPANY");
+ CommandPtr comm1 = *comm;
+ CommandPtr comm2 = comm1;
+ CommandPtr comm3 = das->createCommand("select * from COMPANY;");
+ StatementPtr stmtPtr1 = conn->createStatement();
+ Statement* stmt = stmtPtr1;
+ StatementPtr stmtPtr2 = stmtPtr1;
+ StatementPtr stmtPtr3 = conn->createStatement();
+ StatementPtr* stmtPtr4 = new StatementPtr(stmt);
+
+ cout << "Command pointer working correctly = ";
+ try {
+ comm1->executeQuery();
+ cout << "OK" << endl;
+ } catch (DASNullPointerException& exp) {
+ cout << "DASNullPointerException" << endl;
+ }
+
+ comm1 = 0;
+ comm2 = 0;
+ cout << "Command object deleted when there is no more reference = ";
+ try {
+ comm1->executeQuery();
+ cout << "not deleted" << endl;
+ } catch (DASNullPointerException& exp) {
+ cout << "OK" << endl;
+ }
+
+ delete das;
+ cout << "Command pointer set as null when object is deleted = ";
+ if (comm3 != 0) {
+ cout << "not null" << endl;
+ } else {
+ cout << "OK" << endl;
+ }
+
+ ResultSetPtr resultSetPtr = stmtPtr1->executeQuery("select * from COMPANY;");
+
+ cout << "ResultSet pointer working correctly = ";
+ try {
+ resultSetPtr->getStatement();
+ cout << "OK" << endl;
+ } catch (DASNullPointerException& exp) {
+ cout << "DASNullPointerException" << endl;
+ }
+
+ stmtPtr1->executeQuery("select * from EMPLOYEE;");
+ cout << "ResultSet object deleted when there is another query on its statement = ";
+ try {
+ resultSetPtr->getStatement();
+ cout << "not deleted" << endl;
+ } catch (DASNullPointerException& exp) {
+ cout << "OK" << endl;
+ }
+
+ cout << "Statement pointer working correctly = ";
+ try {
+ stmtPtr1->getODBCStatement();
+ cout << "OK" << endl;
+ } catch (DASNullPointerException& exp) {
+ cout << "DASNullPointerException" << endl;
+ }
+
+ stmtPtr1 = 0;
+ stmtPtr2 = 0;
+ delete stmtPtr4;
+ cout << "Statement object deleted when there is no more reference = ";
+ try {
+ stmtPtr1->getODBCStatement();
+ cout << "not deleted" << endl;
+ } catch (DASNullPointerException& exp) {
+ cout << "OK" << endl;
+ }
+
+ stmtPtr1 = conn->createStatement();
+ resultSetPtr = stmtPtr1 ->executeQuery("select * from COMPANY;");
+ ResultSetPtr resultSetPtr2 = resultSetPtr;
+ delete conn;
+ stmtPtr1 = 0;
+ resultSetPtr = 0;
+ resultSetPtr2 = 0;
+
+ cout << "Statement pointer set as null when object is deleted = ";
+ if (stmtPtr3 != 0) {
+ cout << "not null" << endl;
+ } else {
+ cout << "OK" << endl;
+ }
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testIncompleteCompositeRelationship() {
+ cout << "-------------testIncompleteCompositeRelationship--------------" << endl;
+
+ Connection* conn = getConnection();
+
+ {
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testIncompleteCompositeRelationship1.xml");
+
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+
+ CommandPtr command = das->getCommand("get incomplete relationship");
+
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ cout << "relationship ignored when the ResultSet does not contain all KeyPairs = ";
+ try {
+ root->getDataFactory()->getType(config.getURI(), "DEPARTMENT").getProperty("EMPLOYEE");
+ cout << "not ignored" << endl;
+
+ } catch (commonj::sdo::SDOPropertyNotFoundException& ex) {
+ cout << "OK" << endl;
+ }
+
+ delete das;
+
+ }
+
+ {
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testIncompleteCompositeRelationship2.xml");
+
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+
+ CommandPtr command = das->getCommand("get incomplete relationship");
+
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ cout << "relationship ignored when a defined relationship pk is not a table pk = ";
+ try {
+ root->getDataFactory()->getType(config.getURI(), "DEPARTMENT").getProperty("EMPLOYEE");
+ cout << "not ignored" << endl;
+
+ } catch (commonj::sdo::SDOPropertyNotFoundException& ex) {
+ cout << "OK" << endl;
+ }
+
+ delete das;
+
+ }
+
+ delete conn;
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testCompositeRelationship() {
+ cout << "-------------testCompositeRelationship--------------" << endl;
+
+ Connection* conn = getConnection();
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testCompositeRelationship.xml");
+
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+
+ CommandPtr command = das->getCommand("get composite relationship");
+
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ cout << "relationship created = ";
+ try {
+ root->getDataFactory()->getType(config.getURI(), "DEPARTMENT").getProperty("EMPLOYEE");
+ cout << "OK" << endl;
+
+ cout << "references set = ";
+ if (root->getDataObject("DEPARTMENT[1]")->getList("EMPLOYEE").size() != 0) {
+ cout << "OK" << endl;
+ } else {
+ cout << "not set" << endl;
+ }
+
+ } catch (commonj::sdo::SDOPropertyNotFoundException& ex) {
+ cout << "not created" << endl;
+
+ }
+
+ delete conn;
+ delete das;
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testCOCRelationship() {
+ cout << "-------------testCOCRelationship--------------" << endl;
+
+ Connection* conn = getConnection();
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(*conn);
+
+ CommandPtr command = das->createCommand("SELECT * FROM DEPARTMENT, COMPANY;");
+
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+
+ cout << "relationship created = ";
+ try {
+ root->getDataFactory()->getType(das->getConfig().getURI(), "COMPANY").getProperty("DEPARTMENT");
+ cout << "OK" << endl;
+
+ } catch (commonj::sdo::SDOPropertyNotFoundException& ex) {
+ cout << "not created" << endl;
+ }
+
+ delete conn;
+ delete das;
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testKeyPairColumnTypeNotEqual() {
+ cout << "-------------testKeyPairColumnTypeNotEqual--------------" << endl;
+
+ Connection* conn = getConnection();
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testKeyPairColumnTypeNotEqual.xml");
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+ CommandPtr command = das->getCommand("get all employees and departments");
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ cout << "relationship ignored when keypair types are not equal = ";
+ try {
+ root->getDataFactory()->getType(config.getURI(), "DEPARTMENT").getProperty("EMPLOYEE");
+ cout << "not ignored" << endl;
+
+ } catch (commonj::sdo::SDOPropertyNotFoundException& ex) {
+ cout << "OK" << endl;
+ }
+
+ delete conn;
+ delete das;
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testUniqueObjectByID() {
+ cout << "-------------testUniqueObjectByID--------------" << endl;
+
+ Connection* conn = getConnection();
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(*conn);
+ CommandPtr command = das->createCommand("SELECT * FROM COMPANY, DEPARTMENT where COMPANY.ID = 1;");
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ cout << "table duplicated row ignored = ";
+ if (root->getList("COMPANY").size() == 1) {
+ cout << "OK" << endl;
+ } else {
+ cout << "not ignored" << endl;
+ }
+
+ delete conn;
+ delete das;
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testDeleteOperation() {
+ cout << "-------------testDeleteOperation--------------" << endl;
+
+ Connection* conn = getConnection();
+
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testDeleteOperation.xml");
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+ CommandPtr command = das->getCommand("get all tables");
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ root->getDataObject("COMPANY[1]")->getDataObject("DEPARTMENT[1]")->detach();
+ commonj::sdo::DataObjectPtr company = root->getDataObject("COMPANY[1]");
+ company->detach();
+ long removedCompanyID = company->getInt("ID");
+
+ cout << "COMPANY with id " << removedCompanyID << " deleted on database: ";
+
+ das->applyChanges(root);
+
+ root = command->executeQuery();
+
+ commonj::sdo::DataObjectList& companies = root->getList("COMPANY");
+ bool failed = true;
+ for (unsigned int i = 0 ; i < companies.size() ; i++) {
+ failed = false;
+
+ if (companies[i]->getInt("ID") == removedCompanyID) {
+ cout << "Failed" << endl;
+ failed = true;
+ break;
+
+ }
+
+ }
+
+ if (!failed) {
+ cout << "OK" << endl;
+ }
+
+ delete conn;
+ delete das;
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testCreateOperation() {
+ cout << "-------------testCreateOperation--------------" << endl;
+
+ Connection* conn = getConnection();
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testCreateOperation.xml");
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+ CommandPtr command = das->getCommand("get all tables");
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ commonj::sdo::DataObjectPtr company = root->createDataObject("COMPANY");
+ StringWrapper("hp").defineOnDataObject(company, "NAME");
+ company->setInt("ID", 40);
+
+ commonj::sdo::DataObjectPtr department = root->createDataObject("DEPARTMENT");
+ StringWrapper("DEPARTMENT40").defineOnDataObject(department, "NAME");
+ department->setInt("ID", 39);
+
+ company = root->getDataObject("COMPANY[1]");
+ long departmentCompanyID = company->getInt("ID");
+ company->getList("DEPARTMENT").append(department);
+
+ commonj::sdo::DataObjectPtr employee = root->createDataObject("EMPLOYEE");
+ StringWrapper("juan").defineOnDataObject(employee, "NAME");
+ employee->setInt("ID", 38);
+ department->getList("EMPLOYEE").append(employee);
+
+ das->applyChanges(root);
+
+ root = command->executeQuery();
+
+ commonj::sdo::DataObjectList& departments = root->getList("DEPARTMENT");
+ bool failed = true;
+ for (unsigned int i = 0 ; i < departments.size() ; i++) {
+
+ if (departments[i]->getInt("ID") == 39 && StringWrapper(departments[i], "NAME").getString() == "DEPARTMENT40"
+ && departments[i]->getDataObject("EMPLOYEE[1]")->getInt("ID") == 38
+ && StringWrapper(departments[i]->getDataObject("EMPLOYEE[1]"), "NAME").getString() == "juan") {
+
+ failed = false;
+ break;
+
+ }
+
+ }
+
+ if (!failed) {
+ failed = true;
+ commonj::sdo::DataObjectList& companies = root->getList("COMPANY");
+ for (unsigned int i = 0 ; i < companies.size() ; i++) {
+
+ if (companies[i]->getInt("ID") == departmentCompanyID) {
+ commonj::sdo::DataObjectList& companyDepartments = root->getList("DEPARTMENT");
+
+ for (unsigned int i = 0 ; i < companyDepartments.size() ; i++) {
+
+ if (companyDepartments[i]->getInt("ID") == 39) {
+ failed = false;
+ break;
+
+ }
+
+ }
+
+ break;
+
+ }
+
+ }
+
+ }
+
+ if (failed) {
+ cout << "Failed" << endl;
+ } else {
+ cout << "OK" << endl;
+ }
+
+ delete conn;
+ delete das;
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+//
+
+void testMofidyOperation() {
+ cout << "-------------testMofidyOperation--------------" << endl;
+
+ Connection* conn = getConnection();
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testModifyOperation.xml");
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+ CommandPtr command = das->getCommand("get all tables");
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ commonj::sdo::DataObjectPtr company1 = root->getDataObject("COMPANY[1]");
+ commonj::sdo::DataObjectPtr company2 = root->getDataObject("COMPANY[2]");
+
+ StringWrapper("intel").defineOnDataObject(company1, "NAME");
+
+ commonj::sdo::DataObjectPtr department = root->createDataObject("DEPARTMENT");
+ StringWrapper("department40").defineOnDataObject(department, "NAME");
+ department->setInt("ID", 39);
+ company1->getList("DEPARTMENT").append(department);
+
+ department = company1->getList("DEPARTMENT").remove(0);//company->getDataObject("DEPARTMENT[1]");
+ company2->getList("DEPARTMENT").append(department);
+
+ commonj::sdo::DataObjectPtr employee = root->createDataObject("EMPLOYEE");
+ StringWrapper("albert").defineOnDataObject(employee, "NAME");
+ employee->setInt("ID", 37);
+ department->getList("EMPLOYEE").append(employee);
+
+ das->applyChanges(root);
+
+ commonj::sdo::DataObjectPtr dob;
+ bool failed = false;
+ try {
+ dob = root->getDataObject("COMPANY[NAME='intel']");
+ } catch (commonj::sdo::SDOPathNotFoundException& ex) {
+ cout << ex.getMessageText() << endl;
+ failed = true;
+
+ }
+
+ try {
+ dob = root->getDataObject("COMPANY[NAME='intel']/DEPARTMENT[NAME='department40'and ID=39]");
+ } catch (commonj::sdo::SDOPathNotFoundException& ex) {
+ cout << ex.getMessageText() << endl;
+ failed = true;
+
+ }
+
+ try {
+ dob = root->getDataObject("COMPANY[ID=2]/DEPARTMENT[ID=1]");
+ } catch (commonj::sdo::SDOPathNotFoundException& ex) {
+ cout << ex.getMessageText() << endl;
+ failed = true;
+
+ }
+
+ try {
+ dob = root->getDataObject("COMPANY[ID=2]/DEPARTMENT[ID=1]/EMPLOYEE[ID=37 and NAME='albert']");
+ } catch (commonj::sdo::SDOPathNotFoundException& ex) {
+ cout << ex.getMessageText() << endl;
+ failed = true;
+
+ }
+
+ if (failed) {
+ cout << "Failed" << endl;
+ } else {
+ cout << "OK" << endl;
+ }
+
+ delete conn;
+ delete das;
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testOCC() {
+ cout << "-------------testOCC--------------" << endl;
+
+ Connection* conn = getConnection();
+ {
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testOCC1.xml");
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+ CommandPtr command = das->getCommand("get all companies");
+ commonj::sdo::DataObjectPtr root1 = command->executeQuery();
+ commonj::sdo::DataObjectPtr root2 = command->executeQuery();
+
+ commonj::sdo::DataObjectPtr company = root1->getDataObject("COMPANY[ID=1]");
+ StringWrapper("microsoft").defineOnDataObject(company, "NAME");
+ long oldOCCValue = company->getInt("OCC");
+
+ das->applyChanges(root1);
+
+ root1 = command->executeQuery();
+
+ cout << "OCC field incremented after changes applied: ";
+ if (root1->getDataObject("COMPANY[ID=1]")->getInt("OCC") > oldOCCValue) {
+ cout << "OK";
+ } else {
+ cout << "Failed";
+ }
+
+ cout << endl;
+
+ company = root2->getDataObject("COMPANY[ID=1]");
+ StringWrapper("dell").defineOnDataObject(company, "NAME");
+
+ cout << "DASOptimisticConcurrencyControlException thrown in attempt to modify a row with different occ field value: ";
+ try {
+ das->applyChanges(root2);
+ cout << "Failed";
+
+ } catch (DASOptimisticConcurrencyControlException&) {
+ cout << "OK";
+ }
+
+ cout << endl;
+ delete das;
+
+
+ }
+
+ {
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testOCC2.xml");
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+ CommandPtr command = das->getCommand("get all companies");
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ commonj::sdo::DataObjectPtr company = root->getDataObject("COMPANY[ID=1]");
+ StringWrapper("dell").defineOnDataObject(company, "NAME");
+ long oldOCCValue = company->getInt("OCC");
+
+ das->applyChanges(root);
+
+ root = command->executeQuery();
+
+ cout << "OCC field not incremented when it's not managed by DAS: ";
+ if (root->getDataObject("COMPANY[ID=1]")->getInt("OCC") == oldOCCValue) {
+ cout << "OK";
+ } else {
+ cout << "Failed";
+ }
+
+ cout << endl;
+ delete das;
+
+ }
+
+ delete conn;
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testManyRelationship() {
+ cout << "-------------testManyRelationship--------------" << endl;
+
+ Connection* conn = getConnection();
+ {
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testManyRelationship1.xml");
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+ CommandPtr command = das->getCommand("get company 1 and its departments");
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ cout << "reference created as many on data graph = ";
+ if (root->getDataFactory()->getType(config.getURI(), "COMPANY").getProperty("DEPARTMENT").isMany()) {
+ cout << "OK" << endl;
+
+ cout << "all data objects added on reference list = ";
+ if (root->getDataObject("COMPANY[1]")->getList("DEPARTMENT").size() > 1) {
+ cout << "OK" << endl;
+ } else {
+ cout << "not added all data objects" << endl;
+ }
+
+ } else {
+ cout << "not created as many" << endl;
+ }
+
+ delete das;
+
+ }
+
+ {
+ ConfigImpl config((std::string) TEST_RESOURCE_PATH + "testManyRelationship2.xml");
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *conn);
+ CommandPtr command = das->getCommand("get company 1 and its departments");
+ commonj::sdo::DataObjectPtr root = command->executeQuery();
+
+ cout << "reference created as not many on data graph = ";
+ if (!root->getDataFactory()->getType(config.getURI(), "COMPANY").getProperty("DEPARTMENT").isMany()) {
+ cout << "OK" << endl;
+
+ cout << "only one data object added on reference = ";
+ if (root->getDataObject("COMPANY[1]")->isNull("DEPARTMENT")) {
+ cout << "reference data object not set" << endl;
+ } else {
+ cout << "OK" << endl;
+ }
+
+ } else {
+ cout << "not created as many" << endl;
+ }
+
+ delete das;
+
+ }
+
+ delete conn;
+
+ cout << "---------------------------------" << endl << endl;
+
+}
+
+void testDataTypes() {
+ Connection* conn;
+
+ try {
+ std::string dsn = "PostgresTestcases2";
+ std::string user = "postgres";
+ std::string password = "tuscany";
+
+ conn = new Connection(dsn, user, password);
+
+ } catch (SQLException& ex) {
+ cout << "couldn't connect to the data source: " << ex.what() << endl;
+ system("PAUSE");
+ exit(1);
+
+ }
+
+ StatementPtr stmt = conn->createStatement();
+ ResultSetPtr rs = stmt->executeQuery("select * from DATA;");
+ const ResultSetMetaData& rsm = rs->getResultSetMetaData();
+ rs->next();
+ for (int i = 0 ; i < rsm.getColumnCount() ; i++) {
+ SQLSMALLINT type = rsm.getSQLType(i);
+ cout << rsm.getColumnName(i) << ": ";
+
+ switch (type) {
+ case SQL_INTEGER : cout << "SQL_INTEGER" << endl; break;
+ case SQL_DECIMAL : cout << "SQL_DECIMAL" << endl; break;
+ case SQL_CHAR : cout << "SQL_CHAR" << endl; break;
+ case SQL_NUMERIC : cout << "SQL_NUMERIC" << endl; break;
+ case SQL_SMALLINT : cout << "SQL_SMALLINT" << endl; break;
+ case SQL_FLOAT : cout << "SQL_FLOAT" << endl; break;
+ case SQL_REAL : cout << "SQL_REAL" << endl; break;
+ case SQL_DOUBLE : cout << "SQL_DOUBLE" << endl; break;
+ case SQL_DATETIME : cout << "SQL_DATETIME" << endl; break;
+ case SQL_VARCHAR : cout << "SQL_VARCHAR" << endl; break;
+ case SQL_TYPE_DATE : cout << "SQL_TYPE_DATE" << endl; break;
+ case SQL_TYPE_TIME : cout << "SQL_TYPE_TIME" << endl; break;
+ case SQL_TYPE_TIMESTAMP : cout << "SQL_TYPE_TIMESTAMP" << endl; break;
+ case SQL_UNKNOWN_TYPE : cout << "SQL_UNKNOWN_TYPE" << endl; break;
+ default : cout << "more than unknown = " << type << endl;
+
+ }
+
+ Table table("DATA");
+ const apache::das::rdb::Column& column = table.addColumn(rsm.getColumnName(i), type);
+
+ cout << "SQL value = " << ColumnData(column, rs).toSQL() << endl;
+
+ }
+
+ delete conn;
+
+}
+
+int main() {
+
+ //testDataTypes();
+
+ //try {
+ testMofidyOperation();
+ /*} catch (...) {
+ cout << "FAILED (unexpected unknown exception)" << endl;
+ }*/
+
+ try {
+ testDeleteOperation();
+ } catch (...) {
+ cout << "FAILED (unexpected unknown exception)" << endl;
+ }
+
+ try {
+ testCreateOperation();
+ } catch (...) {
+ cout << "FAILED (unexpected unknown exception)" << endl;
+ }
+
+ try {
+ testPointers();
+ } catch (...) {
+ cout << "FAILED (unexpected unknown exception)" << endl;
+ }
+
+ try {
+ testUniqueObjectByID();
+ } catch (...) {
+ cout << "FAILED (unexpected unknown exception)" << endl;
+ }
+
+ try {
+ testIncompleteCompositeRelationship();
+ } catch (...) {
+ cout << "FAILED (unexpected unknown exception)" << endl;
+ }
+
+ try {
+ testCompositeRelationship();
+ } catch (...) {
+ cout << "FAILED (unexpected unknown exception)" << endl;
+ }
+
+ try {
+ testCOCRelationship();
+ } catch (...) {
+ cout << "FAILED (unexpected unknown exception)" << endl;
+ }
+
+ try {
+ testManyRelationship();
+ } catch (...) {
+ cout << "FAILED (unexpected unknown exception)" << endl;
+ }
+
+ try {
+ testOCC();
+ } catch (...) {
+ cout << "FAILED (unexpected unknown exception)" << endl;
+ }
+
+ system("PAUSE");
+
+}
diff --git a/das-cpp/trunk/samples/CompanySample/Readme.html b/das-cpp/trunk/samples/CompanySample/Readme.html
new file mode 100644
index 0000000000..335b6b1543
--- /dev/null
+++ b/das-cpp/trunk/samples/CompanySample/Readme.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
+ <TITLE>Tuscany RDB DAS Sample</TITLE>
+ <META NAME="GENERATOR" CONTENT="BrOffice.org 2.0 (Win32)">
+ <META NAME="CREATED" CONTENT="20070623;3134782">
+ <META NAME="CHANGEDBY" CONTENT="a a">
+ <META NAME="CHANGED" CONTENT="20070625;523460">
+ <META NAME="ProgId" CONTENT="Word.Document">
+ <META NAME="Originator" CONTENT="Microsoft Word 10">
+ <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+ <!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Author>IBM_USER</o:Author>
+ <o:LastAuthor>IBM_USER</o:LastAuthor>
+ <o:Revision>5</o:Revision>
+ <o:TotalTime>25</o:TotalTime>
+ <o:Created>2006-10-19T16:54:00Z</o:Created>
+ <o:LastSaved>2006-10-24T16:41:00Z</o:LastSaved>
+ <o:Pages>1</o:Pages>
+ <o:Words>739</o:Words>
+ <o:Characters>4216</o:Characters>
+ <o:Company>IBM</o:Company>
+ <o:Lines>35</o:Lines>
+ <o:Paragraphs>9</o:Paragraphs>
+ <o:CharactersWithSpaces>4946</o:CharactersWithSpaces>
+ <o:Version>10.6735</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]-->
+ <!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:SpellingState>Clean</w:SpellingState>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]-->
+ <!--[if !mso]><object
+ classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
+<style>
+st1\:*{behavior:url(#ieooui) }
+</style>
+<![endif]-->
+ <!--[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]-->
+ <!--[if gte mso 9]><xml>
+ <u1:shapelayout u2:ext="edit">
+ <u1:idmap u2:ext="edit" data="1"/>
+ </u1:shapelayout>
+</xml><![endif]-->
+ <!--[if gte mso 9]><xml>
+ <o:shapedefaults v:ext="edit" spidmax="3074"/>
+</xml><![endif]-->
+ <!--[if gte mso 9]><xml>
+ <o:shapelayout v:ext="edit">
+ <o:idmap v:ext="edit" data="1"/>
+ </o:shapelayout></xml><![endif]-->
+ <!-- <p class=MsoNormal><span style="font-size: 9pt">&nbsp;</span></p>
+<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>
+<p class=MsoNormal><span style="font-size: 9pt"><br>
+&nbsp;</span></p>
+<p class=MsoNormal><span style='font-size:9.0pt'>
+<o:p>&nbsp;</o:p></span></p>
+
+-->
+ <STYLE>
+ <!--
+ H1 { color: #000000 }
+ P { color: #000000; font-family: "Verdana", "Helvetica", "Arial", sans-serif; font-size: 12pt }
+ H2 { background: #dddddd; border: 1px solid #999999; padding-top: 0.11cm; padding-bottom: 0.11cm; padding-left: 0.16cm; padding-right: 0.11cm; color: #990000 }
+ A:visited { color: #800080 }
+ A:link { color: #3366aa; text-decoration: none }
+ -->
+ </STYLE>
+</HEAD>
+<BODY LANG="en-US" TEXT="#000000" LINK="#3366aa" VLINK="#800080" DIR="LTR" STYLE="border: none; padding: 0cm">
+<H1 LANG="pt-BR">Tuscany RDB DAS Sample (CompanySample)&nbsp;</H1>
+<P LANG="pt-BR">This sample shows how to load data from a RDB
+ source, using RDB DAS, into a SDO graph, then retrieve data
+ from it, modify the graph and update the data source based on the modified graph.</P>
+<H2 LANG="pt-BR">Setup</H2>
+<UL>
+ <LI><P LANG="pt-BR"><SPAN STYLE="text-decoration: none"><FONT COLOR="#000000">Follow
+ the
+ <A HREF="https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/GettingStarted.html">https://svn.apache.org/repos/asf/incubator/tuscany/cpp/das/GettingStarted.html</A>
+ document to download, compile and install Tuscany DAS for C++.</FONT></SPAN></P>
+ <LI><P ><SPAN STYLE="text-decoration: none">Download
+ the latest version of Postgres Core and ODBC Driver. You can find it
+ here: <A HREF="http://www.postgresql.org/download/">http://www.postgresql.org/download/</A>.</SPAN></P>
+ <LI><P ><SPAN STYLE="text-decoration: none">Install both, Postgres Core and ODBC Driver, on your OS.</SPAN></P>
+
+</UL>
+<H2 LANG="pt-BR">Compiling the Sample</H2>
+<P LANG="pt-BR">Compile the sample source using Visual Studio Express
+solution under &lt;tuscany_das_cpp&gt;/samples/CompanySample/VSExpress/.</P>
+<H2 LANG="pt-BR">Running the Sample</H2>
+<P LANG="pt-BR">To run the sample execute the file
+&lt;tuscany_das_cpp&gt;/samples/CompanySample/VSExpress/debug/CompanySample.exe</P>
+<P LANG="pt-BR"><B>Requirements</B>:</P>
+<UL>
+ <LI><P LANG="pt-BR">Postgres server must be running accepting connection from localhost.</P>
+ <LI><P >The sample access a data source using DSN, it by default access a DSN named "DAStestcases" using "postgres" user with "tuscany" password. However this settings can be modified on main function defined on &lt;tuscany_das_cpp&gt;/samples/CompanySample/src/main.cpp:
+<P STYLE="margin-left: 2cm; margin-bottom: 0cm"><FONT SIZE=2>...<BR>std::string
+ dsn = <FONT COLOR="#800000">&quot;DASCompanySample&quot;</FONT><FONT COLOR="#000000">;</FONT><BR><FONT COLOR="#000000">std::string
+ user = <FONT COLOR="#800000">&quot;postgres&quot;</FONT><FONT COLOR="#000000">;</FONT><BR><FONT COLOR="#000000">std::string
+ password = <FONT COLOR="#800000">&quot;tuscany&quot;</FONT<FONT COLOR="#000000">;</FONT><BR><FONT COLOR="#000000">...</FONT></FONT></FONT></P>
+</UL>
+<H2 LANG="pt-BR"><FONT SIZE=5><B>Sample Architecture</B></FONT></H2>
+<P LANG="pt-BR"><FONT SIZE=2>The sample files are located under
+&lt;tuscany_das_cpp&gt;/samples/CompanySample/.</FONT></P>
+<P LANG="pt-BR"><FONT SIZE=2><B>Contents</B>:</FONT></P>
+
+<UL>
+ <LI><P LANG="pt-BR"><FONT SIZE=2>/src/main.cpp: This file contains the sample source code.</FONT></P>
+</UL>
+
+</BODY>
+</HTML> \ No newline at end of file
diff --git a/das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample.sln b/das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample.sln
new file mode 100644
index 0000000000..7cf5a5a2f4
--- /dev/null
+++ b/das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CompanySample", "CompanySample\CompanySample.vcproj", "{AAA4B06B-A3FA-485D-A450-4965B6EF2F58}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AAA4B06B-A3FA-485D-A450-4965B6EF2F58}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AAA4B06B-A3FA-485D-A450-4965B6EF2F58}.Debug|Win32.Build.0 = Debug|Win32
+ {AAA4B06B-A3FA-485D-A450-4965B6EF2F58}.Release|Win32.ActiveCfg = Release|Win32
+ {AAA4B06B-A3FA-485D-A450-4965B6EF2F58}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample.suo b/das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample.suo
new file mode 100644
index 0000000000..f2bb5e33c5
--- /dev/null
+++ b/das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample.suo
Binary files differ
diff --git a/das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample/CompanySample.vcproj b/das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample/CompanySample.vcproj
new file mode 100644
index 0000000000..6675c344f6
--- /dev/null
+++ b/das-cpp/trunk/samples/CompanySample/VSExpress/CompanySample/CompanySample.vcproj
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="CompanySample"
+ ProjectGUID="{AAA4B06B-A3FA-485D-A450-4965B6EF2F58}"
+ RootNamespace="SimpleRead"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(LIBXML2_HOME)\include&quot;;&quot;$(TUSCANY_DASCPP)/include&quot;;&quot;$(TUSCANY_SDOCPP)/include&quot;"
+ PreprocessorDefinitions="WIN32;_CONSOLE;_DEBUG"
+ RuntimeLibrary="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib tuscany_das.lib tuscany_sdo.lib"
+ AdditionalLibraryDirectories="$(TUSCANY_DASCPP)/lib;$(TUSCANY_SDOCPP)/lib"
+ GenerateDebugInformation="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="4"
+ AdditionalIncludeDirectories="&quot;$(LIBXML2_HOME)\include&quot;;&quot;$(TUSCANY_DASCPP)/include&quot;;&quot;$(TUSCANY_SDOCPP)/include&quot;"
+ PreprocessorDefinitions="WIN32;_CONSOLE;NDEBUG;_CRT_SECURE_NO_DEPRECATE"
+ RuntimeLibrary="2"
+ PrecompiledHeaderFile=".\Release/CompanySample.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_das.lib tuscany_sdo.lib odbc32.lib "
+ OutputFile=".\Release/CompanySample.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(TUSCANY_DASCPP)/lib;$(TUSCANY_SDOCPP)/lib"
+ ProgramDatabaseFile=".\Release/CompanySample.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\src\main.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/das-cpp/trunk/samples/CompanySample/build.xml b/das-cpp/trunk/samples/CompanySample/build.xml
new file mode 100644
index 0000000000..83a7e86dcb
--- /dev/null
+++ b/das-cpp/trunk/samples/CompanySample/build.xml
@@ -0,0 +1,134 @@
+<?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="TuscanyDASNative_Sample_CompanySample" default="all" basedir="../..">
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+ <!--
+ Notice that the basedir for this project is set to the TuscanyDAS root dir
+ This makes path setting in system.xml much simpler, but we'll just have to
+ set a property here to this directory.
+ -->
+
+ <target name="init">
+ <tstamp/>
+ <property name="this.dir" location="${basedir}/samples/CompanySample"/>
+ <property name="sample.CompanySample.dir" location="${this.dir}/build"/>
+ <property name="sample.CompanySample.src.dir" location="${this.dir}/src/"/>
+ <property name="sample.CompanySample.build.dir" location="${sample.CompanySample.dir}/build"/>
+ <property name="CompanySample.install.dir"
+ location="${tuscanyDAS.install.dir}/samples/CompanySample/bin"/>
+
+
+ </target>
+
+ <!--
+ Public targets
+ -->
+ <target name="all"
+ description="build and install the TuscanyDASNative CompanySample sample">
+ <antcall target="build"/>
+ <antcall target="install"/>
+ </target>
+
+ <target name="build"
+ description="build the TuscanyDASNative CompanySample sample">
+ <antcall target="build.sample.CompanySample"/>
+ </target>
+
+ <target name="install"
+ description="Install the TuscanyDASNative CompanySample sample">
+ <antcall target="install.sample.CompanySample"/>
+ </target>
+
+ <target name="clean"
+ description="Clean the TuscanyDASNative CompanySample sample">
+ <antcall target="clean.sample.CompanySample"/>
+
+ </target>
+
+ <target name="distribution" description="Generate the necessary distribution files of Company
+Sample and copy it to the distribution dir">
+ <antcall target="sample.CompanySample.distribution"/>
+ </target>
+
+ <!--
+ Internal targets
+ They can still be called, they're just not described, so wont show up in "ant -p"
+ -->
+
+ <!-- build -->
+
+ <target name="build.sample.CompanySample" depends="init,check.sdo">
+ <mkdir dir="${sample.CompanySample.build.dir}"/>
+
+ <copy todir="${sample.CompanySample.build.dir}">
+ <fileset dir="${sample.CompanySample.dir}" includes="*.h"/>
+ <fileset dir="${sample.CompanySample.dir}" includes="*.cpp"/>
+ </copy>
+ <!-- build the library -->
+ <cpp-build
+ srcdir="${sample.CompanySample.src.dir}"
+ infiles="*.cpp"
+ outdir="${sample.CompanySample.build.dir}/.libs"
+ outtype="executable"
+ outfile="CompanySample">
+ <custom-build-elements>
+ <includepath path="${tuscanyDAS.install.dir}/include"/>
+ <includepath path="${tuscany.sdo.home.dir}/include"/>
+
+ <libset dir="${tuscanyDAS.install.dir}/lib" libs="tuscany_das"/>
+ <libset dir="${tuscany.sdo.home.dir}/lib" libs="tuscany_sdo"/>
+ <libset libs="odbc32"/>
+
+ </custom-build-elements>
+ </cpp-build>
+ </target>
+
+
+ <!-- install -->
+
+ <target name="install.sample.CompanySample" depends="init">
+ <cpp-install-files
+ files="*.exe*"
+ srcdir="${sample.CompanySample.dir}/build/.libs/"
+ destdir="${CompanySample.install.dir}"/>
+ <copy todir="${CompanySample.install.dir}/../rsc" overwrite="true">
+ <fileset dir="${this.dir}/rsc/"/>
+ </copy>
+
+ </target>
+
+ <!-- clean -->
+
+ <target name="clean.sample.CompanySample" depends="init">
+ <delete dir="${sample.CompanySample.dir}" quiet="true"/>
+ </target>
+
+ <target name="sample.CompanySample.distribution">
+ <copy todir="${distribution.bin.dir}/samples/CompanySample" overwrite="true">
+ <fileset dir="${this.dir}/CompanySample" excludes="build/ rsc/ VSExpress/"/>
+ </copy>
+
+
+ </target>
+
+</project>
diff --git a/das-cpp/trunk/samples/CompanySample/rsc/sampleConfig.xml b/das-cpp/trunk/samples/CompanySample/rsc/sampleConfig.xml
new file mode 100644
index 0000000000..e87be4781d
--- /dev/null
+++ b/das-cpp/trunk/samples/CompanySample/rsc/sampleConfig.xml
@@ -0,0 +1,35 @@
+<?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" uri="test.composite.relationship">
+
+ <Command name="get all tables" SQL="SELECT * from department, company, employee;"/>
+
+ <Table tableName="department">
+ <Column sqlType="integer" columnName="id" primaryKey="true"/>
+ <Column sqlType="varchar" columnName="name" primaryKey="true"/>
+ </Table>
+
+ <Relationship primaryKeyTable="department" foreignKeyTable="employee" many="true">
+ <KeyPair primaryKeyColumn="id" foreignKeyColumn="department_id"/>
+ <KeyPair primaryKeyColumn="name" foreignKeyColumn="department_name"/>
+ </Relationship>
+
+</Config> \ No newline at end of file
diff --git a/das-cpp/trunk/samples/CompanySample/src/main.cpp b/das-cpp/trunk/samples/CompanySample/src/main.cpp
new file mode 100644
index 0000000000..b0e567486e
--- /dev/null
+++ b/das-cpp/trunk/samples/CompanySample/src/main.cpp
@@ -0,0 +1,175 @@
+/*
+ * 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.
+ */
+
+#include <string>
+#include <iostream>
+#include <direct.h>
+
+// including DAS headers
+#include <apache/das/rdb/Connection.h>
+#include <apache/das/rdb/DASImpl.h>
+#include <apache/das/rdb/SQLException.h>
+#include <apache/das/CommandPtr.h>
+
+// including SDO header
+#include <commonj/sdo/DataObject.h>
+
+using namespace apache::das::rdb;
+using namespace apache::das;
+using namespace commonj::sdo;
+using namespace std;
+
+std::string clearDBStatements[] = { "delete from employee",
+ "delete from department",
+ "delete from company",
+ "drop table employee",
+ "drop table department",
+ "drop table company"
+ };
+
+std::string resetDBStatements[] = { "create table company ( id int not null, name varchar(20), primary key(id) )",
+ "create table department ( id int not null, name varchar(20) not null, company_id int, foreign key (company_id) references company (id), primary key(id, name) )",
+ "create table employee ( id int not null, name varchar(20), department_id int, department_name varchar(20), primary key(id) )",
+ "insert into company values (1, 'apache')",
+ "insert into company values (2, 'acme')",
+ "insert into company values (3, 'google')",
+ "insert into company values (4, 'ibm')",
+ "insert into company values (5, 'yahoo')",
+ "insert into department values (1, 'department1', 1)",
+ "insert into department values (2, 'department1', 1)",
+ "insert into department values (3, 'department2', 2)",
+ "insert into department values (5, 'department3', 3)",
+ "insert into department values (4, 'department5', 2)",
+ "insert into department values (6, 'department6', 3)",
+ "insert into employee values (1, 'adriano', 1, 'department1')",
+ "insert into employee values (2, 'paul', 1, 'department1')",
+ "insert into employee values (3, 'richard', 1, 'department1')",
+ "insert into employee values (4, 'ema', 2, 'department2')",
+ "insert into employee values (5, 'james', 2, 'department2')"
+ };
+
+Connection* getConnection() {
+ Connection* conn;
+
+ try {
+ //Connect to a database using a DSN
+ std::string dsn = "DASCompanySample";
+ std::string user = "postgres";
+ std::string password = "tuscany";
+
+ conn = new Connection(dsn, user, password);
+
+ } catch (SQLException& ex) {
+ cout << "couldn't connect to the data source: " << ex.what() << endl;
+ system("PAUSE");
+ exit(1);
+
+ }
+
+ // Create and populate the database tables
+
+ StatementPtr stmt = conn->createStatement();
+
+ for (unsigned int i = 0 ; i < 6 ; i++) {
+
+ try {
+ stmt->executeQuery(clearDBStatements[i]);
+ } catch (SQLException& ex) {cout << ex.what() << endl;}
+
+ }
+
+ for (unsigned int i = 0 ; i < 19 ; i++) {
+
+ try {
+ stmt->executeQuery(resetDBStatements[i]);
+ } catch (SQLException& ex) {cout << ex.what() << endl;}
+
+ }
+
+ // Commit the changes
+ stmt->executeQuery("commit");
+
+ return conn;
+
+}
+
+void main() {
+ ConfigImpl config("../rsc/sampleConfig.xml");
+
+ // Get a connection
+ Connection* connection = getConnection();
+
+ // Create a DAS instance providing a connection using a factory
+ DASImpl* das = (DASImpl*) DASImpl::getFACTORY().createDAS(config, *connection);
+
+ // Get a SQL command from the config
+ CommandPtr command = das->getCommand("get all tables");
+
+ // Execute the sql command and generate a SDO graph with the returned data
+ DataObjectPtr root = command->executeQuery();
+
+ // Get all companies
+ DataObjectList& companyList = root->getList("COMPANY");
+
+ // Print each company id and name
+ for (int i = 0 ; i < companyList.size() ; i++) {
+ // Get the company id
+ long id = companyList[i]->getInt("ID");
+
+ // Get the name string length and allocate enough space for it
+ unsigned int stringLength = companyList[i]->getLength("NAME");
+ wchar_t* buffer = new wchar_t[stringLength];
+
+ // Get the company name
+ companyList[i]->getString("NAME", buffer, stringLength);
+ wstring name = wstring(buffer, stringLength);
+
+ // Print the company data
+ wcout << "Company: " << i << endl;
+ wcout << " id = " << id << endl;
+ wcout << " name = " << name << endl << endl;
+
+ // Free the allocated memory
+ delete [] buffer;
+
+ }
+
+ // Get a company named "apache"
+ DataObjectPtr company = root->getDataObject("COMPANY[NAME='apache']");
+
+ // Remove the first department of this company and get it
+ commonj::sdo::DataObjectPtr department = company->getList("DEPARTMENT").remove(0);;
+
+ // Change the company name to "amd"
+ wstring companyName = L"amd";
+ company->setString("NAME", companyName.c_str(), companyName.size());
+
+ // The department is added to the company named "ibm"
+ root->getDataObject("COMPANY[NAME='ibm']")->getList("DEPARTMENT").append(department);
+
+ // The graph changes are persited on the database
+ das->applyChanges(root);
+
+ // Free the allocated connection and DAS instance
+ delete das;
+ delete connection;
+
+ system("PAUSE");
+
+}
diff --git a/das-cpp/trunk/samples/build.xml b/das-cpp/trunk/samples/build.xml
new file mode 100644
index 0000000000..9d1d761ec3
--- /dev/null
+++ b/das-cpp/trunk/samples/build.xml
@@ -0,0 +1,68 @@
+<?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="TuscanyDASNative_samples" default="all" basedir="..">
+
+ <!--
+ This is the root level ant build.xml file for TuscanyDAS Native samples
+ Nothing is actually performed here, it just delegates to subdirectory
+ build.xml files.
+ -->
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+
+ <!--
+ Notice that the basedir for this project is set to the TuscanyDAS root dir
+ This makes path setting in system.xml much simpler, but we'll just have to
+ set a property here to this directory.
+ -->
+ <property name="this.dir" location="${basedir}/samples"/>
+
+ <property name="CompanySample.dir" location="${this.dir}/CompanySample"/>
+
+ <!--
+ Public targets
+ -->
+
+ <target name="all" description="Build and install all TuscanyDASNative samples">
+ <antcall target="CompanySample"/>
+ </target>
+
+ <!--
+ Using antfile and inheritAll="false" to maintain the subdir build.xml basedir settings
+ -->
+
+ <target name="CompanySample" description="Build and install the CompanySample sample">
+ <ant target="all" antfile="${CompanySample.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <!-- clean -->
+
+ <target name="clean" description="Clean all TuscanyDASNative samples">
+ <ant target="clean" antfile="${CompanySample.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="distribution" description="Generate the necessary distribution files of all samples and copy it to the distribution dir">
+ <ant target="distribution" antfile="${CompanySample.dir}/build.xml"/>
+ </target>
+
+</project>
diff --git a/das-cpp/trunk/tools/ant_cpptasks/build.xml b/das-cpp/trunk/tools/ant_cpptasks/build.xml
new file mode 100644
index 0000000000..3810f056b6
--- /dev/null
+++ b/das-cpp/trunk/tools/ant_cpptasks/build.xml
@@ -0,0 +1,75 @@
+<?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="org.apache.tuscany.das.cpp.antCompilers" default="all" basedir="../..">
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+ <target name="init">
+ <tstamp/>
+ <property name="this.dir" location="${basedir}/tools/ant_cpptasks"/>
+ <property name="build.dir" location="${this.dir}/build" />
+ <property name="java.src.dir" location="${this.dir}/tuscanyAntCompilers" />
+ <property name="install.dir" location="${basedir}/antscripts" />
+ <property name="class.name" value="TuscanyMSVC8DevStudioCCompiler" />
+ </target>
+
+ <target name="all" depends="init,build,install"/>
+
+ <target name="build" depends="init" description="Build tuscany ant msvc 8.0 compiler task">
+ <mkdir dir="${build.dir}" />
+
+ <!-- compile the source code -->
+ <javac srcdir="${java.src.dir}"
+ destdir="${build.dir}"
+ failonerror="true"
+ includeAntRuntime="no">
+ <classpath>
+ <pathelement path="${env.ANT_HOME}/lib/cpptasks.jar"/>
+ <pathelement path="${env.ANT_HOME}/lib/ant.jar"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="make.jar" depends="init,build">
+ <jar jarfile="${build.dir}/${class.name}.jar"
+ basedir="${build.dir}"
+ includes="tuscany/antCompilers/das/${class.name}.class">
+ <manifest>
+ <attribute name="Main-Class" value="tuscany.antCompilers.das.${class.name}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="install" depends="init,make.jar">
+ <mkdir dir="${install.dir}"/>
+ <copy todir="${install.dir}" overwrite='true'>
+ <fileset dir="${build.dir}" includes="${class.name}.jar"/>
+ </copy>
+ </target>
+
+ <target name="clean" depends="init" description="Clean of all the files created.">
+ <delete dir="${build.dir}" quiet="true"/>
+ <delete file="${install.dir}/${class.name}.jar" quiet="true"/>
+ </target>
+
+</project>
diff --git a/das-cpp/trunk/tools/ant_cpptasks/tuscanyAntCompilers/TuscanyMSVC8DevStudioCCompiler.java b/das-cpp/trunk/tools/ant_cpptasks/tuscanyAntCompilers/TuscanyMSVC8DevStudioCCompiler.java
new file mode 100644
index 0000000000..61d2120237
--- /dev/null
+++ b/das-cpp/trunk/tools/ant_cpptasks/tuscanyAntCompilers/TuscanyMSVC8DevStudioCCompiler.java
@@ -0,0 +1,227 @@
+/*
+ * 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 tuscany.antCompilers.das;
+
+import java.io.File;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.CUtil;
+import net.sf.antcontrib.cpptasks.OptimizationEnum;
+
+import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;
+import net.sf.antcontrib.cpptasks.compiler.CompilerConfiguration;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.PrecompilingCommandLineCCompiler;
+import net.sf.antcontrib.cpptasks.compiler.Processor;
+
+import net.sf.antcontrib.cpptasks.devstudio.DevStudioProcessor;
+import net.sf.antcontrib.cpptasks.devstudio.DevStudioLinker;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Environment;
+
+
+/**
+ * An abstract base class for compilers that are basically command line
+ * compatible with Microsoft(r) C/C++ Optimizing Compiler
+ *
+ * This class was taken from cpptasks. Its a combination of the following 2 classes:
+ * net.sf.antcontrib.cpptasks.devstudio.DevStudioCompatibleCCompiler
+ * net.sf.antcontrib.cpptasks.devstudio.DevStudioCCompiler
+ *
+ * To compile MSVC8.0 in debug mode, the cpptasks msvc compiler doesnt distinguish
+ * between msvc 7.1 and 8.0 and seems to actually be 7.1 centric. This implementation
+ * For the Apache Tuscany project tries to address those issues.
+ */
+
+public final class TuscanyMSVC8DevStudioCCompiler
+ extends PrecompilingCommandLineCCompiler
+{
+ private static String[] mflags_ =
+ new String[] {"/ML", "/MLd", null, null, "/MT", "/MTd", "/MD", "/MDd"};
+ // first four are single-threaded
+ // (runtime=static,debug=false), (..,debug=true),
+ // (runtime=dynamic,debug=true), (..,debug=false), (not supported)
+ // next four are multi-threaded, same sequence
+
+ // Indeces into the mflags_ array
+ private static int MINDEX_DEBUG = 1;
+ private static int MINDEX_STATIC_RUNTIME = 2;
+ private static int MINDEX_MULTI_THREADED = 4;
+
+ private static final TuscanyMSVC8DevStudioCCompiler instance_ =
+ new TuscanyMSVC8DevStudioCCompiler( "cl", false, null);
+
+ public static TuscanyMSVC8DevStudioCCompiler getInstance()
+ {
+ return instance_;
+ }
+
+ private TuscanyMSVC8DevStudioCCompiler(
+ String command,
+ boolean newEnvironment,
+ Environment env)
+ {
+ super(command,
+ "/bogus",
+ new String[]{".c", ".cc", ".cpp", ".cxx", ".c++"},
+ new String[]{".h", ".hpp", ".inl"},
+ ".obj",
+ false,
+ null,
+ newEnvironment,
+ env);
+ }
+
+ public Processor changeEnvironment(boolean newEnvironment, Environment env)
+ {
+ if (newEnvironment || env != null) {
+ return new TuscanyMSVC8DevStudioCCompiler(getCommand(), newEnvironment, env);
+ }
+ return this;
+ }
+
+ public Linker getLinker(LinkType type)
+ {
+ return DevStudioLinker.getInstance().getLinker(type);
+ }
+
+ public int getMaximumCommandLength()
+ {
+ return 32767;
+ }
+
+ protected void addImpliedArgs(
+ final Vector args,
+ final boolean debug,
+ final boolean multithreaded,
+ final boolean exceptions,
+ final LinkType linkType,
+ final Boolean rtti,
+ final OptimizationEnum optimization)
+ {
+ args.addElement("/c");
+ args.addElement("/nologo");
+ if (exceptions) {
+ // changed to eliminate warning on VC 2005, should support VC 6 and later
+ // use /GX to support VC5 - 2005 (with warning)
+ args.addElement("/EHsc");
+ }
+ int mindex = 0;
+ if (multithreaded) {
+ mindex += MINDEX_MULTI_THREADED;
+ }
+ boolean staticRuntime = linkType.isStaticRuntime();
+ if (!staticRuntime) {
+ mindex += MINDEX_STATIC_RUNTIME;
+ }
+
+ if (debug) {
+ mindex += MINDEX_DEBUG;
+ args.addElement("/Zi"); // Generates complete debugging information
+ args.addElement("/Od"); // Disables optimization
+
+ // Native DAS gets corrupted stack memory when /RTC1 argument is added
+ //args.addElement("/RTC1"); // Enables run-time error checking as opposed to depracated /GZ
+
+ args.addElement("/Gd"); // Uses the __cdecl calling convention (x86 only)
+ args.addElement("/D_DEBUG"); // Debug mode
+ } else {
+ args.addElement("/DNDEBUG");
+ if (optimization != null) {
+ if (optimization.isSize()) {
+ args.addElement("/O1");
+ }
+
+ if (optimization.isSpeed()) {
+ args.addElement("/O2");
+ }
+ }
+ }
+
+ String mflag = mflags_[mindex];
+ if (mflag == null) {
+ throw new BuildException(
+ "multithread='false' and runtime='dynamic' not supported");
+ }
+ args.addElement(mflag);
+ if (rtti != null && rtti.booleanValue()) {
+ args.addElement("/GR");
+ }
+ }
+
+ protected void addWarningSwitch(Vector args, int level)
+ {
+ DevStudioProcessor.addWarningSwitch(args, level);
+ }
+
+ protected CompilerConfiguration createPrecompileGeneratingConfig(
+ CommandLineCompilerConfiguration baseConfig,
+ File prototype,
+ String lastInclude)
+ {
+ String[] additionalArgs = new String[]{
+ "/Fp" + CUtil.getBasename(prototype) + ".pch", "/Yc"};
+ return new
+ CommandLineCompilerConfiguration(
+ baseConfig,
+ additionalArgs,
+ null,
+ true);
+ }
+
+ protected CompilerConfiguration createPrecompileUsingConfig(
+ CommandLineCompilerConfiguration baseConfig,
+ File prototype,
+ String lastInclude,
+ String[] exceptFiles)
+ {
+ String[] additionalArgs = new String[]{
+ "/Fp" + CUtil.getBasename(prototype) + ".pch",
+ "/Yu" + lastInclude};
+ return new
+ CommandLineCompilerConfiguration(
+ baseConfig,
+ additionalArgs,
+ exceptFiles,
+ false);
+ }
+
+ protected void getDefineSwitch(StringBuffer buffer, String define, String value)
+ {
+ DevStudioProcessor.getDefineSwitch(buffer, define, value);
+ }
+
+ protected File[] getEnvironmentIncludePath()
+ {
+ return CUtil.getPathFromEnvironment("INCLUDE", ";");
+ }
+
+ protected String getIncludeDirSwitch(String includeDir)
+ {
+ return DevStudioProcessor.getIncludeDirSwitch(includeDir);
+ }
+
+ protected void getUndefineSwitch(StringBuffer buffer, String define)
+ {
+ DevStudioProcessor.getUndefineSwitch(buffer, define);
+ }
+}
diff --git a/das-cpp/trunk/tools/build.xml b/das-cpp/trunk/tools/build.xml
new file mode 100644
index 0000000000..2fd2064a2e
--- /dev/null
+++ b/das-cpp/trunk/tools/build.xml
@@ -0,0 +1,95 @@
+<?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="TuscanyDASNative_tools" default="all" basedir="..">
+
+ <!--
+ This is the root level ant build.xml file for TuscanyDAS Native tools
+ Nothing is actually performed here, it just delegates to subdirectory
+ build.xml files.
+ -->
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+ <!--
+ Notice that the basedir for this project is set to the TuscanyDAS root dir
+ This makes path setting in system.xml much simpler, but we'll just have to
+ set a property here to this directory.
+ -->
+
+ <property name="this.dir" location="${basedir}/tools"/>
+ <property name="ant_cpptasks.dir" location="${this.dir}/ant_cpptasks"/>
+
+ <!--
+ Public targets
+ -->
+
+ <target name="all" description="Build and install all TuscanyDASNative tools">
+ <antcall target="build"/>
+ <antcall target="install"/>
+ </target>
+
+ <!--
+ Notice the ant_cpptasks tool is not included in the "all" target.
+ This is because its not something that should be built that often.
+ The resulting jar is included in TUSCANY_DAS_SRC_ROOT/antscripts svn
+ -->
+
+ <target name="build" description="Build all TuscanyDASNative tools">
+ <antcall target="build.ant_cpptasks"/>
+ </target>
+
+<target name="install" description="Install TuscanyDASNative tools">
+ <antcall target="install.ant_cpptasks"/>
+ </target>
+
+
+ <target name="clean" description="Clean all TuscanyDASNative tools">
+ <antcall target="clean.ant_cpptasks"/>
+ </target>
+
+ <!--
+ Internal targets
+ They can still be called, they're just not described, so wont show up in "ant -p"
+ Using antfile and inheritAll="false" to maintain the subdir build.xml basedir settings
+ -->
+
+ <!-- build -->
+
+ <target name="build.ant_cpptasks">
+ <ant target="build" antfile="${ant_cpptasks.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <!-- install -->
+
+ <target name="install.ant_cpptasks">
+ <ant target="install" antfile="${ant_cpptasks.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+
+ <!-- clean -->
+
+ <target name="clean.ant_cpptasks">
+ <ant target="clean" antfile="${ant_cpptasks.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+
+</project>