You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2008/04/21 21:00:17 UTC

svn commit: r650222 - in /incubator/tuscany/java/sca/tutorial/store-mashup: ./ build-openajax.xml gadget/map-gadget.html gadget/store-gadget.html mashup/store-mash.html pom.xml store-mashup.composite

Author: jsdelfino
Date: Mon Apr 21 12:00:13 2008
New Revision: 650222

URL: http://svn.apache.org/viewvc?rev=650222&view=rev
Log:
Show how to use openajax Hub class to send and handle widget events.

Added:
    incubator/tuscany/java/sca/tutorial/store-mashup/build-openajax.xml   (with props)
Modified:
    incubator/tuscany/java/sca/tutorial/store-mashup/   (props changed)
    incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html
    incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html
    incubator/tuscany/java/sca/tutorial/store-mashup/mashup/store-mash.html
    incubator/tuscany/java/sca/tutorial/store-mashup/pom.xml
    incubator/tuscany/java/sca/tutorial/store-mashup/store-mashup.composite

Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Apr 21 12:00:13 2008
@@ -14,3 +14,4 @@
 build.xml
 work
 derby.log
+openajax

Added: incubator/tuscany/java/sca/tutorial/store-mashup/build-openajax.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/store-mashup/build-openajax.xml?rev=650222&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/build-openajax.xml (added)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/build-openajax.xml Mon Apr 21 12:00:13 2008
@@ -0,0 +1,86 @@
+<?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 name="OpenAjaxZipInstaller">
+
+    <property name="openajax.version" value="1.0_build117_v1.0"/>
+    <property name="unpack.location" value="${basedir}/openajax"/>
+	
+    <target name="check-openajax-installed">
+        <condition property="already.installed" >
+            <available file="${localRepository}/openajax/openajax/${openajax.version}/openajax-${openajax.version}.zip"/>
+        </condition>
+        <condition property="maven.suffix" value="">
+            <os family="unix"/>
+        </condition>
+        <condition property="maven.suffix" value=".bat">
+            <os family="windows"/>
+        </condition>
+    </target>
+	
+
+    <target name="check-openajax-unpacked">
+        <condition property="already.unpacked" >
+            <available file="${unpack.location}"/>
+        </condition>
+    </target>
+
+    <target name="install-openajax" depends="check-openajax-installed" unless="already.installed">
+        <mkdir dir="${basedir}/target/openajax-download/"/>
+        <get src="http://downloads.sourceforge.net/openajaxallianc/OpenAjaxHub${openajax.version}.zip"
+            dest="${basedir}/target/openajax-download/openajax-${openajax.version}.zip"
+            verbose="true"
+            usetimestamp="true"/>
+        <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+            <arg line="install:install-file -DgroupId=openajax  -DartifactId=openajax -Dversion=${openajax.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/openajax-download/openajax-${openajax.version}.zip"/>
+        </exec>
+    </target>
+
+    <target name="install-openajax-nomaven" depends="check-openajax-installed" unless="already.installed">
+        <mkdir dir="${basedir}/target/openajax-download/"/>
+        <get src="http://downloads.sourceforge.net/openajaxallianc/OpenAjaxHub${openajax.version}.zip"
+            dest="${basedir}/target/openajax-download/openajax-${openajax.version}.zip"
+            verbose="true"
+            usetimestamp="true"/>
+        <copy file="${basedir}/target/openajax-download/openajax-${openajax.version}.zip" 
+              tofile="${localRepository}/openajax/openajax/${openajax.version}/openajax-${openajax.version}.zip"/>
+    </target>
+	
+
+    <target name="unpack-openajax-files" depends="check-openajax-installed, check-openajax-unpacked" unless="already.unpacked">
+        <fail message="openajax zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
+        <mkdir dir="${basedir}/target/openajax-unpack-temp/"/>
+        <unzip src="${localRepository}/openajax/openajax/${openajax.version}/openajax-${openajax.version}.zip"
+               dest="${basedir}/target/openajax-unpack-temp/"
+               overwrite="false">
+            <patternset>
+                <include name="OpenAjaxHub${openajax.version}/release/**"/>
+            </patternset>
+        </unzip>
+        <move file="${basedir}/target/openajax-unpack-temp/OpenAjaxHub${openajax.version}/release"
+              tofile="${unpack.location}"
+              verbose="true"/>
+        <delete dir="${basedir}/target/openajax-unpack-temp/"/>
+    </target>
+	
+
+    <target name="clean-openajax-files">
+        <delete dir="${unpack.location}"/>
+    </target>
+</project>

Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/build-openajax.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/build-openajax.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/build-openajax.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html?rev=650222&r1=650221&r2=650222&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html (original)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html Mon Apr 21 12:00:13 2008
@@ -23,19 +23,22 @@
 <script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"></script>
 
 <script language="JavaScript">
-	var map;
 
-	function coordsChanged(coords) {
-		var latlng = coords.split(',');
-		map.setCenter(new GLatLng(latlng[0], latlng[1]));
+	function coordsChangedCallback(eventname, publisherData, subscriberData) {
+		var coords = publisherData.split(',');
+		if (coords.length >= 2) {
+        	subscriberData.setCenter(new GLatLng(coords[0], coords[1]));
+		}
 	}
        
 	function init() {
     	if (GBrowserIsCompatible()) {
-			map = new GMap2(document.getElementById("map_canvas"));
+			var map = new GMap2(document.getElementById("map_canvas"));
 			map.setCenter(new GLatLng(37.4419, -122.1419), 13);
 
-			window.top.geoSpatialCoords = coordsChanged;
+			if (window.top.hub != null) {
+				window.top.hub.subscribe("geospatial.coords", coordsChangedCallback, null, map);
+			}
 		}
 	}
 </script>

Modified: incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html?rev=650222&r1=650221&r2=650222&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html (original)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html Mon Apr 21 12:00:13 2008
@@ -89,7 +89,7 @@
 		document.getElementById('store').innerHTML='<h2>' +
 				'Thanks for Shopping With Us!</h2>'+
 				'<h2>Your Order</h2>'+
-				'<form name="orderForm" action="/gadget">'+
+				'<form name="orderForm" action="/gadget/store">'+
 					document.getElementById('shoppingCart').innerHTML+
 					'<br>'+
 					document.getElementById('total').innerHTML+
@@ -107,10 +107,10 @@
 
 	function selectItem(i) {
 	    var item = catalogItems[i];
-	    if (window.top.geoSpatialCoords != null) {
-			window.top.geoSpatialCoords(item.origin);
+		if (window.top.hub != null) {
+			window.top.hub.publish("geospatial.coords", item.origin);
 		}
-	}			
+	}		
 
 	function init() {
 		catalog.get(catalog_getResponse);

Modified: incubator/tuscany/java/sca/tutorial/store-mashup/mashup/store-mash.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/store-mashup/mashup/store-mash.html?rev=650222&r1=650221&r2=650222&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/mashup/store-mash.html (original)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/mashup/store-mash.html Mon Apr 21 12:00:13 2008
@@ -20,6 +20,8 @@
 <head>
 <title>Store Mashup</title>
 		
+<script type="text/javascript" src='/openajax/OpenAjax.js'></script>
+
 <script type="text/javascript" src="/mashup/store-mash.js"></script>
 
 <script language="JavaScript">
@@ -45,6 +47,8 @@
 	}
 	
 	function init() {
+		window.top.hub = OpenAjax.hub;
+		
 		storeGadget.get('', storeGadget_getResponse);
 		mapGadget.get('', mapGadget_getResponse);
 	}

Modified: incubator/tuscany/java/sca/tutorial/store-mashup/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/store-mashup/pom.xml?rev=650222&r1=650221&r2=650222&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/pom.xml (original)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/pom.xml Mon Apr 21 12:00:13 2008
@@ -70,6 +70,65 @@
                     </execution>
                 </executions>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <dependencies>
+                    <dependency>
+                        <groupId>ant</groupId>
+                        <artifactId>ant-trax</artifactId>
+                        <version>1.6.5</version>
+                    </dependency>
+                </dependencies>
+                
+                    <executions>
+                        <execution> 
+                            <id>install-openajax</id>                       
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>run</goal>
+                            </goals>
+                            <configuration>
+                                <tasks>
+                                    <ant antfile="./build-openajax.xml" target="install-openajax">
+                                        <property name="localRepository" value="${settings.localRepository}"/>
+                                    </ant>
+                                </tasks>
+                            </configuration>
+                        </execution>
+                        <execution> 
+                            <id>copy-openajax-files</id>                       
+                            <phase>generate-resources</phase>
+                            <goals>
+                                <goal>run</goal>
+                            </goals>
+                            <configuration>
+                                <tasks>
+                                    <ant antfile="./build-openajax.xml" target="unpack-openajax-files">
+                                        <property name="localRepository" value="${settings.localRepository}"/>
+                                        <property name="artifactId" value="${artifactId}"/>
+                                    </ant>
+                                </tasks>
+                            </configuration>
+                        </execution>
+                        <execution> 
+                            <id>clean-openajax-files</id>                       
+                            <phase>clean</phase>
+                            <goals>
+                                <goal>run</goal>
+                            </goals>
+                            <configuration>
+                                <tasks>
+                                    <ant antfile="./build-openajax.xml" target="clean-openajax-files">
+                                        <property name="localRepository" value="${settings.localRepository}"/>
+                                        <property name="artifactId" value="${artifactId}"/>
+                                    </ant>
+                                </tasks>
+                            </configuration>
+                        </execution>
+                    </executions>
+                </plugin>            
        </plugins>
     </build>
 

Modified: incubator/tuscany/java/sca/tutorial/store-mashup/store-mashup.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/store-mashup/store-mashup.composite?rev=650222&r1=650221&r2=650222&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/store-mashup.composite (original)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/store-mashup.composite Mon Apr 21 12:00:13 2008
@@ -39,4 +39,10 @@
 		 </reference>
     </component>
     
+    <component name="openajax">
+        <t:implementation.resource location="openajax"/>
+        <service name="Resource">
+        	<t:binding.http uri="/openajax"/>
+        </service>
+    </component>
 </composite>



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org