From 89d72264d0af4c65c9bf0b7a6f823f13d69162aa Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:07:53 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835127 13f79535-47bb-0310-9956-ffa450edef68 --- .../samples/helloworld-jsonrpc-webapp/README | 90 +++++++++++ .../helloworld-jsonrpc.png | Bin 0 -> 9947 bytes .../helloworld-jsonrpc.svg | 177 +++++++++++++++++++++ .../samples/helloworld-jsonrpc-webapp/pom.xml | 103 ++++++++++++ .../java/helloworldjsonrpc/HelloWorldService.java | 28 ++++ .../helloworldjsonrpc/HelloWorldServiceImpl.java | 36 +++++ .../src/main/resources/jsonrpc.composite | 37 +++++ .../src/main/webapp/HelloWorldJSONRPC.html | 75 +++++++++ .../src/main/webapp/META-INF/sca-contribution.xml | 26 +++ .../src/main/webapp/WEB-INF/web.xml | 41 +++++ .../src/main/webapp/style.css | 22 +++ 11 files changed, 635 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/README create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css (limited to 'sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp') diff --git a/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/README b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/README new file mode 100644 index 0000000000..07253d039b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/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-webapp.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-webapp + +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-webapp/ + 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-webapp.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-webapp +ant package + +This should result in a war file (sample-helloworld-jsonrpc-webapp.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-webapp + +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-webapp +mvn + +Again this should result in a war file (sample-helloworld-jsonrpc-webapp.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-1.3/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png new file mode 100644 index 0000000000..57f90aed01 Binary files /dev/null and b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png differ diff --git a/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg new file mode 100644 index 0000000000..6ef1f438fb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg @@ -0,0 +1,177 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldjsonrpc + + HelloWorldJSONServiceComponent + HelloWorldService + WebApp + DOJO + + diff --git a/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/pom.xml b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/pom.xml new file mode 100644 index 0000000000..0c73688e13 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/pom.xml @@ -0,0 +1,103 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.3-SNAPSHOT + ../../pom.xml + + sample-helloworld-jsonrpc-webapp + war + Apache Tuscany SCA HelloWorld JSON-RPC Sample WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 1.3-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.3-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 1.3-SNAPSHOT + runtime + + + + + stax + stax-api + 1.0.1 + provided + + + + + javax.servlet + servlet-api + 2.3 + provided + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 1.3-SNAPSHOT + + + + generate + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java new file mode 100644 index 0000000000..3d8ea24f04 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/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-1.3/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..35fd00fabd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/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-1.3/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite new file mode 100644 index 0000000000..e895ab455d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html new file mode 100644 index 0000000000..75dd9050fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html @@ -0,0 +1,75 @@ + + + + Tuscany JSON-RPC HelloWorld Example + + + + + + + + + + +

Tuscany JSON-RPC HelloWorld Sample

+ + + + + + + + + + + + + + + +
Non-Dojo Example
+ This example uses the JavaScript served from + SCADomain/scaDomain.js + to make JSON-RPC requests to the SCA service 'HelloWorldService' +
RequestResponse
+

+ Name please:     + + +

+ +
+
None Yet.
+
+ + + diff --git a/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/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-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..267bed176c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany JSON-RPC HelloWorld Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + HelloWorldJSONRPC.html + + + diff --git a/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css new file mode 100644 index 0000000000..1071583264 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.3/samples/helloworld-jsonrpc-webapp/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; } -- cgit v1.2.3