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/19 19:32:04 UTC
svn commit: r649831 - in /incubator/tuscany/java/sca/tutorial: ./
assets/META-INF/ assets/services/ assets/services/map/ domain/
domain/cloud/ domain/launch/ store-mashup/ store-mashup/META-INF/
store-mashup/gadget/ store-mashup/mashup/ store-mashup/ui...
Author: jsdelfino
Date: Sat Apr 19 10:31:59 2008
New Revision: 649831
URL: http://svn.apache.org/viewvc?rev=649831&view=rev
Log:
Added a module to the tutorial to help illustrate how to integrate SCA components in a simple mashup.
Added:
incubator/tuscany/java/sca/tutorial/assets/services/map/
incubator/tuscany/java/sca/tutorial/assets/services/map/FruitsCatalogImpl.java (with props)
incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMashupNode.composite (with props)
incubator/tuscany/java/sca/tutorial/domain/launch/LaunchStoreMashupNode.java (with props)
incubator/tuscany/java/sca/tutorial/store-mashup/ (props changed)
- copied from r642870, incubator/tuscany/java/sca/tutorial/store-eu/
incubator/tuscany/java/sca/tutorial/store-mashup/META-INF/
- copied from r648151, incubator/tuscany/java/sca/tutorial/store-eu/META-INF/
incubator/tuscany/java/sca/tutorial/store-mashup/gadget/
incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html (with props)
incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html (with props)
incubator/tuscany/java/sca/tutorial/store-mashup/map-gadget.composite (with props)
incubator/tuscany/java/sca/tutorial/store-mashup/mashup/
incubator/tuscany/java/sca/tutorial/store-mashup/mashup/store-mash.html
incubator/tuscany/java/sca/tutorial/store-mashup/pom.xml
- copied, changed from r648151, incubator/tuscany/java/sca/tutorial/store-eu/pom.xml
incubator/tuscany/java/sca/tutorial/store-mashup/store-gadget.composite (with props)
incubator/tuscany/java/sca/tutorial/store-mashup/store-mashup.composite (with props)
Removed:
incubator/tuscany/java/sca/tutorial/store-mashup/store-eu.composite
incubator/tuscany/java/sca/tutorial/store-mashup/uiservices/
Modified:
incubator/tuscany/java/sca/tutorial/assets/META-INF/sca-contribution.xml
incubator/tuscany/java/sca/tutorial/assets/services/Item.java
incubator/tuscany/java/sca/tutorial/domain/cloud.composite
incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMarketNode.composite
incubator/tuscany/java/sca/tutorial/domain/domain.composite
incubator/tuscany/java/sca/tutorial/domain/workspace.xml
incubator/tuscany/java/sca/tutorial/pom.xml
incubator/tuscany/java/sca/tutorial/store-mashup/META-INF/sca-contribution.xml
Modified: incubator/tuscany/java/sca/tutorial/assets/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/assets/META-INF/sca-contribution.xml?rev=649831&r1=649830&r2=649831&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/assets/META-INF/sca-contribution.xml (original)
+++ incubator/tuscany/java/sca/tutorial/assets/META-INF/sca-contribution.xml Sat Apr 19 10:31:59 2008
@@ -22,5 +22,6 @@
<export.java package="services.market"/>
<export.java package="services.merger"/>
<export.java package="services.db"/>
+ <export.java package="services.map"/>
<export.resource uri="uiservices/store.html"/>
</contribution>
Modified: incubator/tuscany/java/sca/tutorial/assets/services/Item.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/assets/services/Item.java?rev=649831&r1=649830&r2=649831&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/assets/services/Item.java (original)
+++ incubator/tuscany/java/sca/tutorial/assets/services/Item.java Sat Apr 19 10:31:59 2008
@@ -23,10 +23,17 @@
public class Item {
private String name;
private String price;
+ private String origin;
public Item() {
}
+ public Item(String name, String price, String origin) {
+ this.name = name;
+ this.price = price;
+ this.origin = origin;
+ }
+
public Item(String name, String price) {
this.name = name;
this.price = price;
@@ -46,6 +53,14 @@
public void setPrice(String price) {
this.price = price;
+ }
+
+ public String getOrigin() {
+ return origin;
+ }
+
+ public void setOrigin(String origin) {
+ this.origin = origin;
}
}
Added: incubator/tuscany/java/sca/tutorial/assets/services/map/FruitsCatalogImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/assets/services/map/FruitsCatalogImpl.java?rev=649831&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/assets/services/map/FruitsCatalogImpl.java (added)
+++ incubator/tuscany/java/sca/tutorial/assets/services/map/FruitsCatalogImpl.java Sat Apr 19 10:31:59 2008
@@ -0,0 +1,56 @@
+/*
+ * 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 services.map;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import services.Catalog;
+import services.CurrencyConverter;
+import services.Item;
+
+public class FruitsCatalogImpl implements Catalog {
+
+ @Property
+ public String currencyCode = "USD";
+
+ @Reference
+ public CurrencyConverter currencyConverter;
+
+ private List<Item> catalog = new ArrayList<Item>();
+
+ @Init
+ public void init() {
+ String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
+ catalog.add(new Item("Apple", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99), "34.425744,-119.711151"));
+ catalog.add(new Item("Orange", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55), "25.811018,-80.130844"));
+ catalog.add(new Item("Pear", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55), "36.596649,-121.8964"));
+ }
+
+ public Item[] get() {
+ Item[] catalogArray = new Item[catalog.size()];
+ catalog.toArray(catalogArray);
+ return catalogArray;
+ }
+}
Propchange: incubator/tuscany/java/sca/tutorial/assets/services/map/FruitsCatalogImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tutorial/assets/services/map/FruitsCatalogImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/tutorial/assets/services/map/FruitsCatalogImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/tuscany/java/sca/tutorial/domain/cloud.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/domain/cloud.composite?rev=649831&r1=649830&r2=649831&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/domain/cloud.composite (original)
+++ incubator/tuscany/java/sca/tutorial/domain/cloud.composite Sat Apr 19 10:31:59 2008
@@ -26,8 +26,9 @@
<include name="ns2:StoreMergerNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
<include name="ns2:StoreDBNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
<include name="ns2:StoreSupplierNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
- <include name="ns2:StoreMarketNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
<include name="ns2:StoreEUNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:StoreMashupNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:StoreMarketNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
<include name="ns2:CatalogWebAppNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
<include name="ns2:CatalogMediationNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
<include name="ns2:CatalogEJBNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
Modified: incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMarketNode.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMarketNode.composite?rev=649831&r1=649830&r2=649831&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMarketNode.composite (original)
+++ incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMarketNode.composite Sat Apr 19 10:31:59 2008
@@ -26,9 +26,9 @@
<component name="StoreMarketNode">
<t:implementation.node uri="store-market" composite="s:store-market"/>
<service name="Node">
- <t:binding.http uri="http://localhost:8105"/>
- <t:binding.jsonrpc uri="http://localhost:8105"/>
- <t:binding.atom uri="http://localhost:8105"/>
+ <t:binding.http uri="http://localhost:8107"/>
+ <t:binding.jsonrpc uri="http://localhost:8107"/>
+ <t:binding.atom uri="http://localhost:8107"/>
</service>
</component>
Added: incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMashupNode.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMashupNode.composite?rev=649831&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMashupNode.composite (added)
+++ incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMashupNode.composite Sat Apr 19 10:31:59 2008
@@ -0,0 +1,35 @@
+<?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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:s="http://store"
+ name="StoreMashupNode">
+
+ <component name="StoreMashupNode">
+ <t:implementation.node uri="store-mashup" composite="s:store-mashup"/>
+ <service name="Node">
+ <t:binding.http uri="http://localhost:8106"/>
+ <t:binding.jsonrpc uri="http://localhost:8106"/>
+ <t:binding.atom uri="http://localhost:8106"/>
+ </service>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMashupNode.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tutorial/domain/cloud/StoreMashupNode.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/tutorial/domain/domain.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/domain/domain.composite?rev=649831&r1=649830&r2=649831&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/domain/domain.composite (original)
+++ incubator/tuscany/java/sca/tutorial/domain/domain.composite Sat Apr 19 10:31:59 2008
@@ -26,6 +26,7 @@
<include name="ns2:store-supplier" uri="store-supplier" xmlns:ns2="http://store"/>
<include name="ns2:store-market" uri="store-market" xmlns:ns2="http://store"/>
<include name="ns2:store-eu" uri="store-eu" xmlns:ns2="http://store"/>
+ <include name="ns2:store-mashup" uri="store-mashup" xmlns:ns2="http://store"/>
<include name="ns2:catalogs" uri="web-services" xmlns:ns2="http://services"/>
<include name="ns2:currency" uri="web-services" xmlns:ns2="http://services"/>
<include name="ns2:catalog-web" uri="catalog-webapp" xmlns:ns2="http://catalog"/>
Added: incubator/tuscany/java/sca/tutorial/domain/launch/LaunchStoreMashupNode.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/domain/launch/LaunchStoreMashupNode.java?rev=649831&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/domain/launch/LaunchStoreMashupNode.java (added)
+++ incubator/tuscany/java/sca/tutorial/domain/launch/LaunchStoreMashupNode.java Sat Apr 19 10:31:59 2008
@@ -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 launch;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchStoreMashupNode {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreMashupNode"});
+ }
+}
Propchange: incubator/tuscany/java/sca/tutorial/domain/launch/LaunchStoreMashupNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tutorial/domain/launch/LaunchStoreMashupNode.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/tutorial/domain/launch/LaunchStoreMashupNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/tuscany/java/sca/tutorial/domain/workspace.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/domain/workspace.xml?rev=649831&r1=649830&r2=649831&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/domain/workspace.xml (original)
+++ incubator/tuscany/java/sca/tutorial/domain/workspace.xml Sat Apr 19 10:31:59 2008
@@ -25,6 +25,7 @@
<contribution location="file:../store-supplier/target/tutorial-store-supplier.jar" uri="store-supplier"/>
<contribution location="file:../store-market/target/tutorial-store-market.jar" uri="store-market"/>
<contribution location="file:../store-eu/target/tutorial-store-eu.jar" uri="store-eu"/>
+ <contribution location="file:../store-mashup" uri="store-mashup"/>
<contribution location="file:../web-services/target/tutorial-web-services.jar" uri="web-services"/>
<contribution location="file:../catalog-webapp/target/tutorial-catalog-webapp.war" uri="catalog-webapp"/>
<contribution location="file:../catalog-mediation/target/tutorial-catalog-mediation.jar" uri="catalog-mediation"/>
Modified: incubator/tuscany/java/sca/tutorial/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/pom.xml?rev=649831&r1=649830&r2=649831&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/pom.xml (original)
+++ incubator/tuscany/java/sca/tutorial/pom.xml Sat Apr 19 10:31:59 2008
@@ -44,6 +44,7 @@
<module>store-supplier</module>
<module>store-market</module>
<module>store-eu</module>
+ <module>store-mashup</module>
<module>web-services</module>
<module>catalog-webapp</module>
<module>catalog-ejb</module>
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Apr 19 10:31:59 2008
@@ -0,0 +1,16 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+build.xml
+work
+derby.log
Modified: incubator/tuscany/java/sca/tutorial/store-mashup/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/store-mashup/META-INF/sca-contribution.xml?rev=649831&r1=648151&r2=649831&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/META-INF/sca-contribution.xml (original)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/META-INF/sca-contribution.xml Sat Apr 19 10:31:59 2008
@@ -20,7 +20,6 @@
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:s="http://store">
<import.java package="services"/>
- <import.java package="services.merger"/>
- <import.java package="services.db"/>
- <deployable composite="s:store-eu"/>
-</contribution>
\ No newline at end of file
+ <import.java package="services.map"/>
+ <deployable composite="s:store-mashup"/>
+</contribution>
Added: 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=649831&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html (added)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html Sat Apr 19 10:31:59 2008
@@ -0,0 +1,47 @@
+<!--
+ * 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>Map</title>
+
+<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&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 init() {
+ if (GBrowserIsCompatible()) {
+ map = new GMap2(document.getElementById("map_canvas"));
+ map.setCenter(new GLatLng(37.4419, -122.1419), 13);
+
+ window.top.geoSpatialCoords = coordsChanged;
+ }
+ }
+</script>
+</head>
+
+<body onload="init()">
+ <div id="map_canvas" style="width: 100%; height: 100%"></div>
+</body>
+</html>
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/gadget/map-gadget.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=649831&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html (added)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html Sat Apr 19 10:31:59 2008
@@ -0,0 +1,148 @@
+<!--
+ * 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>Store</title>
+
+<script type="text/javascript" src="/gadget/store/store-gadget.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var catalog = new Reference("catalog");
+
+ //@Reference
+ var shoppingCart = new Reference("shoppingCart");
+
+ //@Reference
+ var shoppingTotal = new Reference("shoppingTotal");
+
+ var catalogItems;
+
+ function catalog_getResponse(items) {
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" onClick="selectItem(' + i + ')" value="' +
+ item + '">' + item + ' <br>';
+ }
+ document.getElementById('catalog').innerHTML=catalog;
+ catalogItems = items;
+ }
+
+ function shoppingCart_getResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var list = "";
+ for (var i=0; i<entries.length; i++) {
+ var content = entries[i].getElementsByTagName("content")[0];
+ var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
+ var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
+ list += name + ' - ' + price + ' <br>';
+ }
+ document.getElementById("shoppingCart").innerHTML = list;
+
+ if (entries.length != 0) {
+ shoppingTotal.getTotal(shoppingTotal_getTotalResponse);
+ }
+ }
+ }
+
+ function shoppingTotal_getTotalResponse(total) {
+ document.getElementById('total').innerHTML = total;
+ }
+
+ function shoppingCart_postResponse(entry) {
+ shoppingCart.get("", shoppingCart_getResponse);
+ }
+
+ function addToCart() {
+ var items = document.catalogForm.items;
+ var j = 0;
+ for (var i=0; i<items.length; i++)
+ if (items[i].checked) {
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>item</title><content type="text/xml">' +
+ '<Item xmlns="http://services/">' +
+ '<name xmlns="">' + catalogItems[i].name + '</name>' + '<price xmlns="">' + catalogItems[i].price + '</price>' +
+ '</Item>' + '</content></entry>';
+ shoppingCart.post(entry, shoppingCart_postResponse);
+ items[i].checked = false;
+ }
+ }
+ function checkoutCart() {
+ document.getElementById('store').innerHTML='<h2>' +
+ 'Thanks for Shopping With Us!</h2>'+
+ '<h2>Your Order</h2>'+
+ '<form name="orderForm" action="/gadget">'+
+ document.getElementById('shoppingCart').innerHTML+
+ '<br>'+
+ document.getElementById('total').innerHTML+
+ '<br>'+
+ '<br>'+
+ '<input type="submit" value="Continue Shopping">'+
+ '</form>';
+ shoppingCart.del("", null);
+ }
+ function deleteCart() {
+ shoppingCart.del("", null);
+ document.getElementById('shoppingCart').innerHTML = "";
+ document.getElementById('total').innerHTML = "";
+ }
+
+ function selectItem(i) {
+ var item = catalogItems[i];
+ if (window.top.geoSpatialCoords != null) {
+ window.top.geoSpatialCoords(item.origin);
+ }
+ }
+
+ function init() {
+ catalog.get(catalog_getResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ }
+
+</script>
+
+</head>
+
+<body onload="init()">
+<h1>Store</h1>
+ <div id="store">
+ <h2>Catalog</h2>
+ <form name="catalogForm">
+ <div id="catalog" ></div>
+ <br>
+ <input type="button" onClick="addToCart()" value="Add to Cart">
+ </form>
+
+ <br>
+
+ <h2>Your Shopping Cart</h2>
+ <form name="shoppingCartForm">
+ <div id="shoppingCart"></div>
+ <br>
+ <div id="total"></div>
+ <br>
+ <input type="button" onClick="checkoutCart()" value="Checkout">
+ <input type="button" onClick="deleteCart()" value="Empty">
+ <a href="../ShoppingCart/Cart/" target="_top">(feed)</a>
+ </form>
+ </div>
+</body>
+</html>
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/gadget/store-gadget.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/tuscany/java/sca/tutorial/store-mashup/map-gadget.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/store-mashup/map-gadget.composite?rev=649831&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/map-gadget.composite (added)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/map-gadget.composite Sat Apr 19 10:31:59 2008
@@ -0,0 +1,32 @@
+<?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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ name="map-gadget">
+
+ <component name="MapGadget">
+ <t:implementation.widget location="gadget/map-gadget.html"/>
+ <service name="Widget">
+ <t:binding.http uri="/gadget/map"/>
+ </service>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/map-gadget.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/map-gadget.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: 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=649831&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/mashup/store-mash.html (added)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/mashup/store-mash.html Sat Apr 19 10:31:59 2008
@@ -0,0 +1,66 @@
+<!--
+ * 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>Store Mashup</title>
+
+<script type="text/javascript" src="/mashup/store-mash.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var storeGadget = new Reference("storeGadget");
+
+ //@Reference
+ var mapGadget = new Reference("mapGadget");
+
+ function storeGadget_getResponse(gadget) {
+ var gadget1 = document.getElementById('gadget1').contentDocument;
+ gadget1.open();
+ gadget1.write(gadget);
+ gadget1.close();
+ }
+
+ function mapGadget_getResponse(gadget) {
+ var gadget2 = document.getElementById('gadget2').contentDocument;
+ gadget2.open();
+ gadget2.write(gadget);
+ gadget2.close();
+ }
+
+ function init() {
+ storeGadget.get('', storeGadget_getResponse);
+ mapGadget.get('', mapGadget_getResponse);
+ }
+
+</script>
+</head>
+
+<body onload="init()">
+<h1>Store Mashup</h1>
+<br>
+<table border="0" cellpadding="0" cellspacing="2">
+ <tr>
+ <td><iframe id="gadget1" style='overflow:hidden;width:400px;height:500px;border:1px solid black;'></iframe></td>
+ <td><iframe id="gadget2" style='overflow:hidden;width:400px;height:500px;border:1px solid black;'></iframe></td>
+ </tr>
+</table>
+
+</body>
+</html>
Copied: incubator/tuscany/java/sca/tutorial/store-mashup/pom.xml (from r648151, incubator/tuscany/java/sca/tutorial/store-eu/pom.xml)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/store-mashup/pom.xml?p2=incubator/tuscany/java/sca/tutorial/store-mashup/pom.xml&p1=incubator/tuscany/java/sca/tutorial/store-eu/pom.xml&r1=648151&r2=649831&rev=649831&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-eu/pom.xml (original)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/pom.xml Sat Apr 19 10:31:59 2008
@@ -25,8 +25,8 @@
<version>2.0-incubating-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>tutorial-store-eu</artifactId>
- <name>Apache Tuscany SCA Tutorial EU Online Store</name>
+ <artifactId>tutorial-store-mashup</artifactId>
+ <name>Apache Tuscany SCA Tutorial Online Store Mashup</name>
<repositories>
<repository>
@@ -70,40 +70,6 @@
</execution>
</executions>
</plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>sql-maven-plugin</artifactId>
- <version>1.0</version>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.1.2.1</version>
- </dependency>
- </dependencies>
-
- <executions>
- <execution>
- <id>create-db</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
- <url>jdbc:derby:${basedir}/target/cart-eu-db;create=true</url>
- <autocommit>true</autocommit>
- <onError>continue</onError>
- <delimiter>;</delimiter>
- <srcFiles>
- <srcFile>${basedir}/../assets/services/db/cart.sql</srcFile>
- </srcFiles>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
Added: incubator/tuscany/java/sca/tutorial/store-mashup/store-gadget.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/store-mashup/store-gadget.composite?rev=649831&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/store-gadget.composite (added)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/store-gadget.composite Sat Apr 19 10:31:59 2008
@@ -0,0 +1,64 @@
+<?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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ name="store-gadget">
+
+ <component name="StoreGadget">
+ <t:implementation.widget location="gadget/store-gadget.html"/>
+ <service name="Widget">
+ <t:binding.http uri="/gadget/store"/>
+ </service>
+ <reference name="catalog" target="StoreGadgetCatalog">
+ <t:binding.jsonrpc/>
+ </reference>
+ <reference name="shoppingCart" target="StoreGadgetShoppingCart/Cart">
+ <t:binding.atom/>
+ </reference>
+ <reference name="shoppingTotal" target="StoreGadgetShoppingCart/Total">
+ <t:binding.jsonrpc/>
+ </reference>
+ </component>
+
+ <component name="StoreGadgetCatalog">
+ <implementation.java class="services.map.FruitsCatalogImpl"/>
+ <property name="currencyCode">USD</property>
+ <service name="Catalog">
+ <t:binding.jsonrpc/>
+ </service>
+ <reference name="currencyConverter" target="StoreGadgetCurrencyConverter"/>
+ </component>
+
+ <component name="StoreGadgetShoppingCart">
+ <implementation.java class="services.ShoppingCartImpl"/>
+ <service name="Cart">
+ <t:binding.atom uri="/ShoppingCart/Cart"/>
+ </service>
+ <service name="Total">
+ <t:binding.jsonrpc/>
+ </service>
+ </component>
+
+ <component name="StoreGadgetCurrencyConverter">
+ <implementation.java class="services.CurrencyConverterImpl"/>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/store-gadget.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/store-gadget.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: 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=649831&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/store-mashup/store-mashup.composite (added)
+++ incubator/tuscany/java/sca/tutorial/store-mashup/store-mashup.composite Sat Apr 19 10:31:59 2008
@@ -0,0 +1,42 @@
+<?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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ xmlns:s="http://store"
+ name="store-mashup">
+
+ <include name="s:store-gadget"/>
+ <include name="s:map-gadget"/>
+
+ <component name="StoreMashup">
+ <t:implementation.widget location="mashup/store-mash.html"/>
+ <service name="Widget">
+ <t:binding.http uri="/mashup"/>
+ </service>
+ <reference name="storeGadget" target="StoreGadget">
+ <t:binding.http/>
+ </reference>
+ <reference name="mapGadget" target="MapGadget">
+ <t:binding.http/>
+ </reference>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/tutorial/store-mashup/store-mashup.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org