Tuscany DAS - Java

This document proves a high-level overview of the Java DAS (Data Access Services) subproject of the Apache Tuscany incubator project.

DAS Java Getting Started

To get started with Java DAS, follow the downloads link and pick up either a binary or source distribution. If you are working from a source distribution, you can follow the general instructions for building the whole of the Tuscany java projects, or you can follow the intructions within the DAS Java overview to build and explore just DAS java.

General DAS Documentation

Title Description
DAS White Paper: The Data Access Service How to access relational data in terms of Service Data Objects
JDJ DAS Article How to access relational data in terms of Service Data Objects
DAS Java Overview

Currently, the project's code base includes an implementation of a DAS RDB (relational database) with following key features :

DAS Java Project Structure

The DAS RDB project is divided into three parts:

  1. das.rdb contains the DAS interfaces and the RDB (Relational Database) runtime implementation.

  2. samples.das provides sample applications based on DAS.

  3. distribution.das provides DAS binaries distribution with required dependencies.

  4. distribution.das-samples provides DAS samples distribution as a ready-to-deploy war file.

DAS high level class diagram

DAS High level class diagram
Build Environment Setup

Tuscany Build Environment Setup

DAS is a subproject of the Tuscany project. If you check out and build the whole Tuscany Java project, you will have also built the DAS subproject. If you want to work with the DAS project, without the rest of Tuscany, skip to the next section.

To build the whole Tuscany project follow these instructions.

DAS Java Build Environment Setup

If you want to work with the DAS project alone, without the rest of Tuscany, proceed with the following steps.

  1. Set up your environment using the instructions for building the whole of Tuscany, but only download and install Java 5, Maven and Svn

  2. Make sure 'mvn' and 'svn' commands are in your PATH environment variable.

  3. Check out the DAS open source projects from Apache.

  1. Run "mvn" under <local tuscany dir>/java directory to install POM files from the root project to the local repository

  • Commands:

    • cd <local tuscany dir>/java/das
      mvn

  • Notes:

    1. If the mvn command completed successfully, you will see BUILD SUCCESSFUL in the output and tuscany-das-rdb-1.0-SNAPSHOP.jar is created under <local tuscany dir>/java/das/rdb/target directory.

    2. External resources are at times unavailable. It may be necessary to run "mvn" again at a later time.

    3. If you are taking time to reply to firewall prompts, this can cause some requests to time out. Set up the firewall to permit the action without prompting.

Building Javadoc for DAS

In order to build DAS Javadocs, you will need to build the a specific maven profile called "javadoc"

  • Commands:

    • cd <local tuscany dir>/java/das
      mvn -P javadoc

    Note: Javadoc will be available at <local tuscany dir>/java/das/rdb/target/apidocs/index.html.

Dependency Jars

The DAS.RDB project has a dependency on SDO and requires the following SDO runtime jars to build

  • sdo-api-r2.0.1-1.0-SNAPSHOT.jar - SDO 2.0 Interfaces

  • tuscany-sdo-impl-1.0-SNAPSHOT.jar - SDO 2.0 implementation

The SDO.IMPL project have dependencies on the following EMF (Eclipse Modeling Framework - www.eclipse.org/emf) runtime jars to build:

  • common-2.2.1.jar - some common framework utility and base classes

  • ecore-2.2.1.jar - the EMF core runtime implementation classes (the Ecore metamodel)

  • ecore-change-2.2.1.jar - the EMF change recorder and framework

  • ecore-xmi-2.2.1.jar - EMF's default XML (and XMI) serializer and loader

  • xsd-2.2.1.jar - the XML Schema model

  • log4j-1.2.12.jar - log4j logging framework

Running DAS Samples

DAS provide sample a CompanyWeb scenario where it exposes some of the DAS Features integrated in a J2EE webapp.

Follow the steps below to be able to run the samples in a J2EE webserver (in our case Apache Tomcat)

From the source repository

  • checkout DAS Sample from SVN repository:

    • md 'local tuscany dir'

    • cd 'local tuscany dir'

    • svn co https://svn.apache.org/repos/asf/incubator/tuscany/java/das das

  • use maven to build the CompanyWeb war file:

    • cd das\samples

    • mvn

  • use maven to deploy the CompanyWeb war file to Tomcat

    • mvn tomcat:deploy

There are also some sample applications that use a mix of SCA, SDO and DAS. See "Running the Samples" on the Java project page for details.

From a DAS Sample distribution (starting with M2):

  • Download a das-sample distribution from http://incubator.apache.org/tuscany/downloads.html

  • Extract the companyweb war file

  • Follow regular deployment procedures to deploy the war file

Running Tuscany DAS Unit Tests

DAS is currently providing two sets of unit tests

  • JUnit tests for the core DAS code

  • HTMLUnit tests integrated with Tomcat for DAS CompanyWeb sample application

Below we are going to describe how you can exercise these two sets of tests, and we recommend you running them after contributing code/patches for DAS to validate that your new changes are not introducing any regressions.

Running DAS tests as part of the build

  • cd 'local tuscany dir'/java/das

  • mvn test

  • -------------------------------------------------------
    T E S T S
    -------------------------------------------------------
    Running org.apache.tuscany.das.rdb.test.suites.AllTestsDerby
    Setting up for Derby run
    Ending Derby run
    Tests run: 137, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 33.468 sec

    Results :

    Tests run: 137, Failures: 0, Errors: 0, Skipped: 0

    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 57 seconds
    [INFO] Finished at: Tue Oct 03 12:06:13 PDT 2006
    [INFO] Final Memory: 5M/10M
    [INFO] ------------------------------------------------------------------------

Running DAS CompanyWeb tests in tomcat

  • Download tomcat distribution into your local filesystem : http://tomcat.apache.org/

  • Create a build.properties in your root directory (e.g. C:\Documents and Settings\lresende in Win2K systems) with the following contents

    • tuscany.acceptance.tomcat.zipped='directory where tomcat was downloaded'\\apache-tomcat-5.5.17-tuscany.zip

  • checkout DAS Sample from SVN repository:

    • md 'local tuscany dir'

    • cd 'local tuscany dir'

    • svn co https://svn.apache.org/repos/asf/incubator/tuscany/java/das das

  • use maven run the DAS CompanyWeb tests in Tomcat:

    • cd das/samples/testing/tomcat

    • mvn

    • -------------------------------------------------------
      T E S T S
      -------------------------------------------------------
      Running org.apache.tuscany.test.das.DasTestCase
      Running:HomePage SUCCESS!!!
      Running:AllCompanies SUCCESS!!!
      Running:AllCompaniesDepartments SUCCESS!!!
      Running:AddDepartmentToFirstCompany SUCCESS!!!
      Running:ChangeCompanyDepartmentNames SUCCESS!!!
      Running:DeleteCompanyOneDepartments SUCCESS!!!
      Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.911 sec

      Results :

      Tests run: 6, Failures: 0, Errors: 0, Skipped: 0

      [INFO]
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Summary:
      [INFO] ------------------------------------------------------------------------
      [INFO] Tuscany Testing in Tomcat ............................. SUCCESS [0.251s]
      [INFO] Tuscany Testing DAS Sample - Companyweb ............... SUCCESS [1:17.791s]
      [INFO] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESSFUL
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1 minute 18 seconds
      [INFO] Finished at: Tue Oct 03 12:25:48 PDT 2006
      [INFO] Final Memory: 7M/15M
      [INFO] ------------------------------------------------------------------------

    • Note: Due to a current limitation, you must run mvn clean before you can run the tests a second time