Author: rfeng
Date: Wed Oct  7 20:52:32 2009
New Revision: 822905

URL: http://svn.apache.org/viewvc?rev=822905&view=rev
Log:
Upgrade to jabsorb 1.3.1 (json-rpc) and jettision 1.1

Modified:
    tuscany/java/sca/distribution/all/src/main/release/bin/LICENSE
    tuscany/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/binding-jsonrpc-runtime/pom.xml
    
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java
    
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java
    
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
    tuscany/java/sca/modules/databinding-json/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/databinding-json/pom.xml
    
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java
    
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java
    
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java

Modified: tuscany/java/sca/distribution/all/src/main/release/bin/LICENSE
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/distribution/all/src/main/release/bin/LICENSE?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- tuscany/java/sca/distribution/all/src/main/release/bin/LICENSE (original)
+++ tuscany/java/sca/distribution/all/src/main/release/bin/LICENSE Wed Oct  7 
20:52:32 2009
@@ -256,12 +256,12 @@
  httpclient-4.0.jar
  httpcore-4.0.1.jar
  httpcore-nio-4.0.1.jar
+ jabsorb-1.3.1.jar
  jackson-core-asl-1.0.1.jar
- jackson-mapper-asl-1.0.1.jar
- jettison-1.0.1.jar
+ jackson-mapper-asl-1.0.1.jar
+ jettison-1.1.jar
  jetty-6.1.19.jar
- jetty-util-6.1.19.jar
- json-rpc-1.0.jar
+ jetty-util-6.1.19.jar
  juli-6.0.18.jar
  log4j-1.2.15.jar
  mex-1.41-impl.jar
@@ -1454,6 +1454,32 @@
 
 
================================================================================
 
+The slf4j-api-1.5.0.jar and slf4j-jdk14-1.5.0.jar are distributed under the 
license:
+
+Copyright (c) 2004-2008 QOS.ch
+ All rights reserved.
+
+ Permission is hereby granted, free  of charge, to any person obtaining
+ a  copy  of this  software  and  associated  documentation files  (the
+ "Software"), to  deal in  the Software without  restriction, including
+ without limitation  the rights to  use, copy, modify,  merge, publish,
+ distribute,  sublicense, and/or sell  copies of  the Software,  and to
+ permit persons to whom the Software  is furnished to do so, subject to
+ the following conditions:
+ 
+ The  above  copyright  notice  and  this permission  notice  shall  be
+ included in all copies or substantial portions of the Software.
+ 
+ THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+ EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+ MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+================================================================================
+
 The tuscany-assembly-xsd-osoa jar includes XSD files under the following SCA 
Collaboration license:
 
 License for the Service Component Architecture JavaDoc, Interface 

Modified: tuscany/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF 
(original)
+++ tuscany/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF Wed 
Oct  7 20:52:32 2009
@@ -8,28 +8,29 @@
 Bundle-ManifestVersion: 2
 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
 Bundle-Description: Apache Tuscany SCA JSON-RPC Binding Runtime
-Import-Package: com.metaparadigm.jsonrpc;version="1.0.0",
- javax.security.auth.login,
+Import-Package: javax.security.auth.login,
  javax.servlet,
  javax.servlet.http,
- org.apache.commons.httpclient;version="3.1.0",
+ org.apache.commons.httpclient,
  org.apache.commons.httpclient.methods,
- org.apache.commons.httpclient.params;version="3.1.0",
- org.apache.tuscany.sca.assembly;version="2.0",
+ org.apache.commons.httpclient.params,
+ org.apache.tuscany.sca.assembly;version="2.0.0",
  org.apache.tuscany.sca.binding.jsonrpc;version="2.0.0",
- org.apache.tuscany.sca.core;version="2.0",
+ org.apache.tuscany.sca.core;version="2.0.0",
  org.apache.tuscany.sca.databinding.javabeans;version="2.0.0",
- org.apache.tuscany.sca.databinding.json,
- org.apache.tuscany.sca.host.http,
- org.apache.tuscany.sca.interfacedef,
+ org.apache.tuscany.sca.databinding.json;version="2.0.0",
+ org.apache.tuscany.sca.host.http;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef;version="2.0.0",
  org.apache.tuscany.sca.interfacedef.java;version="2.0.0",
- org.apache.tuscany.sca.invocation,
+ org.apache.tuscany.sca.invocation;version="2.0.0",
  org.apache.tuscany.sca.node;version="2.0.0",
- org.apache.tuscany.sca.provider,
- org.apache.tuscany.sca.runtime,
- org.json;version="1.0.0",
+ org.apache.tuscany.sca.provider;version="2.0.0",
+ org.apache.tuscany.sca.runtime;version="2.0.0",
+ org.json,
+ org.jabsorb,
+ org.jabsorb.client,
  org.oasisopen.sca;version="2.0.0",
- org.oasisopen.sca.annotation
+ org.oasisopen.sca.annotation;version="2.0.0"
 Bundle-SymbolicName: org.apache.tuscany.sca.binding.jsonrpc.runtime
 Bundle-DocURL: http://www.apache.org/
 

Modified: tuscany/java/sca/modules/binding-jsonrpc-runtime/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jsonrpc-runtime/pom.xml?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jsonrpc-runtime/pom.xml (original)
+++ tuscany/java/sca/modules/binding-jsonrpc-runtime/pom.xml Wed Oct  7 
20:52:32 2009
@@ -80,11 +80,12 @@
         </dependency>        
         
         <dependency>
-            <groupId>com.metaparadigm</groupId>
-            <artifactId>json-rpc</artifactId>
-            <version>1.0</version>
+            <groupId>org.jabsorb</groupId>
+            <artifactId>jabsorb</artifactId>
+            <version>1.3.1</version>
         </dependency>
         
+        
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>

Modified: 
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java
 (original)
+++ 
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java
 Wed Oct  7 20:52:32 2009
@@ -19,10 +19,9 @@
 
 package org.apache.tuscany.sca.binding.jsonrpc.provider;
 
-import java.io.ByteArrayInputStream;
-
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
 import org.apache.tuscany.sca.assembly.EndpointReference;
 import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
 import org.apache.tuscany.sca.interfacedef.Operation;
@@ -52,8 +51,6 @@
     }
 
     public Message invoke(Message msg) {
-        Object[] jsonArgs = (Object[])msg.getBody();
-
         PostMethod post = null;
         try {
 
@@ -79,7 +76,9 @@
             }
 
             post = new PostMethod(uri);
-            post.setRequestBody(new 
ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")));
+            String req = jsonRequest.toString();
+            StringRequestEntity entity = new StringRequestEntity(req, 
"application/json", "UTF-8");
+            post.setRequestEntity(entity);
 
             httpClient.executeMethod(post);
             int status = post.getStatusCode();

Modified: 
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java
 (original)
+++ 
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java
 Wed Oct  7 20:52:32 2009
@@ -74,7 +74,7 @@
     }
 
     public Invoker createInvoker(Operation operation) {
-        return new JSONRPCBindingInvoker(endpointReference, operation, 
httpClient);
+        return new JSONRPCClientInvoker(endpointReference, operation, 
httpClient);
     }
 
     public void start() {

Modified: 
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
 (original)
+++ 
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
 Wed Oct  7 20:52:32 2009
@@ -38,14 +38,14 @@
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.jabsorb.JSONRPCBridge;
+import org.jabsorb.JSONRPCResult;
+import org.jabsorb.JSONRPCServlet;
 import org.json.JSONArray;
+import org.json.JSONException;
 import org.json.JSONObject;
 import org.oasisopen.sca.ServiceRuntimeException;
 
-import com.metaparadigm.jsonrpc.JSONRPCBridge;
-import com.metaparadigm.jsonrpc.JSONRPCResult;
-import com.metaparadigm.jsonrpc.JSONRPCServlet;
-
 /**
  * Servlet that handles JSON-RPC requests invoking SCA services.
  * 
@@ -154,10 +154,14 @@
         // check if it's a system request 
         // or a method invocation
         byte[] bout;
-        if (method.startsWith("system.")) {
-            bout = handleJSONRPCSystemInvocation(request, response, 
data.toString());
-        } else {
-            bout = handleJSONRPCMethodInvocation(request, response, jsonReq);
+        try {
+            if (method.startsWith("system.")) {
+                bout = handleJSONRPCSystemInvocation(request, response, 
data.toString());
+            } else {
+                bout = handleJSONRPCMethodInvocation(request, response, 
jsonReq);
+            }
+        } catch (JSONException e) {
+            throw new RuntimeException(e);
         }
 
         // Send response to client
@@ -182,7 +186,7 @@
     }
     
     protected byte[] handleJSONRPCSystemInvocation(HttpServletRequest request, 
HttpServletResponse response, String requestData) throws IOException,
-    UnsupportedEncodingException {
+    UnsupportedEncodingException, JSONException {
         /*
          * Create a new bridge for every request to avoid all the problems 
with 
          * JSON-RPC-Java storing the bridge in the session
@@ -194,12 +198,8 @@
         session.setAttribute("JSONRPCBridge", jsonrpcBridge);
         
         org.json.JSONObject jsonReq = null;
-        com.metaparadigm.jsonrpc.JSONRPCResult jsonResp = null;
-        try {
-            jsonReq = new org.json.JSONObject(requestData);
-        } catch (java.text.ParseException e) {
-            throw new RuntimeException("Unable to parse request", e);
-        }
+        JSONRPCResult jsonResp = null;
+        jsonReq = new org.json.JSONObject(requestData);
 
         String method = jsonReq.getString("method");
         if ((method != null) && (method.indexOf('.') < 0)) {

Modified: tuscany/java/sca/modules/databinding-json/META-INF/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-json/META-INF/MANIFEST.MF?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding-json/META-INF/MANIFEST.MF (original)
+++ tuscany/java/sca/modules/databinding-json/META-INF/MANIFEST.MF Wed Oct  7 
20:52:32 2009
@@ -1,6 +1,6 @@
 Manifest-Version: 1.0
-Export-Package: org.apache.tuscany.sca.databinding.json,
- org.apache.tuscany.sca.databinding.json.axiom
+Export-Package: org.apache.tuscany.sca.databinding.json;version="2.0.0",
+ org.apache.tuscany.sca.databinding.json.axiom;version="2.0.0"
 Tool: Bnd-0.0.357
 Bundle-Name: Apache Tuscany SCA Data Binding for JSON
 Created-By: 1.6.0_15 (Apple Inc.)
@@ -10,8 +10,7 @@
 Bundle-ManifestVersion: 2
 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
 Bundle-Description: Apache Tuscany SCA Data Binding for JSON
-Import-Package: com.metaparadigm.jsonrpc,
- javax.xml.namespace,
+Import-Package: javax.xml.namespace,
  javax.xml.stream,
  org.apache.axiom.om,
  org.apache.tuscany.sca.common.xml.stax;version="2.0.0",
@@ -25,6 +24,8 @@
  org.codehaus.jettison.badgerfish,
  org.codehaus.jettison.json,
  org.codehaus.jettison.mapped,
+ org.jabsorb,
+ org.jabsorb.serializer,
  org.json,
  org.oasisopen.sca.annotation;version="2.0.0"
 Bundle-SymbolicName: org.apache.tuscany.sca.databinding.json

Modified: tuscany/java/sca/modules/databinding-json/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-json/pom.xml?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding-json/pom.xml (original)
+++ tuscany/java/sca/modules/databinding-json/pom.xml Wed Oct  7 20:52:32 2009
@@ -48,16 +48,15 @@
         </dependency>
 
         <dependency>
-            <groupId>com.metaparadigm</groupId>
-            <artifactId>json-rpc</artifactId>
-            <version>1.0</version>
-            <scope>compile</scope>
+            <groupId>org.jabsorb</groupId>
+            <artifactId>jabsorb</artifactId>
+            <version>1.3.1</version>
         </dependency>
         
         <dependency>
             <groupId>org.codehaus.jettison</groupId>
             <artifactId>jettison</artifactId>
-            <version>1.0.1</version>
+            <version>1.1</version>
             <scope>compile</scope>
             <exclusions>
                 <exclusion>

Modified: 
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java
 (original)
+++ 
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java
 Wed Oct  7 20:52:32 2009
@@ -23,9 +23,8 @@
 import org.apache.tuscany.sca.databinding.TransformationContext;
 import org.apache.tuscany.sca.databinding.TransformationException;
 import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
-
-import com.metaparadigm.jsonrpc.JSONSerializer;
-import com.metaparadigm.jsonrpc.SerializerState;
+import org.jabsorb.JSONSerializer;
+import org.jabsorb.serializer.SerializerState;
 
 /**
  * @version $Rev$ $Date$

Modified: 
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java
 (original)
+++ 
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java
 Wed Oct  7 20:52:32 2009
@@ -19,8 +19,6 @@
 
 package org.apache.tuscany.sca.databinding.json;
 
-import java.text.ParseException;
-
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 
@@ -61,7 +59,7 @@
         if (source instanceof JSONObject) {
             try {
                 json = new 
org.json.JSONObject(((JSONObject)source).toString());
-            } catch (ParseException e) {
+            } catch (org.json.JSONException e) {
                 throw new IllegalArgumentException(e);
             }
         } else if (source instanceof org.json.JSONObject) {
@@ -83,7 +81,7 @@
             }
             try {
                 return type.cast(new org.json.JSONObject(json));
-            } catch (ParseException e) {
+            } catch (org.json.JSONException e) {
                 throw new IllegalArgumentException(e);
             }
         }

Modified: 
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java?rev=822905&r1=822904&r2=822905&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java
 (original)
+++ 
tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java
 Wed Oct  7 20:52:32 2009
@@ -24,9 +24,8 @@
 import org.apache.tuscany.sca.databinding.TransformationException;
 import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
 import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
-
-import com.metaparadigm.jsonrpc.JSONSerializer;
-import com.metaparadigm.jsonrpc.SerializerState;
+import org.jabsorb.JSONSerializer;
+import org.jabsorb.serializer.SerializerState;
 
 public class JavaBean2JSON extends BaseTransformer<Object, Object> implements 
PullTransformer<Object, Object> {
     private JSONSerializer serializer;
@@ -68,7 +67,7 @@
         }
 
         SerializerState state = new SerializerState();
-        return serializer.marshall(state, source);
+        return serializer.marshall(state, null, source, new Integer(0));
     }
 
     public Object transform(Object source, TransformationContext context) {


Reply via email to