This stand-alone sample application demonstrate how to consume the DAS Service exposed trough an SCA service.
The application starts with a canned database of Companies and their related Departments.
Through the web page interface, a user can consume the DAS Service to display the list of available companies.
The sample runs on Tomcat 5.5 and employs a Derby database accessed via a DataSource.
There are two options for running this sample:
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/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/companyweb-service-client/
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/java_das_overview.html.
Set Up:
<!-- Global Datasource for Derby dastest database --> <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="" driverClassName="org.apache.derby.jdbc.EmbeddedDriver" url="jdbc:derby:{absolute path}Databases/dastest"/>
Requirement:You must include the absolute path to the “Databases” directory in the above url attribute. Fore example:
url="jdbc:derby:c:\apache-tomcat-5.5.17\Databases/dastest"
Start tomcat and point your browser to: http://localhost:8080/sample-das-service-client-{version tag}/. Example:
http://localhost:8080/sample-das-service-client-1.0-incubator-SNAPSHOT/
This is a simple, single-page, web application to consume DAS exposed as an SCA service.
The main components of this application are:
The Company.jsp directly invoke the DAS Service to get a list of companies available and then iterate trough the SDO data graphs and manipulate SDO directly to display data
The canned Derby database comes preloaded with Companies and related Departments. The Derby database instance is a simple file folder.
The SCA DAS Service accepts directives (commands) and reads and writes to the derby database instance appropriately using DAS as the service implementation.
First, note that the application have dependencies on the DAS Service:
<!-- DAS Service --> <dependency> <groupId>org.apache.tuscany.das.samples</groupId> <artifactId>sample-das-service</artifactId> <version>${pom.version}</version> </dependency>
And the SCDL references the service:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="DASServiceComposite"> <component name="DASServiceComponent"> <implementation.composite name="DASServiceComposite" jarLocation="lib/sample-das-service-1.0-incubator-SNAPSHOT.jar"/> </component> </composite>