From c9ff2401831abb38a120ce7512862ca737de94ca Mon Sep 17 00:00:00 2001 From: rfeng Date: Wed, 7 Oct 2009 20:52:32 +0000 Subject: Upgrade to jabsorb 1.3.1 (json-rpc) and jettision 1.1 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@822905 13f79535-47bb-0310-9956-ffa450edef68 --- .../distribution/all/src/main/release/bin/LICENSE | 34 +++++++++++++++++++--- .../binding-jsonrpc-runtime/META-INF/MANIFEST.MF | 29 +++++++++--------- java/sca/modules/binding-jsonrpc-runtime/pom.xml | 7 +++-- .../jsonrpc/provider/JSONRPCBindingInvoker.java | 9 +++--- .../provider/JSONRPCReferenceBindingProvider.java | 2 +- .../jsonrpc/provider/JSONRPCServiceServlet.java | 30 +++++++++---------- .../modules/databinding-json/META-INF/MANIFEST.MF | 9 +++--- java/sca/modules/databinding-json/pom.xml | 9 +++--- .../sca/databinding/json/JSON2JavaBean.java | 5 ++-- .../tuscany/sca/databinding/json/JSONHelper.java | 6 ++-- .../sca/databinding/json/JavaBean2JSON.java | 7 ++--- 11 files changed, 85 insertions(+), 62 deletions(-) (limited to 'java/sca') diff --git a/java/sca/distribution/all/src/main/release/bin/LICENSE b/java/sca/distribution/all/src/main/release/bin/LICENSE index 53d764b941..3ef209296b 100644 --- a/java/sca/distribution/all/src/main/release/bin/LICENSE +++ b/java/sca/distribution/all/src/main/release/bin/LICENSE @@ -256,12 +256,12 @@ The following components come under Apache Software License 2.0 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 POSSIBILITY OF SUCH DAMAGE. ================================================================================ +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 diff --git a/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF b/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF index b391a310dd..cb7256f8b4 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF +++ b/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF @@ -8,28 +8,29 @@ Bnd-LastModified: 1253941843749 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/ diff --git a/java/sca/modules/binding-jsonrpc-runtime/pom.xml b/java/sca/modules/binding-jsonrpc-runtime/pom.xml index 41dc87b91e..f80a21101f 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/pom.xml +++ b/java/sca/modules/binding-jsonrpc-runtime/pom.xml @@ -80,11 +80,12 @@ - com.metaparadigm - json-rpc - 1.0 + org.jabsorb + jabsorb + 1.3.1 + javax.servlet servlet-api diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java index abad796ef0..9767f6f46b 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java +++ b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java @@ -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 class JSONRPCBindingInvoker implements Invoker { } public Message invoke(Message msg) { - Object[] jsonArgs = (Object[])msg.getBody(); - PostMethod post = null; try { @@ -79,7 +76,9 @@ public class JSONRPCBindingInvoker implements Invoker { } 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(); diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java index b0da1ff5cf..a0581b4237 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java +++ b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java @@ -74,7 +74,7 @@ public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider } public Invoker createInvoker(Operation operation) { - return new JSONRPCBindingInvoker(endpointReference, operation, httpClient); + return new JSONRPCClientInvoker(endpointReference, operation, httpClient); } public void start() { diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java index f3ece2c80b..71d335acc8 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java +++ b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java @@ -38,14 +38,14 @@ import org.apache.tuscany.sca.invocation.Message; 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 @@ public class JSONRPCServiceServlet extends JSONRPCServlet { // 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 @@ public class JSONRPCServiceServlet extends JSONRPCServlet { } 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 @@ public class JSONRPCServiceServlet extends JSONRPCServlet { 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)) { diff --git a/java/sca/modules/databinding-json/META-INF/MANIFEST.MF b/java/sca/modules/databinding-json/META-INF/MANIFEST.MF index b8c7326487..21024b3efd 100644 --- a/java/sca/modules/databinding-json/META-INF/MANIFEST.MF +++ b/java/sca/modules/databinding-json/META-INF/MANIFEST.MF @@ -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 @@ Bnd-LastModified: 1254338075268 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 @@ Import-Package: com.metaparadigm.jsonrpc, 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 diff --git a/java/sca/modules/databinding-json/pom.xml b/java/sca/modules/databinding-json/pom.xml index 4afdbe90ff..b4616ad361 100644 --- a/java/sca/modules/databinding-json/pom.xml +++ b/java/sca/modules/databinding-json/pom.xml @@ -48,16 +48,15 @@ - com.metaparadigm - json-rpc - 1.0 - compile + org.jabsorb + jabsorb + 1.3.1 org.codehaus.jettison jettison - 1.0.1 + 1.1 compile diff --git a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java index b1813c9eab..a9edc66ae8 100644 --- a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java +++ b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java @@ -23,9 +23,8 @@ import org.apache.tuscany.sca.databinding.PullTransformer; 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$ diff --git a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java index fb29710506..bc6184189a 100644 --- a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java +++ b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java @@ -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 @@ public class JSONHelper { 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 @@ public class JSONHelper { } try { return type.cast(new org.json.JSONObject(json)); - } catch (ParseException e) { + } catch (org.json.JSONException e) { throw new IllegalArgumentException(e); } } diff --git a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java index a928deef22..0d52c66e17 100644 --- a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java +++ b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java @@ -24,9 +24,8 @@ import org.apache.tuscany.sca.databinding.TransformationContext; 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 implements PullTransformer { private JSONSerializer serializer; @@ -68,7 +67,7 @@ public class JavaBean2JSON extends BaseTransformer implements Pu } 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) { -- cgit v1.2.3