diff options
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed')
27 files changed, 2084 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/DISCLAIMER b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/LICENSE b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/LICENSE @@ -0,0 +1,205 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + + + diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/NOTICE b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/NOTICE new file mode 100644 index 0000000000..94481d6cfa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2007 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/README b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/README new file mode 100644 index 0000000000..02e4128ab2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/README @@ -0,0 +1,293 @@ +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.DomainNode
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeB
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeC
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeA
+
+and on *nix do
+
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.DomainNode
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeB
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeC
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeA
+
+
+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 would see output of invoking the
+calculator functions distributed over NodeB and and NodeC. On the command prompts
+where you have started NodeB and NodeC, you would see log messages that indicate that
+the add and substract 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.
+
+
+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/
+ CalculatorNode.java - runs up an sca application based on
+ configuration given on the command
+ line in the form
+
+ CalculatorNode <domain name> <node name>
+
+ it looks for a directory name the same
+ as <node name> and loads the composites
+ there
+
+ if <node name> = nodeA it calls the
+ +-/* operations otherwise it behaves
+ like a server and waits for service
+ requests
+ DomainNode.java - the node that provides the service
+ discovery mechanism to the distributed
+ domain
+ resources/
+ 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 nodeB's part of the
+ calculator application
+ test/
+ java/
+ calculator/
+ DomainInMemoryTestCase.java - JUnit test case which runs all of the
+ separate ndes 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 runDomainNode
+ant runNodeB
+ant runNodeC
+ant runNodeA
+
+You should see the following output from the four separate command prompt:
+
+runDomainNode:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] 23-Aug-2007 17:40:40 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8080/ServiceDiscoveryC
+omponent/ServiceDiscovery
+ [java] Domain node started (press enter to shutdown)
+ [java] Registering service: [mydomain nodeB AddServiceComponent org.apache.
+tuscany.sca.assembly.SCABinding http://localhost:8085/AddServiceComponent]
+ [java] Registering service: [mydomain nodeC SubtractServiceComponent org.ap
+ache.tuscany.sca.assembly.SCABinding http://localhost:8086/SubtractServiceCompon
+ent]
+ [java] Finding service: [mydomain SubtractServiceComponent org.apache.tusca
+ny.sca.assembly.SCABinding]
+ [java] Matching service url: http://localhost:8086/SubtractServiceComponent
+
+ [java] Finding service: [mydomain AddServiceComponent org.apache.tuscany.sc
+a.assembly.SCABinding]
+ [java] Matching service url: http://localhost:8085/AddServiceComponent
+ [java] Java Result: 1
+Terminate batch job (Y/N)? y
+
+
+
+runNodeB:
+ [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/
+target/classes/management/
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Registering service: [mydomain nodeB AddServiceComponent/ org.apache
+.tuscany.sca.assembly.SCABinding http://localhost:8085/AddServiceComponent]
+ [java] 23-Aug-2007 17:41:25 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8085/AddServiceCompone
+nt
+ [java] Node started (press enter to shutdown)
+ [java] AddService - add 3.0 and 2.0
+
+
+runNodeC:
+ [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/
+target/classes/management/
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Registering service: [mydomain nodeC SubtractServiceComponent org.ap
+ache.tuscany.sca.assembly.SCABinding http://localhost:8086/SubtractServiceCompon
+ent]
+ [java] 23-Aug-2007 17:41:51 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] Node started (press enter to shutdown)
+ [java] INFO: Added Servlet mapping: http://localhost:8086/SubtractServiceCo
+mponent
+ [java] SubtractService - subtract 3.0 and 2.0
+Terminate batch job (Y/N)? y
+
+
+runNodeA:
+ [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/
+target/classes/management/
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] 23-Aug-2007 17:42:12 org.apache.tuscany.sca.assembly.builder.impl.Co
+mpositeBuilderImpl$1 problem
+ [java] WARNING: [WARNING] Component reference target not found, it might be
+ a remote service: AddServiceComponent null
+ [java]
+ [java] 23-Aug-2007 17:42:12 org.apache.tuscany.sca.assembly.builder.impl.Co
+mpositeBuilderImpl$1 problem
+ [java] WARNING: [WARNING] Component reference target not found, it might be
+ a remote service: SubtractServiceComponent null
+ [java]
+ [java] Finding service: [mydomain SubtractServiceComponent org.apache.tusca
+ny.sca.assembly.SCABinding]
+ [java] Finding service: [mydomain AddServiceComponent org.apache.tuscany.sc
+a.assembly.SCABinding]
+ [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
+
+
+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 from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.DomainInMemoryTestCase
+Setting up distributed nodes
+file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class
+es/management/
+log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
+Utils).
+log4j:WARN Please initialize the log4j system properly.
+23-Aug-2007 18:18:41 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuild
+erImpl$1 problem
+WARNING: [WARNING] Component reference target not found, it might be a remote se
+rvice: AddServiceComponent null
+
+23-Aug-2007 18:18:41 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuild
+erImpl$1 problem
+WARNING: [WARNING] Component reference target not found, it might be a remote se
+rvice: SubtractServiceComponent null
+
+file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class
+es/management/
+Registering service: [mydomain nodeB AddServiceComponent org.apache.tuscany.sca.
+assembly.SCABinding http://localhost:8085/AddServiceComponent]
+file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class
+es/management/
+Registering service: [mydomain nodeC SubtractServiceComponent org.apache.tuscany
+.sca.assembly.SCABinding http://localhost:8086/SubtractServiceComponent]
+Finding service: [mydomain SubtractServiceComponent org.apache.tuscany.sca.assem
+bly.SCABinding]
+Matching service url: http://localhost:8086/SubtractServiceComponent
+Finding service: [mydomain AddServiceComponent org.apache.tuscany.sca.assembly.S
+CABinding]
+Matching service url: http://localhost:8085/AddServiceComponent
+23-Aug-2007 18:18:45 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap
+ping
+INFO: Added Servlet mapping: http://localhost:8085/AddServiceComponent
+23-Aug-2007 18:18:47 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap
+ping
+INFO: Added Servlet mapping: http://localhost:8086/SubtractServiceComponent
+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
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.14 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+
+This shows that the Junit test cases have run successfully.
+
+Known Bug :
+---------
+The processes that are running NodeB and NodeC do not seem to end on pressing the
+<Enter>. This will be fixed for the next release. For this release you should use
+^C (Control C) to exit these processes.
+
+
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/build.xml b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/build.xml new file mode 100644 index 0000000000..1d62adeffa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/build.xml @@ -0,0 +1,276 @@ +<!-- + * 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="node.class" value="node.CalculatorNode" /> + <property name="domain.class" value="node.DomainNode" /> + <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="../../lib/tuscany-sca-manifest.jar"/> + </classpath> + </javac> + <copy todir="target/classes"> + <fileset dir="src/main/resources"/> + </copy> + <jar destfile="target/${test.jar}" basedir="target/classes"> + <manifest> + <attribute name="Main-Class" value="${test.class}" /> + </manifest> + </jar> + </target> + + <target name="runDomain"> + <java classname="${domain.class}" + fork="true"> + <classpath> + <pathelement path="src/main/resources"/> + <pathelement path="target/classes"/> + <pathelement path="target/${test.jar}"/> + <pathelement location="../../lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> + + <target name="runNodeA"> + <java classname="${node.class}" + fork="true"> + <classpath> + <pathelement path="src/main/resources"/> + <pathelement path="target/classes"/> + <pathelement path="target/${test.jar}"/> + <pathelement location="../../lib/tuscany-sca-manifest.jar"/> + </classpath> + <arg value="http://localhost:8877/"/> + <arg value="nodeA"/> + </java> + </target> + + <target name="runNodeB"> + <java classname="${node.class}" + fork="true"> + <classpath> + <pathelement path="src/main/resources"/> + <pathelement path="target/classes"/> + <pathelement path="target/${test.jar}"/> + <pathelement location="../../lib/tuscany-sca-manifest.jar"/> + </classpath> + <arg value="http://localhost:8877/"/> + <arg value="nodeB"/> + </java> + </target> + + <target name="runNodeC"> + <java classname="${node.class}" + fork="true"> + <classpath> + <pathelement path="src/main/resources"/> + <pathelement path="target/classes"/> + <pathelement path="target/${test.jar}"/> + <pathelement location="../../lib/tuscany-sca-manifest.jar"/> + </classpath> + <arg value="http://localhost:8877/"/> + <arg value="nodeC"/> + </java> + </target> + + <target name="clean"> + <delete quiet="true" includeemptydirs="true"> + <fileset dir="target"/> + </delete> + </target> + + <!-- If you want to test without building the distribution jars set the --> + <!-- localtion value of the m2.repo on your machine and use the targets below --> + <property name="m2.repo" value="${user.home}\.m2\repository" /> + <path id="repo.classpath"> + <pathelement location=".\target\classes"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-sca-api\1.0.1-incubating-SNAPSHOT\tuscany-sca-api-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly\1.0.1-incubating-SNAPSHOT\tuscany-assembly-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\wsdl4j\wsdl4j\1.6.2\wsdl4j-1.6.2.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding-json\1.0.1-incubating-SNAPSHOT\tuscany-databinding-json-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java\1.0.1-incubating-SNAPSHOT\tuscany-interface-java-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-node-impl\1.0.1-incubating-SNAPSHOT\tuscany-node-impl-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\rampart\rampart-trust\1.3\rampart-trust-1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-api\1.2.5\axiom-api-1.2.5.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-jsonrpc\1.0.1-incubating-SNAPSHOT\tuscany-binding-jsonrpc-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar"/> +<pathelement location="${m2.repo}\org\apache\ant\ant-nodeps\1.7.0\ant-nodeps-1.7.0.jar"/> +<pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-activation_1.1_spec\1.0-M1\geronimo-activation_1.1_spec-1.0-M1.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java-xml\1.0.1-incubating-SNAPSHOT\tuscany-interface-java-xml-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\opensaml\opensaml\1.1\opensaml-1.1.jar"/> +<pathelement location="${m2.repo}\logkit\logkit\1.0.1\logkit-1.0.1.jar"/> +<pathelement location="${m2.repo}\annogen\annogen\0.1.0\annogen-0.1.0.jar"/> +<pathelement location="${m2.repo}\org\apache\axis2\axis2-adb\1.3\axis2-adb-1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\axis2\axis2-xmlbeans\1.3\axis2-xmlbeans-1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\axis2\axis2-mtompolicy\1.3\axis2-mtompolicy-1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca\1.0.1-incubating-SNAPSHOT\tuscany-binding-sca-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy\1.0.1-incubating-SNAPSHOT\tuscany-policy-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\axis2\axis2-java2wsdl\1.3\axis2-java2wsdl-1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore-nio\4.0-alpha5\httpcore-nio-4.0-alpha5.jar"/> +<pathelement location="${m2.repo}\org\apache\rampart\rampart-core\1.3\rampart-core-1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-commonj_1.1_spec\1.0\geronimo-commonj_1.1_spec-1.0.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl-xml\1.0.1-incubating-SNAPSHOT\tuscany-interface-wsdl-xml-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xsd\1.0.1-incubating-SNAPSHOT\tuscany-assembly-xsd-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tomcat\catalina\6.0.10\catalina-6.0.10.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core\1.0.1-incubating-SNAPSHOT\tuscany-core-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\jaxen\jaxen\1.1-beta-9\jaxen-1.1-beta-9.jar"/> +<pathelement location="${m2.repo}\org\apache\rampart\rampart-policy\1.3\rampart-policy-1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore-niossl\4.0-alpha5\httpcore-niossl-4.0-alpha5.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-definitions\1.0.1-incubating-SNAPSHOT\tuscany-definitions-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\junit\junit\4.2\junit-4.2.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java\1.0.1-incubating-SNAPSHOT\tuscany-implementation-java-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-xml\1.0.1-incubating-SNAPSHOT\tuscany-implementation-java-xml-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution\1.0.1-incubating-SNAPSHOT\tuscany-contribution-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\javax\activation\activation\1.1\activation-1.1.jar"/> +<pathelement location="${m2.repo}\org\apache\ant\ant\1.7.0\ant-1.7.0.jar"/> +<pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-javamail_1.4_spec\1.0-M1\geronimo-javamail_1.4_spec-1.0-M1.jar"/> +<pathelement location="${m2.repo}\avalon-framework\avalon-framework\4.1.3\avalon-framework-4.1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-impl\1.0.1-incubating-SNAPSHOT\tuscany-contribution-impl-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-xml\1.0.1-incubating-SNAPSHOT\tuscany-binding-sca-xml-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-java\1.0.1-incubating-SNAPSHOT\tuscany-contribution-java-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding\1.0.1-incubating-SNAPSHOT\tuscany-databinding-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-definitions-xml\1.0.1-incubating-SNAPSHOT\tuscany-definitions-xml-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\commons-io\commons-io\1.2\commons-io-1.2.jar"/> +<pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-dom\1.2.5\axiom-dom-1.2.5.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-http\1.0.1-incubating-SNAPSHOT\tuscany-binding-http-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-logging\1.0.1-incubating-SNAPSHOT\tuscany-policy-logging-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\ws\commons\schema\XmlSchema\1.3.2\XmlSchema-1.3.2.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-node\1.0.1-incubating-SNAPSHOT\tuscany-node-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-node-api\1.0.1-incubating-SNAPSHOT\tuscany-node-api-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\woden\woden\1.0-incubating-M7b\woden-1.0-incubating-M7b.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-xml\1.0.1-incubating-SNAPSHOT\tuscany-policy-xml-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain-impl\1.0.1-incubating-SNAPSHOT\tuscany-domain-impl-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\codehaus\jettison\jettison\1.0-RC2\jettison-1.0-RC2.jar"/> +<pathelement location="${m2.repo}\xerces\xercesImpl\2.8.1\xercesImpl-2.8.1.jar"/> +<pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-jms_1.1_spec\1.1\geronimo-jms_1.1_spec-1.1.jar"/> +<pathelement location="${m2.repo}\commons-codec\commons-codec\1.3\commons-codec-1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding-axiom\1.0.1-incubating-SNAPSHOT\tuscany-databinding-axiom-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\xmlbeans\xbean\2.1.0\xbean-2.1.0.jar"/> +<pathelement location="${m2.repo}\xml-apis\xml-apis\1.3.03\xml-apis-1.3.03.jar"/> +<pathelement location="${m2.repo}\org\apache\ws\security\wss4j\1.5.3\wss4j-1.5.3.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-runtime\1.0.1-incubating-SNAPSHOT\tuscany-implementation-java-runtime-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws\1.0.1-incubating-SNAPSHOT\tuscany-binding-ws-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-databinding\1.0.1-incubating-SNAPSHOT\tuscany-core-databinding-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\bouncycastle\bcprov-jdk15\132\bcprov-jdk15-132.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface\1.0.1-incubating-SNAPSHOT\tuscany-interface-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\axis2\axis2-kernel\1.3\axis2-kernel-1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore\4.0-alpha5\httpcore-4.0-alpha5.jar"/> +<pathelement location="${m2.repo}\backport-util-concurrent\backport-util-concurrent\2.2\backport-util-concurrent-2.2.jar"/> +<pathelement location="${m2.repo}\commons-logging\commons-logging\1.1\commons-logging-1.1.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-http\1.0.1-incubating-SNAPSHOT\tuscany-host-http-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\commons-fileupload\commons-fileupload\1.1.1\commons-fileupload-1.1.1.jar"/> +<pathelement location="${m2.repo}\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-xml\1.0.1-incubating-SNAPSHOT\tuscany-binding-ws-xml-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\commons-httpclient\commons-httpclient\3.0.1\commons-httpclient-3.0.1.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-axis2\1.0.1-incubating-SNAPSHOT\tuscany-binding-ws-axis2-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\commons-collections\commons-collections\3.1\commons-collections-3.1.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-security\1.0.1-incubating-SNAPSHOT\tuscany-policy-security-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-resource\1.0.1-incubating-SNAPSHOT\tuscany-implementation-resource-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\xalan\xalan\2.7.0\xalan-2.7.0.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-namespace\1.0.1-incubating-SNAPSHOT\tuscany-contribution-namespace-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain-api\1.0.1-incubating-SNAPSHOT\tuscany-domain-api-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl\1.0.1-incubating-SNAPSHOT\tuscany-interface-wsdl-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\axis2\axis2-adb-codegen\1.3\axis2-adb-codegen-1.3.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-axis2\1.0.1-incubating-SNAPSHOT\tuscany-binding-sca-axis2-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tomcat\coyote\6.0.10\coyote-6.0.10.jar"/> +<pathelement location="${m2.repo}\com\metaparadigm\json-rpc\1.0\json-rpc-1.0.jar"/> +<pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-impl\1.2.5\axiom-impl-1.2.5.jar"/> +<pathelement location="${m2.repo}\commons-discovery\commons-discovery\0.2\commons-discovery-0.2.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-tomcat\1.0.1-incubating-SNAPSHOT\tuscany-host-tomcat-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\neethi\neethi\2.0.2\neethi-2.0.2.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xml\1.0.1-incubating-SNAPSHOT\tuscany-assembly-xml-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tomcat\annotations-api\6.0.10\annotations-api-6.0.10.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-spi\1.0.1-incubating-SNAPSHOT\tuscany-core-spi-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tomcat\juli\6.0.10\juli-6.0.10.jar"/> +<pathelement location="${m2.repo}\org\apache\santuario\xmlsec\1.4.0\xmlsec-1.4.0.jar"/> +<pathelement location="${m2.repo}\log4j\log4j\1.2.12\log4j-1.2.12.jar"/> +<pathelement location="${m2.repo}\javax\mail\mail\1.4\mail-1.4.jar"/> +<pathelement location="${m2.repo}\org\apache\axis2\axis2-codegen\1.3\axis2-codegen-1.3.jar"/> +<pathelement location="${m2.repo}\org\codehaus\woodstox\wstx-asl\3.2.1\wstx-asl-3.2.1.jar"/> +<pathelement location="${m2.repo}\stax\stax-api\1.0.1\stax-api-1.0.1.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain\1.0.1-incubating-SNAPSHOT\tuscany-domain-1.0.1-incubating-SNAPSHOT.jar"/> +<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-embedded\1.0.1-incubating-SNAPSHOT\tuscany-host-embedded-1.0.1-incubating-SNAPSHOT.jar"/> + </path> + + <target name="runDomainRepo"> + <java classname="${domain.class}" + fork="true"> + <classpath> + <path refid="repo.classpath"/> + </classpath> + </java> + </target> + + <target name="runNodeARepo"> + <java classname="${node.class}" + fork="true"> + <classpath> + <path refid="repo.classpath"/> + </classpath> + <arg value="http://localhost:8877/"/> + <arg value="nodeA"/> + </java> + </target> + + <target name="runNodeARepoLoop"> + <java classname="${node.class}" + fork="true"> + <classpath> + <path refid="repo.classpath"/> + </classpath> + <arg value="http://localhost:8877/"/> + <arg value="nodeA"/> + <arg value="loop"/> + </java> + </target> + + <target name="runNodeBRepo"> + <java classname="${node.class}" + fork="true"> + <classpath> + <path refid="repo.classpath"/> + </classpath> + <arg value="http://localhost:8877/"/> + <arg value="nodeB"/> + </java> + </target> + + <target name="runNodeCRepo"> + <java classname="${node.class}" + fork="true"> + <classpath> + <path refid="repo.classpath"/> + </classpath> + <arg value="http://localhost:8877/"/> + <arg value="nodeC"/> + </java> + </target> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/calculator-distributed.png b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/calculator-distributed.png Binary files differnew file mode 100644 index 0000000000..7c0e175664 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/calculator-distributed.png diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/calculator-distributed.svg b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/calculator-distributed.svg new file mode 100644 index 0000000000..be5a4b8185 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/pom.xml b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/pom.xml new file mode 100644 index 0000000000..305618f5a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/pom.xml @@ -0,0 +1,116 @@ +<?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>1.0.1-incubating-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-host-embedded</artifactId> + <version>1.0.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>1.0.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-domain-api</artifactId> + <version>1.0.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-sca-axis2</artifactId> + <version>1.0.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc</artifactId> + <version>1.0.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-http</artifactId> + <version>1.0.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-resource</artifactId> + <version>1.0.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-tomcat</artifactId> + <version>1.0.1-incubating-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-domain-impl</artifactId> + <version>1.0.1-incubating-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>1.0.1-incubating-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..d7dc4473ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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.osoa.sca.annotations.Remotable; + +/** + * The Add service interface + */ +@Remotable +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..e9b7e254e5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..031fa8b912 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..da869e00fd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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.osoa.sca.annotations.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/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..30d248208b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..f7ac0b7287 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..5290605938 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..b7dca792b2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..78ab9c6ee0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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.osoa.sca.annotations.Remotable; + +/** + * The interface for the multiply service + */ +@Remotable +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..1010207154 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/node/CalculatorNode.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/node/CalculatorNode.java new file mode 100644 index 0000000000..4368410c55 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/node/CalculatorNode.java @@ -0,0 +1,103 @@ +/*
+ * 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 java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import calculator.CalculatorService;
+
+/**
+ * This client program shows how to run a distributed SCA node. In this case a
+ * calculator node has been constructed specifically for running the calculator
+ * composite. Internally it creates a representation of a node and associates a
+ * distributed domain with the node. This separation is made different implementations
+ * of the distributed domain can be provided.
+ */
+public class CalculatorNode {
+
+
+ public static void main(String[] args) throws Exception {
+
+ // Check that the correct arguments have been provided
+ if (null == args || args.length < 2) {
+ System.err.println("Useage: java CalculatorNode domainname nodename");
+ System.exit(1);
+ }
+
+ try {
+ String domainName = args[0];
+ String nodeName = args[1];
+
+ ClassLoader cl = CalculatorNode.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ SCANode node = nodeFactory.createSCANode(nodeName, domainName);
+ node.addContribution(nodeName, cl.getResource(nodeName + "/"));
+ node.deployComposite(new QName("http://sample", "Calculator"));
+ node.start();
+
+ // nodeA is the head node and runs some tests while all other nodes
+ // simply listen for incoming messages
+ if ( nodeName.equals("nodeA") ) {
+ // do some application stuff
+ CalculatorService calculatorService =
+ node.getDomain().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));
+
+ // a little hidden loop test to put some load on the nodes
+ if (args.length > 2){
+ 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));
+ }
+ }
+ } else {
+ // start up and wait for messages
+ try {
+ System.out.println("Node started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ // stop the node and all the domains in it
+ node.stop();
+
+ } catch(Exception ex) {
+ System.err.println("Exception in node - " + ex.getMessage());
+ ex.printStackTrace(System.err);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/node/DomainNode.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/node/DomainNode.java new file mode 100644 index 0000000000..00f2062c7f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/java/node/DomainNode.java @@ -0,0 +1,52 @@ +/*
+ * 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.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+
+
+/**
+ * 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 DomainNode {
+
+ private static String DEFAULT_DOMAIN_URI = "http://localhost:8877";
+
+ public static void main(String[] args) {
+
+ try {
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ SCADomain domain = domainFactory.createSCADomain(DEFAULT_DOMAIN_URI);
+ domain.start();
+
+ System.out.println("Domain started (press enter to shutdown)");
+ System.in.read();
+
+ domain.stop();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("Domain stopped");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite new file mode 100644 index 0000000000..7731cc7b55 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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="Calculator">
+
+ <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/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..3f9ed8024b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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:Calculator"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite new file mode 100644 index 0000000000..9d2a97b172 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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="Calculator">
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..3f9ed8024b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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:Calculator"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite new file mode 100644 index 0000000000..ababc1bd02 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite @@ -0,0 +1,32 @@ +<?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="Calculator">
+
+ <component name="SubtractServiceComponentC">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ <service name="SubtractService">
+ <binding.sca uri="http://localhost:8086/SubtractServiceComponentC"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..3f9ed8024b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/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:Calculator"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java new file mode 100644 index 0000000000..1213a553a2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java @@ -0,0 +1,119 @@ +/*
+ * 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 javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.node.SCADomainFinder;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.CalculatorService;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class DomainInMemoryTestCase {
+
+ private static String DEFAULT_DOMAIN_URI = "http://localhost:8877";
+
+ private static SCADomain domainManager;
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+ private static SCANode nodeC;
+ private static SCADomain domain;
+ private static CalculatorService calculatorServiceA;
+ private static CalculatorService calculatorServiceB;
+ private static AddService addServiceB;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain manager");
+
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domainManager = domainFactory.createSCADomain(DEFAULT_DOMAIN_URI);
+
+ System.out.println("Setting up calculator nodes");
+
+ ClassLoader cl = DomainInMemoryTestCase.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+
+ nodeA = nodeFactory.createSCANode("nodeA", DEFAULT_DOMAIN_URI);
+ nodeA.addContribution("nodeA", cl.getResource("nodeA/"));
+ nodeA.deployComposite(new QName("http://sample", "Calculator"));
+ nodeA.start();
+
+
+ nodeB = nodeFactory.createSCANode("nodeB", DEFAULT_DOMAIN_URI);
+ nodeB.addContribution("nodeB", cl.getResource("nodeB/"));
+ nodeB.deployComposite(new QName("http://sample", "Calculator"));
+ nodeB.start();
+
+
+ nodeC = nodeFactory.createSCANode("nodeC", DEFAULT_DOMAIN_URI);
+ nodeC.addContribution("nodeC", cl.getResource("nodeC/"));
+ nodeC.deployComposite(new QName("http://sample", "Calculator"));
+ nodeC.start();
+
+ SCADomainFinder domainFinder = SCADomainFinder.newInstance();
+ domain = domainFinder.getSCADomain(DEFAULT_DOMAIN_URI);
+
+ // get a reference to various services in the domain
+ calculatorServiceA = nodeA.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentA");
+ calculatorServiceB = nodeB.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentB");
+
+ //addServiceB = domain.getService(AddService.class, "AddServiceComponentB");
+ addServiceB = nodeA.getDomain().getService(AddService.class, "AddServiceComponentB");
+
+ } catch(Exception ex){
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the nodes and hence the domains they contain
+ nodeA.stop();
+ nodeB.stop();
+ nodeC.stop();
+ }
+
+ @Test
+ public void testCalculator() throws Exception {
+
+ // Calculate
+ Assert.assertEquals(calculatorServiceA.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorServiceA.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorServiceA.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorServiceA.divide(3, 2), 1.5);
+ }
+}
|