
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@898602 13f79535-47bb-0310-9956-ffa450edef68
199 lines
7.4 KiB
HTML
199 lines
7.4 KiB
HTML
<!--
|
||
Licensed to the Apache Software Foundation (ASF) under one
|
||
or more contributor license agreements. See the NOTICE file
|
||
distributed with this work for additional information
|
||
regarding copyright ownership. The ASF licenses this file
|
||
to you under the Apache License, Version 2.0 (the
|
||
"License"); you may not use this file except in compliance
|
||
with the License. You may obtain a copy of the License at
|
||
|
||
http://www.apache.org/licenses/LICENSE-2.0
|
||
|
||
Unless required by applicable law or agreed to in writing,
|
||
software distributed under the License is distributed on an
|
||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||
KIND, either express or implied. See the License for the
|
||
specific language governing permissions and limitations
|
||
under the License.
|
||
-->
|
||
<html>
|
||
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
||
<title>Tuscany RDB DAS Service client</title>
|
||
|
||
<style>
|
||
.code {font-size: 11px; color: #006699}
|
||
.codebox {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px}
|
||
.codebox2 {border: 1px solid #6699CC; background-color: #F1F7FA;padding:15px; width:85%}
|
||
.codeboxW {border: 1px solid #6699CC; background-color: #FFFFFF;padding:15px}
|
||
.codeboxB {background-color: #C9DBED;padding:1px 10px 10px 10px}
|
||
</style>
|
||
|
||
</head>
|
||
|
||
|
||
|
||
|
||
<body>
|
||
|
||
<h1>Tuscany RDB DAS Service client</h1>
|
||
|
||
|
||
<h3>Introduction</h3>
|
||
|
||
<p>
|
||
This stand-alone sample application demonstrate how to consume the DAS Service exposed trough an SCA service.<br>
|
||
The application starts with a canned database of Companies and their related Departments.<br>
|
||
Through the web page interface, a user can consume the DAS Service to display the list of available companies.<br>
|
||
The sample runs on Tomcat 5.5 and employs a Derby database accessed via a DataSource.
|
||
</p>
|
||
|
||
|
||
|
||
|
||
|
||
<h3>Running the sample</h3>
|
||
|
||
<p>There are two options for running this sample:</p>
|
||
|
||
<ol>
|
||
<li>Run from Tomcat configured by the build</li>
|
||
<li>Deploying the DASService.client WAR into a Tomcat you configure yourself</li>
|
||
</ol>
|
||
|
||
|
||
<h3>Running from Tomcat configured by the build</h3>
|
||
|
||
<p>
|
||
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/
|
||
</p>
|
||
|
||
|
||
|
||
<h3>Deploying the DASService.client WAR into a Tomcat you configure yourself</h3>
|
||
|
||
<p>
|
||
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 <a
|
||
href="http://incubator.apache.org/tuscany/java_das_overview.html">http://incubator.apache.org/tuscany/java_das_overview.html</a>.
|
||
</p>
|
||
|
||
<p><b><u>Set Up:</u></b></p>
|
||
|
||
|
||
<ol>
|
||
<li>Download and install the most recent stable version of Tomcat 5.5. You can find it here: <a
|
||
href="http://tomcat.apache.org/download-55.cgi">http://tomcat.apache.org/download-55.cgi</a></li>
|
||
<li>Download the most recent official release of Derby from here: <a href="http://db.apache.org/derby/index.html">http://db.apache.org/derby/index.html</a>.
|
||
The only file you<6F>ll need from this download is derby.jar</li>
|
||
<li>Stop Tomcat</li>
|
||
<li>Copy derby.jar (from the derby distribution) to {Tomcat_Home}/common/lib:</li>
|
||
<li>Add the sample war file to {Tomcat_Home}/webapps</li>
|
||
<ol start=1 type=a>
|
||
<li>sample-das-service-client-xxx.war (e.g.sample-das-service-client-1.0-incubator-SNAPSHOT.war)</li>
|
||
</ol>
|
||
<li>Install the canned Derby database to Tomcat: </li>
|
||
<ol start=1 type=a>
|
||
<li>First, create a new directory named <20>Databases<65> to hold the sample database. Create {Tomcat_Home}/Databases</li>
|
||
<li>Copy the <b>dastest</b> folder (and all its contents) from {build directory root OR
|
||
where samples where unzipped}/java/das/samples/DASService.client to {Tomcat_Home}/Databases.<br>
|
||
<br>
|
||
<b>NOTE</b>: If you are running this from a sample distribution, the canned database is available in the
|
||
distribution, inside the databases directory. </li>
|
||
</ol>
|
||
<li>Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml.</li>
|
||
<ol start=1 type=a>
|
||
<li>Find the end-of-section marker </GlobalNamingResources> and add the following lines just above it:
|
||
<p>
|
||
<div class="codebox2">
|
||
<pre>
|
||
<!-- 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"/>
|
||
</pre>
|
||
</div>
|
||
</p>
|
||
<p><b>Requirement</b>:You must include the absolute path to the <20>Databases<65> directory in the above url attribute. Fore example:</p>
|
||
<p><pre> url="jdbc:derby:c:\apache-tomcat-5.5.17\Databases/dastest"</pre></p>
|
||
</li>
|
||
</ol>
|
||
<li><p>Start tomcat and point your browser to: <a href="http://localhost:8080/sample-das-service-client-%7bversion%20tag%7d/">http://localhost:8080/sample-das-service-client-{version
|
||
tag}/</a>. Example:</p>
|
||
<p><pre> http://localhost:8080/sample-das-service-client-1.0-incubator-SNAPSHOT/</pre></p>
|
||
|
||
</li>
|
||
|
||
</ol>
|
||
|
||
|
||
|
||
|
||
<h3>Sample Architecture</h3>
|
||
|
||
<p>This is a simple, single-page, web application to consume DAS exposed as an SCA service.</p>
|
||
<p>The main components of this application are:</p>
|
||
|
||
<ul type=disc>
|
||
<li>The SCA DAS Service</li>
|
||
<li>SDO</li>
|
||
<li>Company.jsp</li>
|
||
<li>The canned Derby database</li>
|
||
</ul>
|
||
|
||
|
||
<p>The <b>Company.jsp</b> 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</p>
|
||
|
||
<p>The canned <b>Derby database</b> comes preloaded with Companies and related Departments. The Derby database instance is a simple file folder.</p>
|
||
|
||
<p>The <b>SCA DAS Service</b> accepts directives (commands) and reads and writes to the derby database instance appropriately using DAS as the service implementation.</p>
|
||
|
||
|
||
|
||
<h3>Consuming the DAS service</h3>
|
||
|
||
<p>First, note that the application have dependencies on the DAS Service:</p>
|
||
|
||
|
||
<p>
|
||
<div class="codebox2">
|
||
<pre>
|
||
<!-- DAS Service -->
|
||
<dependency>
|
||
<groupId>org.apache.tuscany.das.samples</groupId>
|
||
<artifactId>sample-das-service</artifactId>
|
||
<version>${pom.version}</version>
|
||
</dependency>
|
||
</pre>
|
||
</div>
|
||
</p>
|
||
|
||
<br>
|
||
<p>And the SCDL references the service:</p>
|
||
|
||
<p>
|
||
<div class="codebox2">
|
||
<pre>
|
||
<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>
|
||
</pre>
|
||
</div>
|
||
</p>
|
||
|
||
|
||
|
||
|
||
</body>
|
||
|
||
</html>
|