Difference between revisions of "SCA/Components/SCA Samples"

From Eclipsepedia

< SCA
Jump to: navigation, search
(Restaurant - Composite)
(Restaurant - Script)
Line 47: Line 47:
 
== Restaurant - Script ==
 
== Restaurant - Script ==
  
This sample splits the initial restaurant sample in two composites.
+
This sample is the same as the simple restaurant sample except that:
  
The restaurant service is composed of three components: RestaurantServiceComponent, MenuServiceComponent and BillServiceComponent. The BillService component is implemented by an other composite named BillService.
+
* TipServiceComponent is implemented in JavaScript,  
 +
* VatServiceComponent is implemented in Python.
  
 
== Restaurant - Composite ==
 
== Restaurant - Composite ==

Revision as of 11:38, 26 May 2008

You can test the SCA Composite Designer and see some possibilities of SCA through the following samples.

This section provides a step-by-step description for creating and testing a sample project.

Contents

How to use samples

Register Tuscany for SCA samples

First, you have to install Apache Tuscany to be able to test the sample applications. See the first section on Installing Tuscany to test your SCA applications. You can download it on: (http://incubator.apache.org/tuscany/sca-java-releases.html)

Then, you have to register Tuscany for SCA samples:

  1. Select Window > Preferences....
  2. Select SOA Tools > SCA Tools.
  3. Set the Tuscany directory
  4. Click on the Ok button.Scaexamples4.png

Creating samples

Different samples are available to test the SCA Composite Designer, they are described in the following sections. The samples projects are automatically created :

  1. Select File > New > Sample....
  2. Select SCA > SCA Examples and click Next.Scaexamples2.png
  3. Select one of the examples and click Next.Scaexamples1.png
  4. Set the Project name.
  5. Click Finish. The project is created with the following structure (for the first sample):Scaexamples3.png

Restaurant sample

This sample provides a simple SCA composite named Restaurant. This composite is a composition of five components:

  • RestaurantServiceComponent shows the list of proposed menus and computes the bill for the chosen menu.
  • MenuServiceComponent provides the menus (price without taxes).
  • BillServiceComponent computes the price of a menu with the different taxes.
  • VATServiceComponent computes the VAT (Value Added Tax).
  • TipServiceComponent computes the tip.

The test.Client exercises this interface by calling getMenus and getBill operations. This results in messages passing to the appropriate components in the composite across the local wires (java binding).

Restaurant - RMI Service

This sample extends the Restaurant sample by replacing the local service binding with an RMI binding. So a Java client can call the service exposed by the SCA application using an RMI client.

Restaurant - RMI Reference

This sample splits the initial restaurant sample in two composites:

  • The first one (restaurant composite) contains the RestaurantServiceComponent and the MenuServiceComponent,
  • The second one (bill composite) contains the BillServiceComponent, the VatServiceComponent, and the TipServiceComponent.

The reference specified in the restaurant composite file include an RMI binding which targets the bill composite.

Restaurant - Script

This sample is the same as the simple restaurant sample except that:

  • TipServiceComponent is implemented in JavaScript,
  • VatServiceComponent is implemented in Python.

Restaurant - Composite

This sample splits the initial restaurant sample in two composites.

The restaurant service is composed of three components: RestaurantServiceComponent, MenuServiceComponent and BillServiceComponent. The BillService component is implemented by an other composite named BillService.