summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-05-05 23:07:02 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-05-05 23:07:02 +0000
commit08c90a78989469f04feaa242e33f719ddc3cd25a (patch)
tree3b7a2db33c3787f8fe92f2ba00796fc42a1ea6f1 /branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime
parentd97fd3b777dcde26ae37b94ef698d6e3c1a95993 (diff)
TUSCANY-2968 - Fixing data binding related issues to properly transform to/from json format as needed
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@772003 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime')
-rw-r--r--branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatInterceptor.java30
-rw-r--r--branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatServiceProvider.java14
2 files changed, 5 insertions, 39 deletions
diff --git a/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatInterceptor.java b/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatInterceptor.java
index 756f90eca4..6bd0298923 100644
--- a/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatInterceptor.java
@@ -60,13 +60,6 @@ public class JSONRPCWireFormatInterceptor implements Interceptor {
}
public Message invoke(Message msg) {
-
- // Configure JSON Databding
- setDataBinding(runtimeWire.getTarget().getInterfaceContract().getInterface());
-
- // Set default databinding to json
- runtimeWire.getTarget().getInterfaceContract().getInterface().resetDataBinding(JSONDataBinding.NAME);
-
JSONObject jsonReq = (JSONObject) msg.getBody();
String method = null;
Object[] args = null;
@@ -131,27 +124,4 @@ public class JSONRPCWireFormatInterceptor implements Interceptor {
return responseMessage;
}
-
-
- private void setDataBinding(Interface interfaze) {
- List<Operation> operations = interfaze.getOperations();
- for (Operation operation : operations) {
- operation.setDataBinding(JSONDataBinding.NAME);
- DataType<List<DataType>> inputType = operation.getInputType();
- if (inputType != null) {
- List<DataType> logical = inputType.getLogical();
- for (DataType inArg : logical) {
- if (!SimpleJavaDataBinding.NAME.equals(inArg.getDataBinding())) {
- inArg.setDataBinding(JSONDataBinding.NAME);
- }
- }
- }
- DataType outputType = operation.getOutputType();
- if (outputType != null) {
- if (!SimpleJavaDataBinding.NAME.equals(outputType.getDataBinding())) {
- outputType.setDataBinding(JSONDataBinding.NAME);
- }
- }
- }
- }
}
diff --git a/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatServiceProvider.java b/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatServiceProvider.java
index 8522d00f73..89c43c0510 100644
--- a/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatServiceProvider.java
+++ b/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatServiceProvider.java
@@ -45,6 +45,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService;
public class JSONRPCWireFormatServiceProvider implements WireFormatProvider {
private RuntimeComponent component;
private RuntimeComponentService service;
+ private InterfaceContract serviceContract;
private Binding binding;
public JSONRPCWireFormatServiceProvider(ExtensionPointRegistry extensionPoints,
@@ -55,22 +56,17 @@ public class JSONRPCWireFormatServiceProvider implements WireFormatProvider {
super();
this.component = component;
this.service = service;
+ this.serviceContract = service.getInterfaceContract();
this.binding = binding;
}
public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract) {
- InterfaceContract configuredContract = null;
- //clone the service contract to avoid databinding issues
- try {
- configuredContract = (InterfaceContract) interfaceContract.clone();
- } catch(CloneNotSupportedException e) {
- configuredContract = interfaceContract;
- }
+ this.serviceContract = interfaceContract;
- setDataBinding(configuredContract.getInterface());
+ setDataBinding(serviceContract.getInterface());
// Set default databinding to json
- configuredContract.getInterface().resetDataBinding(JSONDataBinding.NAME);
+ serviceContract.getInterface().resetDataBinding(JSONDataBinding.NAME);
return interfaceContract;
}