diff options
Diffstat (limited to '')
27 files changed, 908 insertions, 0 deletions
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/ant/README.html b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/ant/README.html new file mode 100644 index 0000000000..414205ac23 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/ant/README.html @@ -0,0 +1,47 @@ +<?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. +--> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"><!--This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.--><head profile="http://dublincore.org/documents/dcmi-terms/"><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/><title xml:lang="en-US">- no title specified</title><meta name="DCTERMS.title" content="" xml:lang="en-US"/><meta name="DCTERMS.language" content="en-US" scheme="DCTERMS.RFC4646"/><meta name="DCTERMS.source" content="http://xml.openoffice.org/odf2xhtml"/><meta name="DCTERMS.creator" content="ant "/><meta name="DCTERMS.issued" content="2011-03-15T09:48:55.71" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.modified" content="2011-04-18T12:37:30.13" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.provenance" content="" xml:lang="en-US"/><meta name="DCTERMS.subject" content="," xml:lang="en-US"/><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en"/><link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en"/><link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en"/><link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en"/><base href="."/><style type="text/css"> + @page { } + table { border-collapse:collapse; border-spacing:0; empty-cells:show } + td, th { vertical-align:top; font-size:12pt;} + h1, h2, h3, h4, h5, h6 { clear:both } + ol, ul { margin:0; padding:0;} + li { list-style: none; margin:0; padding:0;} + <!-- "li span.odfLiEnd" - IE 7 issue--> + li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; } + span.footnodeNumber { padding-right:1em; } + span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000; margin:0; border:0; padding:0; } + * { margin:0;} + .Heading_20_1 { font-size:115%; margin-bottom:0.212cm; margin-top:0.423cm; font-family:Arial; writing-mode:page; font-weight:bold; } + .P1 { font-size:10pt; font-family:Courier New; writing-mode:page; } + .Standard { font-size:12pt; font-family:Times New Roman; writing-mode:page; } + .Table_20_Contents { font-size:12pt; font-family:Times New Roman; writing-mode:page; } + .Table1 { width:17.013cm; margin-left:0cm; margin-right:-0.012cm; float:none; } + .Table1_A1 { padding:0.097cm; border-left-width:0.0133cm; border-left-style:solid; border-left-color:#000000; border-right-style:none; border-top-width:0.0133cm; border-top-style:solid; border-top-color:#000000; border-bottom-width:0.0133cm; border-bottom-style:solid; border-bottom-color:#000000; } + .Table1_A2 { padding:0.097cm; border-left-width:0.0133cm; border-left-style:solid; border-left-color:#000000; border-right-style:none; border-top-style:none; border-bottom-width:0.0133cm; border-bottom-style:solid; border-bottom-color:#000000; } + .Table1_B1 { padding:0.097cm; border-width:0.0133cm; border-style:solid; border-color:#000000; } + .Table1_B2 { padding:0.097cm; border-left-width:0.0133cm; border-left-style:solid; border-left-color:#000000; border-right-width:0.0133cm; border-right-style:solid; border-right-color:#000000; border-top-style:none; border-bottom-width:0.0133cm; border-bottom-style:solid; border-bottom-color:#000000; } + .Table1_A { width:5.609cm; } + .Table1_B { width:11.404cm; } + <!-- ODF styles with no properties representable as CSS --> + { } + </style></head><body dir="ltr" style="max-width:21.001cm;margin-top:2cm; margin-bottom:2cm; margin-left:2cm; margin-right:2cm; "><h1 class="Heading_20_1"><a id="a__Running_the_Tuscany_runtime_from_Ant"><span/></a>Running the Tuscany runtime from Ant</h1><p class="Standard"> </p><p class="Standard">If you're an Ant user it's handy to be able to deploy and run a contribution from an Ant script. This sample re-use the calculator-composite.jar and runs it using the Tuscany shell started from an Ant script. </p><p class="Standard"> </p><p class="Standard">To run the sample :</p><p class="Standard"> </p><p class="P1">cd ant</p><p class="P1">ant</p><p class="P1"> </p><p class="Standard">You will of course need to have Ant (<a href="http://ant.apache.org/">http://ant.apache.org/</a>) installed. This sample was created with Ant version 1.8.0.</p><p class="Standard"> </p><p class="Standard">In the build.xml there are several different targets. Each describes a different way of constructing the Java classpath to include the correct Tuscany jars. </p><p class="Standard"> </p><table border="0" cellspacing="0" cellpadding="0" class="Table1"><colgroup><col width="245"/><col width="498"/></colgroup><tr><td style="text-align:left;width:5.609cm; " class="Table1_A1"><p class="Table_20_Contents">Target</p></td><td style="text-align:left;width:11.404cm; " class="Table1_B1"><p class="Table_20_Contents">Description</p></td></tr><tr><td style="text-align:left;width:5.609cm; " class="Table1_A2"><p class="Table_20_Contents">run-all-manifest-jar</p></td><td style="text-align:left;width:11.404cm; " class="Table1_B2"><p class="Table_20_Contents">Includes a single manifest jar on the classpath which in turn references all of the jars in the binary distribution's modules directory</p></td></tr><tr><td style="text-align:left;width:5.609cm; " class="Table1_A2"><p class="Table_20_Contents">run-base-extension-paths</p></td><td style="text-align:left;width:11.404cm; " class="Table1_B2"><p class="Table_20_Contents">For the Ant user Tuscany ships with predefined Ant paths for each of the Tuscany extensions. </p></td></tr><tr><td style="text-align:left;width:5.609cm; " class="Table1_A2"><p class="Table_20_Contents">run-base-extension-manifests</p></td><td style="text-align:left;width:11.404cm; " class="Table1_B2"><p class="Table_20_Contents">For completeness we also ship manifest jars for the Tuscany base and each of the extensions</p></td></tr><tr><td style="text-align:left;width:5.609cm; " class="Table1_A2"><p class="Table_20_Contents">run-base-extension-jars</p></td><td style="text-align:left;width:11.404cm; " class="Table1_B2"><p class="Table_20_Contents">If you want to re-package Tuscany we ship stand-alone jars for the Tuscany base and extensions</p></td></tr></table><p class="Standard"> </p><p class="Standard">The sample build.xml file defaults to running the run-all-manifest-jar target. To run other targets add the name of the target to then end of the command line. For example, </p><p class="Standard"> </p><p class="P1">ant run-base-extension-paths</p><p class="Standard"> </p><p class="Standard"> </p></body></html> diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/ant/README.odt b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/ant/README.odt Binary files differnew file mode 100644 index 0000000000..e89825446f --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/ant/README.odt diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/ant/build.xml b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/ant/build.xml new file mode 100644 index 0000000000..5c84ea02f8 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/ant/build.xml @@ -0,0 +1,83 @@ +<!--
+ * 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="running-tuscany-with-ant" default="run-all-manifest-jar">
+
+ <property name="tuscany.home" value="../../.."/>
+
+ <import file="${tuscany.home}/features/tuscany-base-runtime-pom/build-path.xml"/>
+ <import file="${tuscany.home}/features/tuscany-binding-ws-runtime-axis2/build-path.xml"/>
+ <import file="${tuscany.home}/features/tuscany-host-jetty/build-path.xml"/>
+
+ <!-- Run using the "all" manifest jar -->
+ <target name="run-all-manifest-jar">
+ <java classname="org.apache.tuscany.sca.shell.Shell"
+ fork="true"
+ failonerror="true">
+ <classpath>
+ <fileset dir="${tuscany.home}/features">
+ <include name="tuscany-sca-manifest.jar" />
+ </fileset>
+ </classpath>
+ <arg value="../calculator-contribution.jar"/>
+ </java>
+ </target>
+
+ <!-- Run using the base + extension ant paths -->
+ <target name="run-base-extension-paths">
+ <java classname="org.apache.tuscany.sca.shell.Shell"
+ fork="true"
+ failonerror="true">
+ <classpath>
+ <path refid="tuscany-base-runtime-pom.path"/>
+ </classpath>
+ <arg value="../calculator-contribution.jar"/>
+ </java>
+ </target>
+
+ <!-- Run using the base + extension manifest -->
+ <target name="run-base-extension-manifests">
+ <java classname="org.apache.tuscany.sca.shell.Shell"
+ fork="true"
+ failonerror="true">
+ <classpath>
+ <fileset dir="${tuscany.home}/features/tuscany-base-runtime-pom">
+ <include name="tuscany-base-runtime-pom-manifest.jar" />
+ </fileset>
+ </classpath>
+ <arg value="../calculator-contribution.jar"/>
+ </java>
+ </target>
+
+ <!-- Run using the base + extension jars -->
+<!-- TODO - which jars should we be using here -->
+ <target name="run-base-extension-jars">
+ <java classname="org.apache.tuscany.sca.shell.Shell"
+ fork="true"
+ failonerror="true">
+ <classpath>
+ <pathelement location="target/${jar.name}"/>
+ <fileset dir="${tuscany.home}/lib">
+ <include name="tuscany-base-runtime-aggregation-2.0-Beta4.jar" />
+ </fileset>
+ </classpath>
+ <arg value="../calculator-contribution.jar"/>
+ </java>
+ </target>
+
+</project>
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/calculator-contribution.jar b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/calculator-contribution.jar Binary files differnew file mode 100644 index 0000000000..32b0ee5f6c --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/calculator-contribution.jar diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/command-line/README.html b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/command-line/README.html new file mode 100644 index 0000000000..6343cf5f85 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/command-line/README.html @@ -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.
+-->
+ +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"><!--This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.--><head profile="http://dublincore.org/documents/dcmi-terms/"><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/><title xml:lang="en-US">- no title specified</title><meta name="DCTERMS.title" content="" xml:lang="en-US"/><meta name="DCTERMS.language" content="en-US" scheme="DCTERMS.RFC4646"/><meta name="DCTERMS.source" content="http://xml.openoffice.org/odf2xhtml"/><meta name="DCTERMS.creator" content="ant "/><meta name="DCTERMS.issued" content="2011-03-15T09:48:55.71" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.modified" content="2011-04-14T11:47:12.75" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.provenance" content="" xml:lang="en-US"/><meta name="DCTERMS.subject" content="," xml:lang="en-US"/><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en"/><link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en"/><link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en"/><link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en"/><base href="."/><style type="text/css"> + @page { } + table { border-collapse:collapse; border-spacing:0; empty-cells:show } + td, th { vertical-align:top; font-size:12pt;} + h1, h2, h3, h4, h5, h6 { clear:both } + ol, ul { margin:0; padding:0;} + li { list-style: none; margin:0; padding:0;} + <!-- "li span.odfLiEnd" - IE 7 issue--> + li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; } + span.footnodeNumber { padding-right:1em; } + span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000; margin:0; border:0; padding:0; } + * { margin:0;} + .Heading_20_1 { font-size:115%; margin-bottom:0.212cm; margin-top:0.423cm; font-family:Arial; writing-mode:page; font-weight:bold; } + .P1 { font-size:10pt; font-family:Times New Roman; writing-mode:page; } + .Standard { font-size:12pt; font-family:Times New Roman; writing-mode:page; } + .T1 { font-family:Courier New; } + .T2 { font-family:Courier New; font-style:italic; } + <!-- ODF styles with no properties representable as CSS --> + { } + </style></head><body dir="ltr" style="max-width:21.001cm;margin-top:2cm; margin-bottom:2cm; margin-left:2cm; margin-right:2cm; "><h1 class="Heading_20_1"><a id="a__Running_contributions_using_the_Tuscany_Shell"><span/></a>Running contributions using the Tuscany Shell</h1><p class="Standard"> </p><p class="Standard">To execute a sample contribution from the command line without needing to write any runtime launcher code you can use the Tuscany shell. The Shell provides a simple tool for loading and running SCA contributions. </p><p class="Standard"> </p><p class="Standard">The shell can be started using the tuscany.bat (windows) or tuscany.sh (linux) scripts provided in the /bin directory of the binary distribution. You can provide the name of a contribution as an argument in the following way </p><p class="Standard"> </p><p class="P1"> <span class="T1">bin/tuscany.bat </span><span class="T2">location_of_contribution</span></p><p class="Standard"> </p><p class="Standard">The getting-started\helloworld contribution is a good contribution to start with if you want to give this a go. First change directory to the root of the Tuscany binary distribution. Then;</p><p class="Standard"> </p><p class="Standard">on Windows:</p><p class="Standard"> </p><p class="P1"> <span class="T1">bin\tuscany.bat samples\getting-started\helloworld</span></p><p class="Standard"> </p><p class="Standard">on Linux:</p><p class="Standard"> </p><p class="P1"> <span class="T1">bin/tuscany.sh samples/getting-started/helloworld</span></p><p class="Standard"> </p><p class="Standard">Once the Shell has started with one of those methods you can use Shell commands to explore</p><p class="Standard">the SCA domain, for example, use the "installed" command to get the status of installed contributions, "services" to see the available component services, and you may test calling the helloworld service by using the "invoke" command:</p><p class="Standard"> </p><p class="P1"> <span class="T1">invoke HelloworldComponent sayHello yourName</span></p><p class="Standard"> </p><p class="Standard">TODO – add more instructions on how to use the shell</p></body></html>
\ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/command-line/README.odt b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/command-line/README.odt Binary files differnew file mode 100644 index 0000000000..08fa3c1204 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/command-line/README.odt diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/eclipse/README.html b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/eclipse/README.html new file mode 100644 index 0000000000..b31333b7e8 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/eclipse/README.html @@ -0,0 +1,38 @@ +<?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.
+-->
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><!--This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.--><head profile="http://dublincore.org/documents/dcmi-terms/"><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/><title xml:lang="en-US">- no title specified</title><meta name="DCTERMS.title" content="" xml:lang="en-US"/><meta name="DCTERMS.language" content="en-US" scheme="DCTERMS.RFC4646"/><meta name="DCTERMS.source" content="http://xml.openoffice.org/odf2xhtml"/><meta name="DCTERMS.creator" content="ant "/><meta name="DCTERMS.issued" content="2011-03-15T09:48:55.71" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.modified" content="2011-04-14T11:46:35.96" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.provenance" content="" xml:lang="en-US"/><meta name="DCTERMS.subject" content="," xml:lang="en-US"/><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en"/><link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en"/><link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en"/><link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en"/><base href="."/><style type="text/css">
+ @page { }
+ table { border-collapse:collapse; border-spacing:0; empty-cells:show }
+ td, th { vertical-align:top; font-size:12pt;}
+ h1, h2, h3, h4, h5, h6 { clear:both }
+ ol, ul { margin:0; padding:0;}
+ li { list-style: none; margin:0; padding:0;}
+ <!-- "li span.odfLiEnd" - IE 7 issue-->
+ li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; }
+ span.footnodeNumber { padding-right:1em; }
+ span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000; margin:0; border:0; padding:0; }
+ * { margin:0;}
+ .Heading_20_1 { font-size:115%; margin-bottom:0.212cm; margin-top:0.423cm; font-family:Arial; writing-mode:page; font-weight:bold; }
+ .Standard { font-size:12pt; font-family:Times New Roman; writing-mode:page; }
+ <!-- ODF styles with no properties representable as CSS -->
+ { }
+ </style></head><body dir="ltr" style="max-width:21.001cm;margin-top:2cm; margin-bottom:2cm; margin-left:2cm; margin-right:2cm; "><h1 class="Heading_20_1"><a id="a__Running_contributions_inside_Eclipse"><span/></a>Running contributions inside Eclipse</h1><p class="Standard"> </p><p class="Standard">To import sample contributions into Eclipse you first need to import the Tuscany runtime. You then need to import the sample contribution into Eclipse as a project. Instructions for doing both of these things can be found here </p><p class="Standard"> </p><p class="Standard"><a href="http://tuscany.apache.org/import-existing-tuscany-sca-projects-into-eclipse.html">http://tuscany.apache.org/import-existing-tuscany-sca-projects-into-eclipse.html</a></p><p class="Standard"> </p><p class="Standard">Note. these instructions refer to our 1.x code base but it holds true for our 2.x code base. </p><p class="Standard"> </p><p class="Standard">Once you have a contribution imported into Eclipse and cleanly compiling against the Tuscany runtime jars you probably want to be able to run and debug it. The easiest way to do this is with a simple Java launcher. If you import the running-tuscany/embedded-jse project into Eclipse you'll see a simple launcher program which you can copy and adjust to launch the contribution(s) of your choice. </p></body></html>
\ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/eclipse/README.odt b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/eclipse/README.odt Binary files differnew file mode 100644 index 0000000000..785754163f --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/eclipse/README.odt diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/README.html b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/README.html new file mode 100644 index 0000000000..fc36b9b643 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/README.html @@ -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.
+-->
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><!--This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.--><head profile="http://dublincore.org/documents/dcmi-terms/"><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/><title xml:lang="en-US">- no title specified</title><meta name="DCTERMS.title" content="" xml:lang="en-US"/><meta name="DCTERMS.language" content="en-US" scheme="DCTERMS.RFC4646"/><meta name="DCTERMS.source" content="http://xml.openoffice.org/odf2xhtml"/><meta name="DCTERMS.creator" content="ant "/><meta name="DCTERMS.issued" content="2011-03-15T09:48:55.71" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.modified" content="2011-04-14T11:19:39.45" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.provenance" content="" xml:lang="en-US"/><meta name="DCTERMS.subject" content="," xml:lang="en-US"/><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en"/><link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en"/><link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en"/><link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en"/><base href="."/><style type="text/css">
+ @page { }
+ table { border-collapse:collapse; border-spacing:0; empty-cells:show }
+ td, th { vertical-align:top; font-size:12pt;}
+ h1, h2, h3, h4, h5, h6 { clear:both }
+ ol, ul { margin:0; padding:0;}
+ li { list-style: none; margin:0; padding:0;}
+ <!-- "li span.odfLiEnd" - IE 7 issue-->
+ li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; }
+ span.footnodeNumber { padding-right:1em; }
+ span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000; margin:0; border:0; padding:0; }
+ * { margin:0;}
+ .Heading_20_1 { font-size:115%; margin-bottom:0.212cm; margin-top:0.423cm; font-family:Arial; writing-mode:page; font-weight:bold; }
+ .P1 { font-size:10pt; font-family:Courier New; writing-mode:page; }
+ .Standard { font-size:12pt; font-family:Times New Roman; writing-mode:page; }
+ .T1 { color:#000000; font-family:Courier New; font-size:10pt; }
+ .T2 { font-family:Courier New; font-size:10pt; }
+ <!-- ODF styles with no properties representable as CSS -->
+ { }
+ </style></head><body dir="ltr" style="max-width:21.001cm;margin-top:2cm; margin-bottom:2cm; margin-left:2cm; margin-right:2cm; "><h1 class="Heading_20_1"><a id="a__Running_the_Tuscany_runtime_from_a_Java_program"><span/></a>Running the Tuscany runtime from a Java program</h1><p class="Standard"> </p><p class="Standard">The Tuscany SCA Runtime provides a Node API that allows the runtime to be started from within a Java program. A Node in Tuscany represents a set of activated composites and a Node is configured with all of the contributions required for those composites to run. The idea is to allow you to partition the domain up into it's constituent deployable composites and run each one in its own node on an appropriate machine. In that way the domain can easily be distributed while SCA takes care of making sure that wired services can communicate regardless of where they are. </p><p class="Standard"> </p><p class="Standard">The basic pattern is as follows:</p><p class="Standard"> </p><p class="Standard">1/ Use the <span class="T1">org.apache.tuscany.sca.node.NodeFactory </span>API to create a <span class="T1">org.apache.tuscany.sca.node.Node</span> instance configured with enough contributions to run the required composite</p><p class="Standard">2/ Start the Node instance. This starts deployable composites contained in the provided contributions</p><p class="Standard">3/ Interact with the services that the Node instance has made available</p><p class="Standard">4/ Stop the Node instance </p><p class="Standard"> </p><p class="Standard">The pattern is demonstrated in this sample in the <span class="T2">launcher.</span><span class="T1">LaunchCalculatorContribution </span>class. It loads the <span class="T2">calculator-contribution.jar </span>contribution found in the parent directory, makes a simple call to add two numbers together using the Calculator service and then shuts down. </p><p class="Standard"> </p><p class="Standard">To run the sample on Windows do:</p><p class="Standard"> </p><p class="P1">cd jse</p><p class="P1">run-sample.bat</p><p class="Standard"> </p><p class="Standard">To run the sample on *nix do:</p><p class="Standard"> </p><p class="P1">cd jse</p><p class="P1">run-sample.sh</p><p class="Standard"> </p><p class="Standard">To re-build the sample classes do </p><p class="Standard"> </p><p class="P1">cd jse</p><p class="P1">mvn</p><p class="Standard"> </p><p class="Standard">Note. The mvn build will automatically run a unit test that also runs the sample. </p><p class="Standard"> </p></body></html>
\ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/README.odt b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/README.odt Binary files differnew file mode 100644 index 0000000000..232c0dd590 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/README.odt diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/pom.xml b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/pom.xml new file mode 100644 index 0000000000..5248089354 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/pom.xml @@ -0,0 +1,50 @@ +<?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.samples</groupId>
+ <artifactId>tuscany-samples-running-tuscany</artifactId>
+ <version>2.0-Beta4</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>jse</artifactId>
+ <name>Apache Tuscany SCA Samples JSE</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-base-runtime</artifactId>
+ <version>2.0-Beta4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${project.artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/run-sample.bat b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/run-sample.bat new file mode 100644 index 0000000000..a7965ff45c --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/run-sample.bat @@ -0,0 +1,18 @@ +REM # Licensed to the Apache Software Foundation (ASF) under one
+REM # or more contributor license agreements. See the NOTICE file
+REM # distributed with this work for additional information
+REM # regarding copyright ownership. The ASF licenses this file
+REM # to you under the Apache License, Version 2.0 (the
+REM # "License"); you may not use this file except in compliance
+REM # with the License. You may obtain a copy of the License at
+REM #
+REM # http://www.apache.org/licenses/LICENSE-2.0
+REM #
+REM # Unless required by applicable law or agreed to in writing,
+REM # software distributed under the License is distributed on an
+REM # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+REM # KIND, either express or implied. See the License for the
+REM # specific language governing permissions and limitations
+REM # under the License.
+
+java -cp ..\..\..\features\tuscany-base-runtime-pom\tuscany-base-runtime-pom-manifest.jar;target\jse.jar launcher.LaunchCalculatorContribution
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/run-sample.sh b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/run-sample.sh new file mode 100644 index 0000000000..ecc78c2e46 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/run-sample.sh @@ -0,0 +1,19 @@ +# 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
+
+#!/bin/bash
+
+java -cp ../../../features/tuscany-base-runtime-pom/tuscany-base-runtime-pom-manifest.jar;target/jse.jar launcher.LaunchCalculatorContribution
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..12d80ffd1c --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,38 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+
+/**
+ * The Calculator service interface.
+ */
+@Remotable
+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-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/src/main/java/launcher/LaunchCalculatorContribution.java b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/src/main/java/launcher/LaunchCalculatorContribution.java new file mode 100644 index 0000000000..2b787fb6b8 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/src/main/java/launcher/LaunchCalculatorContribution.java @@ -0,0 +1,60 @@ +/*
+ * 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 launcher;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+
+import calculator.CalculatorService;
+
+/**
+ * This program shows how to create an embedded SCA runtime, load a contribution,
+ * start it and locate and invoke an SCA component from Java.
+ */
+public class LaunchCalculatorContribution {
+
+ /*
+ * Use the Tuscany Node API to:
+ * - create a Node instance and load a contribution from the parent directory
+ * - start the node (which starts deployable composites)
+ * - get a local service proxy
+ * - make a service call using the proxy
+ * - stop the node
+ */
+ public static void main(String[] args) throws Exception {
+ Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "../calculator-contribution.jar"));
+
+ node.start();
+
+ CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ double result = calculator.add(3, 2);
+
+ System.out.println("3 + 2 = " + result);
+
+ if (result != 5.0){
+ throw new RuntimeException("Expected 5.0 but result was " + result);
+ }
+
+ node.stop();
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/src/test/java/launcher/LauncherTestCase.java b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/src/test/java/launcher/LauncherTestCase.java new file mode 100644 index 0000000000..8adabd8137 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/jse/src/test/java/launcher/LauncherTestCase.java @@ -0,0 +1,33 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package launcher;
+
+import org.junit.Test;
+
+/**
+ * Test the sample launcher
+ */
+public class LauncherTestCase {
+
+ @Test
+ public void testCalculatorContribution() throws Exception {
+ LaunchCalculatorContribution.main(null);
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/README.html b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/README.html new file mode 100644 index 0000000000..00d6592cb8 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/README.html @@ -0,0 +1,39 @@ +<?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.
+-->
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><!--This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.--><head profile="http://dublincore.org/documents/dcmi-terms/"><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/><title xml:lang="en-US">- no title specified</title><meta name="DCTERMS.title" content="" xml:lang="en-US"/><meta name="DCTERMS.language" content="en-US" scheme="DCTERMS.RFC4646"/><meta name="DCTERMS.source" content="http://xml.openoffice.org/odf2xhtml"/><meta name="DCTERMS.creator" content="ant "/><meta name="DCTERMS.issued" content="2011-03-15T09:48:55.71" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.modified" content="2011-04-14T11:20:02.98" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.provenance" content="" xml:lang="en-US"/><meta name="DCTERMS.subject" content="," xml:lang="en-US"/><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en"/><link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en"/><link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en"/><link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en"/><base href="."/><style type="text/css">
+ @page { }
+ table { border-collapse:collapse; border-spacing:0; empty-cells:show }
+ td, th { vertical-align:top; font-size:12pt;}
+ h1, h2, h3, h4, h5, h6 { clear:both }
+ ol, ul { margin:0; padding:0;}
+ li { list-style: none; margin:0; padding:0;}
+ <!-- "li span.odfLiEnd" - IE 7 issue-->
+ li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; }
+ span.footnodeNumber { padding-right:1em; }
+ span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000; margin:0; border:0; padding:0; }
+ * { margin:0;}
+ .Heading_20_1 { font-size:115%; margin-bottom:0.212cm; margin-top:0.423cm; font-family:Arial; writing-mode:page; font-weight:bold; }
+ .P1 { font-size:10pt; font-family:Courier New; writing-mode:page; }
+ .Standard { font-size:12pt; font-family:Times New Roman; writing-mode:page; }
+ <!-- ODF styles with no properties representable as CSS -->
+ { }
+ </style></head><body dir="ltr" style="max-width:21.001cm;margin-top:2cm; margin-bottom:2cm; margin-left:2cm; margin-right:2cm; "><h1 class="Heading_20_1"><a id="a__Running_the_Tuscany_runtime_from_JUnit"><span/></a>Running the Tuscany runtime from JUnit</h1><p class="Standard"> </p><p class="Standard">The same Node API used to start the Tuscany runtime from Java can of course also be used from within a JUnit test case. This allows you to automatically test you SCA contributions. This sample uses the same sart-up code from the jse sample but this time inside:</p><p class="Standard"> </p><p class="P1"> launcher.LaunchCalculatorContributionTestCase.java</p><p class="Standard"> </p><p class="Standard">This JUnit test case can be run using you usually use to run JUnit tests. By default Maven will run JUnit tests for a module so this sample can be run by doing the following:</p><p class="Standard"> </p><p class="P1">cd junit</p><p class="P1">mvn</p><p class="Standard"> </p><p class="Standard">TODO – should we provide run-sample scripts. If so we need to ship JUnit or provide instructions on how to install it?</p></body></html>
\ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/README.odt b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/README.odt Binary files differnew file mode 100644 index 0000000000..6a8240d72e --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/README.odt diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/pom.xml b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/pom.xml new file mode 100644 index 0000000000..9fd6903cca --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/pom.xml @@ -0,0 +1,50 @@ +<?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.samples</groupId>
+ <artifactId>tuscany-samples-running-tuscany</artifactId>
+ <version>2.0-Beta4</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>junit</artifactId>
+ <name>Apache Tuscany SCA Samples JUnit</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-base-runtime</artifactId>
+ <version>2.0-Beta4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${project.artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..12d80ffd1c --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,38 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+
+/**
+ * The Calculator service interface.
+ */
+@Remotable
+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-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/src/test/java/launcher/LaunchCalculatorContributionTestCase.java b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/src/test/java/launcher/LaunchCalculatorContributionTestCase.java new file mode 100644 index 0000000000..229a3fe223 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/junit/src/test/java/launcher/LaunchCalculatorContributionTestCase.java @@ -0,0 +1,51 @@ +/*
+ * 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 launcher;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.Test;
+
+import calculator.CalculatorService;
+
+/**
+ * Test sample contribution.
+ */
+public class LaunchCalculatorContributionTestCase {
+
+
+ @Test
+ public void testCalculatorContribution() throws Exception {
+ Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "../calculator-contribution.jar"));
+ node.start();
+
+ CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ double result = calculator.add(3, 2);
+
+ System.out.println("3 + 2 = " + result);
+
+ Assert.assertEquals(5.0, result);
+
+ node.stop();
+ }
+}
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/osgi/README.html b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/osgi/README.html new file mode 100644 index 0000000000..95f57f8b03 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/osgi/README.html @@ -0,0 +1,88 @@ +<!--
+ * 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.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
+ <TITLE></TITLE>
+ <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.3 (Win32)">
+ <META NAME="AUTHOR" CONTENT="ant ">
+ <META NAME="CREATED" CONTENT="20110315;9485571">
+ <META NAME="CHANGED" CONTENT="20110906;11330986">
+ <STYLE TYPE="text/css">
+ <!--
+ @page { margin: 2cm }
+ P { margin-bottom: 0.21cm }
+ H1 { margin-bottom: 0.21cm }
+ H1.western { font-family: "Arial", sans-serif; font-size: 16pt }
+ H1.cjk { font-family: "SimSun"; font-size: 16pt }
+ H1.ctl { font-family: "Mangal"; font-size: 16pt }
+ PRE.cjk { font-family: "NSimSun", monospace }
+ H2 { margin-bottom: 0.21cm }
+ H2.western { font-family: "Arial", sans-serif; font-size: 14pt; font-style: italic }
+ H2.cjk { font-family: "SimSun"; font-size: 14pt; font-style: italic }
+ H2.ctl { font-family: "Mangal"; font-size: 14pt; font-style: italic }
+ A:link { so-language: zxx }
+ -->
+ </STYLE>
+</HEAD>
+<BODY LANG="en-GB" DIR="LTR">
+<H1 CLASS="western">Running the Tuscany runtime from OSGi</H1>
+<P STYLE="margin-bottom: 0cm"><BR>
+</P>
+<PRE CLASS="western"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>The Tuscany runtime can be run in and OSGi container. </FONT></FONT></PRE><H2 CLASS="western">
+Running in Equinox</H2>
+<P STYLE="margin-bottom: 0cm">On Windows, run</P>
+<PRE CLASS="western">
+cd modules
+java -jar osgi-3.5.0-v20090520.jar -configuration ..\features\configuration -clean -console
+
+<FONT FACE="Times New Roman, serif"><FONT SIZE=3>On *Unix, run</FONT></FONT>
+
+cd modules
+java -jar osgi-3.5.0-v20090520.jar -configuration ../features/configuration -clean -console
+
+<FONT FACE="Times New Roman, serif"><FONT SIZE=3>You should see the osgi console:</FONT></FONT>
+
+osgi>
+
+<FONT FACE="Times New Roman, serif"><FONT SIZE=3>You can run "ss" command under the osgi> to see the status of the bundles:</FONT></FONT>
+
+osgi> ss
+
+<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Then you can install and start contributions as bundles by doing the following:</FONT></FONT>
+
+osgi> install file:///./path/to/contribution_bundle.jar
+
+<FONT FACE="Times New Roman, serif"><FONT SIZE=3>For example, on Windows, </FONT></FONT>
+
+<FONT FACE="Times New Roman, serif"><FONT SIZE=3><FONT FACE="Courier New, monospace"><FONT SIZE=2>osgi> install file:///c:\path\to\Tuscany\installation\samples\learning-more\contribution-osgi\target\sample-contribution-osgi.jar</FONT></FONT></FONT></FONT>
+
+<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Note. This sample contribution contains a bundle activator to fire up the Tuscany runtime. We are not relying on any Tuscany runtime service to detect the installation of the ontribution bundle. </FONT></FONT></PRE><H2 CLASS="western">
+Running on Felix</H2>
+<P STYLE="margin-bottom: 0cm">See
+http://tuscany.apache.org/documentation-2x/running-tuscany-sca-2x-with-equinox-and-felix.html</P>
+<P STYLE="margin-bottom: 0cm"><BR>
+</P>
+<P STYLE="margin-bottom: 0cm"><BR>
+</P>
+<P STYLE="margin-bottom: 0cm"><BR>
+</P>
+</BODY>
+</HTML>
\ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/osgi/README.odt b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/osgi/README.odt Binary files differnew file mode 100644 index 0000000000..5fc0091d0e --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/osgi/README.odt diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/pom.xml b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/pom.xml new file mode 100644 index 0000000000..2fe999ffaa --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/pom.xml @@ -0,0 +1,46 @@ +<?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.samples</groupId>
+ <artifactId>tuscany-samples</artifactId>
+ <version>2.0-Beta4</version>
+
+ </parent>
+
+ <artifactId>tuscany-samples-running-tuscany</artifactId>
+ <version>2.0-Beta4</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Samples Running Tuscany</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>jse</module>
+ <module>junit</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/running-tuscany.html b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/running-tuscany.html new file mode 100644 index 0000000000..ffaa3f1fe0 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/running-tuscany.html @@ -0,0 +1,128 @@ +<!--
+ * 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.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
+ <TITLE></TITLE>
+ <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.3 (Win32)">
+ <META NAME="AUTHOR" CONTENT="ant ">
+ <META NAME="CREATED" CONTENT="20110315;9485571">
+ <META NAME="CHANGED" CONTENT="20110906;11405052">
+ <STYLE TYPE="text/css">
+ <!--
+ @page { margin: 2cm }
+ P { margin-bottom: 0.21cm }
+ H1 { margin-bottom: 0.21cm }
+ H1.western { font-family: "Arial", sans-serif; font-size: 16pt }
+ H1.cjk { font-family: "SimSun"; font-size: 16pt }
+ H1.ctl { font-family: "Mangal"; font-size: 16pt }
+ TD P { margin-bottom: 0cm }
+ A:link { so-language: zxx }
+ -->
+ </STYLE>
+</HEAD>
+<BODY LANG="en-GB" DIR="LTR">
+<H1 CLASS="western"><IMG SRC="running-tuscany_html_m65f05d55.png" NAME="graphics1" ALIGN=LEFT WIDTH=191 HEIGHT=91 BORDER=0><BR CLEAR=LEFT></H1>
+<H1 CLASS="western">Starting the Tuscany SCA Runtime</H1>
+<P STYLE="margin-bottom: 0cm"><BR>
+</P>
+<P STYLE="margin-bottom: 0cm">How you run the Tuscany runtime, load
+contributions and start composites depends on what environment you're
+running in and what you're trying to achieve. For example, if you
+just want to try out some samples then you may want to run the
+Tuscany runtime from the command line using the Tuscany shell or from
+Maven or Ant. If on the other hand you want Tuscany to run in a
+WebApp, in OSGi or you want to debug the runtime in an IDE like
+Eclipse different approaches are required.</P>
+<P STYLE="margin-bottom: 0cm"><BR>
+</P>
+<P STYLE="margin-bottom: 0cm">The samples in this directory show
+various ways in which you can start Tuscany.</P>
+<P STYLE="margin-bottom: 0cm"><BR>
+</P>
+<TABLE WIDTH=643 BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
+ <COL WIDTH=142>
+ <COL WIDTH=483>
+ <TR VALIGN=TOP>
+ <TD WIDTH=142>
+ <P><BR>
+ </P>
+ </TD>
+ <TD WIDTH=483>
+ <P><BR>
+ </P>
+ </TD>
+ </TR>
+ <TR VALIGN=TOP>
+ <TD WIDTH=142>
+ <P><A HREF="command-line/README.html" NAME="commmand-line">command-line</A></P>
+ </TD>
+ <TD WIDTH=483>
+ <P>Deploy a contribution from the command line using the Tuscany
+ Shell without writing any code</P>
+ </TD>
+ </TR>
+ <TR VALIGN=TOP>
+ <TD WIDTH=142>
+ <P><A HREF="eclipse/README.html"><SPAN STYLE="font-weight: normal">eclipse</SPAN></A></P>
+ </TD>
+ <TD WIDTH=483>
+ <P>Deploy and debug a contribution project from the Eclipse IDE</P>
+ </TD>
+ </TR>
+ <TR VALIGN=TOP>
+ <TD WIDTH=142>
+ <P><A HREF="jse/README.html">jse</A></P>
+ </TD>
+ <TD WIDTH=483>
+ <P>Deploy a contribution from a simple Java program</P>
+ </TD>
+ </TR>
+ <TR VALIGN=TOP>
+ <TD WIDTH=142>
+ <P><A HREF="junit/README.html">junit</A></P>
+ </TD>
+ <TD WIDTH=483>
+ <P>Deploy a contribution from a JUnit test case</P>
+ </TD>
+ </TR>
+ <TR VALIGN=TOP>
+ <TD WIDTH=142>
+ <P><A HREF="ant/README.html">ant</A></P>
+ </TD>
+ <TD WIDTH=483>
+ <P>Deploy a contribution from an Ant script</P>
+ </TD>
+ </TR>
+ <TR VALIGN=TOP>
+ <TD WIDTH=142>
+ <P><A HREF="osgi/README.html">osgi</A></P>
+ </TD>
+ <TD WIDTH=483>
+ <P>Start the Tuscany runtime in OSGi and install a contribution</P>
+ </TD>
+ </TR>
+</TABLE>
+<P STYLE="margin-bottom: 0cm"><BR>
+</P>
+<P STYLE="margin-bottom: 0cm"><BR>
+</P>
+</BODY>
+</HTML>
\ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/running-tuscany.odt b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/running-tuscany.odt Binary files differnew file mode 100644 index 0000000000..039ac00408 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/running-tuscany.odt diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/running-tuscany_html_m65f05d55.png b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/running-tuscany_html_m65f05d55.png Binary files differnew file mode 100644 index 0000000000..ad6ba6b202 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/samples/running-tuscany/running-tuscany_html_m65f05d55.png |