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 2010/07/06 11:05:58 UTC
svn commit: r960846 - in /tuscany/sca-cpp/trunk: modules/http/
modules/openid/ modules/server/ samples/store-cpp/
samples/store-cpp/htdocs/ samples/store-gae/ samples/store-gae/htdocs/
samples/store-java/ samples/store-java/htdocs/ samples/store-nosql/...
Author: jsdelfino
Date: Tue Jul 6 09:05:57 2010
New Revision: 960846
URL: http://svn.apache.org/viewvc?rev=960846&view=rev
Log:
Minor cleanup of config scripts and samples.
Added:
tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html
tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html
tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html
tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/index.html
tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html
tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html
tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html
Removed:
tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/.htaccess
tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/store.html
tuscany/sca-cpp/trunk/samples/store-gae/htdocs/store.html
tuscany/sca-cpp/trunk/samples/store-java/htdocs/.htaccess
tuscany/sca-cpp/trunk/samples/store-java/htdocs/store.html
tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/.htaccess
tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/store.html
tuscany/sca-cpp/trunk/samples/store-python/htdocs/.htaccess
tuscany/sca-cpp/trunk/samples/store-python/htdocs/store.html
tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/.htaccess
tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/store.html
tuscany/sca-cpp/trunk/samples/store-sql/htdocs/.htaccess
tuscany/sca-cpp/trunk/samples/store-sql/htdocs/store.html
Modified:
tuscany/sca-cpp/trunk/modules/http/httpd-conf
tuscany/sca-cpp/trunk/modules/http/httpd-ssl-conf
tuscany/sca-cpp/trunk/modules/openid/openid-conf
tuscany/sca-cpp/trunk/modules/server/server-conf
tuscany/sca-cpp/trunk/samples/store-cpp/Makefile.am
tuscany/sca-cpp/trunk/samples/store-cpp/server-test
tuscany/sca-cpp/trunk/samples/store-gae/server-test
tuscany/sca-cpp/trunk/samples/store-java/Makefile.am
tuscany/sca-cpp/trunk/samples/store-java/server-test
tuscany/sca-cpp/trunk/samples/store-nosql/Makefile.am
tuscany/sca-cpp/trunk/samples/store-nosql/server-test
tuscany/sca-cpp/trunk/samples/store-python/Makefile.am
tuscany/sca-cpp/trunk/samples/store-python/server-test
tuscany/sca-cpp/trunk/samples/store-scheme/Makefile.am
tuscany/sca-cpp/trunk/samples/store-scheme/server-test
tuscany/sca-cpp/trunk/samples/store-sql/Makefile.am
tuscany/sca-cpp/trunk/samples/store-sql/server-test
Modified: tuscany/sca-cpp/trunk/modules/http/httpd-conf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/http/httpd-conf?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/http/httpd-conf (original)
+++ tuscany/sca-cpp/trunk/modules/http/httpd-conf Tue Jul 6 09:05:57 2010
@@ -38,7 +38,7 @@ cat >$root/conf/httpd.conf <<EOF
# Apache HTTPD server configuration
# Set server name
-ServerName $host:$pport
+ServerName http://$host:$pport
UseCanonicalName On
UseCanonicalPhysicalPort off
PidFile $root/logs/httpd.pid
@@ -107,20 +107,20 @@ Satisfy Any
# Allow access to document root
<Directory "$htdocs">
-Options +SymLinksIfOwnerMatch
+Options FollowSymLinks
Allow from all
</Directory>
# Allow access to service components
<Location />
-Options +SymLinksIfOwnerMatch
+Options FollowSymLinks
Allow from all
</Location>
# Setup HTTP virtual host
Listen $port
<VirtualHost _default_:$port>
-ServerName $host:$pport
+ServerName http://$host:$pport
</VirtualHost>
EOF
Modified: tuscany/sca-cpp/trunk/modules/http/httpd-ssl-conf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/http/httpd-ssl-conf?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/http/httpd-ssl-conf (original)
+++ tuscany/sca-cpp/trunk/modules/http/httpd-ssl-conf Tue Jul 6 09:05:57 2010
@@ -54,7 +54,7 @@ SSLRandomSeed connect builtin
# HTTPS virtual host
Listen $sslport
<VirtualHost _default_:$sslport>
-ServerName $host:$sslpport
+ServerName https://$host:$sslpport
UseCanonicalName On
UseCanonicalPhysicalPort off
Modified: tuscany/sca-cpp/trunk/modules/openid/openid-conf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/openid-conf?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/openid-conf (original)
+++ tuscany/sca-cpp/trunk/modules/openid/openid-conf Tue Jul 6 09:05:57 2010
@@ -24,12 +24,6 @@ htdocs=`readlink -f $2`
openid_prefix=`cat openid.prefix`
servername=`cat $root/conf/httpd.conf | grep ServerName | tail -1 | awk '{ print $2 }'`
-ssl=`cat $root/conf/httpd.conf | grep "SSLEngine" | awk '{ print $2 }'`
-if [ "$ssl" = "on" ]; then
- protocol="https"
-else
- protocol="http"
-fi
# Configure HTTPD mod_auth_openid module
cat >>$root/conf/httpd.conf <<EOF
Modified: tuscany/sca-cpp/trunk/modules/server/server-conf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/server/server-conf?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/server/server-conf (original)
+++ tuscany/sca-cpp/trunk/modules/server/server-conf Tue Jul 6 09:05:57 2010
@@ -22,13 +22,11 @@ here=`readlink -f $0`; here=`dirname $he
root=`readlink -f $1`
servername=`cat $root/conf/httpd.conf | grep ServerName | tail -1 | awk '{ print $2 }'`
-host=`echo $servername | awk -F ":" '{ print $1 }'`
+host=`echo $servername | awk -F ":" '{ printf "%s:%s", $1, $2 }'`
port=`cat $root/conf/httpd.conf | grep Listen | tail -1 | awk '{ print $2 }'`
ssl=`cat $root/conf/httpd.conf | grep "SSLEngine" | awk '{ print $2 }'`
if [ "$ssl" = "on" ]; then
- protocol="https"
-
cat >>$root/conf/httpd.conf <<EOF
# Configure SCA SSL support
SCASSLCACertificateFile "$root/conf/ca.crt"
@@ -36,15 +34,12 @@ SCASSLCertificateFile "$root/conf/server
SCASSLCertificateKeyFile "$root/conf/server.key"
EOF
-
-else
- protocol="http"
fi
cat >>$root/conf/httpd.conf <<EOF
# Support for SCA component wiring
LoadModule mod_tuscany_wiring $here/libmod_tuscany_wiring.so
-SCAWiringServerName $protocol://$host:$port
+SCAWiringServerName $host:$port
Alias /js/tuscany-ref.js $here/htdocs/js/tuscany-ref.js
Modified: tuscany/sca-cpp/trunk/samples/store-cpp/Makefile.am
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-cpp/Makefile.am?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-cpp/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/samples/store-cpp/Makefile.am Tue Jul 6 09:05:57 2010
@@ -19,7 +19,7 @@
dist_sample_SCRIPTS = start stop ssl-start
sampledir = $(prefix)/samples/store-cpp
-nobase_dist_sample_DATA = currency-converter.cpp fruits-catalog.cpp shopping-cart.cpp store.composite htdocs/.htaccess htdocs/*.html
+nobase_dist_sample_DATA = currency-converter.cpp fruits-catalog.cpp shopping-cart.cpp store.composite htdocs/*.html
sample_LTLIBRARIES = libcurrency-converter.la libfruits-catalog.la libshopping-cart.la
Added: tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html?rev=960846&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html (added)
+++ tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html Tue Jul 6 09:05:57 2010
@@ -0,0 +1,157 @@
+<!--
+ * 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="/js/tuscany-ref.js"></script>
+
+<script type="text/javascript">
+var component = new tuscany.sca.Component("Store");
+
+//@Reference
+var catalog = new tuscany.sca.Reference("catalog");
+
+//@Reference
+var shoppingCart = new tuscany.sca.Reference("shoppingCart");
+
+//@Reference
+var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+
+var catalogItems;
+
+function catalog_getcatalogResponse(items, exception) {
+ if (exception){
+ alert(exception.message);
+ return;
+ }
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" 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;
+
+ shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ }
+}
+
+function shoppingTotal_gettotalResponse(total, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ 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 type="text">Item</title><content type="application/xml">' +
+ '<item>' +
+ '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
+ '<name>' + catalogItems[i].name + '</name>' +
+ '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
+ '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
+ '<price>' + 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">'+
+ 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 init() {
+ try {
+ catalog.apply("getcatalog", catalog_getcatalogResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ } catch(e){
+ alert(e);
+ }
+}
+</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/">(feed)</a>
+</form>
+</div>
+
+</body>
+</html>
Modified: tuscany/sca-cpp/trunk/samples/store-cpp/server-test
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-cpp/server-test?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-cpp/server-test (original)
+++ tuscany/sca-cpp/trunk/samples/store-cpp/server-test Tue Jul 6 09:05:57 2010
@@ -26,8 +26,8 @@ curl_prefix=`cat $here/../../modules/htt
sleep 2
# Test HTTP GET
-$curl_prefix/bin/curl http://localhost:8090/store.html 2>/dev/null >tmp/store.html
-diff tmp/store.html htdocs/store.html
+$curl_prefix/bin/curl http://localhost:8090/ 2>/dev/null >tmp/index.html
+diff tmp/index.html htdocs/index.html
rc=$?
# Cleanup
Added: tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html?rev=960846&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html (added)
+++ tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html Tue Jul 6 09:05:57 2010
@@ -0,0 +1,167 @@
+<!--
+ * 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="/js/tuscany-ref.js"></script>
+
+<script type="text/javascript">
+var component = new tuscany.sca.Component("Store");
+
+//@Reference
+var catalog = new tuscany.sca.Reference("catalog");
+
+//@Reference
+var shoppingCart = new tuscany.sca.Reference("shoppingCart");
+
+//@Reference
+var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+
+var catalogItems;
+
+function catalog_getcatalogResponse(items, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" value="' +
+ item + '">' + item + ' <br>';
+ }
+ document.getElementById('catalog').innerHTML=catalog;
+ catalogItems = items;
+}
+
+function shoppingCart_getemailResponse(email, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ document.getElementById('email').innerHTML = email;
+}
+
+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;
+
+ shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ }
+}
+
+function shoppingTotal_gettotalResponse(total,exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ 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 type="text">Item</title><content type="application/xml">' +
+ '<item>' +
+ '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
+ '<name>' + catalogItems[i].name + '</name>' +
+ '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
+ '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
+ '<price>' + 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">'+
+ 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 init() {
+ try {
+ catalog.apply("getcatalog", catalog_getcatalogResponse);
+ shoppingCart.apply("getemail", shoppingCart_getemailResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ } catch(e){
+ alert(e);
+ }
+}
+</script>
+</head>
+
+<body onload="init()">
+<h1>Store</h1>
+<p>You're signed in as: <span id="email"></span><br/><a href="/_ah/login?continue=/store.html&action=Logout">Sign out</a></p>
+<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/">(feed)</a>
+</form>
+</div>
+
+</body>
+</html>
Modified: tuscany/sca-cpp/trunk/samples/store-gae/server-test
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-gae/server-test?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-gae/server-test (original)
+++ tuscany/sca-cpp/trunk/samples/store-gae/server-test Tue Jul 6 09:05:57 2010
@@ -27,7 +27,7 @@ sleep 2
# Test HTTP GET
mkdir -p tmp
-$curl_prefix/bin/curl -L http://localhost:8090/store.html 2>/dev/null >tmp/login.html
+$curl_prefix/bin/curl -L http://localhost:8090/ 2>/dev/null >tmp/login.html
grep "Login" tmp/login.html >/dev/null
rc=$?
Modified: tuscany/sca-cpp/trunk/samples/store-java/Makefile.am
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-java/Makefile.am?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-java/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/samples/store-java/Makefile.am Tue Jul 6 09:05:57 2010
@@ -26,7 +26,7 @@ AM_JAVACFLAGS = -cp ${top_builddir}/modu
dist_sample_JAVA = store/*.java
CLEANFILES = *.stamp store/*.class
-nobase_dist_sample_DATA = store.composite htdocs/.htaccess htdocs/*.html store/*.*
+nobase_dist_sample_DATA = store.composite htdocs/*.html store/*.*
dist_noinst_SCRIPTS = server-test
TESTS = server-test
Added: tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html?rev=960846&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html (added)
+++ tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html Tue Jul 6 09:05:57 2010
@@ -0,0 +1,157 @@
+<!--
+ * 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="/js/tuscany-ref.js"></script>
+
+<script type="text/javascript">
+var component = new tuscany.sca.Component("Store");
+
+//@Reference
+var catalog = new tuscany.sca.Reference("catalog");
+
+//@Reference
+var shoppingCart = new tuscany.sca.Reference("shoppingCart");
+
+//@Reference
+var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+
+var catalogItems;
+
+function catalog_getcatalogResponse(items, exception) {
+ if (exception){
+ alert(exception.message);
+ return;
+ }
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" 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;
+
+ shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ }
+}
+
+function shoppingTotal_gettotalResponse(total, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ 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 type="text">Item</title><content type="application/xml">' +
+ '<item>' +
+ '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
+ '<name>' + catalogItems[i].name + '</name>' +
+ '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
+ '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
+ '<price>' + 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">'+
+ 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 init() {
+ try {
+ catalog.apply("getcatalog", catalog_getcatalogResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ } catch(e){
+ alert(e);
+ }
+}
+</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/">(feed)</a>
+</form>
+</div>
+
+</body>
+</html>
Modified: tuscany/sca-cpp/trunk/samples/store-java/server-test
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-java/server-test?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-java/server-test (original)
+++ tuscany/sca-cpp/trunk/samples/store-java/server-test Tue Jul 6 09:05:57 2010
@@ -26,8 +26,8 @@ curl_prefix=`cat $here/../../modules/htt
sleep 2
# Test HTTP GET
-$curl_prefix/bin/curl http://localhost:8090/store.html 2>/dev/null >tmp/store.html
-diff tmp/store.html htdocs/store.html
+$curl_prefix/bin/curl http://localhost:8090/ 2>/dev/null >tmp/index.html
+diff tmp/index.html htdocs/index.html
rc=$?
# Cleanup
Modified: tuscany/sca-cpp/trunk/samples/store-nosql/Makefile.am
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-nosql/Makefile.am?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-nosql/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/samples/store-nosql/Makefile.am Tue Jul 6 09:05:57 2010
@@ -18,7 +18,7 @@
dist_sample_SCRIPTS = start stop ssl-start
sampledir = $(prefix)/samples/store-nosql
-nobase_dist_sample_DATA = currency-converter.scm fruits-catalog.scm shopping-cart.scm store.scm store.composite htdocs/.htaccess htdocs/*.html
+nobase_dist_sample_DATA = currency-converter.scm fruits-catalog.scm shopping-cart.scm store.scm store.composite htdocs/*.html
dist_noinst_SCRIPTS = server-test
TESTS = server-test
Added: tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/index.html?rev=960846&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/index.html (added)
+++ tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/index.html Tue Jul 6 09:05:57 2010
@@ -0,0 +1,157 @@
+<!--
+ * 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="/js/tuscany-ref.js"></script>
+
+<script type="text/javascript">
+var component = new tuscany.sca.Component("Store");
+
+//@Reference
+var catalog = new tuscany.sca.Reference("catalog");
+
+//@Reference
+var shoppingCart = new tuscany.sca.Reference("shoppingCart");
+
+//@Reference
+var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+
+var catalogItems;
+
+function catalog_getcatalogResponse(items, exception) {
+ if (exception){
+ alert(exception.message);
+ return;
+ }
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" 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;
+
+ shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ }
+}
+
+function shoppingTotal_gettotalResponse(total, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ 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 type="text">Item</title><content type="application/xml">' +
+ '<item>' +
+ '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
+ '<name>' + catalogItems[i].name + '</name>' +
+ '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
+ '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
+ '<price>' + 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">'+
+ 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 init() {
+ try {
+ catalog.apply("getcatalog", catalog_getcatalogResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ } catch(e){
+ alert(e);
+ }
+}
+</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/">(feed)</a>
+</form>
+</div>
+
+</body>
+</html>
Modified: tuscany/sca-cpp/trunk/samples/store-nosql/server-test
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-nosql/server-test?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-nosql/server-test (original)
+++ tuscany/sca-cpp/trunk/samples/store-nosql/server-test Tue Jul 6 09:05:57 2010
@@ -26,8 +26,8 @@ curl_prefix=`cat $here/../../modules/htt
sleep 2
# Test HTTP GET
-$curl_prefix/bin/curl http://localhost:8090/store.html 2>/dev/null >tmp/store.html
-diff tmp/store.html htdocs/store.html
+$curl_prefix/bin/curl http://localhost:8090/ 2>/dev/null >tmp/index.html
+diff tmp/index.html htdocs/index.html
rc=$?
# Cleanup
Modified: tuscany/sca-cpp/trunk/samples/store-python/Makefile.am
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-python/Makefile.am?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-python/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/samples/store-python/Makefile.am Tue Jul 6 09:05:57 2010
@@ -20,7 +20,7 @@ if WANT_PYTHON
dist_sample_SCRIPTS = start stop ssl-start
sampledir = $(prefix)/samples/store-python
-nobase_dist_sample_DATA = currency-converter.py fruits-catalog.py shopping-cart.py store.py store.composite htdocs/.htaccess htdocs/*.html
+nobase_dist_sample_DATA = currency-converter.py fruits-catalog.py shopping-cart.py store.py store.composite htdocs/*.html
dist_noinst_SCRIPTS = server-test
TESTS = server-test
Added: tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html?rev=960846&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html (added)
+++ tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html Tue Jul 6 09:05:57 2010
@@ -0,0 +1,157 @@
+<!--
+ * 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="/js/tuscany-ref.js"></script>
+
+<script type="text/javascript">
+var component = new tuscany.sca.Component("Store");
+
+//@Reference
+var catalog = new tuscany.sca.Reference("catalog");
+
+//@Reference
+var shoppingCart = new tuscany.sca.Reference("shoppingCart");
+
+//@Reference
+var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+
+var catalogItems;
+
+function catalog_getcatalogResponse(items, exception) {
+ if (exception){
+ alert(exception.message);
+ return;
+ }
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" 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;
+
+ shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ }
+}
+
+function shoppingTotal_gettotalResponse(total, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ 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 type="text">Item</title><content type="application/xml">' +
+ '<item>' +
+ '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
+ '<name>' + catalogItems[i].name + '</name>' +
+ '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
+ '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
+ '<price>' + 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">'+
+ 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 init() {
+ try {
+ catalog.apply("getcatalog", catalog_getcatalogResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ } catch(e){
+ alert(e);
+ }
+}
+</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/">(feed)</a>
+</form>
+</div>
+
+</body>
+</html>
Modified: tuscany/sca-cpp/trunk/samples/store-python/server-test
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-python/server-test?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-python/server-test (original)
+++ tuscany/sca-cpp/trunk/samples/store-python/server-test Tue Jul 6 09:05:57 2010
@@ -26,8 +26,8 @@ curl_prefix=`cat $here/../../modules/htt
sleep 2
# Test HTTP GET
-$curl_prefix/bin/curl http://localhost:8090/store.html 2>/dev/null >tmp/store.html
-diff tmp/store.html htdocs/store.html
+$curl_prefix/bin/curl http://localhost:8090/ 2>/dev/null >tmp/index.html
+diff tmp/index.html htdocs/index.html
rc=$?
# Cleanup
Modified: tuscany/sca-cpp/trunk/samples/store-scheme/Makefile.am
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-scheme/Makefile.am?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-scheme/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/samples/store-scheme/Makefile.am Tue Jul 6 09:05:57 2010
@@ -18,7 +18,7 @@
dist_sample_SCRIPTS = start stop ssl-start
sampledir = $(prefix)/samples/store-scheme
-nobase_dist_sample_DATA = currency-converter.scm fruits-catalog.scm shopping-cart.scm store.scm store.composite htdocs/.htaccess htdocs/*.html
+nobase_dist_sample_DATA = currency-converter.scm fruits-catalog.scm shopping-cart.scm store.scm store.composite htdocs/*.html
EXTRA_DIST = script-test.scm
Added: tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html?rev=960846&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html (added)
+++ tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html Tue Jul 6 09:05:57 2010
@@ -0,0 +1,157 @@
+<!--
+ * 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="/js/tuscany-ref.js"></script>
+
+<script type="text/javascript">
+var component = new tuscany.sca.Component("Store");
+
+//@Reference
+var catalog = new tuscany.sca.Reference("catalog");
+
+//@Reference
+var shoppingCart = new tuscany.sca.Reference("shoppingCart");
+
+//@Reference
+var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+
+var catalogItems;
+
+function catalog_getcatalogResponse(items, exception) {
+ if (exception){
+ alert(exception.message);
+ return;
+ }
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" 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;
+
+ shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ }
+}
+
+function shoppingTotal_gettotalResponse(total, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ 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 type="text">Item</title><content type="application/xml">' +
+ '<item>' +
+ '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
+ '<name>' + catalogItems[i].name + '</name>' +
+ '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
+ '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
+ '<price>' + 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">'+
+ 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 init() {
+ try {
+ catalog.apply("getcatalog", catalog_getcatalogResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ } catch(e){
+ alert(e);
+ }
+}
+</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/">(feed)</a>
+</form>
+</div>
+
+</body>
+</html>
Modified: tuscany/sca-cpp/trunk/samples/store-scheme/server-test
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-scheme/server-test?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-scheme/server-test (original)
+++ tuscany/sca-cpp/trunk/samples/store-scheme/server-test Tue Jul 6 09:05:57 2010
@@ -26,8 +26,8 @@ curl_prefix=`cat $here/../../modules/htt
sleep 2
# Test HTTP GET
-$curl_prefix/bin/curl http://localhost:8090/store.html 2>/dev/null >tmp/store.html
-diff tmp/store.html htdocs/store.html
+$curl_prefix/bin/curl http://localhost:8090/ 2>/dev/null >tmp/index.html
+diff tmp/index.html htdocs/index.html
rc=$?
# Cleanup
Modified: tuscany/sca-cpp/trunk/samples/store-sql/Makefile.am
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-sql/Makefile.am?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-sql/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/samples/store-sql/Makefile.am Tue Jul 6 09:05:57 2010
@@ -20,7 +20,7 @@ if WANT_SQLDB
dist_sample_SCRIPTS = start stop ssl-start
sampledir = $(prefix)/samples/store-sql
-nobase_dist_sample_DATA = currency-converter.scm fruits-catalog.scm shopping-cart.scm store.scm store.composite htdocs/.htaccess htdocs/*.html
+nobase_dist_sample_DATA = currency-converter.scm fruits-catalog.scm shopping-cart.scm store.scm store.composite htdocs/*.html
dist_noinst_SCRIPTS = server-test
TESTS = server-test
Added: tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html?rev=960846&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html (added)
+++ tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html Tue Jul 6 09:05:57 2010
@@ -0,0 +1,157 @@
+<!--
+ * 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="/js/tuscany-ref.js"></script>
+
+<script type="text/javascript">
+var component = new tuscany.sca.Component("Store");
+
+//@Reference
+var catalog = new tuscany.sca.Reference("catalog");
+
+//@Reference
+var shoppingCart = new tuscany.sca.Reference("shoppingCart");
+
+//@Reference
+var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+
+var catalogItems;
+
+function catalog_getcatalogResponse(items, exception) {
+ if (exception){
+ alert(exception.message);
+ return;
+ }
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" 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;
+
+ shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ }
+}
+
+function shoppingTotal_gettotalResponse(total, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ 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 type="text">Item</title><content type="application/xml">' +
+ '<item>' +
+ '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
+ '<name>' + catalogItems[i].name + '</name>' +
+ '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
+ '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
+ '<price>' + 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">'+
+ 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 init() {
+ try {
+ catalog.apply("getcatalog", catalog_getcatalogResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ } catch(e){
+ alert(e);
+ }
+}
+</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/">(feed)</a>
+</form>
+</div>
+
+</body>
+</html>
Modified: tuscany/sca-cpp/trunk/samples/store-sql/server-test
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-sql/server-test?rev=960846&r1=960845&r2=960846&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-sql/server-test (original)
+++ tuscany/sca-cpp/trunk/samples/store-sql/server-test Tue Jul 6 09:05:57 2010
@@ -26,8 +26,8 @@ curl_prefix=`cat $here/../../modules/htt
sleep 2
# Test HTTP GET
-$curl_prefix/bin/curl http://localhost:8090/store.html 2>/dev/null >tmp/store.html
-diff tmp/store.html htdocs/store.html
+$curl_prefix/bin/curl http://localhost:8090/ 2>/dev/null >tmp/index.html
+diff tmp/index.html htdocs/index.html
rc=$?
# Cleanup