Tuscany Supply Chain Sample

Overview

The Tuscany supply chain sample shows using the Tuscany SCA runtime in a J2SE environment executing the SCA asynchronous API.

Location

This sample is located  in the samples\sca\supplychain directory.

Setup

This sample depends on the Tuscany runtime and the sample jar, sample-supplychain-incubating-M1.jar , both of these must be available on the classpath to run the sample.

Running

In the directory samples\sca\supplychain use the JDK 1.5 java command to run the class supplychain.SupplyChainClient
Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:target/sample-supplychain-incubating-M1.jar supplychain.SupplyChainClient
Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;target/sample-supplychain-incubating-M1.jar supplychain.SupplyChainClient

Results

The sample when run should simply display to the standard output:

May 16, 2006 3:12:13 PM org.apache.tuscany.core.client.TuscanyRuntime$Monitor moduleStarted
INFO: Started application module [supplychain]
Main thread Thread[main,5,main]
Work thread Thread[Thread-1,5,main] - Order, submitted, fulfilled, shipped

Code Overview

The source files are physically organized as shown below:
src
+---main
    +---java
    ¦   +---supplychain
    ¦           Customer.java
    ¦           CustomerComponentImpl.java
    ¦           Retailer.java
    ¦           RetailerComponentImpl.java
    ¦           Shipper.java
    ¦           ShipperComponentImpl.java
    ¦           SupplyChainClient.java
    ¦           Warehouse.java
    ¦           WarehouseComponentImpl.java
    ¦
    +---resources
            logging.properties
            sca.module

Customer.java Defines the Java interface implemented by the Customer component.
CustomerComponentImpl.java Implements the SCA Customer component.
Retailer.java Defines the Java interface implemented by the Retailer component.
RetailerComponentImpl.javaImplements the SCA RetailerComponent component.
Shipper.javaDefines the Java interface implemented by the Shipper component
ShipperComponentImpl.javaImplements the SCA ShipperComponent component.
SupplyChainClient.javaSupplyChainClient.java loads SCA runtime
Warehouse.javaDefines the Java interface implemented by the Warehouse component.
WarehouseComponentImpl.javaImplements the SCA WarehouseComponent component.
logging.propertiesConfigures Tuscany logging. Provides the output of this demo.
sca.moduleDefines and assembles the SCA components