From 5559ef5edbf8d3616f7a4b497b2a459b0ee4082b Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:07:07 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835122 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca-java-1.0/samples/osgi-supplychain/README | 161 +++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-1.0/samples/osgi-supplychain/README (limited to 'sca-java-1.x/branches/sca-java-1.0/samples/osgi-supplychain/README') diff --git a/sca-java-1.x/branches/sca-java-1.0/samples/osgi-supplychain/README b/sca-java-1.x/branches/sca-java-1.0/samples/osgi-supplychain/README new file mode 100644 index 0000000000..2ede760e24 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0/samples/osgi-supplychain/README @@ -0,0 +1,161 @@ +osgi-supplychain Sample +======================= + +The Tuscany OSGi supply chain sample shows using the Tuscany SCA runtime in a J2SE environment executing the SCA asynchronous API with OSGi and Java implementation types. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +In the directory samples\osgi-supplychain use the JDK 1.5 java command to run the class supplychain.SupplyChainClient + +Linux: java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-osgi-supplychain.jar supplychain.SupplyChainClient +Windows: java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-osgi-supplychain.jar supplychain.SupplyChainClient + +Results +---------- +The sample when run should simply display on the standard output some startup messages followed by: + +Work thread Thread[Thread-1,5,main] - Order, submitted, fulfilled, shipped + + +Sample Overview +--------------- + +The sample provides a Customer service with a purchaseGoods operation +and a notifyShipment operation annotated with the SCA @OneWay annotation. +The SupplyChainClient exercises this interface by calling the +purchaseGoods operation. This results in messages passing to +the Retailer, Warehouse, and Shipper components and the result returned +to the Customer service on a separate callback thread. The Customer +and Shipper components are implemented as OSGi bundles which use +implementation.osgi, while the Retailer and Warehouse components are +implemented using implementation.java. + + +src ++---main + +---java + ¦ +---supplychain + ¦ OSGiBundleImpl.java + ¦ SupplyChainClient.java + ¦ +---customer + ¦ Customer.java + ¦ JavaCustomerComponentImpl.java + ¦ OSGiCustomerComponentImpl.java + ¦ OSGiCustomerImpl.java + ¦ +---retailer + ¦ Retailer.java + ¦ JavaRetailerComponentImpl.java + ¦ OSGiRetailerComponentImpl.java + ¦ OSGiRetailerImpl.java + ¦ +---shipper + ¦ Shipper.java + ¦ JavaShipperComponentImpl.java + ¦ OSGiShipperComponentImpl.java + ¦ OSGiShipperImpl.java + ¦ +---warehouse + ¦ Warehouse.java + ¦ JavaWarehouseComponentImpl.java + ¦ OSGiWarehouseComponentImpl.java + ¦ OSGiWarehouseImpl.java + ¦ + +---resources + ¦ +---osgi + ¦ Customer.mf + ¦ Retailer.mf + ¦ Shipper.mf + ¦ Warehouse.mf + ¦ +---ds + ¦ Customer.mf + ¦ Retailer.mf + ¦ Shipper.mf + ¦ Warehouse.mf + ¦ Customer.xml + ¦ Retailer.xml + ¦ Shipper.xml + ¦ Warehouse.xml + ¦ Customer.componentType + ¦ Retailer.componentType + ¦ Shipper.componentType + ¦ Warehouse.componentType + ¦ supplychain.composite + ¦-- supplychain.ds.composite + + + build.xml - the Ant build file + pom.xml - the Maven build file + +Understanding OSGI implementation files +--------------------------------------- +Some of the files introduced by OSGI implementation are explained below. + +OSG files related to customer. java are: +OSGiCustomerComponentImpl.java: OSGi Declarative Services Implementation of the SCA Customer component. +OSGiCustomerImpl.java: OSGi Procedural Services Implementation of the SCA Customer component. + +You notice the same pattern for shipper.java, retailer.java, SupplyChainClient.java. + +The rest of OSGI related files are: +OSGiBundleImpl.java: Common code for OSGi Procedural Services Implementation of the SCA components + +resources/osgi/*.mf: Manifest files for OSGi bundles for OSGi procedural services implementation + +resources/osgi/ds/*.m:f Manifest files for OSGi bundles for OSGi declarative services implementation + +resources/osgi/ds/*.xml: OSGi Declarative services component xml files + +resources/*.componentType: Component types used by OSGi implementation provider for SCA + +resources/supplychain.composite: Composite file using OSGi and Java implementation types + +resources/supplychain.ds.composite: Composite file using OSGi (declarative services) and Java implementation types + +Building And Running The Sample Using Ant +----------------------------------------- +cd osgi-supplychain +ant compile +ant run + +you should see: +Buildfile: build.xml + +run: + [java] Main thread Thread[main,5,main] + [java] Main thread Started OSGi bundle with activator OSGiCustomerImpl + [java] Main thread Started OSGi bundle with activator OSGiShipperImpl + [java] Main thread Sleeping ... + [java] Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shipped + + + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd osgi-supplychain +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running supplychain.SupplyChainClientTestCase +Main thread Thread[main,5,main] +Started OSGi bundle with activator OSGiCustomerImpl +Started OSGi bundle with activator OSGiShipperImpl +Sleeping ... +Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shipped +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.625 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. -- cgit v1.2.3