You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by fm...@apache.org on 2010/08/31 18:35:30 UTC

svn commit: r991235 - in /tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp: ./ src/ src/main/ src/main/java/ src/main/java/sample/ src/main/webapp/ src/main/webapp/META-INF/ src/main/webapp/WEB-INF/ src/main/webapp/WEB-INF/lib/

Author: fmoga
Date: Tue Aug 31 16:35:29 2010
New Revision: 991235

URL: http://svn.apache.org/viewvc?rev=991235&view=rev
Log:
Added sources.

Added:
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/pom.xml
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/Location.java
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareService.java
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/META-INF/
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/lib/
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/index.html
Modified:
    tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/   (props changed)

Propchange: tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Aug 31 16:35:29 2010
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Added: tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/pom.xml?rev=991235&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/pom.xml Tue Aug 31 16:35:29 2010
@@ -0,0 +1,53 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.tuscany.sca</groupId>
+		<artifactId>tuscany-sca</artifactId>
+		<version>2.0-SNAPSHOT</version>
+		<relativePath>../../pom.xml</relativePath>
+	</parent>
+
+	<groupId>org.apache.tuscany.sca</groupId>
+	<artifactId>sample-jsonp-webapp</artifactId>
+	<packaging>war</packaging>
+	<version>1.0</version>
+	<name>jsonp-webapp</name>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.tuscany.sca.shades</groupId>
+			<artifactId>tuscany-base-nodep</artifactId>
+			<version>2.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-binding-jsonp-runtime</artifactId>
+			<version>2.0-SNAPSHOT</version>
+			<type>jar</type>
+		</dependency>
+	</dependencies>
+	
+	<build>
+    	<finalName>jsonp-webapp</finalName>
+    </build>
+</project>
+

Added: tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/Location.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/Location.java?rev=991235&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/Location.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/Location.java Tue Aug 31 16:35:29 2010
@@ -0,0 +1,33 @@
+package sample;
+
+public class Location {
+
+	private String city;
+	private String country;
+	private int altitude;
+
+	public String getCity() {
+		return city;
+	}
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+	public String getCountry() {
+		return country;
+	}
+
+	public void setCountry(String country) {
+		this.country = country;
+	}
+
+	public int getAltitude() {
+		return altitude;
+	}
+
+	public void setAltitude(int altitude) {
+		this.altitude = altitude;
+	}
+
+}

Added: tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareService.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareService.java?rev=991235&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareService.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareService.java Tue Aug 31 16:35:29 2010
@@ -0,0 +1,14 @@
+package sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface ShareService {
+
+	String shareName(String firstName, String lastName);
+	
+	int shareAge(int age);
+	
+	Location shareLocation(Location location);
+	
+}

Added: tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java?rev=991235&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java Tue Aug 31 16:35:29 2010
@@ -0,0 +1,23 @@
+package sample;
+
+import org.oasisopen.sca.annotation.Service;
+
+@Service(ShareService.class)
+public class ShareServiceImpl implements ShareService {
+
+	@Override
+	public String shareName(String firstName, String lastName) {
+		return firstName + " " + lastName;
+	}
+
+	@Override
+	public int shareAge(int age) {
+		return age;
+	}
+
+	@Override
+	public Location shareLocation(Location location) {
+		return location;
+	}
+
+}

Added: tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF?rev=991235&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF (added)
+++ tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF Tue Aug 31 16:35:29 2010
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+

Added: tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite?rev=991235&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite (added)
+++ tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite Tue Aug 31 16:35:29 2010
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+           targetNamespace="http://samples"
+           name="Stock">
+
+	<component name="c">
+		<implementation.java class="sample.ShareServiceImpl"/>
+		<service name="ShareService">
+			<interface.java interface="sample.ShareService"/>
+			<tuscany:binding.jsonp/>
+		</service>
+	</component>
+	
+</composite>
\ No newline at end of file

Added: tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml?rev=991235&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml (added)
+++ tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml Tue Aug 31 16:35:29 2010
@@ -0,0 +1,34 @@
+<?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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:j2ee="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_3.0.xsd" version="3.0">
+  <display-name>Apache Tuscany JSONP Sample</display-name>
+  <filter>
+    <filter-name>tuscany</filter-name>
+    <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+    <async-supported>true</async-supported>
+  </filter>
+  <filter-mapping>
+    <filter-name>tuscany</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+  <welcome-file-list>
+    <welcome-file>index.html</welcome-file>
+  </welcome-file-list>
+</web-app>
\ No newline at end of file

Added: tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/index.html?rev=991235&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/index.html (added)
+++ tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/index.html Tue Aug 31 16:35:29 2010
@@ -0,0 +1,104 @@
+<!--
+ * 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.
+-->
+<html>
+	<head>
+		<title>Apache Tuscany Comet Sample</title>
+		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+		<script type="text/javascript" src="http://jquery-json.googlecode.com/svn/trunk/jquery.json.min.js"></script>
+		<script type="text/javascript">
+		$(document).ready(function() {
+			document.getElementById("shareLocationButton").onclick = function(event) {
+				var location = {
+					city: document.getElementById("city").value,
+					country: document.getElementById("country").value,
+					altitude: document.getElementById("altitude").value
+				};
+				$.getJSON("c/ShareService/shareLocation", "location=" + $.toJSON(location), shareLocationCallback);
+			}
+		});
+		
+		function shareNameCallback(response) {
+			alert("Your name, " + response + ", has been shared.");
+		}
+		
+		function shareAge() {
+			document.getElementById("shareAgeForm").submit();
+		}
+		
+		function shareAgeCallback(response) {
+			alert("Your age, " + response + ", has been shared.");
+		}
+		
+		function shareLocationCallback(response) {
+			alert("Your location, " + response.city + " - " + response.country + " - " + response.altitude + ", has been shared.");
+		}
+		</script>
+	</head>
+	<body>
+		<h2>Apache Tuscany JSONP Sample</h2>
+		<h3>Share Personal Information Webapp</h3>
+		
+		<form method="GET" action="c/ShareService/shareName">
+			<b><label>Share Full Name</label></b>
+			<table>
+				<tr>
+					<td>First Name</td>
+					<td><input type="text" name="firstName" value="John"/>
+				</tr>
+				<tr>
+					<td>Last Name</td>
+					<td><input type="text" name="lastName" value="Locke"/>
+				</tr>
+			</table>
+			<input type="hidden" name="callback" value="shareNameCallback"/>
+			<input type="submit" value="Share"/>
+		</form>
+		
+		<form method="GET" id="shareAgeForm" action="c/ShareService/shareAge">
+			<b><label>Share Age</label></b>
+			<table>
+				<tr>
+					<td>Age</td>
+					<td><input type="text" name="age" value="54"/>
+				</tr>
+			</table>
+			<input type="hidden" name="callback" value="shareAgeCallback"/>
+			<input type="submit" value="Share" onclick="shareAge()"/>
+		</form>
+		
+		<form method="GET" >
+			<b><label>Share Location</label></b>
+			<table>
+				<tr>
+					<td>City</td>
+					<td><input type="text" name="city" id="city" value="Los Angeles" />
+				</tr>
+				<tr>
+					<td>Country</td>
+					<td><input type="text" name="country" id="country" value="USA" />
+				</tr>
+				<tr>
+					<td>Altitude</td>
+					<td><input type="text" name="altitude" id="altitude" value="560" />
+				</tr>
+			</table>
+			<input type="button" id="shareLocationButton" value="Share"/>
+		</form>
+	</body>
+</html>