Author: lresende
Date: Mon Sep 10 16:38:14 2007
New Revision: 574407
URL: http://svn.apache.org/viewvc?rev=574407&view=rev
Log:
TUSCANY-1604 - Applying patch from Haleh Mahbod
Added:
incubator/tuscany/java/sca/samples/osgi-supplychain/README (with props)
incubator/tuscany/java/sca/samples/osgi-supplychain/build.xml (with props)
Removed:
incubator/tuscany/java/sca/samples/osgi-supplychain/readme.htm
Added: incubator/tuscany/java/sca/samples/osgi-supplychain/README
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/osgi-supplychain/README?rev=574407&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/osgi-supplychain/README (added)
+++ incubator/tuscany/java/sca/samples/osgi-supplychain/README Mon Sep 10
16:38:14 2007
@@ -0,0 +1,162 @@
+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.
+
+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] Created OSGiCustomerImpl
+ [java] Started bundle OSGiCustomerImpl
+ [java] Customer.purchaseGoods, retailer is [Proxy - 1afae45]
+ [java] Retailer.submitOrder, warehouse is [Proxy - 811c88]
+ [java] Warehouse.fulfillOrder : shipper is [Proxy - 15bdc50]
+ [java] Created OSGiShipperImpl
+ [java] Started bundle OSGiShipperImpl
+ [java] Shipper.processShipment, customer is [Proxy - 60e128]
+ [java] Main thread sleeping ...
+ [java] Work thread Thread[pool-1-thread-1,5,main] - Order, submitted,
fulfi
+lled, 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]
+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.
Propchange: incubator/tuscany/java/sca/samples/osgi-supplychain/README
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/samples/osgi-supplychain/README
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/tuscany/java/sca/samples/osgi-supplychain/build.xml
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/osgi-supplychain/build.xml?rev=574407&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/osgi-supplychain/build.xml (added)
+++ incubator/tuscany/java/sca/samples/osgi-supplychain/build.xml Mon Sep 10
16:38:14 2007
@@ -0,0 +1,72 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project name="osgi-supplychain" default="compile">
+ <property name="test.class" value="supplychain.SupplyChainClient" />
+ <property name="test.jar" value="sample-osgi-supplychain.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
Propchange: incubator/tuscany/java/sca/samples/osgi-supplychain/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/samples/osgi-supplychain/build.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/samples/osgi-supplychain/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]