summaryrefslogtreecommitdiffstats
path: root/java/sca-contrib/samples/calculator-distributed
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca-contrib/samples/calculator-distributed')
-rw-r--r--java/sca-contrib/samples/calculator-distributed/README438
-rw-r--r--java/sca-contrib/samples/calculator-distributed/build.xml111
-rw-r--r--java/sca-contrib/samples/calculator-distributed/calculator-distributed.pngbin0 -> 76839 bytes
-rw-r--r--java/sca-contrib/samples/calculator-distributed/calculator-distributed.svg383
-rw-r--r--java/sca-contrib/samples/calculator-distributed/cloud.composite26
-rw-r--r--java/sca-contrib/samples/calculator-distributed/domain.composite26
-rw-r--r--java/sca-contrib/samples/calculator-distributed/pom.xml119
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/AddService.java31
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java31
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java35
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java74
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/DivideService.java28
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java28
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/SubtractService.java31
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java31
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java67
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java28
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java28
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchDomain.java33
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite33
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite33
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite33
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite41
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml24
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite29
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml24
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite29
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml24
-rw-r--r--java/sca-contrib/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java92
-rw-r--r--java/sca-contrib/samples/calculator-distributed/workspace.xml25
32 files changed, 1995 insertions, 0 deletions
diff --git a/java/sca-contrib/samples/calculator-distributed/README b/java/sca-contrib/samples/calculator-distributed/README
new file mode 100644
index 0000000000..51f4b07e81
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/README
@@ -0,0 +1,438 @@
+Calculator Distributed Sample
+=============================
+This sample implements a simple calculator using SCA components. It uses
+exactly the same calculator application classes as the calculator sample but
+runs the application distributed across three nodes.
+
+A node in this sample means an instance of the Tuscany SCA java runtime running
+in a Java virtual machine.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open four command prompts and
+navigate to this sample directory in each one. There is one command to be run
+in each command prompt:
+
+ant runDomain
+ant runNodeB
+ant runNodeC
+ant runNodeA
+
+Please run the commands in this order.
+
+OR if you don't have ant, on Windows use
+
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchDomain
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeB
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeC
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeA
+
+and on *nix do
+
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchDomain
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeB
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeC
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeA
+
+
+The processes started on each of these command prompts can be ended by pressing
+the <Enter> key.
+
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. NodeA exercises this interface by calling add, subtract, multiply and
+divide operations.
+
+In the case of add and subtract the runtime recognises that
+it can't find these services locally and, using the remote (web services)
+version of the default SCA binding, contacts the add service running in NodeB
+and the subtract service running in NodeC.
+
+On the command prompt where you started NodeA, you see the output of invoking the
+calculator functions distributed over NodeB and and NodeC. On the command prompts
+where you have started NodeB and NodeC, you see log messages that indicate that
+the add and subtract services where called on these nodes respectively.
+
+The sample demonstrates that the calculator application can be distributed
+across multiple nodes with no change to the application or to the SCA description
+files.
+
+The domain node makes available a web application through which the contributions and
+composites used in this sample can be navigated. One you have run "ant runDomain" you can
+point you browser at:
+
+http://localhost:9990/ui/workspace/
+
+The contents of the sample are as follows:
+
+calculator/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - the first component, calls +-/* as
+ appropriate
+ AddService.java - adds two numbers
+ AddServiceImpl.java
+ SubtractService.java - subtracts one number from another
+ SubtractServiceImpl.java
+ MultiplyService.java - multiplies two numbers
+ MultiplyServiceImpl.java
+ DivideService.java - divides one number by another
+ DivideServiceImpl.java
+ node/
+ LaunchCalculatorNodeA.java - runs an sca node configured with the
+ composite describing the main calculator
+ application. If you look inside this class
+ you will see that the node is configured
+ using a URL of the form:
+
+ http://localhost:9990/node-config/NodeA
+
+ This retrieves the information required
+ to configure NodeA from the domain.
+
+ Once the node has been started this launcher
+ then finds the calculator service and
+ calls the various methods.
+
+ LaunchCalculatorNodeB&C.java - These launchers start nodes B and C
+ which runs the add and subtract services.
+
+ Unlike NodeA though these launchers just
+ wait once the node has been started. They
+ will service incomming web service requests
+ as they arrive.
+
+ LaunchDomain.java - the node that provides the domain
+ configuration to the distributed
+ nodes
+ resources/
+ cloud - The SCA composite files that describe
+ the configuration of each node
+ nodeA - the SCA assembly for nodeA's part of the
+ calculator application
+ nodeB - the SCA assembly for nodeB's part of the
+ calculator application
+ nodeC - the SCA assembly for nodeC's part of the
+ calculator application
+ test/
+ java/
+ calculator/
+ CalculatorDistributedTestCase.java - JUnit test case which runs all
+ of the separate nodes along with the domain
+ in a single VM for test purposes
+ calculator-distributed.png - a pictorial representation of the sample
+ .composite files
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd calculator-distributed
+ant compile
+ant runDomain
+ant runNodeB
+ant runNodeC
+ant runNodeA
+
+You should see the following output from the four separate command prompt:
+
+runDomain:
+ted>ant runDomain
+Buildfile: build.xml
+
+runDomain:
+ [java] 26-Mar-2008 12:55:12 org.apache.tuscany.sca.node.launcher.DomainMana
+gerLauncher main
+ [java] INFO: Apache Tuscany SCA Domain Manager starting...
+ [java] 26-Mar-2008 12:55:13 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2
+\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-
+1.2-incubating-SNAPSHOT\lib
+ [java] 26-Mar-2008 12:55:13 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\
+distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1
+.2-incubating-SNAPSHOT\modules
+ [java] 26-Mar-2008 12:55:19 org.apache.catalina.core.StandardEngine start
+ [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.ContextConfig defau
+ltWebConfig
+ [java] INFO: No default web.xml
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.
+xsd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_1.
+xsd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_1_1.dtd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_1_2.dtd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_2_0.xsd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_2_1.xsd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/resources/j2ee_web_ser
+vices_1_1.xsd
+ [java] 26-Mar-2008 12:55:20 org.apache.coyote.http11.Http11Protocol init
+ [java] INFO: Initializing Coyote HTTP/1.1 on http-9990
+ [java] 26-Mar-2008 12:55:20 org.apache.coyote.http11.Http11Protocol start
+ [java] INFO: Starting Coyote HTTP/1.1 on http-9990
+ [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/home/*
+ [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/workspace/*
+ [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/files/*
+ [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/composite/*
+ [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/cloud/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/workspace/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/contribution/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/feed/files/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/files/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-source/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/deployable/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-resolved/
+*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/cloud/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/cloud-source/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-config/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/node-config/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/quickstart/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/processes/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/node/processes/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ping/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.node.launcher.DomainMana
+gerLauncher main
+ [java] INFO: SCA Domain Manager started.
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.node.launcher.DomainMana
+gerLauncher main
+ [java] INFO: Press enter to shutdown.
+
+
+runNodeB:
+ [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: Apache Tuscany SCA Node starting...
+ [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: SCA Node configuration: http://localhost:9990/node-config/NodeB
+
+ [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2
+\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-
+1.2-incubating-SNAPSHOT\lib
+ [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\
+distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1
+.2-incubating-SNAPSHOT\modules
+ [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.impl.NodeImpl <init
+>
+ [java] INFO: Creating node: http://localhost:9990/node-config/NodeB
+ [java] 26-Mar-2008 12:55:45 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist
+ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i
+ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeB/
+ [java] 26-Mar-2008 12:55:46 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co
+mposite:nodeB;http://sample;CalculatorB
+ [java] 26-Mar-2008 12:55:47 org.apache.tuscany.sca.node.impl.NodeImpl start
+
+ [java] INFO: Starting node: http://localhost:9990/node-config/NodeB
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8200/AddServiceComponent
+B
+ [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: SCA Node started.
+ [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: Press enter to shutdown.
+ [java] AddService - add 3.0 and 2.0
+
+runNodeC:
+ [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: Apache Tuscany SCA Node starting...
+ [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: SCA Node configuration: http://localhost:9990/node-config/NodeC
+
+ [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2
+\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-
+1.2-incubating-SNAPSHOT\lib
+ [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\
+distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1
+.2-incubating-SNAPSHOT\modules
+ [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.impl.NodeImpl <init
+>
+ [java] INFO: Creating node: http://localhost:9990/node-config/NodeC
+ [java] 26-Mar-2008 12:56:03 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist
+ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i
+ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeC/
+ [java] 26-Mar-2008 12:56:04 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co
+mposite:nodeC;http://sample;CalculatorC
+ [java] 26-Mar-2008 12:56:04 org.apache.tuscany.sca.node.impl.NodeImpl start
+
+ [java] INFO: Starting node: http://localhost:9990/node-config/NodeC
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8300/SubtractServiceComp
+onentC
+ [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: SCA Node started.
+ [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: Press enter to shutdown.
+ [java] SubtractService - subtract 3.0 and 2.0
+
+runNodeA:
+ [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.impl.NodeImpl <init
+>
+ [java] INFO: Creating node: http://localhost:9990/node-config/NodeA
+ [java] 26-Mar-2008 12:56:12 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist
+ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i
+ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeA/
+ [java] 26-Mar-2008 12:56:13 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co
+mposite:nodeA;http://sample;CalculatorA
+ [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.assembly.builder.impl.Co
+mpositeBuilderImpl$1 problem
+ [java] WARNING: Component reference target not found, it might be a remote
+service: SubtractServiceComponentC
+ [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.assembly.builder.impl.Co
+mpositeBuilderImpl$1 problem
+ [java] WARNING: Component reference target not found, it might be a remote
+service: AddServiceComponentB
+ [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.node.impl.NodeImpl start
+
+ [java] INFO: Starting node: http://localhost:9990/node-config/NodeA
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] CalculatorService - add 3.0 and 2.0
+ [java] 3 + 2=5.0
+ [java] CalculatorService - subtract 3.0 and 2.0
+ [java] 3 - 2=1.0
+ [java] CalculatorService - multiply 3.0 and 2.0
+ [java] 3 * 2=6.0
+ [java] CalculatorService - divide 3.0 and 2.0
+ [java] 3 / 2=1.5
+ [java] 26-Mar-2008 12:56:20 org.apache.tuscany.sca.node.impl.NodeImpl stop
+ [java] INFO: Stopping node: http://localhost:9990/node-config/NodeA
+
+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. When running from Maven the four nodes all run within
+Java virtual machine.
+
+cd calculator-distributed
+mvn
+
+You should see the following output at the end of the test phase.
+
+INFO: Starting node: http://localhost:9990/node-config/NodeA
+CalculatorService - add 3.0 and 2.0
+AddService - add 3.0 and 2.0
+CalculatorService - subtract 3.0 and 2.0
+SubtractService - subtract 3.0 and 2.0
+CalculatorService - multiply 3.0 and 2.0
+CalculatorService - divide 3.0 and 2.0
+26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop
+INFO: Stopping node: http://localhost:9990/node-config/NodeC
+26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop
+INFO: Stopping node: http://localhost:9990/node-config/NodeB
+26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop
+INFO: Stopping node: http://localhost:9990/node-config/NodeA
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.328 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
+
+
+
diff --git a/java/sca-contrib/samples/calculator-distributed/build.xml b/java/sca-contrib/samples/calculator-distributed/build.xml
new file mode 100644
index 0000000000..cccd22f3ae
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/build.xml
@@ -0,0 +1,111 @@
+<!--
+ * 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="calculator" default="runDomain">
+ <property name="test.jar" value="sample-calculator-distributed.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="../../modules/tuscany-sca-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.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="runDomain">
+ <java classname="node.LaunchDomain"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../modules/tuscany-sca-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runNodeA">
+ <java classname="node.LaunchCalculatorNodeA"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../modules/tuscany-sca-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runNodeB">
+ <java classname="node.LaunchCalculatorNodeB"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../modules/tuscany-sca-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runNodeC">
+ <java classname="node.LaunchCalculatorNodeC"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../modules/tuscany-sca-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.4-SNAPSHOT.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+
+
+</project>
diff --git a/java/sca-contrib/samples/calculator-distributed/calculator-distributed.png b/java/sca-contrib/samples/calculator-distributed/calculator-distributed.png
new file mode 100644
index 0000000000..7c0e175664
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/calculator-distributed.png
Binary files differ
diff --git a/java/sca-contrib/samples/calculator-distributed/calculator-distributed.svg b/java/sca-contrib/samples/calculator-distributed/calculator-distributed.svg
new file mode 100644
index 0000000000..be5a4b8185
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/calculator-distributed.svg
@@ -0,0 +1,383 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * 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.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-distributed"
+ sodipodi:docname="calculator-distributed.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-distributed\calculator-distributed.png"
+ inkscape:export-xdpi="104.05"
+ inkscape:export-ydpi="104.05">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.98994949"
+ inkscape:cx="555.3085"
+ inkscape:cy="454.41561"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1171"
+ inkscape:window-height="871"
+ inkscape:window-x="18"
+ inkscape:window-y="27" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="16.178549"
+ y="156.41957"
+ x="258.31146"
+ height="382.40201"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971927;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(-3.571429,-41.82534)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="167.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,-31.77519)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,190.29606 L 606.65371,190.29606 L 612.71462,203.42804 L 605.64356,215.54988 L 573.31867,215.54988 L 580.89482,203.42804 L 573.31867,190.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="280.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,81.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,303.15313 L 605.96428,303.15313 L 612.02519,316.28511 L 604.95413,328.40695 L 572.62924,328.40695 L 580.20539,316.28511 L 572.62924,303.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="391.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,192.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,414.43884 L 606.67856,414.43884 L 612.73947,427.57082 L 605.66841,439.69266 L 573.34352,439.69266 L 580.91967,427.57082 L 573.34352,414.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="502.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,303.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,525.15313 L 608.10713,525.15313 L 614.16804,538.28511 L 607.09698,550.40695 L 574.77209,550.40695 L 582.34824,538.28511 L 574.77209,525.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52287 L 511.42857,335.52287 L 510.71429,202.66577 L 579.28571,202.66577"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80878 L 528.57143,369.80878 L 528.57143,315.52306 L 580,315.52306"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52318 L 509.28571,435.52318 L 510,539.09463 L 582.14286,537.65613"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.14286,404.09448 L 527.85714,404.09448 L 527.85714,427.66591 L 580,426.95163"
+ id="path1950" />
+ <rect
+ style="opacity:0.32777776;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1.99999964;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:5.99999869, 1.99999955;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2844"
+ width="328.57144"
+ height="117.85712"
+ x="532.85712"
+ y="140.8802"
+ rx="6.9961648"
+ ry="2.4683809" />
+ <rect
+ style="opacity:0.32777776;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1.99999976;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:5.99999958, 1.99999985;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2846"
+ width="328.57144"
+ height="98.571434"
+ x="533.57147"
+ y="268.73746"
+ rx="6.9961648"
+ ry="2.0644646" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2860"
+ transform="translate(614.3034,-75.00004)"><flowRegion
+ id="flowRegion2862"><rect
+ id="rect2864"
+ width="75"
+ height="32.857143"
+ x="173.57143"
+ y="231.95163" /></flowRegion><flowPara
+ id="flowPara2866">nodeB</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2868"
+ transform="translate(616.0952,47.8571)"><flowRegion
+ id="flowRegion2870"><rect
+ id="rect2872"
+ width="75"
+ height="32.857143"
+ x="173.57143"
+ y="231.95163" /></flowRegion><flowPara
+ id="flowPara2874">nodeC</flowPara></flowRoot> <path
+ style="opacity:0.35555558;fill:#efacac;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,3;stroke-dashoffset:0"
+ d="M 172.73609,222.85576 L 495.9849,223.86592 L 498.00521,384.48017 L 863.68043,383.47002 L 862.67028,606.71373 L 173.74624,605.70358 L 172.73609,222.85576 z "
+ id="path1975"
+ sodipodi:nodetypes="ccccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2852"
+ transform="translate(8,0)"><flowRegion
+ id="flowRegion2854"><rect
+ id="rect2856"
+ width="75"
+ height="32.857143"
+ x="173.57143"
+ y="231.95163" /></flowRegion><flowPara
+ id="flowPara2858">nodeA</flowPara></flowRoot> </g>
+</svg>
diff --git a/java/sca-contrib/samples/calculator-distributed/cloud.composite b/java/sca-contrib/samples/calculator-distributed/cloud.composite
new file mode 100644
index 0000000000..85e2f9c7f3
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/cloud.composite
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite name="cloud.composite"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0">
+ <include name="ns2:NodeA" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://sample/cloud"/>
+ <include name="ns2:NodeB" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://sample/cloud"/>
+ <include name="ns2:NodeC" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://sample/cloud"/>
+</composite>
diff --git a/java/sca-contrib/samples/calculator-distributed/domain.composite b/java/sca-contrib/samples/calculator-distributed/domain.composite
new file mode 100644
index 0000000000..643e22d0cf
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/domain.composite
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite name="domain.composite"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0">
+ <include name="ns2:CalculatorA" uri="nodeA" xmlns:ns2="http://sample"/>
+ <include name="ns2:CalculatorB" uri="nodeB" xmlns:ns2="http://sample"/>
+ <include name="ns2:CalculatorC" uri="nodeC" xmlns:ns2="http://sample"/>
+</composite>
diff --git a/java/sca-contrib/samples/calculator-distributed/pom.xml b/java/sca-contrib/samples/calculator-distributed/pom.xml
new file mode 100644
index 0000000000..e1e86d8896
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/pom.xml
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-distributed</artifactId>
+ <name>Apache Tuscany SCA Distributed Calculator Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-launcher</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-manager</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/AddService.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..dd7ecb827d
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/AddService.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+package calculator;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..e9b7e254e5
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+package calculator;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..c927500cc7
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+package calculator;
+
+import org.oasisopen.sca.annotation.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ public double add(double n1, double n2) {
+ System.out.println("CalculatorService - add " + n1 + " and " + n2);
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ System.out.println("CalculatorService - subtract " + n1 + " and " + n2);
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.out.println("CalculatorService - multiply " + n1 + " and " + n2);
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ System.out.println("CalculatorService - divide " + n1 + " and " + n2);
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/DivideService.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+package calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/SubtractService.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..f03b9b94d4
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+package calculator;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1010207154
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ System.out.println("SubtractService - subtract " + n1 + " and " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java
new file mode 100644
index 0000000000..87021505b3
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+package node;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+import org.oasisopen.sca.ServiceRuntimeException;
+
+import calculator.CalculatorService;
+
+public class LaunchCalculatorNodeA {
+ public static void main(String[] args) throws Exception {
+
+ SCANode node = null;
+ try {
+
+ NodeLauncher nodeLauncher = NodeLauncher.newInstance();
+ node = nodeLauncher.createNodeFromURL("http://localhost:9990/node-config/NodeA");
+
+ node.start();
+
+ // get a reference to the calculator component
+ SCAClient client = (SCAClient)node;
+ CalculatorService calculatorService =
+ client.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ if (args.length > 1){
+ for (int i=0; i < 1000; i++){
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+ }
+ }
+
+ node.stop();
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java
new file mode 100644
index 0000000000..50600eaedc
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package node;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchCalculatorNodeB {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeB"});
+ }
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java
new file mode 100644
index 0000000000..95d8934665
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package node;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchCalculatorNodeC {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeC"});
+ }
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchDomain.java b/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchDomain.java
new file mode 100644
index 0000000000..8b4fe566a1
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/java/node/LaunchDomain.java
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+package node;
+
+import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher;
+
+/**
+ * This server program that loads a composite to provide simple registry function.
+ * This server can be replaced with any registry that is appropriate but the components
+ * in each node that talk to the registry should be replaced also.
+ */
+public class LaunchDomain {
+ public static void main(String[] args) throws Exception {
+ DomainManagerLauncher.main(args);
+ }
+
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite b/java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite
new file mode 100644
index 0000000000..ed7fe55abc
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/cloud"
+ xmlns:s="http://sample"
+ name="NodeA">
+
+ <component name="NodeA">
+ <t:implementation.node uri="nodeA" composite="s:CalculatorA"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8100"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite b/java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite
new file mode 100644
index 0000000000..8f29cc17aa
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/cloud"
+ xmlns:s="http://sample"
+ name="NodeB">
+
+ <component name="NodeB">
+ <t:implementation.node uri="nodeB" composite="s:CalculatorB"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8200"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite b/java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite
new file mode 100644
index 0000000000..9ad132b0d4
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/cloud"
+ xmlns:s="http://sample"
+ name="NodeC">
+
+ <component name="NodeC">
+ <t:implementation.node uri="nodeC" composite="s:CalculatorC"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8300"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite
new file mode 100644
index 0000000000..172676a3c7
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorA">
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..1b1c0291e2
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorA"/>
+</contribution> \ No newline at end of file
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite
new file mode 100644
index 0000000000..b770dbe8d4
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorB">
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..6c0ffe4ac0
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorB"/>
+</contribution> \ No newline at end of file
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite
new file mode 100644
index 0000000000..66caf0d17b
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorC">
+
+ <component name="SubtractServiceComponentC">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ </component>
+
+</composite>
diff --git a/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8c311553c3
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorC"/>
+</contribution> \ No newline at end of file
diff --git a/java/sca-contrib/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java b/java/sca-contrib/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java
new file mode 100644
index 0000000000..2a6f3af002
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+package calculator;
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class CalculatorDistributedTestCase {
+
+ private static SCANode manager;
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+ private static SCANode nodeC;
+
+ private static CalculatorService calculatorService;
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain");
+
+ DomainManagerLauncher managerLauncher = DomainManagerLauncher.newInstance();
+ manager = managerLauncher.createDomainManager();
+ manager.start();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ nodeC = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeC");
+ nodeB = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeB");
+ nodeA = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeA");
+
+ nodeC.start();
+ nodeB.start();
+ nodeA.start();
+
+ SCAClient client = (SCAClient)nodeA;
+ calculatorService =
+ client.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ } catch(Exception ex){
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ nodeC.stop();
+ nodeB.stop();
+ nodeA.stop();
+ manager.stop();
+ }
+
+ @Test
+ public void testCalculator() throws Exception {
+
+ // Calculate
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorService.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorService.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorService.divide(3, 2), 1.5);
+ }
+}
diff --git a/java/sca-contrib/samples/calculator-distributed/workspace.xml b/java/sca-contrib/samples/calculator-distributed/workspace.xml
new file mode 100644
index 0000000000..7d6d3dbdbd
--- /dev/null
+++ b/java/sca-contrib/samples/calculator-distributed/workspace.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0">
+ <contribution location="file:./src/main/resources/nodeA" uri="nodeA"/>
+ <contribution location="file:./src/main/resources/nodeB" uri="nodeB"/>
+ <contribution location="file:./src/main/resources/nodeC" uri="nodeC"/>
+ <contribution location="file:./src/main/resources/cloud" uri="http://tuscany.apache.org/cloud"/>
+</workspace>