diff options
Diffstat (limited to '')
56 files changed, 200 insertions, 201 deletions
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/jane/fruits-catalog.py b/sca-cpp/trunk/samples/store-cluster/domains/jane/fruits-catalog.py index fb85d12bc7..fb20b4ff27 100644 --- a/sca-cpp/trunk/samples/store-cluster/domains/jane/fruits-catalog.py +++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/fruits-catalog.py @@ -17,11 +17,11 @@ # Catalog implementation -def getcatalog(converter, currencyCode): - code = currencyCode() +def items(converter, currencyCode): + code = currencyCode.eval() def convert(price): - return converter("convert", "USD", code, price) - symbol = converter("symbol", code) + return converter.convert("USD", code, price) + symbol = converter.symbol(code) return ( (("'name", "Passion"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))), (("'name", "Mango"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))), diff --git a/sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py b/sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py index e315b2f1ca..44484ea5d2 100644 --- a/sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py @@ -21,12 +21,12 @@ import sys # Convert a particular host and user email to a cart id def cartid(host, email): - return ("cart", host(), email()) + return ("cart", host.eval(), email.eval()) # Get the shopping cart from the cache # Return an empty cart if not found def getcart(id, cache): - cart = cache("get", id) + cart = cache.get(id) if cart is None: return () return cart @@ -35,7 +35,7 @@ def getcart(id, cache): def post(collection, item, cache, host, email): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartid(host, email), cache) - cache("put", cartid(host, email), cart) + cache.put(cartid(host, email), cart) return (id,) @@ -51,13 +51,13 @@ def find(id, cart): # Get items from the cart def get(id, cache, host, email): if id == (): - return ("Your Cart", email()) + getcart(cartid(host, email), cache) + return ("Your Cart", email.eval()) + getcart(cartid(host, email), cache) return find(id[0], getcart(cartid(host, email), cache)) # Delete items from the cart def delete(id, cache, host, email): if id == (): - return cache("delete", cartid(host, email)) + return cache.delete(cartid(host, email)) return True # Return the price of an item @@ -71,6 +71,6 @@ def sum(items): return price(items[0]) + sum(items[1:]) # Return the total price of the items in the cart -def gettotal(cache, host, email): +def total(cache, host, email): return sum(getcart(cartid(host, email), cache)) diff --git a/sca-cpp/trunk/samples/store-cluster/domains/jane/store.py b/sca-cpp/trunk/samples/store-cluster/domains/jane/store.py index 0b4e0f72fd..ff82f1d327 100644 --- a/sca-cpp/trunk/samples/store-cluster/domains/jane/store.py +++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/store.py @@ -18,23 +18,23 @@ # Store implementation def post(item, catalog, shoppingCart, shoppingTotal): - return shoppingCart("post", item) + return shoppingCart.post(item) def getall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("getall") + return shoppingCart.getall() def get(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("get", id) + return shoppingCart.get(id) -def getcatalog(catalog, shoppingCart, shoppingTotal): - return catalog("getcatalog") +def items(catalog, shoppingCart, shoppingTotal): + return catalog.items() -def gettotal(catalog, shoppingCart, shoppingTotal): - return shoppingCart("gettotal") +def total(catalog, shoppingCart, shoppingTotal): + return shoppingCart.total() def deleteall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("deleteall") + return shoppingCart.deleteall() def delete(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("delete", id) + return shoppingCart.delete(id) diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/fruits-catalog.py b/sca-cpp/trunk/samples/store-cluster/domains/joe/fruits-catalog.py index b5eb035ae3..6644421683 100644 --- a/sca-cpp/trunk/samples/store-cluster/domains/joe/fruits-catalog.py +++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/fruits-catalog.py @@ -17,11 +17,11 @@ # Catalog implementation -def getcatalog(converter, currencyCode): - code = currencyCode() +def items(converter, currencyCode): + code = currencyCode.eval() def convert(price): - return converter("convert", "USD", code, price) - symbol = converter("symbol", code) + return converter.convert("USD", code, price) + symbol = converter.symbol(code) return ( (("'name", "Apple"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))), (("'name", "Orange"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))), diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py b/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py index e315b2f1ca..44484ea5d2 100644 --- a/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py @@ -21,12 +21,12 @@ import sys # Convert a particular host and user email to a cart id def cartid(host, email): - return ("cart", host(), email()) + return ("cart", host.eval(), email.eval()) # Get the shopping cart from the cache # Return an empty cart if not found def getcart(id, cache): - cart = cache("get", id) + cart = cache.get(id) if cart is None: return () return cart @@ -35,7 +35,7 @@ def getcart(id, cache): def post(collection, item, cache, host, email): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartid(host, email), cache) - cache("put", cartid(host, email), cart) + cache.put(cartid(host, email), cart) return (id,) @@ -51,13 +51,13 @@ def find(id, cart): # Get items from the cart def get(id, cache, host, email): if id == (): - return ("Your Cart", email()) + getcart(cartid(host, email), cache) + return ("Your Cart", email.eval()) + getcart(cartid(host, email), cache) return find(id[0], getcart(cartid(host, email), cache)) # Delete items from the cart def delete(id, cache, host, email): if id == (): - return cache("delete", cartid(host, email)) + return cache.delete(cartid(host, email)) return True # Return the price of an item @@ -71,6 +71,6 @@ def sum(items): return price(items[0]) + sum(items[1:]) # Return the total price of the items in the cart -def gettotal(cache, host, email): +def total(cache, host, email): return sum(getcart(cartid(host, email), cache)) diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/store.py b/sca-cpp/trunk/samples/store-cluster/domains/joe/store.py index 0b4e0f72fd..811b05c580 100644 --- a/sca-cpp/trunk/samples/store-cluster/domains/joe/store.py +++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/store.py @@ -18,23 +18,23 @@ # Store implementation def post(item, catalog, shoppingCart, shoppingTotal): - return shoppingCart("post", item) + return shoppingCart.post(item) def getall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("getall") + return shoppingCart.getall() def get(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("get", id) + return shoppingCart.get(id) -def getcatalog(catalog, shoppingCart, shoppingTotal): - return catalog("getcatalog") +def items(catalog, shoppingCart, shoppingTotal): + return catalog.items() -def gettotal(catalog, shoppingCart, shoppingTotal): - return shoppingCart("gettotal") +def total(catalog, shoppingCart, shoppingTotal): + return shoppingCart.total() def deleteall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("deleteall") + return shoppingCart.deletall() def delete(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("delete", id) + return shoppingCart.delete(id) diff --git a/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html index b60e18690a..376b15f6c1 100644 --- a/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html +++ b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html @@ -36,7 +36,7 @@ var shoppingTotal = new tuscany.sca.Reference("shoppingTotal"); var catalogItems;
-function catalog_getcatalogResponse(items, exception) {
+function catalog_itemsResponse(items, exception) {
if (exception){
alert(exception.message);
return;
@@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
@@ -119,7 +119,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
+ catalog.apply("items", catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html index 37ed010229..e3675dc2d3 100644 --- a/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html +++ b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html @@ -36,7 +36,7 @@ var shoppingTotal = new tuscany.sca.Reference("shoppingTotal"); var catalogItems;
-function catalog_getcatalogResponse(items, exception) {
+function catalog_itemsResponse(items, exception) {
if (exception){
alert(exception.message);
return;
@@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
@@ -119,7 +119,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
+ catalog.apply("items", catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-cluster/server-test b/sca-cpp/trunk/samples/store-cluster/server-test index 2f657c4ce5..7f6ff4ead6 100755 --- a/sca-cpp/trunk/samples/store-cluster/server-test +++ b/sca-cpp/trunk/samples/store-cluster/server-test @@ -36,8 +36,8 @@ rc=$? # Test Catalog if [ "$rc" = "0" ]; then - $curl_prefix/bin/curl http://joe.sca-store.com/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/getcatalog-request.txt >tmp/getcatalog-result.txt 2>/dev/null - diff tmp/getcatalog-result.txt ../store-cpp/htdocs/test/getcatalog-result.txt + $curl_prefix/bin/curl http://joe.sca-store.com/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/items-request.txt >tmp/items-result.txt 2>/dev/null + diff tmp/items-result.txt ../store-cpp/htdocs/test/items-result.txt rc=$? fi diff --git a/sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp b/sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp index cc0dc0849a..ce5ebfec6f 100644 --- a/sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp +++ b/sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp @@ -50,7 +50,7 @@ const list<value> mkfruit(const string& name, const string& code, const string& mklist<value>("name", name) + mklist<value>("currencyCode", code) + mklist<value>("currencySymbol", symbol) + mklist<value>("price", price); } -const failable<value> getcatalog(const lambda<value(const list<value>&)> converter, const lambda<value(const list<value>&)> currencyCode) { +const failable<value> items(const lambda<value(const list<value>&)> converter, const lambda<value(const list<value>&)> currencyCode) { const string currency(currencyCode(list<value>())); const string symbol(converter(mklist<value>("symbol", currency))); const lambda<value(const value&)> conv(convert(converter, currency)); @@ -68,8 +68,8 @@ extern "C" { const tuscany::value apply(const tuscany::list<tuscany::value>& params) { const tuscany::value func(car(params)); - if (func == "getcatalog") - return tuscany::store::getcatalog(cadr(params), caddr(params)); + if (func == "items") + return tuscany::store::items(cadr(params), caddr(params)); return tuscany::mkfailure<tuscany::value>(); } diff --git a/sca-cpp/trunk/samples/store-cpp/htdocs/index.html b/sca-cpp/trunk/samples/store-cpp/htdocs/index.html index 15e857895e..7de17d92e3 100644 --- a/sca-cpp/trunk/samples/store-cpp/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-cpp/htdocs/index.html @@ -36,7 +36,7 @@ var shoppingTotal = new tuscany.sca.Reference("shoppingTotal"); var catalogItems;
-function catalog_getcatalogResponse(items, exception) {
+function catalog_itemsResponse(items, exception) {
if (exception){
alert(exception.message);
return;
@@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
@@ -119,7 +119,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
+ catalog.apply("items", catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-cpp/htdocs/test/getcatalog-request.txt b/sca-cpp/trunk/samples/store-cpp/htdocs/test/getcatalog-request.txt deleted file mode 100644 index 1bbbc1bf52..0000000000 --- a/sca-cpp/trunk/samples/store-cpp/htdocs/test/getcatalog-request.txt +++ /dev/null @@ -1 +0,0 @@ -{"id": 1, "method": "getcatalog", "params": []} diff --git a/sca-cpp/trunk/samples/store-cpp/htdocs/test/getcatalog-result.txt b/sca-cpp/trunk/samples/store-cpp/htdocs/test/getcatalog-result.txt deleted file mode 100644 index 56f87d2778..0000000000 --- a/sca-cpp/trunk/samples/store-cpp/htdocs/test/getcatalog-result.txt +++ /dev/null @@ -1 +0,0 @@ -{"id":1,"result":[{"name":"Apple","currencyCode":"USD","currencySymbol":"$","price":2.99},{"name":"Orange","currencyCode":"USD","currencySymbol":"$","price":3.55},{"name":"Pear","currencyCode":"USD","currencySymbol":"$","price":1.55}]}
\ No newline at end of file diff --git a/sca-cpp/trunk/samples/store-cpp/htdocs/test/items-result.txt b/sca-cpp/trunk/samples/store-cpp/htdocs/test/items-result.txt index 788b7cdf89..56f87d2778 100644 --- a/sca-cpp/trunk/samples/store-cpp/htdocs/test/items-result.txt +++ b/sca-cpp/trunk/samples/store-cpp/htdocs/test/items-result.txt @@ -1 +1 @@ -{"id":1,"result":[{"name":"Mango","currencyCode":"USD","currencySymbol":"$","price":2.99},{"name":"Passion","currencyCode":"USD","currencySymbol":"$","price":3.55},{"name":"Kiwi","currencyCode":"USD","currencySymbol":"$","price":1.55}]}
\ No newline at end of file +{"id":1,"result":[{"name":"Apple","currencyCode":"USD","currencySymbol":"$","price":2.99},{"name":"Orange","currencyCode":"USD","currencySymbol":"$","price":3.55},{"name":"Pear","currencyCode":"USD","currencySymbol":"$","price":1.55}]}
\ No newline at end of file diff --git a/sca-cpp/trunk/samples/store-cpp/server-test b/sca-cpp/trunk/samples/store-cpp/server-test index fa020c6418..e0d8716449 100755 --- a/sca-cpp/trunk/samples/store-cpp/server-test +++ b/sca-cpp/trunk/samples/store-cpp/server-test @@ -32,8 +32,8 @@ rc=$? # Test Catalog if [ "$rc" = "0" ]; then - $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @htdocs/test/getcatalog-request.txt >tmp/getcatalog-result.txt 2>/dev/null - diff tmp/getcatalog-result.txt htdocs/test/getcatalog-result.txt + $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @htdocs/test/items-request.txt >tmp/items-result.txt 2>/dev/null + diff tmp/items-result.txt htdocs/test/items-result.txt rc=$? fi diff --git a/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp b/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp index 3a1df44490..738ab2f4c7 100644 --- a/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp +++ b/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp @@ -109,7 +109,7 @@ const double sum(const list<value>& items) { /** * Return the total price of the items in the cart. */ -const failable<value> gettotal(const lambda<value(const list<value>&)> cache) { +const failable<value> total(const lambda<value(const list<value>&)> cache) { const list<value> cart(getcart(cartId, cache)); return value(sum(cart)); } @@ -127,8 +127,8 @@ const tuscany::value apply(const tuscany::list<tuscany::value>& params) { return tuscany::store::get(cadr(params), caddr(params)); if (func == "delete") return tuscany::store::del(cadr(params), caddr(params)); - if (func == "gettotal") - return tuscany::store::gettotal(cadr(params)); + if (func == "total") + return tuscany::store::total(cadr(params)); return tuscany::mkfailure<tuscany::value>(); } diff --git a/sca-cpp/trunk/samples/store-gae/fruits-catalog.py b/sca-cpp/trunk/samples/store-gae/fruits-catalog.py index ab599e8400..4b2baca2ff 100644 --- a/sca-cpp/trunk/samples/store-gae/fruits-catalog.py +++ b/sca-cpp/trunk/samples/store-gae/fruits-catalog.py @@ -18,10 +18,10 @@ # Catalog implementation def items(converter, currencyCode): - code = currencyCode() + code = currencyCode.eval() def convert(price): - return converter("convert", "USD", code, price) - symbol = converter("symbol", code) + return converter.convert("USD", code, price) + symbol = converter.symbol(code) return ( (("'name", "Platano"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))), (("'name", "Banana"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))), diff --git a/sca-cpp/trunk/samples/store-gae/htdocs/index.html b/sca-cpp/trunk/samples/store-gae/htdocs/index.html index aee6ad5f70..8907cc6b49 100644 --- a/sca-cpp/trunk/samples/store-gae/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-gae/htdocs/index.html @@ -79,11 +79,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total,exception) {
+function shoppingTotal_totalResponse(total,exception) {
if (exception) {
alert(exception.message);
return;
diff --git a/sca-cpp/trunk/samples/store-gae/shopping-cart.py b/sca-cpp/trunk/samples/store-gae/shopping-cart.py index 8d369e3315..6501f3db8d 100644 --- a/sca-cpp/trunk/samples/store-gae/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-gae/shopping-cart.py @@ -24,7 +24,7 @@ cartId = "1234" # Get the shopping cart from the cache # Return an empty cart if not found def getcart(id, cache): - cart = cache("get", (id,)) + cart = cache.get((id,)) if cart is None: return () return cart @@ -33,7 +33,7 @@ def getcart(id, cache): def post(collection, item, cache, host, email): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartId, cache) - cache("put", (cartId,), cart) + cache.put((cartId,), cart) return (id,) # Find an item in the cart @@ -54,7 +54,7 @@ def get(id, cache, host, email): # Delete items from the cart def delete(id, cache, host, email): if id == (): - return cache("delete", (cartId,)) + return cache.delete((cartId,)) return True # Return the price of an item @@ -68,15 +68,15 @@ def sum(items): return price(items[0]) + sum(items[1:]) # Return the total price of the items in the cart -def gettotal(cache, host, email): +def total(cache, host, email): cart = getcart(cartId, cache) return sum(cart) # Return the email of the cart owner def getemail(cache, host, email): - return email() + return email.eval() # Return the host that the app is running on def gethost(cache, host, email): - return host() + return host.eval() diff --git a/sca-cpp/trunk/samples/store-gae/store.py b/sca-cpp/trunk/samples/store-gae/store.py index becd1d14a5..ff82f1d327 100644 --- a/sca-cpp/trunk/samples/store-gae/store.py +++ b/sca-cpp/trunk/samples/store-gae/store.py @@ -18,23 +18,23 @@ # Store implementation def post(item, catalog, shoppingCart, shoppingTotal): - return shoppingCart("post", item) + return shoppingCart.post(item) def getall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("getall") + return shoppingCart.getall() def get(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("get", id) + return shoppingCart.get(id) def items(catalog, shoppingCart, shoppingTotal): - return catalog("items") + return catalog.items() -def gettotal(catalog, shoppingCart, shoppingTotal): - return shoppingCart("gettotal") +def total(catalog, shoppingCart, shoppingTotal): + return shoppingCart.total() def deleteall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("deleteall") + return shoppingCart.deleteall() def delete(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("delete", id) + return shoppingCart.delete(id) diff --git a/sca-cpp/trunk/samples/store-java/htdocs/index.html b/sca-cpp/trunk/samples/store-java/htdocs/index.html index 15e857895e..7de17d92e3 100644 --- a/sca-cpp/trunk/samples/store-java/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-java/htdocs/index.html @@ -36,7 +36,7 @@ var shoppingTotal = new tuscany.sca.Reference("shoppingTotal"); var catalogItems;
-function catalog_getcatalogResponse(items, exception) {
+function catalog_itemsResponse(items, exception) {
if (exception){
alert(exception.message);
return;
@@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
@@ -119,7 +119,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
+ catalog.apply("items", catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-java/server-test b/sca-cpp/trunk/samples/store-java/server-test index dd94ccabde..1612bc59e2 100755 --- a/sca-cpp/trunk/samples/store-java/server-test +++ b/sca-cpp/trunk/samples/store-java/server-test @@ -32,8 +32,8 @@ rc=$? # Test Catalog if [ "$rc" = "0" ]; then - $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/getcatalog-request.txt >tmp/getcatalog-result.txt 2>/dev/null - diff tmp/getcatalog-result.txt ../store-cpp/htdocs/test/getcatalog-result.txt + $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/items-request.txt >tmp/items-result.txt 2>/dev/null + diff tmp/items-result.txt ../store-cpp/htdocs/test/items-result.txt rc=$? fi diff --git a/sca-cpp/trunk/samples/store-java/store/FruitsCatalogImpl.java b/sca-cpp/trunk/samples/store-java/store/FruitsCatalogImpl.java index 7ceffeb943..8881543103 100644 --- a/sca-cpp/trunk/samples/store-java/store/FruitsCatalogImpl.java +++ b/sca-cpp/trunk/samples/store-java/store/FruitsCatalogImpl.java @@ -31,7 +31,7 @@ public class FruitsCatalogImpl { /** * Returns the catalog. */ - public Iterable<?> getcatalog(final CurrencyConverter converter, final Service currencyCode) { + public Iterable<?> items(final CurrencyConverter converter, final Service currencyCode) { final String code = currencyCode.eval(); class Converter { diff --git a/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java b/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java index 279bf63131..e51beacc20 100644 --- a/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java +++ b/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java @@ -104,7 +104,7 @@ public class ShoppingCartImpl { /** * Return the total price of the items in the cart. */ - public Double gettotal(final Service cache) { + public Double total(final Service cache) { final Iterable<?> cart = this.getcart(cartId, cache); return this.sum(cart); } diff --git a/sca-cpp/trunk/samples/store-nosql/fruits-catalog.scm b/sca-cpp/trunk/samples/store-nosql/fruits-catalog.scm index 8368a1f369..d55394b96a 100644 --- a/sca-cpp/trunk/samples/store-nosql/fruits-catalog.scm +++ b/sca-cpp/trunk/samples/store-nosql/fruits-catalog.scm @@ -17,7 +17,7 @@ ; Catalog implementation -(define (getcatalog converter currencyCode) +(define (items converter currencyCode) (define code (currencyCode)) (define (convert price) (converter "convert" "USD" code price)) (define symbol (converter "symbol" code)) diff --git a/sca-cpp/trunk/samples/store-nosql/htdocs/index.html b/sca-cpp/trunk/samples/store-nosql/htdocs/index.html index 15e857895e..7de17d92e3 100644 --- a/sca-cpp/trunk/samples/store-nosql/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-nosql/htdocs/index.html @@ -36,7 +36,7 @@ var shoppingTotal = new tuscany.sca.Reference("shoppingTotal"); var catalogItems;
-function catalog_getcatalogResponse(items, exception) {
+function catalog_itemsResponse(items, exception) {
if (exception){
alert(exception.message);
return;
@@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
@@ -119,7 +119,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
+ catalog.apply("items", catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-nosql/server-test b/sca-cpp/trunk/samples/store-nosql/server-test index dd94ccabde..1612bc59e2 100755 --- a/sca-cpp/trunk/samples/store-nosql/server-test +++ b/sca-cpp/trunk/samples/store-nosql/server-test @@ -32,8 +32,8 @@ rc=$? # Test Catalog if [ "$rc" = "0" ]; then - $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/getcatalog-request.txt >tmp/getcatalog-result.txt 2>/dev/null - diff tmp/getcatalog-result.txt ../store-cpp/htdocs/test/getcatalog-result.txt + $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/items-request.txt >tmp/items-result.txt 2>/dev/null + diff tmp/items-result.txt ../store-cpp/htdocs/test/items-result.txt rc=$? fi diff --git a/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm b/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm index ec85d463fc..61b169426f 100644 --- a/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm +++ b/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm @@ -75,7 +75,7 @@ ) ; Return the total price of the items in the cart -(define (gettotal cache) +(define (total cache) (define cart (getcart cartId cache)) (sum cart) ) diff --git a/sca-cpp/trunk/samples/store-nosql/store.scm b/sca-cpp/trunk/samples/store-nosql/store.scm index 8bfbb3d5fd..f54257343e 100644 --- a/sca-cpp/trunk/samples/store-nosql/store.scm +++ b/sca-cpp/trunk/samples/store-nosql/store.scm @@ -29,12 +29,12 @@ (shoppingCart "get" id) ) -(define (getcatalog catalog shoppingCart shoppingTotal) - (catalog "getcatalog") +(define (items catalog shoppingCart shoppingTotal) + (catalog "items") ) -(define (gettotal catalog shoppingCart shoppingTotal) - (shoppingCart "gettotal") +(define (total catalog shoppingCart shoppingTotal) + (shoppingCart "total") ) (define (deleteall catalog shoppingCart shoppingTotal) diff --git a/sca-cpp/trunk/samples/store-python/fruits-catalog.py b/sca-cpp/trunk/samples/store-python/fruits-catalog.py index c244a78736..8289afcac5 100644 --- a/sca-cpp/trunk/samples/store-python/fruits-catalog.py +++ b/sca-cpp/trunk/samples/store-python/fruits-catalog.py @@ -18,10 +18,10 @@ # Catalog implementation def items(converter, currencyCode): - code = currencyCode() + code = currencyCode.eval() def convert(price): - return converter("convert", "USD", code, price) - symbol = converter("symbol", code) + return converter.convert("USD", code, price) + symbol = converter.symbol(code) return ( (("'name", "Mango"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))), (("'name", "Passion"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))), diff --git a/sca-cpp/trunk/samples/store-python/htdocs/index.html b/sca-cpp/trunk/samples/store-python/htdocs/index.html index f7cf87f722..7de17d92e3 100644 --- a/sca-cpp/trunk/samples/store-python/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-python/htdocs/index.html @@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
diff --git a/sca-cpp/trunk/samples/store-python/htdocs/test/items-result.txt b/sca-cpp/trunk/samples/store-python/htdocs/test/items-result.txt new file mode 100644 index 0000000000..788b7cdf89 --- /dev/null +++ b/sca-cpp/trunk/samples/store-python/htdocs/test/items-result.txt @@ -0,0 +1 @@ +{"id":1,"result":[{"name":"Mango","currencyCode":"USD","currencySymbol":"$","price":2.99},{"name":"Passion","currencyCode":"USD","currencySymbol":"$","price":3.55},{"name":"Kiwi","currencyCode":"USD","currencySymbol":"$","price":1.55}]}
\ No newline at end of file diff --git a/sca-cpp/trunk/samples/store-python/server-test b/sca-cpp/trunk/samples/store-python/server-test index 1612bc59e2..27490c580b 100755 --- a/sca-cpp/trunk/samples/store-python/server-test +++ b/sca-cpp/trunk/samples/store-python/server-test @@ -33,7 +33,7 @@ rc=$? # Test Catalog if [ "$rc" = "0" ]; then $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/items-request.txt >tmp/items-result.txt 2>/dev/null - diff tmp/items-result.txt ../store-cpp/htdocs/test/items-result.txt + diff tmp/items-result.txt htdocs/test/items-result.txt rc=$? fi diff --git a/sca-cpp/trunk/samples/store-python/shopping-cart.py b/sca-cpp/trunk/samples/store-python/shopping-cart.py index 405adb85bf..feb7398ed9 100644 --- a/sca-cpp/trunk/samples/store-python/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-python/shopping-cart.py @@ -24,7 +24,7 @@ cartId = "1234" # Get the shopping cart from the cache # Return an empty cart if not found def getcart(id, cache): - cart = cache("get", (id,)) + cart = cache.get((id,)) if cart is None: return () return cart @@ -33,7 +33,7 @@ def getcart(id, cache): def post(collection, item, cache): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartId, cache) - cache("put", (cartId,), cart) + cache.put((cartId,), cart) return (id,) @@ -55,7 +55,7 @@ def get(id, cache): # Delete items from the cart def delete(id, cache): if id == (): - return cache("delete", (cartId,)) + return cache.delete((cartId,)) return True # Return the price of an item @@ -69,7 +69,7 @@ def sum(items): return price(items[0]) + sum(items[1:]) # Return the total price of the items in the cart -def gettotal(cache): +def total(cache): cart = getcart(cartId, cache) return sum(cart) diff --git a/sca-cpp/trunk/samples/store-python/store.py b/sca-cpp/trunk/samples/store-python/store.py index becd1d14a5..b71f505dd1 100644 --- a/sca-cpp/trunk/samples/store-python/store.py +++ b/sca-cpp/trunk/samples/store-python/store.py @@ -18,23 +18,23 @@ # Store implementation def post(item, catalog, shoppingCart, shoppingTotal): - return shoppingCart("post", item) + return shoppingCart.post(item) def getall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("getall") + return shoppingCart.getall() def get(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("get", id) + return shoppingCart.get(id) def items(catalog, shoppingCart, shoppingTotal): - return catalog("items") + return catalog.items() -def gettotal(catalog, shoppingCart, shoppingTotal): - return shoppingCart("gettotal") +def total(catalog, shoppingCart, shoppingTotal): + return shoppingCart.gettotal() def deleteall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("deleteall") + return shoppingCart.deleteall() def delete(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("delete", id) + return shoppingCart.delete(id) diff --git a/sca-cpp/trunk/samples/store-scheme/fruits-catalog.scm b/sca-cpp/trunk/samples/store-scheme/fruits-catalog.scm index 8368a1f369..d55394b96a 100644 --- a/sca-cpp/trunk/samples/store-scheme/fruits-catalog.scm +++ b/sca-cpp/trunk/samples/store-scheme/fruits-catalog.scm @@ -17,7 +17,7 @@ ; Catalog implementation -(define (getcatalog converter currencyCode) +(define (items converter currencyCode) (define code (currencyCode)) (define (convert price) (converter "convert" "USD" code price)) (define symbol (converter "symbol" code)) diff --git a/sca-cpp/trunk/samples/store-scheme/htdocs/index.html b/sca-cpp/trunk/samples/store-scheme/htdocs/index.html index 15e857895e..7de17d92e3 100644 --- a/sca-cpp/trunk/samples/store-scheme/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-scheme/htdocs/index.html @@ -36,7 +36,7 @@ var shoppingTotal = new tuscany.sca.Reference("shoppingTotal"); var catalogItems;
-function catalog_getcatalogResponse(items, exception) {
+function catalog_itemsResponse(items, exception) {
if (exception){
alert(exception.message);
return;
@@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
@@ -119,7 +119,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
+ catalog.apply("items", catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-scheme/script-test.cpp b/sca-cpp/trunk/samples/store-scheme/script-test.cpp index c05c287a20..0d5a9ccf9d 100644 --- a/sca-cpp/trunk/samples/store-scheme/script-test.cpp +++ b/sca-cpp/trunk/samples/store-scheme/script-test.cpp @@ -56,7 +56,7 @@ bool testEval() { ostringstream os; scheme::setupDisplay(os); scheme::Env globalEnv = scheme::setupEnvironment(); - const value exp(mklist<value>("storeui_service", string("getcatalog"))); + const value exp(mklist<value>("storeui_service", string("items"))); const value val = scheme::evalScript(exp, is, globalEnv); ostringstream vs; @@ -71,7 +71,7 @@ bool testEval() { scheme::setupDisplay(os); scheme::Env globalEnv = scheme::setupEnvironment(); - const value exp(mklist<value>("storeui_service", string("gettotal"))); + const value exp(mklist<value>("storeui_service", string("total"))); const value res = scheme::evalScript(exp, is, globalEnv); ostringstream rs; diff --git a/sca-cpp/trunk/samples/store-scheme/script-test.scm b/sca-cpp/trunk/samples/store-scheme/script-test.scm index 2120949701..50b587b8f1 100644 --- a/sca-cpp/trunk/samples/store-scheme/script-test.scm +++ b/sca-cpp/trunk/samples/store-scheme/script-test.scm @@ -53,7 +53,7 @@ (define (catalog_impl converter op args) (cond - ((equal? op "getcatalog") (apply catalog_get (cons converter args))) + ((equal? op "items") (apply catalog_get (cons converter args))) ) ) @@ -76,7 +76,7 @@ (cons "Item" (list id entry)) ) -(define (cart_gettotal) +(define (cart_total) 10.0 ) @@ -85,7 +85,7 @@ ((equal? op "post") (apply cart_post args)) ((equal? op "getall") (apply cart_getall args)) ((equal? op "getentry") (apply cart_getentry args)) - ((equal? op "gettotal") (apply cart_gettotal args)) + ((equal? op "total") (apply cart_total args)) ) ) @@ -103,12 +103,12 @@ (cart "getentry" id) ) -(define (storeui_getcatalog catalog) - (catalog "getcatalog") +(define (storeui_items catalog) + (catalog "items") ) -(define (storeui_gettotal cart) - (cart "gettotal") +(define (storeui_total cart) + (cart "total") ) (define (storeui_impl cart catalog op args) @@ -116,8 +116,8 @@ ((equal? op "post") (apply storeui_post (cons cart args))) ((equal? op "getall") (apply storeui_getcart (cons cart args))) ((equal? op "getentry") (apply storeui_getentry (cons cart args))) - ((equal? op "getcatalog") (apply storeui_getcatalog (cons catalog args))) - ((equal? op "gettotal") (apply storeui_gettotal (cons cart args))) + ((equal? op "items") (apply storeui_items (cons catalog args))) + ((equal? op "total") (apply storeui_total (cons cart args))) ) ) @@ -129,12 +129,12 @@ ; Store UI test case -(define catalog (storeui_service "getcatalog")) +(define catalog (storeui_service "items")) (define empty (list)) (define apple (car catalog)) (define orange (car (cdr catalog))) (define added1 (storeui_service "post" empty apple)) (define added2 (storeui_service "post" added1 orange)) (display (storeui_service "getall" added2)) -(display (storeui_service "gettotal")) +(display (storeui_service "total")) diff --git a/sca-cpp/trunk/samples/store-scheme/server-test b/sca-cpp/trunk/samples/store-scheme/server-test index dd94ccabde..1612bc59e2 100755 --- a/sca-cpp/trunk/samples/store-scheme/server-test +++ b/sca-cpp/trunk/samples/store-scheme/server-test @@ -32,8 +32,8 @@ rc=$? # Test Catalog if [ "$rc" = "0" ]; then - $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/getcatalog-request.txt >tmp/getcatalog-result.txt 2>/dev/null - diff tmp/getcatalog-result.txt ../store-cpp/htdocs/test/getcatalog-result.txt + $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/items-request.txt >tmp/items-result.txt 2>/dev/null + diff tmp/items-result.txt ../store-cpp/htdocs/test/items-result.txt rc=$? fi diff --git a/sca-cpp/trunk/samples/store-scheme/shopping-cart.scm b/sca-cpp/trunk/samples/store-scheme/shopping-cart.scm index ec85d463fc..61b169426f 100644 --- a/sca-cpp/trunk/samples/store-scheme/shopping-cart.scm +++ b/sca-cpp/trunk/samples/store-scheme/shopping-cart.scm @@ -75,7 +75,7 @@ ) ; Return the total price of the items in the cart -(define (gettotal cache) +(define (total cache) (define cart (getcart cartId cache)) (sum cart) ) diff --git a/sca-cpp/trunk/samples/store-scheme/store.scm b/sca-cpp/trunk/samples/store-scheme/store.scm index 8bfbb3d5fd..f54257343e 100644 --- a/sca-cpp/trunk/samples/store-scheme/store.scm +++ b/sca-cpp/trunk/samples/store-scheme/store.scm @@ -29,12 +29,12 @@ (shoppingCart "get" id) ) -(define (getcatalog catalog shoppingCart shoppingTotal) - (catalog "getcatalog") +(define (items catalog shoppingCart shoppingTotal) + (catalog "items") ) -(define (gettotal catalog shoppingCart shoppingTotal) - (shoppingCart "gettotal") +(define (total catalog shoppingCart shoppingTotal) + (shoppingCart "total") ) (define (deleteall catalog shoppingCart shoppingTotal) diff --git a/sca-cpp/trunk/samples/store-sql/fruits-catalog.scm b/sca-cpp/trunk/samples/store-sql/fruits-catalog.scm index 8368a1f369..d55394b96a 100644 --- a/sca-cpp/trunk/samples/store-sql/fruits-catalog.scm +++ b/sca-cpp/trunk/samples/store-sql/fruits-catalog.scm @@ -17,7 +17,7 @@ ; Catalog implementation -(define (getcatalog converter currencyCode) +(define (items converter currencyCode) (define code (currencyCode)) (define (convert price) (converter "convert" "USD" code price)) (define symbol (converter "symbol" code)) diff --git a/sca-cpp/trunk/samples/store-sql/htdocs/index.html b/sca-cpp/trunk/samples/store-sql/htdocs/index.html index 15e857895e..7de17d92e3 100644 --- a/sca-cpp/trunk/samples/store-sql/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-sql/htdocs/index.html @@ -36,7 +36,7 @@ var shoppingTotal = new tuscany.sca.Reference("shoppingTotal"); var catalogItems;
-function catalog_getcatalogResponse(items, exception) {
+function catalog_itemsResponse(items, exception) {
if (exception){
alert(exception.message);
return;
@@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
@@ -119,7 +119,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
+ catalog.apply("items", catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-sql/server-test b/sca-cpp/trunk/samples/store-sql/server-test index dd94ccabde..1612bc59e2 100755 --- a/sca-cpp/trunk/samples/store-sql/server-test +++ b/sca-cpp/trunk/samples/store-sql/server-test @@ -32,8 +32,8 @@ rc=$? # Test Catalog if [ "$rc" = "0" ]; then - $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/getcatalog-request.txt >tmp/getcatalog-result.txt 2>/dev/null - diff tmp/getcatalog-result.txt ../store-cpp/htdocs/test/getcatalog-result.txt + $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/items-request.txt >tmp/items-result.txt 2>/dev/null + diff tmp/items-result.txt ../store-cpp/htdocs/test/items-result.txt rc=$? fi diff --git a/sca-cpp/trunk/samples/store-sql/shopping-cart.scm b/sca-cpp/trunk/samples/store-sql/shopping-cart.scm index ec85d463fc..61b169426f 100644 --- a/sca-cpp/trunk/samples/store-sql/shopping-cart.scm +++ b/sca-cpp/trunk/samples/store-sql/shopping-cart.scm @@ -75,7 +75,7 @@ ) ; Return the total price of the items in the cart -(define (gettotal cache) +(define (total cache) (define cart (getcart cartId cache)) (sum cart) ) diff --git a/sca-cpp/trunk/samples/store-sql/store.scm b/sca-cpp/trunk/samples/store-sql/store.scm index 8bfbb3d5fd..f54257343e 100644 --- a/sca-cpp/trunk/samples/store-sql/store.scm +++ b/sca-cpp/trunk/samples/store-sql/store.scm @@ -29,12 +29,12 @@ (shoppingCart "get" id) ) -(define (getcatalog catalog shoppingCart shoppingTotal) - (catalog "getcatalog") +(define (items catalog shoppingCart shoppingTotal) + (catalog "items") ) -(define (gettotal catalog shoppingCart shoppingTotal) - (shoppingCart "gettotal") +(define (total catalog shoppingCart shoppingTotal) + (shoppingCart "total") ) (define (deleteall catalog shoppingCart shoppingTotal) diff --git a/sca-cpp/trunk/samples/store-vhost/domains/jane/fruits-catalog.py b/sca-cpp/trunk/samples/store-vhost/domains/jane/fruits-catalog.py index fb85d12bc7..fb20b4ff27 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/jane/fruits-catalog.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/jane/fruits-catalog.py @@ -17,11 +17,11 @@ # Catalog implementation -def getcatalog(converter, currencyCode): - code = currencyCode() +def items(converter, currencyCode): + code = currencyCode.eval() def convert(price): - return converter("convert", "USD", code, price) - symbol = converter("symbol", code) + return converter.convert("USD", code, price) + symbol = converter.symbol(code) return ( (("'name", "Passion"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))), (("'name", "Mango"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))), diff --git a/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py b/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py index 405adb85bf..feb7398ed9 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py @@ -24,7 +24,7 @@ cartId = "1234" # Get the shopping cart from the cache # Return an empty cart if not found def getcart(id, cache): - cart = cache("get", (id,)) + cart = cache.get((id,)) if cart is None: return () return cart @@ -33,7 +33,7 @@ def getcart(id, cache): def post(collection, item, cache): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartId, cache) - cache("put", (cartId,), cart) + cache.put((cartId,), cart) return (id,) @@ -55,7 +55,7 @@ def get(id, cache): # Delete items from the cart def delete(id, cache): if id == (): - return cache("delete", (cartId,)) + return cache.delete((cartId,)) return True # Return the price of an item @@ -69,7 +69,7 @@ def sum(items): return price(items[0]) + sum(items[1:]) # Return the total price of the items in the cart -def gettotal(cache): +def total(cache): cart = getcart(cartId, cache) return sum(cart) diff --git a/sca-cpp/trunk/samples/store-vhost/domains/jane/store.py b/sca-cpp/trunk/samples/store-vhost/domains/jane/store.py index 0b4e0f72fd..ff82f1d327 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/jane/store.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/jane/store.py @@ -18,23 +18,23 @@ # Store implementation def post(item, catalog, shoppingCart, shoppingTotal): - return shoppingCart("post", item) + return shoppingCart.post(item) def getall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("getall") + return shoppingCart.getall() def get(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("get", id) + return shoppingCart.get(id) -def getcatalog(catalog, shoppingCart, shoppingTotal): - return catalog("getcatalog") +def items(catalog, shoppingCart, shoppingTotal): + return catalog.items() -def gettotal(catalog, shoppingCart, shoppingTotal): - return shoppingCart("gettotal") +def total(catalog, shoppingCart, shoppingTotal): + return shoppingCart.total() def deleteall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("deleteall") + return shoppingCart.deleteall() def delete(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("delete", id) + return shoppingCart.delete(id) diff --git a/sca-cpp/trunk/samples/store-vhost/domains/joe/fruits-catalog.py b/sca-cpp/trunk/samples/store-vhost/domains/joe/fruits-catalog.py index b5eb035ae3..6644421683 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/joe/fruits-catalog.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/joe/fruits-catalog.py @@ -17,11 +17,11 @@ # Catalog implementation -def getcatalog(converter, currencyCode): - code = currencyCode() +def items(converter, currencyCode): + code = currencyCode.eval() def convert(price): - return converter("convert", "USD", code, price) - symbol = converter("symbol", code) + return converter.convert("USD", code, price) + symbol = converter.symbol(code) return ( (("'name", "Apple"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))), (("'name", "Orange"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))), diff --git a/sca-cpp/trunk/samples/store-vhost/domains/joe/shopping-cart.py b/sca-cpp/trunk/samples/store-vhost/domains/joe/shopping-cart.py index 405adb85bf..feb7398ed9 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/joe/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/joe/shopping-cart.py @@ -24,7 +24,7 @@ cartId = "1234" # Get the shopping cart from the cache # Return an empty cart if not found def getcart(id, cache): - cart = cache("get", (id,)) + cart = cache.get((id,)) if cart is None: return () return cart @@ -33,7 +33,7 @@ def getcart(id, cache): def post(collection, item, cache): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartId, cache) - cache("put", (cartId,), cart) + cache.put((cartId,), cart) return (id,) @@ -55,7 +55,7 @@ def get(id, cache): # Delete items from the cart def delete(id, cache): if id == (): - return cache("delete", (cartId,)) + return cache.delete((cartId,)) return True # Return the price of an item @@ -69,7 +69,7 @@ def sum(items): return price(items[0]) + sum(items[1:]) # Return the total price of the items in the cart -def gettotal(cache): +def total(cache): cart = getcart(cartId, cache) return sum(cart) diff --git a/sca-cpp/trunk/samples/store-vhost/domains/joe/store.py b/sca-cpp/trunk/samples/store-vhost/domains/joe/store.py index 0b4e0f72fd..ff82f1d327 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/joe/store.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/joe/store.py @@ -18,23 +18,23 @@ # Store implementation def post(item, catalog, shoppingCart, shoppingTotal): - return shoppingCart("post", item) + return shoppingCart.post(item) def getall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("getall") + return shoppingCart.getall() def get(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("get", id) + return shoppingCart.get(id) -def getcatalog(catalog, shoppingCart, shoppingTotal): - return catalog("getcatalog") +def items(catalog, shoppingCart, shoppingTotal): + return catalog.items() -def gettotal(catalog, shoppingCart, shoppingTotal): - return shoppingCart("gettotal") +def total(catalog, shoppingCart, shoppingTotal): + return shoppingCart.total() def deleteall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("deleteall") + return shoppingCart.deleteall() def delete(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("delete", id) + return shoppingCart.delete(id) diff --git a/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html b/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html index b60e18690a..376b15f6c1 100644 --- a/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html +++ b/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html @@ -36,7 +36,7 @@ var shoppingTotal = new tuscany.sca.Reference("shoppingTotal"); var catalogItems;
-function catalog_getcatalogResponse(items, exception) {
+function catalog_itemsResponse(items, exception) {
if (exception){
alert(exception.message);
return;
@@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
@@ -119,7 +119,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
+ catalog.apply("items", catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html b/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html index 37ed010229..e3675dc2d3 100644 --- a/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html +++ b/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html @@ -36,7 +36,7 @@ var shoppingTotal = new tuscany.sca.Reference("shoppingTotal"); var catalogItems;
-function catalog_getcatalogResponse(items, exception) {
+function catalog_itemsResponse(items, exception) {
if (exception){
alert(exception.message);
return;
@@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
@@ -119,7 +119,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
+ catalog.apply("items", catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-vhost/server-test b/sca-cpp/trunk/samples/store-vhost/server-test index 5cc160b23f..405da2165d 100755 --- a/sca-cpp/trunk/samples/store-vhost/server-test +++ b/sca-cpp/trunk/samples/store-vhost/server-test @@ -35,8 +35,8 @@ rc=$? # Test Catalog if [ "$rc" = "0" ]; then - $curl_prefix/bin/curl http://joe.sca-store.com:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/getcatalog-request.txt >tmp/getcatalog-result.txt 2>/dev/null - diff tmp/getcatalog-result.txt ../store-cpp/htdocs/test/getcatalog-result.txt + $curl_prefix/bin/curl http://joe.sca-store.com:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/items-request.txt >tmp/items-result.txt 2>/dev/null + diff tmp/items-result.txt ../store-cpp/htdocs/test/items-result.txt rc=$? fi |