Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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:

...

  • Display

...

  • all

...

  • Companies

...

  • in

...

  • the

...

  • database

...

  • Display

...

  • all

...

  • Companies

...

  • and

...

  • related

...

  • Departments

...

  • Add

...

  • a

...

  • new

...

  • Department

...

  • to

...

  • a

...

  • Company

...

  • Delete

...

  • all

...

  • Departments

...

  • from

...

  • a

...

  • Company

...

  • Change

...

  • the

...

  • names

...

  • of

...

  • Departments

...

  • in

...

  • a

...

  • Company

...

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/6.x

...

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. Deploying the CompanyWeb WAR into a Tomcat you configure yourself

1. 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/.

...

2.

...

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

...

  1. and

...

  1. install

...

  1. the

...

  1. most

...

  1. recent

...

  1. stable

...

  1. version

...

  1. of

...

  1. Tomcat

...

  1. 5.5.

...

  1. You

...

  1. can

...

  1. find

...

  1. it

...

  1. here:

...


  1. http://tomcat.apache.org/download-55.cgi

...

  1. Download

...

  1. the

...

  1. most

...

  1. recent

...

  1. official

...

  1. release

...

  1. of

...

  1. Derby

...

  1. from

...

  1. here:

...

  1. http://db.apache.org/derby/index.html.

...


  1. The

...

  1. only

...

  1. file

...

  1. you'll

...

  1. need

...

  1. from

...

  1. this

...

  1. download

...

  1. is

...

  1. derby.jar

...

  1. Stop

...

  1. Tomcat

...

  1. Copy

...

  1. derby.jar

...

  1. (from

...

  1. the

...

  1. derby

...

  1. distribution)

...

  1. to

...

  1. Tomcat_Home

...

  1. /common/lib

...

  1. Add

...

  1. the

...

  1. sample

...

  1. war

...

  1. file

...

  1. to

...

  1. Tomcat_Home

...

  1. /webapps

...


  1. a.

...

  1. sample-companyweb-xxx.war

...

  1. (e.g.

...

  1. "sample-companyweb-1.0-incubator-M2.war")

...

  1. Install

...

  1. the

...

  1. canned

...

  1. Derby

...

  1. database

...

  1. to

...

  1. Tomcat:

...


  1. a.

...

  1. First,

...

  1. create

...

  1. a

...

  1. new

...

  1. directory

...

  1. named

...

  1. "Databases"

...

  1. to

...

  1. hold

...

  1. the

...

  1. sample

...

  1. database.

...

  1. Create

...


  1. Tomcat_Home

...

  1. / Databases

...


  1. b.

...

  1. Copy

...

  1. the

...

  1. dastest

...

  1. folder

...

  1. (and

...

  1. all

...

  1. its

...

  1. contents)

...

  1. from

...

  1. (_build

...

  1. directory

...

  1. root

...

  1. OR

...

  1. where

...

  1. samples

...


  1. were unzipped_/java/das/samples/companyweb

...

  1. ) to

...

  1. Tomcat_Home

...

  1. /Databases

...

  1. (NOTE:

...

  1. If

...

  1. you

...

  1. are

...

  1. running

...


  1. this

...

  1. from

...

  1. a

...

  1. sample

...

  1. distribution,

...

  1. the

...

  1. canned

...

  1. database

...

  1. is

...

  1. available

...

  1. in

...

  1. the

...

  1. distribution,

...

  1. inside

...


  1. the

...

  1. databases

...

  1. directory.

...

  1. )
  2. Define a DataSource by adding a datasource definition to Tomcat_Home

...

  1. /conf/server.xml.

...


  1. a.

...

  1. Find

...

  1. the

...

  1. end-of-section

...

  1. marker

...

  1. </GlobalNamingResources>

...

  1. and

...

  1. add

...

  1. the

...

  1. following

...

  1. lines

...

  1. just

...

  1. above

...


  1. it

...

  1. : (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"/>)
    No Format
    
            <!-- 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"/>
    

...

  1. Start tomcat and point your browser to: http://localhost:8080/sample-companyweb-

...

  1. version

...

  1. tag

...

  1. /

...


  1. example:

...

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

...