You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2010/10/27 08:57:31 UTC

svn commit: r1027835 - in /tuscany/sca-cpp/trunk: modules/oauth/htdocs/ modules/openid/htdocs/ modules/server/htdocs/js/ samples/store-cluster/htdocs/domains/jane/ samples/store-cluster/htdocs/domains/joe/ samples/store-cpp/htdocs/ samples/store-gae/ s...

Author: jsdelfino
Date: Wed Oct 27 06:57:31 2010
New Revision: 1027835

URL: http://svn.apache.org/viewvc?rev=1027835&view=rev
Log:
Simplify Javascript component reference API a bit. Rename tuscany-ref.js to ref.js. Add a function to declare reference proxy methods.

Added:
    tuscany/sca-cpp/trunk/modules/server/htdocs/js/ref.js
      - copied, changed from r1026940, tuscany/sca-cpp/trunk/modules/server/htdocs/js/tuscany-ref.js
Removed:
    tuscany/sca-cpp/trunk/modules/server/htdocs/js/tuscany-ref.js
Modified:
    tuscany/sca-cpp/trunk/modules/oauth/htdocs/index.html
    tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html
    tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-gae/shopping-cart.py
    tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html
    tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html

Modified: tuscany/sca-cpp/trunk/modules/oauth/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/oauth/htdocs/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/oauth/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/oauth/htdocs/index.html Wed Oct 27 06:57:31 2010
@@ -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");

Modified: tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html Wed Oct 27 06:57:31 2010
@@ -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>

Copied: tuscany/sca-cpp/trunk/modules/server/htdocs/js/ref.js (from r1026940, tuscany/sca-cpp/trunk/modules/server/htdocs/js/tuscany-ref.js)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/server/htdocs/js/ref.js?p2=tuscany/sca-cpp/trunk/modules/server/htdocs/js/ref.js&p1=tuscany/sca-cpp/trunk/modules/server/htdocs/js/tuscany-ref.js&r1=1026940&r2=1027835&rev=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/server/htdocs/js/tuscany-ref.js (original)
+++ tuscany/sca-cpp/trunk/modules/server/htdocs/js/ref.js Wed Oct 27 06:57:31 2010
@@ -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_UNM
 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
     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 = functi
     }
     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 = funct
     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 = functi
     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 = functi
     }
     xhr.open("DELETE", this.uri + '/' + id, true);        
     xhr.send(null);
-}
+};
 
 HTTPBindingClient.prototype.createXMLHttpRequest = function () {
     /* Mozilla XMLHttpRequest */
@@ -496,25 +497,6 @@ HTTPBindingClient.prototype.createXMLHtt
 }
 
 /**
- * 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, o
              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;
+};
+

Modified: tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html Wed Oct 27 06:57:31 2010
@@ -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);

Modified: tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html Wed Oct 27 06:57:31 2010
@@ -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);

Modified: tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html Wed Oct 27 06:57:31 2010
@@ -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);

Modified: tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html Wed Oct 27 06:57:31 2010
@@ -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, ex
     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(ho
     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);

Modified: tuscany/sca-cpp/trunk/samples/store-gae/shopping-cart.py
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-gae/shopping-cart.py?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-gae/shopping-cart.py (original)
+++ tuscany/sca-cpp/trunk/samples/store-gae/shopping-cart.py Wed Oct 27 06:57:31 2010
@@ -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()
 

Modified: tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html Wed Oct 27 06:57:31 2010
@@ -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);

Modified: tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-nosql/htdocs/index.html Wed Oct 27 06:57:31 2010
@@ -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);

Modified: tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html Wed Oct 27 06:57:31 2010
@@ -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);

Modified: tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html Wed Oct 27 06:57:31 2010
@@ -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);

Modified: tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html Wed Oct 27 06:57:31 2010
@@ -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);

Modified: tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html Wed Oct 27 06:57:31 2010
@@ -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);

Modified: tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html?rev=1027835&r1=1027834&r2=1027835&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html (original)
+++ tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html Wed Oct 27 06:57:31 2010
@@ -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);