tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Tuscany: Starting with DAS (page edited)
Date Tue, 04 Sep 2007 13:23:01 GMT
Starting with DAS (TUSCANY) edited by Amita Vadhavkar
      Page: http://cwiki.apache.org/confluence/display/TUSCANY/Starting+with+DAS
   Changes: http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=54705&originalVersion=11&revisedVersion=12


{include: DAS Java Subproject Menu}
h1. Starting with DAS

This page provides links to DAS samples and explains a simple "how to" and gives step-by-step
instructions to check one of the DAS features - ColumnConverter. Other DAS features can be
tried on similar lines.

Many sample examples demonstrating different DAS features are available on 
https://svn.apache.org/repos/asf/incubator/tuscany/java/das/samples e.g.

# companyweb - tomcat based web sample
# customer - J2SE based standalone application

Check readme files e.g. For companyweb
for basic steps on how to get the sample running. 

Once the sample is running, parts of sample can be modified based on the requirement or new
code can be added from-scratch. Many features supported by DAS are listed in User Guide -

This document details the changes needed to different part of the web sample (companyweb)
to experiment with more features of DAS than just basic CRUD.Let us take example of checking
how to use ColumnConverters. For details on feature testing, check Tests under https://svn.apache.org/repos/asf/incubator/tuscany/java/das/rdb/src/test/

1> As a first step you need to implement *Converter* interface in a class to achieve the
column conversion. Check org.apache.tuscany.das.rdb.test.mappings.StringObfuscationConverter
from the svn repository for example of converter. Make your converter class available in (Tomcat

2> DAS functions based on external Configuration, e.g. CompanyConfig.xml file in companyweb
sample. The purpose of this Config file to supply information for DataSource connection, Commands
(SQL) (that DAS can execute against Database) and Database schema like - Table/Columns, Relationship
and so forth. Please check Architecture Guide for complete details about Config.xsd ()
at http://incubator.apache.org/tuscany/rdb-das-architecture-guide.html. Modify Config get
converter working. The <ConnectionInfo> element should match the resource name from
server.xml for DataSource.Add a <Table> which has a column with converter class name
of the class you just created. Add a <Command> with kind="Select" for this table/column
<Command name="getFirstCustomer" SQL="Select * from CUSTOMER where ID = 1" kind="Select"/>

<Table tableName="CUSTOMER">
<Column columnName="ID" primaryKey="true"/>
<Column columnName="LASTNAME" converterClassName="org.apache.tuscany.das.rdb.test.mappings.StringObfuscationConverter"/>
3> Now the code and config setup is complete. What remains is calling the new command from
.jsp and
servlet. Follow the technique similar to CompanyClient.java and Company.jsp to call the new
command. The returned results will verify that the converter is called and the column value
from database is converted based on converter logic. 
4> For more details check the test cases from ConverterTests in https://svn.apache.org/repos/asf/incubator/tuscany/java/das/rdb/src/test/.

*Assumption:* Tomcat version 5.5.* or 6.0.10 , Derby version

*Troubleshooting Checkpoints:* Check the following and if still having issues , report at
# All libraries are present in (Tomcat root)/webapps/companyweb/WEB-INF/lib (these libs can
be taken from companyweb sample or can be downloaded from web)
i) common-(latest version).jar 
ii) ecore-(latest version).jar 
iii) ecore-change-(latest version).jar
iv) ecore-xmi-(latest version).jar
v) log4j-(latest version).jar 
vi) sdo-api-xxx.jar 
vii) tuscany-das-rdb-xxx.jar 
viii) tuscany-sdo-xxx.jar
ix) xsd-(latest version).jar 
x) derby driver jar - or whichever database you are planning to use
# The Database exists with required tables and data.
# WEB-INF/web.xml has entry under welcome-file-list for required .jsp like -
    <display-name>Tuscany DAS sample Company  WEB</display-name>

    <welcome-file-list id="WelcomeFileList">
# META-INF/context.xml has entry for the datasource the sample is using like -
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/DAS Stand alone app" debug="5" reloadable="true" crossContext="true">
   <Manager pathname=""/>
   <ResourceLink name="jdbc/dastest" global="jdbc/dastest" type="javax.sql.DataSource"
# (Tomcat root)/conf server.xml has entry similar to below for the datasource -
<Resource name="jdbc/dastest"
      type="javax.sql.DataSource"  auth="Container"
      description="Derby database for DAS Company sample"
      maxActive="100" maxIdle="30" maxWait="10000"
      username="" password=""


This message is automatically generated by Confluence

Unsubscribe or edit your notifications preferences

If you think it was sent incorrectly contact one of the administrators

If you want more information on Confluence, or have a bug to report see

To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org

View raw message