This web
sample demonstrates SDO RDB Data Access Service using
The
application user can navigate the menu to see examples of different DAS
features.
The application user “dbsetup” utility to create canned Derby database
with required tables and populate initial data in them.
For refreshing database data to initial state, user can click on Refresh Button.
►Adhoc
Query (CRUD operations on COMPANY and DEPARTMENT using adhoc
Sql statements)
►DAS Commad
(CRUD operations on COMPANY and DEPARTMENT using DAS config
commands)
►Advanced Features –
►Optimistic Concurrecy Control (Using BOOK. NAME)
►Converter (Using
CUSTOMER.LASTNAME)
►Result Set Shape
(Using CUSTOMER table)
In future
more features will get added.
Running
the sample
There are two options for running this sample:
Running from Tomcat configured by
the build
This sample application is deployed (along with the canned
test database) to an instance of Tomcat as part of our automated sample
testing. This means you can run the
java/das/samples/testing/tomcat build (see
java/das/samples/testing/tomcat/readme.htm ) and then access the application by pointing
your browser to http://localhost:8080/sample-ajax-das/.
Deploying the sample-ajax-das WAR into a Tomcat you configure
yourself
Alternatively, you can deploy the sample to your own
configured Tomcat installation by following the instructions below. These instructions assume that you have
either 1) downloaded the Tuscany sample distribution or 2) Downloaded the
Tuscany source and run our maven build, see the following link to more details
steps on how to build DAS Sample applications http://incubator.apache.org/tuscany/das-java-developer-guide.html
.
Set Up
<!-- Global
Datasource for Derby ajaxdastest
database -->
<Resource name="jdbc/ajaxdastest"
type="javax.sql.DataSource" auth="Container"
description="
maxActive="100" maxIdle="30"
maxWait="10000"
username=""
password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:{absolute
path}Databases/ajaxdastest;create=true"/>
Requirement: You must include
the absolute path to the “Databases” directory in the above url
attribute. Fore example:
url="jdbc:derby:c:\apache-tomcat-6.0.13\Databases/ajaxdastest"/>
Sample
Architecture
The design
is modular and reusable by other web samples. There are java servlet, other java classes, jsp,
javascript, xml, xsl, css and html files.
Client Side Files
Javascripts
Ajax.js
and dasmenu.js are generic (not DAS specific) and
reusable by any web sample.
Set
response handler when request is passed to servlet.
Response handler’s job is transform xml
response using xsl into html or plain text based on
the example’s requirement.
Used for
menu/submenu rendering, is quite generic and can be used to display any menu.
HTMLs & jsps (DAS specific
files)
DASMenu.html
and DASWebSampleFrame.html are for giving frame and menu to web sample.
DASMenu.html calls required .jsps like indexAdhoc.jsp, indexCommand.jsp,
occ.jsp, converter.jsp.
These jsps are all DAS specific. The .jsp file is responsible for deciding the DAS config file required by current sample and relevant .xsl file.
Serverside files
CommandServlet.java and ServiceProcessor.java
Used for
invoking required service and returning results back to ajax.js.
These files are not DAS specific.
DASQueryProcessor.java
Specific to
DAS sample, has logic to invoke required sample example.