summaryrefslogtreecommitdiffstats
path: root/site/trunk/site-publish/das-c-architecture-guide.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/trunk/site-publish/das-c-architecture-guide.html')
-rw-r--r--site/trunk/site-publish/das-c-architecture-guide.html662
1 files changed, 662 insertions, 0 deletions
diff --git a/site/trunk/site-publish/das-c-architecture-guide.html b/site/trunk/site-publish/das-c-architecture-guide.html
new file mode 100644
index 0000000000..36c83390a1
--- /dev/null
+++ b/site/trunk/site-publish/das-c-architecture-guide.html
@@ -0,0 +1,662 @@
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE- 2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+ <HEAD>
+ <!-- generateKeywords macro -->
+ <META name="description" content="Apache Tuscany">
+ <META name="keywords" content="apache, apache tuscany, tuscany, service, services, fabric, soa, service oriented architecture, sca, service component architecture, das, sdo, csa, ruby, opensource">
+ <!-- generateKeywords macro end -->
+
+ <LINK type="text/css" rel="stylesheet" href="http://tuscany.apache.org/stylesheets/default.css">
+ <LINK rel="SHORTCUT ICON" href="https://cwiki.apache.org/confluence/pages/$images/favicon.ico">
+ <TITLE>Apache Tuscany : DAS C++ Architecture Guide</TITLE>
+ <META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
+
+ <BODY onload="init()">
+ <!-- topNav macro -->
+ <TABLE valign="top" border="0" cellspacing="0" cellpadding="0" width="100%" background="http://tuscany.apache.org/images/TuscanyLogoNEW_Text_120px_bg.jpg">
+ <TR>
+ <TD valing="top" align="left">
+ <A href="https://cwiki.apache.org/confluence/pages/$siteroot"><IMG src="http://tuscany.apache.org/images/TuscanyLogoNEW_Text_120px_bg.jpg" height="91" width="25" border="0"></A>
+ </TD>
+ <TD>
+ <A href="http://tuscany.apache.org/"><IMG src="http://tuscany.apache.org/images/TuscanyLogo.jpg" border="0"></A>
+ </TD>
+
+ <TD width="100%">
+ &nbsp;
+ </TD>
+
+ <!-- Adds the edit page link to the top banner-->
+ <TD valign="bottom">
+ <DIV style="padding: 2px 10px; margin: 0px;">
+ <A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=45093">
+ <IMG src="http://tuscany.apache.org/images/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A>
+ </DIV>
+ </TD>
+
+ </TR>
+ </TABLE>
+ <!-- topNav macro end -->
+
+ <!-- breadCrumbs macro -->
+ <TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
+ <TR class="topBar">
+ <TD align="left" valign="middle" class="topBarDiv" nowrap="true" width="100%">
+ &nbsp;<A href="home.html" title="Apache Tuscany">Apache Tuscany</A>&nbsp;&gt;&nbsp;<A href="home.html" title="Home">Home</A>&nbsp;&gt;&nbsp;<A href="das-overview.html" title="DAS Overview">DAS Overview</A>&nbsp;&gt;&nbsp;<A href="das-c.html" title="DAS C++">DAS C++</A>&nbsp;&gt;&nbsp;<A href="das-c-documentation-menu.html" title="DAS C++ Documentation Menu">DAS C++ Documentation Menu</A>&nbsp;&gt;&nbsp;<A href="" title="DAS C++ Architecture Guide">DAS C++ Architecture Guide</A>
+ </TD>
+
+ <TD align="right" valign="middle" class="topBarDiv" align="left" nowrap="true">
+ <A href="http://mail-archives.apache.org/mod_mbox/tuscany-user">User List</A> | <A href="http://mail-archives.apache.org/mod_mbox/tuscany-dev">Dev List</A> | <A href="http://issues.apache.org/jira/browse/Tuscany">Issue Tracker</A>&nbsp;&nbsp;
+ </TD>
+ </TR>
+ </TABLE>
+ <!-- breadCrumbs macro end -->
+
+
+ <TABLE border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF">
+ <TR>
+ <TD align="left" valign="top">
+
+ <!-- pageContent macro -->
+ <DIV id="PageContent">
+
+ <DIV class="pagecontent">
+ <DIV class="wiki-content">
+ <TABLE class="sectionMacro" border="0" cellpadding="5" cellspacing="0" width="100%"><TBODY><TR>
+<TD class="confluenceTd" valign="top" width="15%">
+<DIV class="panel" style="background-color: #ECF4D1;border-color: #C3CDA1;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #C3CDA1;background-color: #C3CDA1;"><B>General</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
+<P><A href="home.html" title="Home">Home</A><BR>
+<A href="http://www.apache.org/licenses/LICENSE-2.0.html" class="external-link" rel="nofollow">License </A><BR>
+<A href="das-java-get-involved.html" title="DAS Java Get Involved">Get Involved</A><BR>
+<A href="das-java-found-a-bug.html" title="DAS Java Found A Bug">Found a Bug?</A></P>
+</DIV></DIV>
+<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>DAS Java</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
+<P><A href="das-java.html" title="DAS Java">DAS Java Home</A><BR>
+<A href="das-java-faq.html" title="DAS Java - FAQ">FAQ</A><BR>
+<A href="das-java-releases.html" title="DAS Java Releases">Downloads</A><BR>
+<A href="das-java-documentation-menu.html" title="DAS Java Documentation Menu">Documentation</A><BR>
+<A href="https://svn.apache.org/repos/asf/tuscany/java/das/" class="external-link" rel="nofollow">Source Code</A></P>
+</DIV></DIV></TD>
+<TD class="confluenceTd" valign="top" width="85%">
+<DIV class="panel" style="background-color: #ffffff;border-color: #ECF4D1;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #ECF4D1;background-color: #ECF4D1;"><B>Apache Tuscany RDB DAS Java Architecture Guide</B></DIV><DIV class="panelContent" style="background-color: #ffffff;">
+<UL>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-Overview">Overview</A></LI>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-FunctionDescription">Function Description</A></LI>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-Architecture">Architecture</A></LI>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-UserInterface">User Interface</A></LI>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-ClassDiagram">Class Diagram</A></LI>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-DesignDetails">Design Details</A></LI>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-ConfigurationSchema%2528config.xsd%2529">Configuration Schema(config.xsd)</A></LI>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-ScalabilityAspects">Scalability Aspects</A></LI>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-Future">Future</A></LI>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-Samples">Samples</A></LI>
+ <LI><A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-TerminologyandUsefulLinks">Terminology and Useful Links</A></LI>
+</UL>
+</DIV></DIV>
+
+<H3><A name="DASC%2B%2BArchitectureGuide-Overview"></A><A name="DASC%2B%2BArchitectureGuide-Overview"></A>Overview</H3>
+
+<P>Service Data Object (SDO) and Service Component Architecture (SCA) are the basic building blocks in Service Oriented Architecture (SOA). SDO is the way of representing data in SCA. As the applications using SOA have back-end data representation in different formats like Database, File System, XML Based Data, etc., there is a need to provide a mapping between these data representations and SDO. C+&#43; RDB DAS (Data Access Service for Relational Database) is the effort to suffice this mapping requirement for Relational Database.</P>
+
+<H3><A name="DASC%2B%2BArchitectureGuide-FunctionDescription"></A><A name="DASC%2B%2BArchitectureGuide-FunctionDescription"></A> Function Description</H3>
+
+<P>RDB DAS provides 2 major capabilities:&#45;<BR>
+1) Execute SQL Queries and return result as a graph of Data Objects.<BR>
+2) Reflect changes made to a graph of Data Objects back to the database.<BR>
+It also supports explicit CUD SQL statements execution against database.<BR>
+<SPAN class="error">Unable to render embedded object: File (rdbDAS.gif) not found.</SPAN></P>
+
+<H3><A name="DASC%2B%2BArchitectureGuide-Architecture"></A><A name="DASC%2B%2BArchitectureGuide-Architecture"></A> Architecture</H3>
+
+<P>This section describes the overall architecture of C+&#43; RDB DAS. The details are elaborated in <A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-DesignDetails">Design Details</A>. Also, for details of different DAS Configuration settings, refer to <A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-ConfigurationSchema%2528config.xsd%2529">Configuration Schema(config.xsd)</A>.</P>
+
+<P>DAS functions based on external Configuration. This configuration can be specified using file or can be programmatically build by the caller, using Config interface.</P>
+
+<P>Design follows a factory pattern to create DAS instance. DAS instance contains <B>Connection</B>, <B>Config</B> and <B>Commands</B>.</P>
+
+<P>The <B>Connection</B> can either be passed from caller or can be created using the Configuration information(not implemented yet). It is used for all the database operations done in that DAS instance and also for controlling transactions.</P>
+
+<P><B>Commands</B> hold all the commands from Configuration file and also the ones that are created programmatically on the fly. The Command is implemented using different inherited classes like <B>Read/Insert/Update/Delete/OptimisticWrite</B> with root parent class <B>CommandImpl</B>. More details on different classes will be in <A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-DesignDetails">Design Details</A>.</P>
+
+<P><B>Config</B> holds the reference for Configuration associated with the DAS instance and contains all details as mentioned in <A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-ConfigurationSchema%2528config.xsd%2529">Configuration Schema (config.xsd)</A>.</P>
+
+<P>Caller has 2 (and some other) main APIs available in DAS instance to use the Commands <B>getCommand(name)</B> and <B>applyChanges(Data Object)</B></P>
+<OL>
+ <LI><B>getCommand(name)</B> is typically used to retrieve the Command (SQL String) available from Config. SQL String. User calls executeQuery() on this Command and based on whether it is CUD/Read operation. executeQuery() will return a root DataObject or a null DataObject.</LI>
+ <LI><B>applyChanges(Data Object)</B> is the way to process a SDO DataObject and SDO ChangeSummary to create SQL UPDATE statement to be executed against database. More details on SDO integration are in <A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-DesignDetails">Design Details</A>.</LI>
+</OL>
+
+
+<H3><A name="DASC%2B%2BArchitectureGuide-UserInterface"></A><A name="DASC%2B%2BArchitectureGuide-UserInterface"></A> User Interface</H3>
+
+<P>DAS exposes a set of interfaces to end user.</P>
+<UL>
+ <LI><B>DASFactory</B> uses different options to produce DAS instance using Factory pattern.<BR>
+<B>Method Summary</B>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> apache::das::DAS </TD>
+<TD class="confluenceTd"> createDAS(apache::das::rdb::ConnectionPtr connection) </TD>
+<TD class="confluenceTd"> Creates a DAS based on the provided connection </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> apache::das::DAS </TD>
+<TD class="confluenceTd"> createDAS(apache::das::Config config) </TD>
+<TD class="confluenceTd"> Creates a DAS based on the provided config object <BR class="atl-forced-newline"> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> apache::das::DAS </TD>
+<TD class="confluenceTd"> createDAS(apache::das::Config config, apache::das::rdb::ConnectionPtr connection) </TD>
+<TD class="confluenceTd"> Creates a DAS based on the provide config object and connection </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+</LI>
+</UL>
+
+
+<UL>
+ <LI><B>DAS Interface</B> to call APIs for DAS instance.<BR>
+<B>Field Summary</B>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> static apache::das::rdb::DASFactoryImpl </TD>
+<TD class="confluenceTd"> getFactory() </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+<P><B>Method Summary</B></P>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> void </TD>
+<TD class="confluenceTd"> applyChanges(commonj::sdo::DataObjectPtr root) </TD>
+<TD class="confluenceTd"> The change history is scanned and modifications to the graph of data objects are flushed to the database. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> apache::das::rdb::CommandPtr </TD>
+<TD class="confluenceTd"> createCommand(std::string sql) </TD>
+<TD class="confluenceTd"> Creates a Command based on the provided SQL statement </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> apache::das::rdb:: CommandPtr </TD>
+<TD class="confluenceTd"> getCommand(std::string name) </TD>
+<TD class="confluenceTd"> Gets the named command from this factory's inventory </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+</LI>
+</UL>
+
+
+<UL>
+ <LI><B>Command</B> Used to execute read / write (CRUD) on database.<BR>
+<B>Method Summary</B>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> commonj::sdo::DataObjectPtr </TD>
+<TD class="confluenceTd"> executeQuery() </TD>
+<TD class="confluenceTd"> Performs the function defined by the command and return the results in the root DataObject </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+</LI>
+</UL>
+
+
+<UL>
+ <LI><B>ConfigImpl</B> is used to load configuration for RDB DAS instance from a XML file. A instance of this class can be empty or can load information from a XML file.<BR>
+<B>Constructor Summary</B>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> apache::das::rdb::ConfigImpl() </TD>
+<TD class="confluenceTd"> creates an empty Config object <BR class="atl-forced-newline"> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> apache::das::rdb::ConfigImpl(std::string xmlFilePath) </TD>
+<TD class="confluenceTd"> creates a Config object based on data read from the specified XML file </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+<P><B>Method Summary</B></P>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> apache::das::rdb::Table&amp; </TD>
+<TD class="confluenceTd"> addTable(std::string tableName) </TD>
+<TD class="confluenceTd"> create a Table object with the specified table name, adds it to the Config&nbsp; object and returns a reference the created Table object <BR class="atl-forced-newline"> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> void </TD>
+<TD class="confluenceTd"> addCommand(std::string commandName, std::string sqlStatement) </TD>
+<TD class="confluenceTd"> add a command on the Config object <BR class="atl-forced-newline"> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Relationship </TD>
+<TD class="confluenceTd"> addRelationship(java.lang.String parentName, java.lang.String childName) </TD>
+<TD class="confluenceTd">&nbsp;</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Relationship </TD>
+<TD class="confluenceTd"> addRelationship(java.util.Vector parentNames, java.util.Vector childNames) </TD>
+<TD class="confluenceTd">&nbsp;</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Command </TD>
+<TD class="confluenceTd"> addSelectCommand(java.lang.String name, java.lang.String sql) </TD>
+<TD class="confluenceTd">&nbsp;</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Table </TD>
+<TD class="confluenceTd"> addTable(java.lang.String name, java.lang.String typeName) </TD>
+<TD class="confluenceTd">&nbsp;</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Command </TD>
+<TD class="confluenceTd"> addUpdateCommand(java.lang.String name, java.lang.String sql) </TD>
+<TD class="confluenceTd">&nbsp;</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> void </TD>
+<TD class="confluenceTd"> addUpdateStatement(Table table, java.lang.String statement, java.lang.String parameters) </TD>
+<TD class="confluenceTd">&nbsp;</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Config </TD>
+<TD class="confluenceTd"> getConfig() </TD>
+<TD class="confluenceTd">&nbsp;</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> void </TD>
+<TD class="confluenceTd"> setDataObjectModel(java.lang.String dataObjectModel) </TD>
+<TD class="confluenceTd">&nbsp;</TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+</LI>
+</UL>
+
+
+<UL>
+ <LI><B>Converter</B> A lightweight Table-column &lt;--&gt; DataObject-property converter framework. Converters allow a user to insert a transformation between a column's value and its destination DataObject property's value. For example, by default, a VARCHAR column will be represented as a String in its corresponding DataObject property. A user could insert a converter that transforms the VARCHAR value to an Integer. If this is done then although the column returns character data, the DataObject property will be an Integer<BR>
+<B>Method Summary</B>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> java.lang.Object </TD>
+<TD class="confluenceTd"> getColumnValue(java.lang.Object propertyData) </TD>
+<TD class="confluenceTd"> Transform the columnData object to a new value and possibly new type </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> java.lang.Object </TD>
+<TD class="confluenceTd"> getPropertyValue(java.lang.Object columnData) </TD>
+<TD class="confluenceTd"> Transform the columnData object to a new value and possibly new type. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+</LI>
+</UL>
+
+
+<UL>
+ <LI><B>Pager</B> An iterator-like interface to conveniently move through chunks of data. The idea is that a Pager works with a read Command. The read command returns a large amount of data and the client wants to work with chunks of it at a time. So the Pager is created on the command and each call to next returns the next chunk of data.<BR>
+<B>Method Summary</B>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> DataObject </TD>
+<TD class="confluenceTd"> getPage(int page) </TD>
+<TD class="confluenceTd"> Return a specific identified page </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> DataObject </TD>
+<TD class="confluenceTd"> next() </TD>
+<TD class="confluenceTd"> Get the next page of data </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> DataObject </TD>
+<TD class="confluenceTd"> previous() </TD>
+<TD class="confluenceTd"> Get the page prior to the last page returned </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+</LI>
+</UL>
+
+
+<UL>
+ <LI><B>GraphMerger</B> is utility class implementation (no interface), to provide functions for flexibly managing DataObjects.<BR>
+<B>Constructor Summary</B>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> GraphMerger() </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+<P><B>Method Summary</B></P>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> void </TD>
+<TD class="confluenceTd"> addPrimaryKey(java.lang.String key) </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> DataObject </TD>
+<TD class="confluenceTd"> emptyGraph(Config config) </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> DataObject </TD>
+<TD class="confluenceTd"> merge(DataObject primary, DataObject secondary) </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> DataObject </TD>
+<TD class="confluenceTd"> merge(java.util.List graphs) </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+</LI>
+</UL>
+
+
+<H3><A name="DASC%2B%2BArchitectureGuide-ClassDiagram"></A><A name="DASC%2B%2BArchitectureGuide-ClassDiagram"></A> Class Diagram</H3>
+
+<P><A href="rdb-das-class-diagram.html" title="RDB DAS class diagram">Class Diagram</A></P>
+
+<H3><A name="DASC%2B%2BArchitectureGuide-DesignDetails"></A><A name="DASC%2B%2BArchitectureGuide-DesignDetails"></A>Design Details</H3>
+
+<P>Major classes are described here at high level to show how these fit in the complete picture. For<BR>
+methods/members details please refer to javadoc from binary distribution at <A href="http://cwiki.apache.org/confluence/display/TUSCANY/DAS%20Downloads" class="external-link" rel="nofollow">Downloads</A>.</P>
+
+<P><B>DASFactoryImpl</B> Expose methods to create DAS instance from Config or Connection or both.</P>
+
+<P><B>DASImpl</B> The sole instance of DAS existing for one DAS runtime. It contains MappingWrapper, JDBC Connection and a Map of all DAS Commands. To create appropriate instances of CommandImpl, DASImpl, scan's each Config Command for attribute kind, and based on that required instance of CommandImpl is added to the map. Connection from DataSource or Database Driver Manager both are supported. releaseResources() method allows external caller to close JDBC Connection when it is supplied by the caller.Provides methods to get/create DAS Commands and applyChanges(changed DataObject) to reflect DataObject changes to Database.</P>
+
+<P><B>MappingWrapper</B> Wrapper over DAS Config. Provides various get/set methods for all different elements in DAS Config.</P>
+
+<P><B>ConnectionImpl</B> Contains JDBC Connection, and whether it is managed by DAS/caller and also whether Database platform support auto-generated key column values.</P>
+
+<P><B>BaseCommandImpl</B> Parent class for all other CommandImpl classes. Contains MappingWrapper. setConnection() method to associate ConnectionImpl with each DAS Command.</P>
+
+<P><B>ApplyChangesCommandImpl</B> Extends BaseCommandImpl. Contains ChangeSummarizer. It is used to load DataObject's ChangeSummary and for each change, Generator classes (UpdateGenerator, DeleteGenerator) are called to form appropriate SQL Statement with parameters, which is executed against the Database.</P>
+
+<P><B>CommandImpl</B> Extends BaseCommandImpl and implements DAS Config's &lt;Command&gt;. So, in effect it is parent class for all explicit CRUD Commands. It contains Statement, Parameters and ResultSetShape.</P>
+
+<P><B>WriteCommandImpl</B> Extends CommandImpl. Parent for CUD. If SELECT(Read) is attempted, exception is thrown.</P>
+
+<P><B>DeleteCommandImpl</B> Extends WriteCommandImpl.</P>
+
+<P><B>InsertCommandImpl</B> Extends WriteCommandImpl. Supports Database generated keys.</P>
+
+<P><B>UpdateCommandImpl</B> Extends WriteCommandImpl.</P>
+
+<P><B>OptimisticWriteCommandImpl</B> Extends UpdateCommandImpl. Supports OCC feature. Here by design when a CollisionParameter's value is attempted to change more than once, the CollisionParameter does not allow its value change (as during first setValue(), flag indicating that value is changed is set). So, the attempt results in no database rows getting changes. On this condition exception is thrown as Update Collision is occurred.</P>
+
+<P><B>ReadCommandImpl</B> Extends CommandImpl. Used for explicit SELECT. Support's DAS feature, ResultDescriptor. If CUD is attempted, exception is thrown. Supports paging. When Query is executed (executeQuery()), the JDBC ResultSet is converted into DataObject Graph and returned to caller.</P>
+
+<P><B>SPCommandImpl</B> Extends ReadCommandImpl for StoredProcedure call. Method executeQuery() is used when the stored procedure returns ResultSet and method execute() is used when the stored procedure does not have any return ResultSet.<BR>
+Parameters hold both IN and OUT parameters.</P>
+
+<P><B>PagerImpl</B> Holds ReadCommandImpl, page size and current page index. Implements next(), previous(), getPage(index) methods. In each based on current page index and page size, the ReadCommandImpl is executed with start and end boundaries set.</P>
+
+<P><B>ChangeFactory</B> This class is used during DAS.applyChanges(). With changed DataObject and ChangeSummary, required type of ChangeOperation instance is created (like DeleteOperation, UpdateOperation). This instance of ChangeOperation holds appropriate CommandImpl, which in itself holds the Parameters. Thus for a given DAS Config and Connection, ChangeFactory is used to propagate DataObject changes to Database via CommandImpl.</P>
+
+<P><B>ChangeSummarizer</B> Main function of this class is load Changes based on root DataObject of applyChanges() Command MappingWrapper is used to sort the ChangeOperations in Changes.</P>
+
+<P><B>Changes</B> Contains DeleteList, InsertList, Update List pertaining to one applyChanges() command.</P>
+
+<P><B>DeleteList</B> Maintains ordered/unordered list of DeleteOperations. If DAS Config defines any Relationships, MappingWrapper aids in forming Delete Order for all the Tables undergoing DeleteOperation, based on Parent-Child relationships. If Delete Order is available, DeleteList forms a List following appropriate Referential Integrity. Otherwise no order is maintained.</P>
+
+<P><B>InsertList</B> Maintains ordered/unordered list of CreateOperations. If DAS Config defines any Relationships, MappingWrapper aids in forming Insert Order for all the Tables undergoing InsertOperation, based on Parent-Child relationships. If Insert Order is available, InsertList forms a List following appropriate Referential Integrity. Otherwise no order is maintained.</P>
+
+<P><B>UpdateList</B> As UpdateOperation happens on single Table, there is no reason for sorting based on any Referntial Relationships. So, this class is just a wrapper on ArrayList.</P>
+
+<P><B>BaseGenerator</B> Parent class for Delete/Update/InsertGenerator. If in DAS Config, any Table Column specifies a ColumnConverter class, BaseGenerator, returns a new instance of this class.</P>
+
+<P><B>DeleteGenerator</B> Extends BaseGenerator. Based on Table and DAS Config, DELETE statement is generated with Primary Keys in WHERE clause. Using this, DeleteCommandImpl is instantiated. For Parameters in DeleteCommandImpl ColumnConverter is considered if present.</P>
+
+<P><B>InsertGenerator</B> Same as DeleteGenerator. Here Database Key value generation is also considered.</P>
+
+<P><B>UpdateGenerator</B> Extends BaseGenerator. In UPDATE statement WHERE clause Primary Keys are considered as well as Default OCC policy is considered. Also check is implemented for any violation for Foreign Key relationships. Parameters in UpdateCommandImpl consider ColumnConvert as appropriate. OCC attributes in DAS Config for &lt;Column&gt;, viz. managed and collision are considered in SET and WHERE clause formation respectively.</P>
+
+<P><B>ChangeOperation</B> Abstract parent class for Create/Delete/UpdateOperation. It contains WriteCommand, DatabaseObject and any generated ID.</P>
+
+<P><B>DeleteOperation</B> Extends ChangeOperation. Uses SDO's ChangeSummary based OldValues as in the DataGraph , deleted objects have lost their <B>settings</B>.</P>
+
+<P><B>CreateOperation</B> Extends ChangeOperation, makes use of Generated ID.</P>
+
+<P><B>UpdateOperation</B> Extends ChangeOperation and makes use of generated ID.</P>
+
+<P><B>DatabaseObject</B> Wraps DataObject. If a field is FK, it will return value from parent. It also sets the Database generated value in primary key property of DataObject.</P>
+
+<P><B>RowObjects</B> Holds a Map of TableName-&gt;DataObject. It uses relationship information to associate these DataObjects to form DataGraph .</P>
+
+<P><B>GraphBuilderMetadata</B> Class that form Metadata for forming DataObjects based on MetaData available in JDBC ResultSet. It uses DAS Config, ResultSet and ResultSetShape to form a Collection of ResultMetaData. It is used in ResultSetProcessor and thus further in RowObjects.</P>
+
+<P><B>ResultSetProcessor</B> This class is used to transform data in ResultSet into set of inter-related DataObjects. It contains TableRegistry, GraphBuilderMetadata and DataObjectMaker. Using GrapbBuilderMetadata and the JDBC ResultSet, it forms<BR>
+ResultSetRow , then form RowObjects and connects related DataObjects using Relationship information from RowObjects to form the completed DataGraph.</P>
+
+<P><B>DataObjectMaker</B> Forms DataObject based on TableData. It is used in ResultSetProcessor for this.</P>
+
+<P><B>TableRegistry</B> Base Interface for Single/MultiTableRegistry.</P>
+
+<P><B>SingleTableRegistry</B> No functionality.</P>
+
+<P><B>MultiTableRegistry</B> Implements TableRegistry. Used when converting JDBC ResultSet of SQL SELECT into DataObjects.</P>
+
+<P><B>DefaultConverter</B> Implements Converter. In case of Blob database column type, returns byte[] for the column value when mapping from database data to property value.</P>
+
+<P><B>ResultMetaData</B> Holds complete ResultSet related metadata of the Query result&#45; ResultSet, ColumnConverters, MappingWrapper, SDO Type Names, SDO Property Names, ResultSetShape for the ResultSet, Map containing Table Type <DEL>&gt; Column Property (equivalent to Database Table</DEL>&gt;Column). It provides various get methods on these members.</P>
+
+<P><B>ResultSetRow</B> A ResultSetRow is used to transform a single row of ResultSet into a set of DataObjects. It uses TableData as a intermediate place to keep Database Data for a Row , which is later used to form DataObject. It holds a List of all Table Data for the current row. This class is used in ResultSetProcessor.</P>
+
+<P><B>TableData</B> Holds single JDBC row for a Table and its Columns - tableName, list of PKs, Map of ColumnName-&gt;Data, if table has PK. Is used by DataObjectMaker to form DataObject based on Table Row.</P>
+
+<P><B>ResultSetTypeMap</B> Provides mapping from sql.Types to SDO Type. Used in ResultSetShape to populate SDO Type[] for all columns present in ResultSet.</P>
+
+<P><B>FactoryRegistry</B> Maintains registry of ChangeFactory. There is one FactoryRegistry for on DAS Config and Connection. It maintains a Map with entries of each SDO Type against ChangeFactory for current DAS Config+Connection.</P>
+
+<P><B>ParameterImpl</B> Holds values required for representing SQL statement/StoredProcedure parameter like name, index, value, SDO Type and columnConverter. Can have direction IN/OUT/IN-OUT. IN is default. OUT/IN-OUT is only in case of Stored Procedure.</P>
+
+<P><B>ManagedParameterImpl</B> Extends ParameterImpl. Expected to be integer or BigDecimal type, else exception is thrown. setValue() returns oldValue+1.</P>
+
+<P><B>CollisionParameter</B> Extends ParameterImpl. Design restricts setting value in CollisionParameter only once.</P>
+
+<P><B>Parameters</B> Maintains lists of parameters (used in SQL statements), IN/OUT parameters (used in stored procedures).</P>
+
+<P><B>ResultSetShape</B> This is an alternative to use ResultSetMetaData of the Query result. It can be used when some platforms like Oracle do not fully support MetaData. For a given SQL Query, this holds schemaName, tableName, columnName, SDO Column Type for each column in ResultSet. It has 2 constructors, one uses JDBC's ResultSetMetaData to form ResultSetShape and another uses DAS Config supplied ResultDescriptor to form ResultSetShape.</P>
+
+<P><B>Statement</B> Holds SQL String, JDBC connection, JDBC PreparedStatement and also state information whether the current statement is used by Pager.</P>
+
+<P><B>SDODataTypeHelper</B> Provides mapping between SDO's Type and JDBC's sql.Types.</P>
+
+<P><B>SDODataTypes</B> Uses SDO's TypeHelper to get SDO Type for given string.</P>
+
+<P><B>QualifiedColumn</B> Maintains schemaName, tableName and columnName for a Table's Column.</P>
+
+<P><B>RelationshipWrapper</B> Wrapper for DAS Config's &lt;Relationship&gt;. Only one method to return Collection of all FKColumns in a Relationship.</P>
+
+<P><B>TableWrapper</B> Wrapper on DAS Config's &lt;Table&gt;. Provides various get methods to get values of different elements and attributes within &lt;Table&gt;.</P>
+
+<P><B>ConfigUtil</B> Uses SDO's XMLHelper to load DAS Config Data Model in memory.</P>
+
+<P><B>DataObjectUtil</B> Provides utility methods for SDO DataObject like copying one DataObject into another, restoring Old Values of a DataObject using its SDO's ChangeSummary.</P>
+
+<H3><A name="DASC%2B%2BArchitectureGuide-ConfigurationSchema%28config.xsd%29"></A><A name="DASC%2B%2BArchitectureGuide-ConfigurationSchema%28config.xsd%29"></A> Configuration Schema(config.xsd)</H3>
+
+<P>Complete DAS Configuration follows.<BR>
+Convention <INS>Element</INS> &lt;attribute&gt; <EM>Child Element</EM></P>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> <INS>Config</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;uri&gt; Not used <BR class="atl-forced-newline">
+&lt;dataObjectModel&gt; Needs a valid value when creating static DataObjects. <BR class="atl-forced-newline">
+&lt;databaseSchemaNameSupported&gt; when true, multiple database schema under same database are supported <BR class="atl-forced-newline">
+<EM>Command</EM>&#45;0..n <BR class="atl-forced-newline">
+<EM>Table</EM>&#45;0..n <BR class="atl-forced-newline">
+<EM>Relationship</EM>&#45;0..n <BR class="atl-forced-newline">
+<EM>ConnectionInfo</EM>&#45;0..1 <BR class="atl-forced-newline">
+<INS>ConnectionInfo</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;dataSource&gt;complete URL of data source <BR class="atl-forced-newline">
+&lt;managedtx&gt;if true, DAS manages database transaction <BR class="atl-forced-newline">
+<EM>ConnectionProperties</EM>&#45;0..1 <BR class="atl-forced-newline">
+<INS>ConnectionProperties</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;driverClass&gt;complete qualified class name <BR class="atl-forced-newline">
+&lt;databaseURL&gt;database URL <BR class="atl-forced-newline">
+&lt;username&gt; authentic database user <BR class="atl-forced-newline">
+&lt;password&gt; password for the user <BR class="atl-forced-newline">
+&lt;loginTimeout&gt;in milliseconds <BR class="atl-forced-newline">
+<INS>Command</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;name&gt; <BR class="atl-forced-newline">
+&lt;SQL kind&gt;Select/Update/Delete/Insert/procedure <BR class="atl-forced-newline">
+<EM>Parameter</EM>&#45;0..n <BR class="atl-forced-newline">
+<EM>ResultDescriptor</EM>&#45;0..n <BR class="atl-forced-newline">
+<INS>Parameter</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;columnName&gt; database table column name (no meaning when Command kind is procedure) <BR class="atl-forced-newline">
+&lt;direction&gt;IN/OUT (OUT makes sense when Command kind is &quot;procedure&quot;) <BR class="atl-forced-newline">
+&lt;index&gt;used in set/getParameter() on Command based on direction (used when Command kind is procedure). <BR class="atl-forced-newline">
+<INS>ResultDescriptor</INS>&#45;&gt; Used as alternative to database result set metadata. <BR class="atl-forced-newline">
+&lt;columnName&gt; database table column name <BR class="atl-forced-newline">
+&lt;tableName&gt; database table name <BR class="atl-forced-newline">
+&lt;schemaName&gt; used when databaseSchemaNameSupported=true <BR class="atl-forced-newline">
+&lt;columnType&gt;SDO mapped data type <BR class="atl-forced-newline">
+<INS>Relationship</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;name&gt; <BR class="atl-forced-newline">
+&lt;primaryKeyTable&gt; <BR class="atl-forced-newline">
+&lt;foreignKeyTable&gt; <BR class="atl-forced-newline">
+&lt;many&gt; =true allows for 1:n relationship. If it is false, it's 1:1 relationship. <BR class="atl-forced-newline">
+&lt;keyRestricted&gt; In case of 1:1 relationship, if keyRestricted is not specified, the <BR class="atl-forced-newline">
+link (relationship) between the parent and child rows can be broken, by setting the <BR class="atl-forced-newline">
+parentKeyTable's row to null/deleting the row. Also, a different parent row can <BR class="atl-forced-newline">
+be associated to the child row, which has one pre-existing parent row association. <BR class="atl-forced-newline">
+If keyRestricted=true, this kind on change in existing relationship is not allowed, <BR class="atl-forced-newline">
+user will get exception 'Can not modify a one to one relationship that is key <BR class="atl-forced-newline">
+restricted'. <BR class="atl-forced-newline">
+<EM>KeyPair</EM>&#45;0..n <BR class="atl-forced-newline">
+<INS>KeyPair</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;PrimaryKeyColumn&gt;database table column name <BR class="atl-forced-newline">
+&lt;ForeignKeyColumn&gt;database table column name <BR class="atl-forced-newline">
+<INS>Table</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;tableName&gt;Database table name <BR class="atl-forced-newline">
+&lt;typeName&gt;Data Object type name <BR class="atl-forced-newline">
+&lt;schemaName&gt; used when databaseSchemaNameSupported=true <BR class="atl-forced-newline">
+<EM>Column</EM>&#45;0..n <BR class="atl-forced-newline">
+<EM>Create</EM>&#45;0..1 <BR class="atl-forced-newline">
+<EM>Update</EM>&#45;0..1 <BR class="atl-forced-newline">
+<EM>Delete</EM>&#45;0..1 <BR class="atl-forced-newline">
+<INS>Create</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;sql&gt; INSERT statement in PreparedStement format <BR class="atl-forced-newline">
+&lt;parameters&gt;space separated column names used in explicit INSERT <BR class="atl-forced-newline">
+<INS>Update</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;sql&gt; UPDATE statement in PreparedStement format <BR class="atl-forced-newline">
+&lt;parameters&gt; space separated column names used in explicit UPDATE <BR class="atl-forced-newline">
+<INS>Delete</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;sql&gt; DELETE statement in PreparedStement format <BR class="atl-forced-newline">
+&lt;parameters&gt; space separated column names used in explicit DELETE <BR class="atl-forced-newline">
+<INS>Column</INS>&#45;&gt; <BR class="atl-forced-newline">
+&lt;columnName&gt; database table column name <BR class="atl-forced-newline">
+&lt;propertyName&gt; SDO data object's property name <BR class="atl-forced-newline">
+&lt;converterClassName&gt; if converter is used, this needs a valid class name <BR class="atl-forced-newline">
+&lt;primaryKey&gt;true if column is PK <BR class="atl-forced-newline">
+&lt;generated&gt; true if column value is database generated <BR class="atl-forced-newline">
+&lt;collision&gt; when true, during UPDATE statement generation, that column is <BR class="atl-forced-newline">
+included in the WHERE clause.(OCC feature) <BR class="atl-forced-newline">
+&lt;managed&gt; when true, during UPDATE statement generation, that column (needs <BR class="atl-forced-newline">
+to be BigDecimal) value is incremented by 1 and used in the SET clause in <BR class="atl-forced-newline">
+UPDATE. <BR class="atl-forced-newline">
+managed=true, is effective only when collision=true, else managed attribute value <BR class="atl-forced-newline">
+is ignored. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<H3><A name="DASC%2B%2BArchitectureGuide-ScalabilityAspects"></A><A name="DASC%2B%2BArchitectureGuide-ScalabilityAspects"></A> Scalability Aspects</H3>
+
+<P>Java RDB DAS has exposed <A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-UserInterface">User Interface</A>for end user. Other than that, from design perspective, many major DAS classes do not have associated interfaces and by design are tightly coupled with SDO and Database. It needs further enhancement on this line, especially when more DAS flavors are coming up as mentioned in <A href="https://cwiki.apache.org/confluence/pages/viewpage.action#DASC%252B%252BArchitectureGuide-Future">Future</A>. As DAS is a bridge between SOA based applications and backend Data Sources, the interfaces with SOA and Data Source need to be flexible. E.g. SDO/Some Other mechanism should be pluggable when using DAS as well as different technologies based Data Sources can be supported like XML files, LDAP based file system and so forth. Work is in-progress on this front.</P>
+
+<H3><A name="DASC%2B%2BArchitectureGuide-Future"></A><A name="DASC%2B%2BArchitectureGuide-Future"></A> Future</H3>
+
+<P>DAS is implemented in Java and C+&#43; and both are integrated with SDO and support Relational Database based Data Source. There are other flavors of DAS coming up like LDAP DAS, XQuery DAS etc. These implementations will provide different ways to interface with the backend data source as their names suggest.</P>
+
+<H3><A name="DASC%2B%2BArchitectureGuide-Samples"></A><A name="DASC%2B%2BArchitectureGuide-Samples"></A> Samples</H3>
+
+<P>There are a couple of samples distributed to demonstrate working examples of using different DAS features. See User Guide/Samples for more details.</P>
+
+<H3><A name="DASC%2B%2BArchitectureGuide-TerminologyandUsefulLinks"></A><A name="DASC%2B%2BArchitectureGuide-TerminologyandUsefulLinks"></A> Terminology and Useful Links</H3>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> 1 </TD>
+<TD class="confluenceTd"> User Guide </TD>
+<TD class="confluenceTd"> <A href="http://cwiki.apache.org/confluence/display/TUSCANY/RDB%20DAS%20-%20User%20Guide" class="external-link" rel="nofollow">Readme</A> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> 2 </TD>
+<TD class="confluenceTd"> Getting Started </TD>
+<TD class="confluenceTd"> <A href="http://cwiki.apache.org/confluence/display/TUSCANY/Starting%20with%20DAS" class="external-link" rel="nofollow">Readme</A> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> 3 </TD>
+<TD class="confluenceTd"> All Useful Links </TD>
+<TD class="confluenceTd"> <A href="http://cwiki.apache.org/confluence/display/TUSCANY/DAS%20Java" class="external-link" rel="nofollow">Links</A> </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+</TD></TR></TBODY></TABLE>
+ </DIV>
+ </DIV>
+ </DIV>
+ <!-- pageContent macro end -->
+
+ </TD>
+ </TR>
+ </TABLE>
+
+ <!-- footer macro -->
+ <SCRIPT src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+ </SCRIPT>
+ <SCRIPT type="text/javascript">
+ _uacct = "UA-1174707-5";
+ urchinTracker();
+ </SCRIPT>
+
+ <A href="http://www.statcounter.com/" target="_blank"><IMG src="http://c26.statcounter.com/counter.php?sc_project=2619156&java=0&security=94bd7e7d&invisible=0" alt="website stats" border="0"></A>
+
+ <DIV class="footer">
+ Copyright � 2003-2012, The Apache Software Foundation&nbsp;&nbsp;</BR>
+ Apache Tuscany and the Apache Tuscany project logo are trademarks of The Apache Software Foundation.
+ </DIV>
+ <!-- footer macro end -->
+
+ </BODY>
+</HTML>