Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 required
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 root)webapps/companyweb/WEB-INF/classes.

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://cwiki.apache.org/confluence/display/TUSCANY/RDB+DAS+-+Architecture+GuideImage Modified. 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 e.g.

No Format

<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"/>
</Table>

...

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/Image Modified

...

Similarly, you can experiment with different features supported by DAS.

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

...