From d0e86aec253c57f94e4ebcdb2c417a825daafe3b Mon Sep 17 00:00:00 2001 From: lresende Date: Mon, 2 Nov 2009 22:22:47 +0000 Subject: moving das branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@832145 13f79535-47bb-0310-9956-ffa450edef68 --- .../das-java-M2/samples/companyweb/readme.htm | 654 +++++++++++++++++++++ 1 file changed, 654 insertions(+) create mode 100644 das-java/branches/das-java-M2/samples/companyweb/readme.htm (limited to 'das-java/branches/das-java-M2/samples/companyweb/readme.htm') diff --git a/das-java/branches/das-java-M2/samples/companyweb/readme.htm b/das-java/branches/das-java-M2/samples/companyweb/readme.htm new file mode 100644 index 0000000000..4af782ff8d --- /dev/null +++ b/das-java/branches/das-java-M2/samples/companyweb/readme.htm @@ -0,0 +1,654 @@ + + + + + + + + +Tuscany RDB DAS Sample + + + + + + + + + + +
+ +

Tuscany RDB DAS Sample (companyweb)

+ +

 

+ +

This stand-alone sample demonstrates the SDO RDB Data Access +Service in the context of a simple web application.

+ +

 

+ +

The application starts with a canned database of Companies +and their related Departments.  Through +the web page interface, a user can:

+ +

 

+ +
    +
  1. Display + all Companies in the database
  2. +
  3. Display + all Companies and related Departments
  4. +
  5. Add a + new Department to a Company
  6. +
  7. Delete + all Departments from a Company
  8. +
  9. Change + the names of Departments in a Company
  10. +
+ +

 

+ +

So, this simple application covers all CRUD operations as +well as the some relationship manipulation (adding a Department associates that +Department with the Company).  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 CompanyWeb 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/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-companyweb/. 

+ +

Deploying the CompanyWeb 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-companyweb-xxx.war (e.g. + “sample-companyweb-1.0-incubator-M2.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/companyweb 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. +
    +
+ +

 

+ +
    +
  1. Define + a DataSource by adding a datasource definition + to {Tomcat_Home}/conf/server.xml.
  2. +
      +
    1. Find + the end-of-section marker </GlobalNamingResources> + and add the following lines just above it:
    2. +
    +
+ +

 

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

 

+ +
    +
  1. Start + tomcat and point your browser to: http://localhost:8080/sample-companyweb-{version + tag}/
  2. +
+ +

 

+ +

example: http://localhost:8080/sample-companyweb-1.0-incubator-M2/

+ +

 

+ +

Sample Architecture

+ +

This is a simple, single-page, web application.  The main components of this application are:

+ +
    +
  • The + RDB Data Access Service (DAS)
  • +
  • SDO
  • +
  • CompanyClient.java
  • +
  • Company.jsp
  • +
  • The + canned Derby database
  • +
+ +

 

+ +

 

+ +

The CompanyClient +uses the DAS directly and provides +high-level services to the jsp such as:

+ +

public +final List getCompanies()

+ +

This is a good place to look for how you might use the DAS +in your own application.

+ +

 

+ +

The Company.jsp +responds to client interaction by invoking services of the CompanyClient.  It receives data from the CompanyClient +as SDO data graphs and manipulates SDOs 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 DAS accepts +directives (commands) from the CompanyClient and +reads and writes to the derby database instance appropriately.

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