Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Section
bordertrue
Column
width15%
Include Page
TUSCANYWIKI: SCA Java Subproject MenuTUSCANYWIKI:
SCA Java Subproject Menu
Include Page
TUSCANYWIKI: Java SCA Menu NewTUSCANYWIKI:
Java SCA Menu New
{panel:title= How to get involved in development of Java SCA? |borderStyle=solid|borderColor=#C3CDA1|titleBGColor=#C3CDA1|bgColor=#ECF4D1} This document is the development guideline for SCA Java project. * [General Guide|#General Guide] * [Getting Source code|#Getting Source] * [Setting up your development environment|#Setup] * [Importing SCA modules into your Development IDE|#IDE] * [Coding Guidelines|#Coding Guidelines] * [Testing|#Testing] * [Maven Build Structure|#Maven Build Structure] * [Reporting Issues and Providing patches|#Providing patches] \\   {panel} h3. {anchor:General Guide}

Column
width85%
Panel
borderColor#C3CDA1
bgColor#ECF4D1
titleBGColor#C3CDA1
titleHow to get involved in development of Java SCA?
borderStylesolid

This document is the development guideline for SCA Java project.


 

Wiki Markup
Anchor
General Guide
General Guide
Wiki Markup

{bgcolor:#C3CDA1}General Guide{bgcolor}

Welcome

to

the

Tuscany

SCA

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
  • SCA
  • sub-project
  • aims
  • to
  • provide
  • enterprise-grade
  • service
  • infrastructure
  • based
  • on
  • SCA.
*
  • Tuscany
  • SCA
  • is
  • not
  • just
  • a
  • reference
  • implementation.
  • We
  • encourage
  • innovation
  • based
  • on
  • the
  • tenets
  • of
  • SCA.
  • A
  • lot
  • of
  • work
  • we
  • do
  • provides
  • feedback
  • to
  • the
  • specifications.
*
  • The
  • Java
  • SCA
  • infrastructure
  • should
  • provide
  • flexibility
  • and
  • choice.
  • It
  • should
  • not
  • dictate
  • programming
  • models
  • but
  • support
  • many.
*
  • The
  • Java
  • SCA
  • infrastructure
  • is
  • very
  • modularized
  • and
  • is
  • designed
  • to
  • be
  • highly
  • extensible
  • so
  • users
  • can
  • customize
  • it
  • to
  • fit
  • their
  • needs.
h3. {anchor:Getting Source}

Anchor
Getting Source
Getting Source
Wiki Markup
{bgcolor:#C3CDA1}Getting Source code{bgcolor}

The

Java

SCA

project

Subversion

repository

is

located

at

[

https://svn.apache.org/repos/asf/incubator/tuscany/java/sca

]

.


The

repository

can

also

be

viewed

online

at

[

http://svn.apache.org/viewvc/incubator/tuscany/java/

]

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.

h4.

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):

{
Code Block
}
svn checkout http://svn.apache.org/repos/asf/incubator/tuscany/java/sca
{code}

h4. Committing Changes to Subversion

Any Tuscany committer should have a shell account on 

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:

{
Code Block
}
svn commit
{code}

If

Subversion

can't

figure

out

your

username,

you

can

tell

it

explicitly:

{
Code Block
}
svn --username <name> commit
{code}

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.

h3. {anchor:Setup}

Anchor
Setup
Setup
Wiki Markup
{bgcolor:#C3CDA1}Setting up your Development Environment{bgcolor}

h4. Prerequisites Java SCA requires the following: * [JDK

Prerequisites

Java SCA requires the following:

\ |http://java.sun.com/j2se/1.5.0] * [Apache Maven |http://maven.apache.org/] * [Subversion

Build tree structure

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

No Format
|http://subversion.tigris.org/]

h4. Build tree structure

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

{noformat}
-java
 |-- sca
     |-- demos                SCA demo applications
     |-- distribution         SCA distributions
     |-- itest                SCA Integration Tests
     |-- modules              SCA Implementation Modules (core, runtimes, contribution, extensions, etc)
     |-- samples              SCA Sample Applications
{noformat}

  
The individual modules can be built separately or build with 

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

build.

h4.

top-down

build

(recommended

approach)

Check

out

all

of

the

java

source

code.

{
Code Block
}
svn checkout http://svn.apache.org/repos/asf/incubator/tuscany/java
{code}

Building

the

SCA

source

code

is

simple

{
Code Block
}
cd java/sca
mvn
{code}

It

should

work

even

if

you

start

with

an

empty

Maven

local

repository,

and

it

should

always

work.

This

assumes

that

maven

is

able

to

retrieve

a

SNAPSHOT

version

of

SDO

(and

of

course

the

rest

of

software

that

SCA

depends

on)

as

we

haven't

built

anything

other

than

SCA

here.

(on) 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. (on) 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 {code} mvn -o {code} h3. {anchor:IDE}

(lightbulb) 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.

(lightbulb) 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

Code Block

mvn -o

Anchor
IDE
IDE
Wiki Markup
{bgcolor:#C3CDA1}Importing SCA modules into your Development IDE{bgcolor}

h4.

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

:

{
Code Block
}
mvn -Declipse.workspace=[path-to-eclipse-workspace] eclipse:add-maven-rep
{code}

In

order

to

generate

the

necessary

project

files

to

import

the

SCA

modules

to

Eclipse,

you

can

use

the

maven

eclipse

plugin

{
Code Block
}
cd java/sca
mvn -Peclipse eclipse:eclipse
{code}

Now,

launch

your

Eclipse

IDE,

select

File->Import->Existing

projects

into

Workplace,

and

then

select

the

base

SCA

directory

(e.g

java/sca)

and

then

press

Finish,

this

should

import

all

SCA

modules

into

your

Eclipse

Workspace.

h3. {anchor:Coding Guidelines}

Anchor
Coding Guidelines
Coding Guidelines
Wiki Markup
{bgcolor:#C3CDA1}Coding Guidelines{bgcolor}

There

are

a

few

simple

guidelines

when

developing

for

JAVA

SCA:

*

  • 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
[]
  • and
[]
  • .
  • 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:
{
Code Block
}
@version $Rev$ $Date$
{code}
* Please attempt to accompanied 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 
  • Please attempt to accompanied 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:
Code Block
in:

{code}
mvn clean
mvn -o -Psourcecheck
{code}
* 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".

h4. 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. So, for example, 
  • 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. So, for example, java/sca/module/implementation-java

would

be

in

package

structure

org.apache.tuscany.implementation.java.

\* h3. {anchor:Testing}

*

Anchor
Testing
Testing
Wiki Markup
{bgcolor:#C3CDA1}Testing{bgcolor}

All

committs

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,

below

is

an

example

that

can

also

be

used

as

a

template

for

writing

new

test

cases;

it

demonstrates

how

to

bootstrap

the

Tuscany

SCA

runtime

in

your

test

case,

and

because

they

are

based

on

junit,

you

can

run

it

from

your

IDE

of

choice

or

from

Maven.

{
Code Block
}
/**
 * Description of your test case and necessary details you find necessary
 */
public class YourTestCase extends TestCase {
    private SCADomain domain;
    private YourService service;


    @Override
    protected void setUp() throws Exception {
    	domain = SCADomain.newInstance("YourTest.composite");
        service = domain.getService(YourService.class, "serviceName");
    }

    @Override
    protected void tearDown() throws Exception {
    	domain.close();
    }


   ...
}
{code}


(on) Note that we use surefire maven plugin to run the unit and integration tests, and in most cases, they are configured to match a 

(lightbulb) 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.

We

encourage

and

follow

_

continuous

integration

_

.

Martin

Fowler

has

a

concise

write-up

[here|http://www.martinfowler.com/articles/continuousIntegration.html] h3. {anchor:Maven Build Structure}

here

Anchor
Maven Build Structure
Maven Build Structure
Wiki Markup
{bgcolor:#C3CDA1}Maven Build Structure{bgcolor}

_

We

use

the

term

Module

to

refer

to

the

leaf

of

maven

tree.

_ *

  • sca/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.sca
*
  • Version
  • of
  • our
  • modules
  • will
  • be
  • specified
  • once
  • in
  • java/sca/pom.xml,
  • child
  • poms
  • don't
  • need
  • specify
  • a
  • version
  • as
  • they
  • get
  • it
  • from
  • their
  • parent
*
  • pom
  • names
  • begin
  • Apache
  • Tuscany
  • SCA
*
  • Eclipse
  • projects
  • are
  • generated
  • for
  • all
  • built
  • modules
  • using
  • mvn
\
  • -Peclipse
  • eclipse:eclipse
h4.

Adding

a

new

module

and

not

ready

to

integrate?

'work-in-progress'

modules

can

be

worked

on

in

the

same

source

tree

and

yet

not

break

the

top-down

build.

You

can

do

this

by

not

listing

your

module(s)

in

java/sca/modules/pom.xml.

h3. {anchor:Providing patches}

Anchor
Providing patches
Providing patches
Wiki Markup
{bgcolor:#C3CDA1}Reporting issues and providing patches{bgcolor}

{include: Found a Bug Section} {HTMLcomment

Include Page
Found a Bug Section
Found a Bug Section

Wiki Markup
{htmlcomment:hidden}{children:sort=creation}{

HTMLcomment

htmlcomment}