Versions Compared

Key

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

...

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

...

Note
titleTODO

This sample webapp doesn't provide any web pages so how to make it do something?

need

description

of

structure

and

operation

this

application

once

we've

decided

what

that

should

be {node} {note:title=TODO} For more information on creating webapps to run SCA contributions with Tuscany see - ?

be

Note
titleTODO
Wiki Markup
Note
titleTODO

For more information on creating webapps to run SCA contributions with Tuscany see - ?

callback-api

Note
titleTODO

This feels like a learning-more sample. I wouldn't focus on callbacks with the first time user

...

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

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 execute the commandTuscany runtime jars will also work within an OSGi enviroment. If you want to load them into a vanilla OSGi environment see the osgi directory. If you want Tuscany to create an OSGi environment for you this directory contains launchers that do just that.

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

Code Block

cd embedded-osgi
mvn

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

To use the sample OSGI launchers with ant do the following:

Code Block

cd embedded-osgi
Code Block

ant <contributionname>

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

To use this sample launcher to run all of the contributions as junit test cases,
execute the command

Code Block
mvn

in the launcher directory.

maven

To execute a sample contribution from Maven

maven

Maven can be used to install contributions. Tuscany has a special plugin (maven-tuscany-plugin) that makes this happen. Look look for contributions that have the following configuration in their pom.xml file:

Code Block

<plugin>

...


<groupId>org.apache.tuscany.maven.plugins</groupId>

...


<artifactId>maven-tuscany-plugin</artifactId>

...


<version>2.0-SNAPSHOT</version>

...


</plugin>

For contributions that have this, for example, learning-more/binding-sca/contribution-calculator, do the following

cd samples/learning-more/binding-sca/contribution-calculator
mvn tuscany:run

This will launch install the contribution in the Tuscany runtime, start the composite it contains, and then wait. At this point you can use
other clients to send messages to services that the running SCA applcation exposes,
for example, try learning-more/sca-client/calculator-scaclient.

osgi

The Tuscany runtime can be run in and a vanilla OSGi container

Running in Equinox

On Windows, run

such as Equinox. To do this you have to:

  • launch the OSGi container itself
  • load the Tuscany runtime bundles (all our jars are bundles) into the container
  • install a contribution packaged as an OSGi bundle

For example, to install a contribution in Equinox do the following

On Windows, run

Code Block
java \-jar ..\..\modules\osgi-3.5.0-v20090520.jar \-configuration ..\..\features\configuration \-clean \-console

On *Unix, run

Code Block
java \-jar ../../modules/osgi-3.5.0-v20090520.jar \-configuration ../../features/configuration \-clean \-console

You should see the osgi console:

...

You can run "ss" command under the osgi> to see the status of the bundles.

Code Block
osgi> ss

Then you can install and start contributions as bundles by doing the following:

Code Block
osgi> install file:./path/to/contribution<contribution_bundle.jar
jar>

Note that contribution<contribution_bundle.jar jar> will need an activator in order to register the bundle as a SCA contribution

...

...

Running on Felix

See http://tuscany.apache.org/documentation-2x/running-tuscany-sca-2x-with-equinox-and-felix.html

...

This directory contains a sample shell program supporting simple commands to
start and stop SCA composites.

Note
titleTODO

We currently have two similar approaches available (see command-line). We need to merge the two together.

To build the sample shell do this:

...

The shell can also run as a Webapp. To try it install target/scashell.war in
a Web container, point your Web browser to http://localhost:8080/scashell
and try the links on that page.

webapp

To execute sample webapp Tuscany can be embedded inside a webapp alongside one or more SCA contributions. To execute sample webapp based contributions (contributions that have webapp at the end of their name) you
can build the contribution using maven and then copy the resulting war file to your container of choice

For example, for binding-jsonrpc/contribution-calculator-webapp, do the following:

Code Block
cd samples/binding-jsonrpc/contribution-calculator-webapp
mvn
cp target/sample-contribution-binding-jsonrpc-calculator-webapp.war your<your_container_deployment-dirdir>

As an alternative, sample webapp based contributions can be run within Jetty directly from Maven, look for
webapp contributions that have the following configuration in their pom.xml file:

...

This will launch the contribution in the Jetty runtime and then wait. At this point you can use
HTTP clients to send messages to services that the running SCA applcation exposes. For this
example try pointing your browser at:

Code Block
http://localhost:8080/sample-contribution-binding-jsonrpc-calculator-webapp/

...

The samples found in the contributions below illustrate how to see more of SCA and Tuscany's features in action. You'll need to employ The contributions here are primarily focused on demonstrating the various SCA extensions that the Tuscany runtime supports, for example, bindings and implementations. The directories are named to let you easily find a sample of the extension you're interested in.

You can identify contributions here as the name of the directory from which they are built ends with "-contribution". There are also webapp samples here. The names of these directories end with "-webapp".

Refer to the information above in the "running tuscany" section to select an appropriate way of runing the contributions in the samples listed belowfind the various options for installing these sample contributions. We present an single default approach for each sample as an example.

async

This sample  demonstrates invocation of services offered in both synchronous and asynchronous forms. Asynchroncity is possible by either callback to or polling by the original service invoker.

...