diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:06:58 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:06:58 +0000 |
commit | 3dd7e2c4da9c80b8182a2d04dc129a67aa7910df (patch) | |
tree | 71b970aa1c5987564405511d3912044387118fd4 /sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc | |
parent | 0f3f9b59b310833f31ba234ee4aefa808649833c (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835121 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc')
12 files changed, 701 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/README b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/README new file mode 100644 index 0000000000..93a2c703ac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/README @@ -0,0 +1,90 @@ +Hello World JSONRPC Sample +========================== +This sample demostrates the JSONRPC binding using a simple web app that +talks JSONRPC to an SCA service. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-helloworld-jsonrpc.war) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-jsonrpc + +The port and hostname will of course vary depending on your local installation. + +Sample Overview +--------------- +The sample provides a single service with an operation that reflects +a greeting back to the caller. The service is exposed using the JSONRPC +binding. The web app provided shows how the SCA-provided JSON client can be +used to invoke the SCA service. + +helloworld-jsonrpc/ + src/ + main/ + java/ + helloworldjsonrpc/ + HelloWorldService.java - service interface + HelloWorldServiceImpl.java - service implementation + resources/ + jsonrpc.composite - the SCA assembly for this sample + webapp + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime + HelloWorldJSONRPC.html - the web application that calls the + SCA service via JSONRPC + style.css - style sheet + + helloworld-jsonrpc.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file that unpacks the + dojo installation + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd helloworld-jsonrpc +ant package + +This should result in a war file (sample-helloworld-jsonrpc.war) in the target +directory. Copy this war file to your web app deployment directory in your +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-jsonrpc + +The port and hostname will of course vary depending on your local installation. + +You should see a web page that allows you to send messages, via JSONRPC, to the +application running in the Tuscany SCA Runtime + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd helloworld-jsonrpc +mvn + +Again this should result in a war file (sample-helloworld-jsonrpc.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/build.xml b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/build.xml new file mode 100644 index 0000000000..dd3d5e6512 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/build.xml @@ -0,0 +1,92 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project name="helloworld-jsonrpc" default="package"> + + <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> + </target> + + <target name="package" depends="compile"> + <war destfile="target/sample-helloworld-jsonrpc.war" + webxml="src/main/webapp/WEB-INF/web.xml"> + <fileset dir="src/main/webapp"/> + <zipfileset dir="../../modules" prefix="WEB-INF/lib"> + <include name="sca-api-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-assembly-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-assembly-xml-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-binding-jsonrpc-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-binding-sca-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-binding-sca-xml-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-contribution-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-contribution-impl-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-contribution-java-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-contribution-namespace-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-core-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-core-databinding-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-core-spi-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-databinding-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-distributed-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-extension-helper-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-host-embedded-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-host-http-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-host-webapp-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-implementation-java-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-implementation-java-runtime-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-implementation-java-xml-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-interface-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-interface-java-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-interface-java-xml-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-policy-0.99-incubating-SNAPSHOT.jar"/> + <include name="tuscany-policy-xml-0.99-incubating-SNAPSHOT.jar"/> + </zipfileset> + <lib dir="../../lib"> + <include name="cglib-nodep-2.1_3.jar"/> + <include name="geronimo-commonj_1.1_spec-1.0.jar"/> + <include name="json-rpc-1.0.jar"/> + <include name="stax-api-1.0.1.jar"/> + <include name="wstx-asl-3.2.1.jar"/> + </lib> + <classes dir="target/classes"/> + </war> + + </target> + + + + <target name="clean"> + <delete quiet="true" includeemptydirs="true"> + <fileset dir="target"/> + </delete> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/helloworld-jsonrpc.png b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/helloworld-jsonrpc.png Binary files differnew file mode 100644 index 0000000000..57f90aed01 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/helloworld-jsonrpc.png diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/helloworld-jsonrpc.svg b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/helloworld-jsonrpc.svg new file mode 100644 index 0000000000..fe966d8c17 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/helloworld-jsonrpc.svg @@ -0,0 +1,177 @@ +<?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\helloworld-jsonrpc" + sodipodi:docname="helloworld-jsonrpc.svg" + version="1.0" + inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-jsonrpc\helloworld-jsonrpc.png" + inkscape:export-xdpi="52.84" + inkscape:export-ydpi="52.84"> + <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="1.4" + inkscape:cx="516.28571" + inkscape:cy="414.63224" + inkscape:document-units="px" + inkscape:current-layer="layer1" + inkscape:window-width="1054" + inkscape:window-height="721" + inkscape:window-x="158" + inkscape:window-y="164" /> + <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="translate(144.2857,52.85714)"> + <rect + rx="8.0946665" + ry="12.692303" + y="192.00233" + x="258.31134" + height="299.99988" + width="262.14267" + id="rect2067" + style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999893;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <flowRoot + id="flowRoot2954" + xml:space="preserve"><flowRegion + id="flowRegion2956"><rect + y="212.66591" + x="281.42856" + height="61.42857" + width="170" + id="rect2958" /></flowRegion><flowPara + id="flowPara2960">helloworldjsonrpc</flowPara></flowRoot> </g> + <rect + style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect2988" + width="115.66247" + height="85.862968" + x="449.91632" + y="349.31049" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot2966" + transform="translate(190.3256,143.3719)"><flowRegion + id="flowRegion2968"><rect + id="rect2970" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara2972">HelloWorld</flowPara><flowPara + id="flowPara1883">JSONService</flowPara><flowPara + id="flowPara1885">Component</flowPara></flowRoot> <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000036px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 373.48019,364.72909 L 455.16689,364.72909 L 470.019,392.34681 L 452.69154,417.84009 L 373.48019,417.84009 L 392.04536,392.34681 L 373.48019,364.72909 z " + id="path3017" /> + <flowRoot + xml:space="preserve" + id="flowRoot1887" + transform="translate(113.6483,167.4037)"><flowRegion + id="flowRegion1889"><rect + id="rect1891" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara1893">HelloWorld</flowPara><flowPara + id="flowPara1897">Service</flowPara></flowRoot> <rect + style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1" + id="rect1888" + width="85" + height="97.85714" + x="214.28571" + y="340.52307" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot1892" + transform="translate(-56.88742,135.3526)"><flowRegion + id="flowRegion1894"><rect + id="rect1896" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara1900">WebApp</flowPara></flowRoot> <rect + style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1" + id="rect1912" + width="45.714287" + height="40.714287" + x="277.85715" + y="370.52304" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot1914" + transform="translate(1.400116,166.6895)"><flowRegion + id="flowRegion1916"><rect + id="rect1918" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara1920">DOJO</flowPara></flowRoot> <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 324.28571,391.23734 C 391.42857,391.95163 391.42857,391.95163 391.42857,391.95163" + id="path1922" /> + </g> +</svg> diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/pom.xml b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/pom.xml new file mode 100644 index 0000000000..e7c0f37e99 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/pom.xml @@ -0,0 +1,73 @@ +<?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>0.99-incubating-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <artifactId>sample-helloworld-jsonrpc</artifactId> + <packaging>war</packaging> + <name>Apache Tuscany JSON-RPC Sample WebApp</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-webapp</artifactId> + <version>0.99-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>0.99-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc</artifactId> + <version>0.99-incubating-SNAPSHOT</version> + <scope>runtime</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-0.99/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldService.java b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldService.java new file mode 100644 index 0000000000..3d8ea24f04 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldService.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 helloworldjsonrpc; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldService { + + String getGreetings(String name); + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..35fd00fabd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java @@ -0,0 +1,36 @@ +/* + * 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 helloworldjsonrpc; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldService.class) +public class HelloWorldServiceImpl implements HelloWorldService { + + /* + * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() + */ + public String getGreetings(String name) { + return "jsonrpcHello " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/resources/jsonrpc.composite b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/resources/jsonrpc.composite new file mode 100644 index 0000000000..e895ab455d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/resources/jsonrpc.composite @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="helloworldjsonrpc">
+
+ <service name="HelloWorldService" promote="HelloWorldJSONServiceComponent/HelloWorldService">
+ <interface.java interface="helloworldjsonrpc.HelloWorldService"/>
+ <tuscany:binding.jsonrpc/>
+ </service>
+
+ <component name="HelloWorldJSONServiceComponent">
+ <implementation.java class="helloworldjsonrpc.HelloWorldServiceImpl"/>
+ </component>
+
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/HelloWorldJSONRPC.html b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/HelloWorldJSONRPC.html new file mode 100644 index 0000000000..98853189db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/HelloWorldJSONRPC.html @@ -0,0 +1,75 @@ +<html> +<!-- + * 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. + --> + <head> + <title>Tuscany JSON-RPC HelloWorld Example</TITLE> + + <script type="text/javascript" src="SCA/SCADomain/scaDomain.js"></script> + + <script language="JavaScript"> + + function getGreeting() { + var name = document.getElementById("name").value; + HelloWorldService.getGreetings(name, handleResponse); + } + + function handleResponse(result) { + document.getElementById('greeting').innerHTML=result; + } + + </script> + + <link rel="stylesheet" type="text/css" href="style.css" /> + </head> + + <body> + + <h2>Tuscany JSON-RPC HelloWorld Sample</h2> + + <table> + <tr> + <th colspan="2">Non-Dojo Example</th> + </tr> + <tr> + <td colspan="2"> + This example uses the JavaScript served from + <a href="SCA/SCADomain/scaDomain.js">SCA/SCADomain/scaDomain.js</a> + to make JSON-RPC requests to the SCA service 'HelloWorldService' + </tr> + <tr> + <td>Request</td> + <td>Response</td> + </tr> + <tr> + <td> + <p> + Name please: + <input type="text" id="name" size="30" value="World" /> + <input type="button" value="Submit" onclick="getGreeting()" /> + </p> + + </td> + <td> + <div id='greeting'>None Yet.</div> + </td> + </tr> + </table> + + </body> +</html> diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c8246e15a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+-->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:helloworldjsonrpc"/>
+</contribution>
+
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..52117b1dce --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + * 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 web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web +Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> +<web-app> + + <display-name>Tuscany sample HelloWorld JSON-RPC</display-name> + + <listener> + <listener-class>org.apache.tuscany.sca.host.webapp.TuscanyContextListener</listener-class> + </listener> + + <servlet> + <servlet-name>TuscanyServlet</servlet-name> + <servlet-class>org.apache.tuscany.sca.host.webapp.TuscanyServlet</servlet-class> + </servlet> + + <servlet-mapping> + <servlet-name>TuscanyServlet</servlet-name> + <url-pattern>/SCA/*</url-pattern> + </servlet-mapping> + + <welcome-file-list id="WelcomeFileList"> + <welcome-file>HelloWorldJSONRPC.html</welcome-file> + </welcome-file-list> + +</web-app> diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/style.css b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/style.css new file mode 100644 index 0000000000..1071583264 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/helloworld-jsonrpc/src/main/webapp/style.css @@ -0,0 +1,22 @@ +/* + * 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. + */ +* { font-family: arial; } + +table, th, td { border: 2px solid blue; border-collapse: collapse; } +th { color: white; background-color: blue; } |