Versions Compared

Key

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

Getting Started with Tuscany SCA for Java

Overview

Set up the development environment

1) Repository

Tuscany source code is hosted at Apache subversion repository. If you want to build Tuscany from source, you need to install a subversion client.

Info
titleWhere to download the subversion clients?

Command line: http://subversion.tigris.org/ (1.4.2)
Windows GUI: http://tortoisesvn.tigris.org/ (1.4.1)

2) Build

Info
titleWhere to download maven?

Maven 2: http://maven.apache.org/ (2.0.4)

3) Development IDE

Info
titleWhere to download Eclipse/WTP?

Eclipse: http://www.eclipse.org/ (3.2.1)
Eclipse WTP: http://www.eclipse.org/webtools/ (1.5.2)

Create a simple project from scratch

Code Block
mvn archetype:create -DgroupId=sample -DartifactId=helloworld

Configure the project for maven build

Code Block
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.apache.tuscany.samples.sca</groupId>
    <version>1.0-incubator-SNAPSHOT</version>
    <artifactId>sample-mortgage</artifactId>
    <packaging>jar</packaging>
    <name>Tuscany Mortgage Sample</name>
    <description>A sample Mortgage application made of several SCA components wired together.</description>

    <properties>
        <property name="tuscanyVersion">1.0-incubator-SNAPSHOT</property>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.osoa</groupId>
            <artifactId>sca-api-r0.95</artifactId>
            <version>${tuscanyVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tuscany.sca</groupId>
            <artifactId>test</artifactId>
            <version>${tuscanyVersion}</version>
            <scope>test</scope>
        </dependency>
</project>

Load the project into Eclipse

1. Adding M2_REPO classpath variable

Code Block
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo

2. (Optional) Add maven as an external tool for Eclipse

3. Create Eclispe metadata files

Code Block
mvn -Peclipse eclipse:eclipse

4. Import projects into Eclipse
File --> Import ... --> Existing Projects into Workspace

Tip
title"Maven integration with Eclipse"

http://maven.apache.org/guides/mini/guide-ide-eclipse.html

Develop a simple SCA application

1. Declare components in the SCDL

Code Block
titleMETA-INF/sca/default.scdl
The SCDL file

2. Implement the components in java

Code Block
titleCreditCheckImpl.java
The java file

Run the SCA application