Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In a distribution, the samples source code is found in either a binary or source code distribution in the samples directory, directly under the root directory. The following sections are laid out to match the structure of the samples directory and its subdirectories.

In the following code snippets text enclosed in <> means you have to replace it with whatever is appropriate in your environment. For example <tuscany_din_distro> means the directory in which you install the Tuscany binary distribution.

Table of Contents
minLevel2
outlinetrue

...

The sample contributions in getting-started and learning-more should work regardless of which approach you adopt. However some approaches, like embedded-jse, don't have launchers for every single sample contribution.

command-line

Instructions for how to You can execute a sample contribution from the command line on Windows or Linux.

eclipse

Instructions for how import sample contributions into eclipse and have them compile against the Tuscany runtime Jars. If you also use the simple Java launcher style demonstrated in the embedded-jse directory you can easily launch and debug contributions. The sample launching code can be included in JUnit tests if you want to be able to automatically test your contributions.

embedded-jse

Note
titleTODO

Waiting for tuscany.bat to be reworked before correcting

To execute a sample contribution from the command line

on Windows, from a command prompt in the samples directory, run the command ...

Code Block

<tuscany_din_distro>\bin\tuscany.bat "contribution-name"

for example

Code Block

cd <tuscany_din_distro>\samples\learning-more\binding-sca\calculator-contribution
<tuscany_din_distro>\bin\tuscany.bat sample-binding-sca-calculator-contribution.jar

or on *nix platforms, from a shell prompt in the samples directory, run the command ...

Code Block

cd <tuscany_din_distro>/samples/learning-more/binding-sca/calculator-contribution
<tuscany_din_distro>/bin/tuscany.sh sample-binding-sca-calculator-contribution.jar

eclipse

To import sample contributions into Eclipse you first need to import the Tuscany runtime. You then need to import the sample contribution into Eclipse as a project. Instructions for doing both of these things can be found here

http://tuscany.apache.org/import-existing-tuscany-sca-projects-into-eclipse.htmlImage Added

Note. these instructions refer to our 1.x code base but it holds true for our 2.x code base.

Once you have a contribution imported into Eclipse and cleanly compiling against the Tuscany runtime jars you probably want to be able to run and debug it. The easiest way to do this is with a simple Java launcher. If you import the running-tuscany/embedded-jse project into Eclipse you'll see a number of such launcher programs which you can copy to launch the contribution(s) of your choice. Alternatively you can add a JUnit test case to the contribution that starts Tuscany and launches the contribution. See maven-junit as an example of how to do this.

embedded-jse

This directory contains sample java launchers for the some of the Tuscany sample contributions from the learning-more directory. It shows you how to embed the Tuscany runtime in a Java program. To make you're own launchers simply copy and existing one and change the details of the contribution being loaded. You'll note that the same launcher code is used inside the contribution unit test demonstrated by maven-junit.

To use the sample JSE launchers from maven do the following:

Code Block

cd embedded-jse
mvn

This runs a JUnit test case that runs all the launchers in turn.

This directory contains sample java launchers for the some of the tuscany sample contributions. To use the sample JSE launchers with ant execute the command

Code Block
ant <contributionname>

where run- <contributionname> is one of the targets in the provided build.xml fileTo use this sample launcher to run all of the contributions as junit test cases, execute the command "mvn" in the launcher directory.

embedded-osgi

The launchers implemented in the src/main/java/launchers directory each launch a specific contribution into the OSGI runtime.
To use this sample OSGI launcher with ant excute execute the command

Code Block
ant run-<contributionname>

where run- <contributionname> is one of the targets in the build.xml file

...