From 5559ef5edbf8d3616f7a4b497b2a459b0ee4082b Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:07:07 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835122 13f79535-47bb-0310-9956-ffa450edef68 --- .../samples/company-das-webapp/readme.html | 199 +++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-1.0/samples/company-das-webapp/readme.html (limited to 'sca-java-1.x/branches/sca-java-1.0/samples/company-das-webapp/readme.html') diff --git a/sca-java-1.x/branches/sca-java-1.0/samples/company-das-webapp/readme.html b/sca-java-1.x/branches/sca-java-1.0/samples/company-das-webapp/readme.html new file mode 100644 index 0000000000..65a50de320 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/samples/company-das-webapp/readme.html @@ -0,0 +1,199 @@ + + + + + +Tuscany RDB DAS Service client + + + + + + + + + + +

Tuscany RDB DAS Service client

+ + +

Introduction

+ +

+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. +

+ + + + + +

Running the sample

+ +

There are two options for running this sample:

+ +
    +
  1. Run from Tomcat configured by the build
  2. +
  3. Deploying the DASService.client WAR into a Tomcat you configure yourself
  4. +
+ + +

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/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/ +

+ + + +

Deploying the DASService.client 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/java_das_overview.html. +

+ +

Set Up:

+ + +
    +
  1. Download and install the most recent stable version of Tomcat 5.5. You can find it here: http://tomcat.apache.org/download-55.cgi
  2. +
  3. Download the most recent official release of Derby from here: http://db.apache.org/derby/index.html. + The only file you’ll need from this download is derby.jar
  4. +
  5. Stop Tomcat
  6. +
  7. Copy derby.jar (from the derby distribution) to {Tomcat_Home}/common/lib:
  8. +
  9. Add the sample war file to {Tomcat_Home}/webapps
  10. +
      +
    1. sample-das-service-client-xxx.war (e.g.sample-das-service-client-1.0-incubator-SNAPSHOT.war)
    2. +
    +
  11. Install the canned Derby database to Tomcat:
  12. +
      +
    1. First, create a new directory named “Databases” to hold the sample database. Create {Tomcat_Home}/Databases
    2. +
    3. Copy the dastest folder (and all its contents) from {build directory root OR + where samples where unzipped}/java/das/samples/DASService.client to {Tomcat_Home}/Databases.
      +
      + NOTE: If you are running this from a sample distribution, the canned database is available in the + distribution, inside the databases directory.
    4. +
    +
  13. Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml.
  14. +
      +
    1. Find the end-of-section marker </GlobalNamingResources> and add the following lines just above it: +

      +

      +
      +         <!-- 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"

      +
    2. +
    +
  15. 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/

    + +
  16. + +
+ + + + +

Sample Architecture

+ +

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.

+ + + +

Consuming the DAS service

+ +

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>
+
+
+

+ + + + + + + -- cgit v1.2.3