Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Section
borderfalse
Column
width12%15%
Available
Include Page
RDB
DAS Java Subproject Menu
XQuery
DAS

LDAP DAS

Downloads

Java Subproject Menu
Column
width88%85%

How to get involved in development of Java RDB DAS?

This document is the development guideline for RDB DAS Java project.

  • General Guide
  • Getting Source code
  • Setting up your development environment
  • Importing DAS code and samples into your Development IDE
  • Coding Guidelines
  • Testing
  • Maven Build Structure
  • Reporting Issues and Providing patches

General Guide

Welcome to the Tuscany RDB DAS Java subproject project. We look forward to your participation and try to help you get on board. Feel free to ask your questions on the mailing list.

Here are some general guidelines we use in this project.

  • Java RDB DAS sub-project aims to provide enterprise-grade Data Access Service to help SOA applications using SDO have data updates with Database Data Source at backend.
  • Java RDB DAS provides feedback to Tuscany SDO and Spec as it evolves.
  • The Java RDB DAS provides flexibility in accessing data with explicit CRUD as well as using SDO DataObjects.
  • The Java RDB DAS infrastructure is very modularized and is designed to be highly extensible so users can customize it to fit their needs.

Getting Source code

The Java RDB DAS project Subversion repository is located at

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:

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

samples.das provides sample applications based on DAS.

distribution.das provides DAS binaries distribution with required dependencies.

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

DAS high level class diagram

Image Removed

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.

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

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

Check out the DAS open source projects from Apache.

Commands:

md <local tuscany dir>
cd <local tuscany dir>
svn co https://svn.apache.org/repos/asf/incubator/tuscany/javaImage Removed

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:

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.

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

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

/das .
The repository can also be viewed online at http://svn.apache.org/viewvc/incubator/tuscany/java/das
Anyone can check code out of Subversion. You only need to specify a username and password in order to update the Subversion repository, and only Tuscany committers have the permissions to do so.

Checking out code from Subversion

Use the command as follows (note that it uses http scheme so if you're a committer change it to https):

No Format
 svn checkout http://svn.apache.org/repos/asf/incubator/tuscany/java/das 

Committing Changes to Subversion

Any Tuscany committer should have a shell account on svn.apache.org. Before you can commit, you'll need to set a Subversion password for yourself. To do that, log in to svn.apache.org and run the command svnpasswd.
Once your password is set, you can use a command like this to commit:

No Format
 svn commit 

If Subversion can't figure out your username, you can tell it explicitly:

No Format
 svn --username <name> commit 

Subversion will prompt you for a password, and once you've entered it, it will remember it for you. Note this is the password you configured with svnpasswd not your shell or other password.

Setting up your Development Environment

Prerequisites

Java RDB DAS requires the following:

  • JDK 5.0+ (J2SE 1.5.0+)
  • Apache Maven (2.0.4+)
  • Subversion (1.2+)

Build tree structure

The build tree is designed to facilitate modular development and releases. Maven modules are grouped by how they are released under a hierarchy. Java RDB DAS currently have the below module hierarchy :

No Format

-java
 |-- das
     |-- distribution         DAS distributions
     |-- rdb                	 DAS Core Source
     |-- samples              DAS Web, J2SE Sample Applications

The individual modules can be built separately or build with top-down build.

top-down build (recommended approach)

Check out all of the java source code.

No Format
svn checkout http://svn.apache.org/repos/asf/incubator/tuscany/java
/dasImage Removed
 

Building the RDB DAS source code is simple

No Format

cd java/das
mvn

It should work irrespective of whether you have an empty Maven local repository. This assumes that maven is able to retrieve a SNAPSHOT version of SDO (and of course the rest of software that RDB DAS depends on) as we do not build anything other than RDB DAS here.

There can be occasional problems downloading artifacts from remote Maven repositories so if mvn fails with network related sounding messages sometimes just trying again can fix the problem.
Once you have done a top-down build, and your local maven repository is populated, you can start using the maven off line option to speed up the build process

No Format
 mvn -o  

Importing RDB DAS into your Development IDE

Using Eclipse

If this is the first time you are using your workspace with maven m2 local repository, you will need to tell your Eclipse workspace the location of the directory, and you can do this with the following command :

No Format
 mvn -Declipse.workspace=[path-to-eclipse-workspace] eclipse:add-maven-rep 

In order to generate the necessary project files to import the SCA modules to Eclipse, you can use the maven eclipse plugin

No Format

cd java/das
mvn -Peclipse eclipse:eclipse

Now, launch your Eclipse IDE, select File->Import->Existing projects into Workplace, and then select the base DAS directory (e.g java/das) and then press Finish, this should import all DAS core and Samples into your Eclipse Workspace.

Coding Guidelines

There are a few simple guidelines when developing for JAVA DAS:

  • Formatting standards are defined by the .checkstyle and .pmd configurations in the source repository. Please be sure to check code is formatted properly before doing a checkin (see below). If you are unfamiliar with Checkstyle or PMD, please see http://checkstyle.sourceforge.net/ and http://pmd.sourceforge.net/ . Consistent formatting makes it easier for others to follow and allows diffs to work properly.
  • Always include the Apache License Headers on all files and the following version tag:
    No Format
     @version $Rev$ $Date$ 
  • Please attempt to accompany code with at least unit tests or verify it by existing tests before submitting a patch or checking in.
  • Do not checkin IDE-specific resources such as project files.
  • Prior to check-in, perform a clean build and run the complete battery of unit tests for the current module from the command line with Checkstyle enabled, as in:
No Format

mvn clean
mvn -o -Psourcecheck
  • Please do not perform a checkin using an IDE as doing so is frequently problematic.
  • Include a descriptive log message for checkins, for example "fixed such and such problem".

Naming conventions to increase consistency
Folder Names: Please use all lowercases and dashes in folder names (like in the jar names)

  • Maven artifact id = tuscany-<folder name>

Package names: Package names within modules should include the module name so that source code can be located in the source tree easily.

Testing

All commits are expected to be accompanied by unit test and integration tests when appropriate. Unit tests should verify specific behavior relating to a single class or small set of related classes; integration tests verify code paths across subsystems. Testcases should be documented and clearly indicate what they verify. Also, avoid things that may cause side-effects when possible such as access of external resources.
Tuscany uses plain junit test cases to perform unit and integration testing. Web Samples use htmlunit Test cases to verify the expected behavior.
Note that we use surefire maven plugin to run the unit and integration tests, and in most cases, they are configured to match a **/*TestCase.java file name pattern. Because of this, if your test case has a different file name pattern, you might execute it from your IDE of choice, but the maven build won't execute the test.

Maven Build Structure

We use the term Module to refer to the leaf of maven tree.

  • das/pom.xml's parent will be pom/parent/pom.xml
  • Other poms will use the pom from the parent folder as parent pom
  • Group id: org.apache.tuscany.das
  • Version of our modules will be specified once in java/das/pom.xml, child poms don't need specify a version as they get it from their parent
  • pom names begin Apache Tuscany DAS
  • Eclipse projects are generated for all built modules using mvn -Peclipse eclipse:eclipse

Reporting issues and providing patches

Issue Tracking

Tuscany bug reports are handled via a JIRA issues list. Please use this list to report any bugs and track their status.

Reporting an Issue

Please search JIRA to see if the problem has already been reported. If it has not, please create a new JIRA issue. To help developers quickly resolve an issue, include as much information with your report as possible such as your platform, version numbers, error logs, configuration, steps to reproduce the problem, etc. Also, if possible, please include a testcase that demonstrates the problem.
Thanks for working with us to improve Apache Tuscany.

Submitting a Patch

To submit a patch, create an issue in JIRA that describes the problem and attach your patch file. Please include detailed steps to reproduce the problem in the issue description. Providing test cases in the patch will help us verify and apply it quicker. To create a patch, follow the steps below:

  • Perform a full build with all tests enabled for the module the fix is for. Specific build procedures vary by sub-project.
  • Confirm that the problem is fixed and include testcases where possible
  • Generate the patch using svn diff File > patchfile
  • Try to give your patch files meaningful names, including the JIRA number
  • Add your patch file as an attachment to the associated JIRA issue
    Once you have submitted the patch it will be picked up for review.
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.htmlImage Removed

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/Image Removed

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/dasImage Removed 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 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