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-webapp - tomcat based web sample
- customer - J2SE based standalone application
Check readme files e.g. For companyweb https://svn.apache.org/repos/asf/incubator/tuscany/java/das/samples/company-webapp/readme.htm 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 - http://incubator.apache.org/tuscany/rdb-das-user-guide.html 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-webapp/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://incubator.apache.org/tuscany/rdb-das-architecture-guide.html. Modify Config to 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"/> |
|