diff options
Diffstat (limited to 'sca-cpp')
15 files changed, 159 insertions, 204 deletions
diff --git a/sca-cpp/trunk/modules/oauth/htdocs/index.html b/sca-cpp/trunk/modules/oauth/htdocs/index.html index dd75b736db..779ea74986 100644 --- a/sca-cpp/trunk/modules/oauth/htdocs/index.html +++ b/sca-cpp/trunk/modules/oauth/htdocs/index.html @@ -19,10 +19,10 @@ <html> <head> -<script type="text/javascript" src="/js/tuscany-ref.js"></script> +<script type="text/javascript" src="/js/ref.js"></script> <script type="text/javascript"> -var component = new tuscany.sca.Component("Protected"); -var userInfo = new tuscany.sca.Reference("userInfo"); +var protected = component("Protected"); +var userInfo = reference(protected, "userInfo"); var user = userInfo.apply("getuser"); var email = userInfo.apply("getemail"); var nickname = userInfo.apply("getnickname"); diff --git a/sca-cpp/trunk/modules/openid/htdocs/index.html b/sca-cpp/trunk/modules/openid/htdocs/index.html index e6295a93b5..c2dfc791e6 100644 --- a/sca-cpp/trunk/modules/openid/htdocs/index.html +++ b/sca-cpp/trunk/modules/openid/htdocs/index.html @@ -19,10 +19,10 @@ <html> <head> -<script type="text/javascript" src="/js/tuscany-ref.js"></script> +<script type="text/javascript" src="/js/ref.js"></script> <script type="text/javascript"> -var component = new tuscany.sca.Component("Protected"); -var userInfo = new tuscany.sca.Reference("userInfo"); +var protected = component("Protected"); +var userInfo = reference(protected, "userInfo"); var user = userInfo.apply("getuser"); var email = userInfo.apply("getemail"); </script> diff --git a/sca-cpp/trunk/modules/server/htdocs/js/tuscany-ref.js b/sca-cpp/trunk/modules/server/htdocs/js/ref.js index fd09a3efc7..b7daf40b48 100644 --- a/sca-cpp/trunk/modules/server/htdocs/js/tuscany-ref.js +++ b/sca-cpp/trunk/modules/server/htdocs/js/ref.js @@ -30,7 +30,9 @@ /** * Escape a character. */ -function escapeJSONChar(c) { +var JSONClient = new Object(); + +JSONClient.escapeJSONChar = function(c) { if(c == "\"" || c == "\\") return "\\" + c; else if (c == "\b") return "\\b"; else if (c == "\f") return "\\f"; @@ -42,16 +44,16 @@ function escapeJSONChar(c) { else if(hex.length == 2) return "\\u00" + hex; else if(hex.length == 3) return "\\u0" + hex; else return "\\u" + hex; -} +}; /** * Encode a string into JSON format. */ -function escapeJSONString(s) { +JSONClient.escapeJSONString = function(s) { /* The following should suffice but Safari's regex is broken (doesn't support callback substitutions) return "\"" + s.replace(/([^\u0020-\u007f]|[\\\"])/g, - escapeJSONChar) + "\""; + JSONClient.escapeJSONChar) + "\""; */ /* Rather inefficient way to do it */ @@ -62,19 +64,19 @@ function escapeJSONString(s) { c == '\\' || c.charCodeAt(0) < 32 || c.charCodeAt(0) >= 128) - parts[i] = escapeJSONChar(parts[i]); + parts[i] = JSONClient.escapeJSONChar(parts[i]); } return "\"" + parts.join("") + "\""; -} +}; /** * Marshall objects to JSON format. */ -function toJSON(o) { +JSONClient.toJSON = function(o) { if(o == null) { return "null"; } else if(o.constructor == String) { - return escapeJSONString(o); + return JSONClient.escapeJSONString(o); } else if(o.constructor == Number) { return o.toString(); } else if(o.constructor == Boolean) { @@ -83,21 +85,21 @@ function toJSON(o) { return '{javaClass: "java.util.Date", time: ' + o.valueOf() +'}'; } else if(o.constructor == Array) { var v = []; - for(var i = 0; i < o.length; i++) v.push(toJSON(o[i])); + for(var i = 0; i < o.length; i++) v.push(JSONClient.toJSON(o[i])); return "[" + v.join(", ") + "]"; } else { var v = []; for(attr in o) { if(o[attr] == null) v.push("\"" + attr + "\": null"); else if(typeof o[attr] == "function"); /* skip */ - else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr])); + else v.push(JSONClient.escapeJSONString(attr) + ": " + JSONClient.toJSON(o[attr])); } return "{" + v.join(", ") + "}"; } -} +}; /** - * HTTPBindingClient.Exception + * HTTPBindingClient.Exception. */ HTTPBindingClient.Exception = function(code, message, javaStack) { this.code = code; @@ -120,16 +122,16 @@ HTTPBindingClient.Exception.CODE_ERR_UNMARSHALL = 592; HTTPBindingClient.Exception.CODE_ERR_MARSHALL = 593; HTTPBindingClient.Exception.prototype = new Error(); -HTTPBindingClient.Exception.prototype.toString = function(code, msg) -{ +HTTPBindingClient.Exception.prototype.toString = function(code, msg) { return this.name + ": " + this.message; }; /** - * Default top level exception handler + * Default top level exception handler. */ -HTTPBindingClient.default_ex_handler = function(e) { alert(e); }; - +HTTPBindingClient.default_ex_handler = function(e) { + alert(e); +}; /** * Client settable variables @@ -139,7 +141,6 @@ HTTPBindingClient.profile_async = false; HTTPBindingClient.max_req_active = 1; HTTPBindingClient.requestId = 1; - /** * HTTPBindingClient implementation */ @@ -258,7 +259,7 @@ HTTPBindingClient.prototype._makeRequest = function(methodName, args, cb) { if (cb) req.cb = cb; if (HTTPBindingClient.profile_async) req.profile = { "submit": new Date() }; - req.data = toJSON(obj); + req.data = JSONClient.toJSON(obj); return req; }; @@ -424,7 +425,7 @@ HTTPBindingClient.prototype.get = function(id, responseFunction) { } xhr.open("GET", this.uri + '/' + id, true); xhr.send(null); -} +}; HTTPBindingClient.prototype.post = function (entry, responseFunction) { var xhr = this.createXMLHttpRequest(); @@ -445,7 +446,7 @@ HTTPBindingClient.prototype.post = function (entry, responseFunction) { xhr.open("POST", this.uri, true); xhr.setRequestHeader("Content-Type", "application/atom+xml"); xhr.send(entry); -} +}; HTTPBindingClient.prototype.put = function (id, entry, responseFunction) { var xhr = this.createXMLHttpRequest(); @@ -466,7 +467,7 @@ HTTPBindingClient.prototype.put = function (id, entry, responseFunction) { xhr.open("PUT", this.uri + '/' + id, true); xhr.setRequestHeader("Content-Type", "application/atom+xml"); xhr.send(entry); -} +}; HTTPBindingClient.prototype.del = function (id, responseFunction) { var xhr = this.createXMLHttpRequest(); @@ -481,7 +482,7 @@ HTTPBindingClient.prototype.del = function (id, responseFunction) { } xhr.open("DELETE", this.uri + '/' + id, true); xhr.send(null); -} +}; HTTPBindingClient.prototype.createXMLHttpRequest = function () { /* Mozilla XMLHttpRequest */ @@ -496,25 +497,6 @@ HTTPBindingClient.prototype.createXMLHttpRequest = function () { } /** - * Create Tuscany namespace. - */ -var tuscany; -if (!tuscany) - tuscany = {}; -if (!tuscany.sca) - tuscany.sca = {}; - -/** - * Configure component name - */ -tuscany.sca.componentName = "Default"; - -tuscany.sca.Component = function(name) { - tuscany.sca.componentName = name; - return name -} - -/** * Construct an HTTPBindingClient. */ function HTTPBindingClient(cname, uri, objectID) { @@ -540,14 +522,53 @@ function HTTPBindingClient(cname, uri, objectID) { req.send(null); return req.responseXML; } - } - } + } + } }; /** - * Construct a reference proxy + * Construct a component. */ -tuscany.sca.Reference = function(name) { - return new HTTPBindingClient(tuscany.sca.componentName, name); +function ClientComponent(name) { + this.name = name; } +/** + * Public API. + */ + +/** + * Return a component. + */ +function component(name) { + return new ClientComponent(name); +} + +/** + * Return a reference proxy. + */ +function reference(comp, name) { + return new HTTPBindingClient(comp.name, name); +}; + +/** + * Add proxy functions to a reference proxy. + */ +function defun(ref) { + function defapply(name) { + return function() { + var args = new Array(); + args[0] = name; + for (i = 0, n = arguments.length; i < n; i++) + args[i + 1] = arguments[i]; + this.apply.apply(this, args); + }; + } + + for (f = 1; f < arguments.length; f++) { + var fn = arguments[f]; + ref[fn]= defapply(fn); + } + return ref; +}; + 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 376b15f6c1..c1c38c9d6e 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 @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = reference(store, "shoppingCart");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -64,7 +58,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -119,7 +113,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
+ catalog.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 e3675dc2d3..cce2939f1a 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 @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = reference(store, "shoppingCart");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -64,7 +58,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -119,7 +113,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
+ catalog.items(catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-cpp/htdocs/index.html b/sca-cpp/trunk/samples/store-cpp/htdocs/index.html index 7de17d92e3..27007eb09d 100644 --- a/sca-cpp/trunk/samples/store-cpp/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-cpp/htdocs/index.html @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = reference(store, "shoppingCart");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -64,7 +58,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -119,7 +113,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
+ catalog.items(catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-gae/htdocs/index.html b/sca-cpp/trunk/samples/store-gae/htdocs/index.html index 8907cc6b49..3823f58f14 100644 --- a/sca-cpp/trunk/samples/store-gae/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-gae/htdocs/index.html @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = defun(reference(store, "shoppingCart"), "email", "host");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -51,7 +45,7 @@ function catalog_itemsResponse(items, exception) { catalogItems = items;
}
-function shoppingCart_gethostResponse(host, exception) {
+function shoppingCart_hostResponse(host, exception) {
if (exception) {
alert(exception.message);
return;
@@ -59,7 +53,7 @@ function shoppingCart_gethostResponse(host, exception) { document.getElementById('host').innerHTML = host;
}
-function shoppingCart_getemailResponse(email, exception) {
+function shoppingCart_emailResponse(email, exception) {
if (exception) {
alert(exception.message);
return;
@@ -79,7 +73,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -136,9 +130,9 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
- shoppingCart.apply("getemail", shoppingCart_getemailResponse);
- shoppingCart.apply("gethost", shoppingCart_gethostResponse);
+ catalog.items(catalog_itemsResponse);
+ shoppingCart.email(shoppingCart_emailResponse);
+ shoppingCart.host(shoppingCart_hostResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-gae/shopping-cart.py b/sca-cpp/trunk/samples/store-gae/shopping-cart.py index 6501f3db8d..3c3168d77b 100644 --- a/sca-cpp/trunk/samples/store-gae/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-gae/shopping-cart.py @@ -73,10 +73,10 @@ def total(cache, host, email): return sum(cart) # Return the email of the cart owner -def getemail(cache, host, email): - return email.eval() +def email(cache, host, email_): + return email_.eval() # Return the host that the app is running on -def gethost(cache, host, email): - return host.eval() +def host(cache, host_, email): + return host_.eval() diff --git a/sca-cpp/trunk/samples/store-java/htdocs/index.html b/sca-cpp/trunk/samples/store-java/htdocs/index.html index 7de17d92e3..27007eb09d 100644 --- a/sca-cpp/trunk/samples/store-java/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-java/htdocs/index.html @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = reference(store, "shoppingCart");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -64,7 +58,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -119,7 +113,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
+ catalog.items(catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-nosql/htdocs/index.html b/sca-cpp/trunk/samples/store-nosql/htdocs/index.html index 7de17d92e3..27007eb09d 100644 --- a/sca-cpp/trunk/samples/store-nosql/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-nosql/htdocs/index.html @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = reference(store, "shoppingCart");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -64,7 +58,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -119,7 +113,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
+ catalog.items(catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-python/htdocs/index.html b/sca-cpp/trunk/samples/store-python/htdocs/index.html index 7de17d92e3..27007eb09d 100644 --- a/sca-cpp/trunk/samples/store-python/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-python/htdocs/index.html @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = reference(store, "shoppingCart");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -64,7 +58,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -119,7 +113,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
+ catalog.items(catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-scheme/htdocs/index.html b/sca-cpp/trunk/samples/store-scheme/htdocs/index.html index 7de17d92e3..27007eb09d 100644 --- a/sca-cpp/trunk/samples/store-scheme/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-scheme/htdocs/index.html @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = reference(store, "shoppingCart");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -64,7 +58,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -119,7 +113,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
+ catalog.items(catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-sql/htdocs/index.html b/sca-cpp/trunk/samples/store-sql/htdocs/index.html index 7de17d92e3..27007eb09d 100644 --- a/sca-cpp/trunk/samples/store-sql/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-sql/htdocs/index.html @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = reference(store, "shoppingCart");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -64,7 +58,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -119,7 +113,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
+ catalog.items(catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
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 376b15f6c1..c1c38c9d6e 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 @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = reference(store, "shoppingCart");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -64,7 +58,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -119,7 +113,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
+ catalog.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 e3675dc2d3..cce2939f1a 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 @@ -20,19 +20,13 @@ <head>
<title>Store</title>
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/javascript" src="/js/ref.js"></script>
<script type="text/javascript">
-var component = new tuscany.sca.Component("Store");
-
-//@Reference
-var catalog = new tuscany.sca.Reference("catalog");
-
-//@Reference
-var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
-//@Reference
-var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+var store = component("Store");
+var catalog = defun(reference(store, "catalog"), "items");
+var shoppingCart = reference(store, "shoppingCart");
+var shoppingTotal = defun(reference(store, "shoppingTotal"), "total");
var catalogItems;
@@ -64,7 +58,7 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("total", shoppingTotal_totalResponse);
+ shoppingTotal.total(shoppingTotal_totalResponse);
}
}
@@ -119,7 +113,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("items", catalog_itemsResponse);
+ catalog.items(catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
|