summaryrefslogtreecommitdiffstats
path: root/sca-cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-10-25 03:18:16 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-10-25 03:18:16 +0000
commita2a2cb76e9582af32b6803be7fa99af074dc04ae (patch)
treed0ef504321e72fe16afd23f385f20386530f5dfc /sca-cpp
parent0dd33c3859618f3a385583d7344230f0e1eb1004 (diff)
Support python method invocation style on references, ref.func(...) in addition to ref('func', ...). Minor cleanup of the various samples, renamed gettotal to total and getcatalog to items, for consistency with the python sample.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1026939 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp')
-rw-r--r--sca-cpp/trunk/modules/python/client-test.py15
-rw-r--r--sca-cpp/trunk/modules/python/eval.hpp44
-rw-r--r--sca-cpp/trunk/modules/wsgi/client-test.py15
-rwxr-xr-xsca-cpp/trunk/modules/wsgi/http-test.py2
-rw-r--r--sca-cpp/trunk/modules/wsgi/httputil.py9
-rw-r--r--sca-cpp/trunk/modules/wsgi/scdl.py39
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/jane/fruits-catalog.py8
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py12
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/jane/store.py18
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/joe/fruits-catalog.py8
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py12
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/joe/store.py18
-rw-r--r--sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html8
-rw-r--r--sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html8
-rwxr-xr-xsca-cpp/trunk/samples/store-cluster/server-test4
-rw-r--r--sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp6
-rw-r--r--sca-cpp/trunk/samples/store-cpp/htdocs/index.html8
-rw-r--r--sca-cpp/trunk/samples/store-cpp/htdocs/test/getcatalog-request.txt1
-rw-r--r--sca-cpp/trunk/samples/store-cpp/htdocs/test/getcatalog-result.txt1
-rw-r--r--sca-cpp/trunk/samples/store-cpp/htdocs/test/items-result.txt2
-rwxr-xr-xsca-cpp/trunk/samples/store-cpp/server-test4
-rw-r--r--sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp6
-rw-r--r--sca-cpp/trunk/samples/store-gae/fruits-catalog.py6
-rw-r--r--sca-cpp/trunk/samples/store-gae/htdocs/index.html4
-rw-r--r--sca-cpp/trunk/samples/store-gae/shopping-cart.py12
-rw-r--r--sca-cpp/trunk/samples/store-gae/store.py16
-rw-r--r--sca-cpp/trunk/samples/store-java/htdocs/index.html8
-rwxr-xr-xsca-cpp/trunk/samples/store-java/server-test4
-rw-r--r--sca-cpp/trunk/samples/store-java/store/FruitsCatalogImpl.java2
-rw-r--r--sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java2
-rw-r--r--sca-cpp/trunk/samples/store-nosql/fruits-catalog.scm2
-rw-r--r--sca-cpp/trunk/samples/store-nosql/htdocs/index.html8
-rwxr-xr-xsca-cpp/trunk/samples/store-nosql/server-test4
-rw-r--r--sca-cpp/trunk/samples/store-nosql/shopping-cart.scm2
-rw-r--r--sca-cpp/trunk/samples/store-nosql/store.scm8
-rw-r--r--sca-cpp/trunk/samples/store-python/fruits-catalog.py6
-rw-r--r--sca-cpp/trunk/samples/store-python/htdocs/index.html4
-rw-r--r--sca-cpp/trunk/samples/store-python/htdocs/test/items-result.txt1
-rwxr-xr-xsca-cpp/trunk/samples/store-python/server-test2
-rw-r--r--sca-cpp/trunk/samples/store-python/shopping-cart.py8
-rw-r--r--sca-cpp/trunk/samples/store-python/store.py16
-rw-r--r--sca-cpp/trunk/samples/store-scheme/fruits-catalog.scm2
-rw-r--r--sca-cpp/trunk/samples/store-scheme/htdocs/index.html8
-rw-r--r--sca-cpp/trunk/samples/store-scheme/script-test.cpp4
-rw-r--r--sca-cpp/trunk/samples/store-scheme/script-test.scm22
-rwxr-xr-xsca-cpp/trunk/samples/store-scheme/server-test4
-rw-r--r--sca-cpp/trunk/samples/store-scheme/shopping-cart.scm2
-rw-r--r--sca-cpp/trunk/samples/store-scheme/store.scm8
-rw-r--r--sca-cpp/trunk/samples/store-sql/fruits-catalog.scm2
-rw-r--r--sca-cpp/trunk/samples/store-sql/htdocs/index.html8
-rwxr-xr-xsca-cpp/trunk/samples/store-sql/server-test4
-rw-r--r--sca-cpp/trunk/samples/store-sql/shopping-cart.scm2
-rw-r--r--sca-cpp/trunk/samples/store-sql/store.scm8
-rw-r--r--sca-cpp/trunk/samples/store-vhost/domains/jane/fruits-catalog.py8
-rw-r--r--sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py8
-rw-r--r--sca-cpp/trunk/samples/store-vhost/domains/jane/store.py18
-rw-r--r--sca-cpp/trunk/samples/store-vhost/domains/joe/fruits-catalog.py8
-rw-r--r--sca-cpp/trunk/samples/store-vhost/domains/joe/shopping-cart.py8
-rw-r--r--sca-cpp/trunk/samples/store-vhost/domains/joe/store.py18
-rw-r--r--sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html8
-rw-r--r--sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html8
-rwxr-xr-xsca-cpp/trunk/samples/store-vhost/server-test4
62 files changed, 307 insertions, 218 deletions
diff --git a/sca-cpp/trunk/modules/python/client-test.py b/sca-cpp/trunk/modules/python/client-test.py
index 47e6cf4bda..3c7183e865 100644
--- a/sca-cpp/trunk/modules/python/client-test.py
+++ b/sca-cpp/trunk/modules/python/client-test.py
@@ -15,21 +15,26 @@
# specific language governing permissions and limitations
# under the License.
+import unittest
+
# JSON-RPC test case
def echo(x, ref):
- return ref("echo", x)
+ e1 = ref("echo", x)
+ e2 = ref.echo(x)
+ assert e1 == e2
+ return e1
# ATOMPub test case
def get(id, ref):
- return ref("get", id)
+ return ref.get(id);
def post(collection, item, ref):
- return ref("post", collection, item)
+ return ref.post(collection, item)
def put(id, item, ref):
- return ref("put", id, item)
+ return ref.put(id, item)
def delete(id, ref):
- return ref("delete", id)
+ return ref.delete(id)
diff --git a/sca-cpp/trunk/modules/python/eval.hpp b/sca-cpp/trunk/modules/python/eval.hpp
index daccb16ec7..9b75945cf2 100644
--- a/sca-cpp/trunk/modules/python/eval.hpp
+++ b/sca-cpp/trunk/modules/python/eval.hpp
@@ -94,15 +94,54 @@ typedef struct {
lambda<value(const list<value>&)> func;
} pyLambda;
+PyObject *mkPyLambda(const lambda<value(const list<value>&)>& l);
+
void pyLambda_dealloc(PyObject* self) {
PyMem_DEL(self);
}
+const string pyRepr(PyObject * o) {
+ return PyString_AsString(PyObject_Repr(o));
+}
+
PyObject* pyLambda_call(PyObject* self, PyObject* args, unused PyObject* kwds) {
+ debug("python::call");
const pyLambda* pyl = (pyLambda*)self;
const value result = pyl->func(pyTupleToValues(args));
+ debug(result, "python::call::result");
Py_DECREF(args);
PyObject *pyr = valueToPyObject(result);
+ Py_INCREF(pyr);
+ return pyr;
+}
+
+struct pyProxy {
+ const value name;
+ const lambda<value(const list<value>&)> func;
+
+ pyProxy(const value& name, const lambda<value(const list<value>&)>& func) : name(name), func(func) {
+ }
+
+ const value operator()(const list<value>& args) const {
+ debug(name, "python::proxy::name");
+ const value result = func(cons<value>(name, args));
+ debug(result, "python::proxy::result");
+ return result;
+ }
+};
+
+PyObject* pyLambda_getattr(PyObject *self, PyObject *attrname) {
+ const string name = PyString_AsString(attrname);
+ if (substr(name, 0, 1) == "_")
+ return PyObject_GenericGetAttr(self, attrname);
+
+ if (name == "eval")
+ return self;
+
+ const pyLambda* pyl = (pyLambda*)self;
+ debug(name, "python::getattr::name");
+ PyObject* pyr = mkPyLambda(pyProxy(name, pyl->func));
+ Py_INCREF(pyr);
return pyr;
}
@@ -115,7 +154,9 @@ PyTypeObject pyLambda_type = {
(destructor)pyLambda_dealloc,
0, 0, 0, 0, 0, 0, 0, 0, 0,
(ternaryfunc)pyLambda_call,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+ (binaryfunc)pyLambda_getattr,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0
@@ -179,6 +220,7 @@ const list<value> pyTupleToValuesHelper(PyObject* o, const int i, const int size
}
const list<value> pyTupleToValues(PyObject* o) {
+ debug(pyRepr(o), "python::pyTupleToValues");
return pyTupleToValuesHelper(o, 0, PyTuple_Size(o));
}
diff --git a/sca-cpp/trunk/modules/wsgi/client-test.py b/sca-cpp/trunk/modules/wsgi/client-test.py
index 47e6cf4bda..867222e792 100644
--- a/sca-cpp/trunk/modules/wsgi/client-test.py
+++ b/sca-cpp/trunk/modules/wsgi/client-test.py
@@ -15,21 +15,26 @@
# specific language governing permissions and limitations
# under the License.
+import unittest
+
# JSON-RPC test case
def echo(x, ref):
- return ref("echo", x)
+ e1 = ref("echo", x)
+ e2 = ref.echo(x)
+ assert e1 == e2
+ return e1
# ATOMPub test case
def get(id, ref):
- return ref("get", id)
+ return ref.get(id)
def post(collection, item, ref):
- return ref("post", collection, item)
+ return ref.post(collection, item)
def put(id, item, ref):
- return ref("put", id, item)
+ return ref.put(id, item)
def delete(id, ref):
- return ref("delete", id)
+ return ref.delete(id)
diff --git a/sca-cpp/trunk/modules/wsgi/http-test.py b/sca-cpp/trunk/modules/wsgi/http-test.py
index 87a8780fb3..45a1ecd3cc 100755
--- a/sca-cpp/trunk/modules/wsgi/http-test.py
+++ b/sca-cpp/trunk/modules/wsgi/http-test.py
@@ -22,7 +22,7 @@ from httputil import *
def testClient():
c = mkclient("http://localhost:8090/wsgi")
- assert c("echo", "Hey") == "Hey"
+ assert c.echo("Hey") == "Hey"
return True
if __name__ == "__main__":
diff --git a/sca-cpp/trunk/modules/wsgi/httputil.py b/sca-cpp/trunk/modules/wsgi/httputil.py
index 3d0c3350ef..723e1a7284 100644
--- a/sca-cpp/trunk/modules/wsgi/httputil.py
+++ b/sca-cpp/trunk/modules/wsgi/httputil.py
@@ -56,6 +56,15 @@ class client:
return None
return jsonResultValue((res.read(),))
+ def __getattr__(self, name):
+ if name[0] == '_':
+ raise AttributeError()
+ if name == "eval":
+ return self
+ l = lambda *args: self.__call__(name, *args)
+ self.__dict__[name] = l
+ return l
+
def __repr__(self):
return repr((self.url,))
diff --git a/sca-cpp/trunk/modules/wsgi/scdl.py b/sca-cpp/trunk/modules/wsgi/scdl.py
index 6b22e92823..447dd985c2 100644
--- a/sca-cpp/trunk/modules/wsgi/scdl.py
+++ b/sca-cpp/trunk/modules/wsgi/scdl.py
@@ -56,6 +56,15 @@ class component:
def __call__(self, func, *args):
return self.mod.__getattribute__(func)(*(args + self.proxies))
+ def __getattr__(self, name):
+ if name[0] == '_':
+ raise AttributeError()
+ if name == "eval":
+ return self
+ l = lambda *args: self.__call__(name, *args)
+ self.__dict__[name] = l
+ return l
+
def __repr__(self):
return repr((self.name, self.impl, self.mod, self.svcs, self.refs, self.props, self.proxies))
@@ -186,19 +195,39 @@ def evalReference(r, comps):
return mkclient(t)
return nameToComponent(t, comps)
+# Make a callable property
+class property:
+ def __init__(self, name, l):
+ self.name = name
+ self.l = l
+
+ def __call__(self, *args):
+ return self.l(*args)
+
+ def __getattr__(self, name):
+ if name == "eval":
+ return self
+ raise AttributeError()
+
+ def __repr__(self):
+ return repr((self.name, self.l()))
+
+def mkproperty(name, l):
+ return property(name, l)
+
# Evaluate a property, return a lambda function returning the property
# value. The host, user and email properties are configured with the
# values from the HTTP request, if any
def evalProperty(p):
if car(p) == "host":
- return lambda: hostProperty(cadr(p), environ)
+ return mkproperty(car(p), lambda: hostProperty(cadr(p), environ))
if car(p) == "user":
- return lambda: userProperty(cadr(p))
+ return mkproperty(car(p), lambda: userProperty(cadr(p)))
if car(p) == "nickname":
- return lambda: nicknameProperty(cadr(p))
+ return mkproperty(car(p), lambda: nicknameProperty(cadr(p)))
if car(p) == "email":
- return lambda: emailProperty(cadr(p))
- return lambda: cadr(p)
+ return mkproperty(car(p), lambda: emailProperty(cadr(p)))
+ return mkproperty(car(p), lambda: cadr(p))
def currentUser():
try:
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