summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.0.1/samples/company-das-webapp/readme.html
blob: 65a50de3209475411b178f52c86f66f041b962aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!--
  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�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 �Databases� 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 &lt;/GlobalNamingResources&gt; and add the following lines just above it:
      <p>
	  <div class="codebox2">
      <pre>
         &lt;!-- Global Datasource for Derby dastest database --&gt;
         &lt;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"/&gt;
      </pre>
	  </div>
      </p>
      <p><b>Requirement</b>:You must include the absolute path to the �Databases� directory in the above url attribute. Fore example:</p>
	  <p><pre>	url=&quot;jdbc:derby:c:\apache-tomcat-5.5.17\Databases/dastest&quot;</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>
&lt;!-- DAS Service --&gt;
&lt;dependency&gt;
   &lt;groupId&gt;org.apache.tuscany.das.samples&lt;/groupId&gt;
   &lt;artifactId&gt;sample-das-service&lt;/artifactId&gt;
   &lt;version&gt;${pom.version}&lt;/version&gt;
&lt;/dependency&gt;
</pre>
</div>
</p>

<br>
<p>And the SCDL references the service:</p>

<p>
<div class="codebox2">
<pre>
&lt;composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="DASServiceComposite"&gt;
  &lt;component name="DASServiceComponent"&gt;
     &lt;implementation.composite name="DASServiceComposite" jarLocation="lib/sample-das-service-1.0-incubator-SNAPSHOT.jar"/&gt;
  &lt;/component&gt;
&lt;/composite&gt;
</pre>
</div>
</p>




</body>

</html>