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 2008/04/19 19:46:47 UTC

svn commit: r649832 - in /incubator/tuscany/java/sca/modules/implementation-widget: pom.xml src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetProxyHelper.java src/main/resources/binding-atom.js src/main/resources/binding-http.js

Author: jsdelfino
Date: Sat Apr 19 10:46:45 2008
New Revision: 649832

URL: http://svn.apache.org/viewvc?rev=649832&view=rev
Log:
Cleaned up dependencies a bit. Added a .javascript file to allow Javascript references to support binding.http in addition to binding.jsonrpc and binding.atom.

Added:
    incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-http.js   (with props)
Modified:
    incubator/tuscany/java/sca/modules/implementation-widget/pom.xml
    incubator/tuscany/java/sca/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetProxyHelper.java
    incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-atom.js

Modified: incubator/tuscany/java/sca/modules/implementation-widget/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-widget/pom.xml?rev=649832&r1=649831&r2=649832&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-widget/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/implementation-widget/pom.xml Sat Apr 19 10:46:45 2008
@@ -32,13 +32,19 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-assembly</artifactId>
+            <artifactId>tuscany-assembly-xml</artifactId>
             <version>2.0-incubating-SNAPSHOT</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-interface-java-xml</artifactId>
+            <artifactId>tuscany-interface-java</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+        </dependency>        
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-data-api</artifactId>
             <version>2.0-incubating-SNAPSHOT</version>
         </dependency>        
 
@@ -58,18 +64,21 @@
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-binding-http</artifactId>
             <version>2.0-incubating-SNAPSHOT</version>
+            <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-binding-atom-abdera</artifactId>
             <version>2.0-incubating-SNAPSHOT</version>
+            <scope>test</scope>
         </dependency>
         
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-binding-jsonrpc</artifactId>
             <version>2.0-incubating-SNAPSHOT</version>
+            <scope>test</scope>
         </dependency>
         
        <dependency>

Modified: incubator/tuscany/java/sca/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetProxyHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetProxyHelper.java?rev=649832&r1=649831&r2=649832&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetProxyHelper.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetProxyHelper.java Sat Apr 19 10:46:45 2008
@@ -32,6 +32,9 @@
         
         proxyFileRegistry.put("org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding", "binding-jsonrpc.js");
         proxyClient.put("org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding", "JSONRpcClient");
+
+        proxyFileRegistry.put("org.apache.tuscany.sca.binding.http.impl.HTTPBindingImpl", "binding-http.js");
+        proxyClient.put("org.apache.tuscany.sca.binding.http.impl.HTTPBindingImpl", "HTTPClient");
     }
     
     static String getJavaScriptProxyFile(String bindingClass) {

Modified: incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-atom.js
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-atom.js?rev=649832&r1=649831&r2=649832&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-atom.js (original)
+++ incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-atom.js Sat Apr 19 10:46:45 2008
@@ -135,5 +135,3 @@
       }
    }
 }
-
-bindingatom = "loaded";

Added: incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-http.js
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-http.js?rev=649832&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-http.js (added)
+++ incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-http.js Sat Apr 19 10:46:45 2008
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+	
+function HTTPClient(uri) {
+
+	this.msxmlNames = [ "MSXML2.XMLHTTP.5.0",
+                        "MSXML2.XMLHTTP.4.0",
+                        "MSXML2.XMLHTTP.3.0",
+                        "MSXML2.XMLHTTP",
+                        "Microsoft.XMLHTTP" ];
+			            
+	this.uri=uri;
+	
+	this.get = function(id, responseFunction) {
+		var xhr = this.createXMLHttpRequest();
+		xhr.onreadystatechange = function() {
+			if (xhr.readyState == 4) {
+				if (xhr.status == 200) {
+				    var strDocument = xhr.responseText;
+                    if (responseFunction != null) responseFunction(strDocument);
+				} else {
+                    alert("get - Error getting data from the server");
+				}
+			}
+		}
+		xhr.open("GET", uri + '/' + id, true);
+		xhr.send(null);
+	}	
+
+	this.post = function (entry, responseFunction) {
+		var xhr = this.createXMLHttpRequest();
+		xhr.onreadystatechange = function() {
+			if (xhr.readyState == 4) {
+				if (xhr.status == 201) {
+				    var strDocument = xhr.responseText;
+					if (responseFunction != null) responseFunction(strDocument);
+				} else {
+					alert("post - Error getting data from the server");
+				}
+			}
+		}
+		xhr.open("POST", uri, true);
+		xhr.setRequestHeader("Content-Type", "text/xml");
+		xhr.send(entry);
+	}	
+
+	this.put = function (id, entry, responseFunction) {
+		var xhr = this.createXMLHttpRequest();
+		xhr.onreadystatechange = function() {
+			if (xhr.readyState == 4) {
+				if (xhr.status == 200) {
+				    var strDocument = xhr.responseText;
+					if (responseFunction != null) responseFunction(strDocument);
+				} else {
+					alert("put - Error getting data from the server");
+				}
+			}
+		}
+		xhr.open("PUT", uri + '/' + id, true);
+		xhr.setRequestHeader("Content-Type", "text/xml");
+		xhr.send(entry);
+	}	
+
+	this.del = function (id, responseFunction) {       
+		var xhr = this.createXMLHttpRequest();
+		xhr.onreadystatechange = function() {
+			if (xhr.readyState == 4) {
+				if (xhr.status == 200) {
+					if (responseFunction != null) responseFunction();
+				} else {
+					alert("delete - Error getting data from the server");
+				}
+			}
+		}
+		xhr.open("DELETE", uri + '/' + id, true);		
+		xhr.send(null);
+	}
+	this.createXMLHttpRequest = function () {
+        /* Mozilla XMLHttpRequest */
+        try {return new XMLHttpRequest();} catch(e) {}      
+		
+        /* Microsoft MSXML ActiveX */
+        for (var i=0;i < this.msxmlNames.length; i++) {
+            try {return new ActiveXObject(this.msxmlNames[i]);} catch (e) {}
+        }
+        alert("XML http request not supported");
+        return null;
+	}
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-http.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-widget/src/main/resources/binding-http.js
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org