Versions Compared

Key

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

...

The first thing you do is to create a folder on you disk into which you will download the TUSCANY distribution.
Next you download the latest release distribution. Launch your browser and enter one of the
following URL's.

Latest Release - http://cwiki.apache.org/TUSCANY/sca-java-releases.htmlImage Removed

Download both the bin zip as well as the src zip to the folder that you created on your disk. Once
you completed the download you should see the following on your disk.

Next you unzip the bin zip in place, you should see the following folder file structure on your disk
after unzip is complete.

...

Start Eclipse and create a User Library to contain the TUSCANY runtime jar's as well as their
depending jar's.

From the menu bar select Window and then Preferences... . The Preferences dialog will appear,
in its left navigation tree select Java, followed by Build Path, and followed by User Libraries.
Select the New... pushbutton on the right of the New Libraries dialog to create a new user library.

...

The user library created is empty, select the Add JARs... pushbutton on the right to add all the
jar's from your Tuscany installation lib folder. When completed all the jar's will appear under the
TUSCANY user library.

...

Since some of you maybe interested in debugging also the Tuscany runtime code we will attach
the Tuscany source to the Tuscany runtime jar in the following step. In the User Libraies dialog
scroll down until you see the Tuscany runtime jar and select its Source attachment.

Select the Edit... pushbutton on the right and in the Edit dialog use the External File... pushbutton
to the select the Tuscany src zip that we downloaded earlier.

Image Added

Select OK to complete this and the Preferences dialog, and you are done with the Tuscany setup
for Eclipse.

Create your 1st Composite Service Application

The following shows the composition diagram for the composite service application you are about
to create.

Image Added

The composite service application you will create is a composition of four services. The composed
service provided is that of an on-line store.
There is a Catalog service which you can ask for catalog items, and depending on its currency
code property configuration it will provide the item prices in USD or EUR. The Catalog service is not
doing the currency conversion itself it references a CurrencyConverter service to do that task. Then
there is the ShoppingCart service into which items chosen from the catalog can be added, it is
implemented as a REST service. The Catalog is bound using the JSONRPC binding, and the
ShoppingCart service is bound using the ATOM binding. Finally there is the Store user facing
service that provides the browser based user interface of the store. The Store service makes use of
the Catalog and ShoppingCart service using the JSONRPC, and ATOM binding respectively.

Create a Java Project

In this step you create a Java Project in Eclipse to hold the composite service application.
Click on the New Java Project button Image Added  in the toolbar to launch the project creation dialog.

Select the Edit... pushbutton on the right and in the Edit dialog use the External File... pushbutton
to the select the Tuscany src zip that we downloaded earlier.


Next you enter "store" as the Project name, and for Project Layout select Create separate
folders for sources and class files.
Image Added
 
Image Added
 
Hit the Next button, and on the following page go to the Libraries tab. Use the Add Library...
button on the right to add the TUSCANY user library to the project.
 
Image Added
 
 
Hit the Finish button to complete the New Java Project dialog to create the "store" java project. 
 
Image Added
 
 

Construct Services

First you create two package folders into which later in this step you place service implementations.
Select the "store" project and click on the New Java Package button Image Added in the toolbar to launch
the package creation dialog.

Next you enter "services" as the package Name, and press the Finish button to complete the
dialog.
Image Added
 
Repeat the previous step to create another package named "ufservices". The store project now
should look as follows.
 
Image Added
 
In the following you will place in the "services" package the regular services, and in the "ufservices"
package the user facing services of the composite service application you create.

Catalog

In this step you create the Catalog service interface and implementation.
Select the "services" package. Next you click on the dropdown arrow next to the New Java Class
button  Image Added  and select the New Java Interface   Image Added
option from the dropdown list. In the dialog

Wiki Markup
enter "Catalog" as the *{_}Name{_}* of the interface and select the Finish button to complete the dialog.
The Java editor will open on the new created Java interface. Replace the content of the editor by
*{_}copy-paste{_}* of the following Java interface code snippet.
 
package services;
import org.osoa.sca.annotations.Remotable;
@Remotable
public interface Catalog {
String\[\] get();
} 
Image Removed