Author: lresende
Date: Mon May  4 07:04:07 2009
New Revision: 771209

URL: http://svn.apache.org/viewvc?rev=771209&view=rev
Log:
TUSCANY-2868 - Further changes trying to add the json-rpc wireformat and 
operation selector interceptors to the invocation chain

Modified:
    
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java
    
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorInterceptor.java
    
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorProviderFactory.java
    
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorServiceProvider.java
    
tuscany/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
    
tuscany/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
    
tuscany/branches/sca-java-1.x/modules/binding-http-new-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java

Modified: 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java?rev=771209&r1=771208&r2=771209&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java
 Mon May  4 07:04:07 2009
@@ -24,8 +24,6 @@
 
 import org.apache.tuscany.sca.host.embedded.SCADomain;
 import org.json.JSONObject;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -45,12 +43,12 @@
 
     private SCADomain domain;
 
-    //@Before
+    //@BeforeClass
     public void setUp() throws Exception {
         domain = 
SCADomain.newInstance("org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCBinding.composite");
     }
 
-    //@After
+    //@AfterClass
     public void tearDown() throws Exception {
        domain.close();
     }

Modified: 
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorInterceptor.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorInterceptor.java?rev=771209&r1=771208&r2=771209&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorInterceptor.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorInterceptor.java
 Mon May  4 07:04:07 2009
@@ -38,15 +38,15 @@
     }
 
     public Invoker getNext() {
-        return null;
+        return this.next;
     }
 
     public void setNext(Invoker next) {
-        
+        this.next = next;
     }
 
     public Message invoke(Message msg) {
-        return null;
+        return getNext().invoke(msg);
     }
 
 }

Modified: 
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorProviderFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorProviderFactory.java?rev=771209&r1=771208&r2=771209&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorProviderFactory.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorProviderFactory.java
 Mon May  4 07:04:07 2009
@@ -21,6 +21,7 @@
 
 import org.apache.tuscany.sca.assembly.Binding;
 import 
org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelector;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.provider.OperationSelectorProvider;
 import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -28,6 +29,11 @@
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 
 public class JSONRPCOperationSelectorProviderFactory implements 
OperationSelectorProviderFactory<JSONRPCOperationSelector> {
+    private ExtensionPointRegistry extensionPoints;
+
+    public JSONRPCOperationSelectorProviderFactory(ExtensionPointRegistry 
extensionPoints) {
+        this.extensionPoints = extensionPoints;
+    }
 
     public OperationSelectorProvider 
createReferenceOperationSelectorProvider(RuntimeComponent component,
                                                                               
RuntimeComponentReference reference,

Modified: 
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorServiceProvider.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorServiceProvider.java?rev=771209&r1=771208&r2=771209&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorServiceProvider.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-http-new-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorServiceProvider.java
 Mon May  4 07:04:07 2009
@@ -20,7 +20,10 @@
 package org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.provider;
 
 import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.BindingRRB;
+import org.apache.tuscany.sca.assembly.OperationSelector;
 import org.apache.tuscany.sca.binding.http.HTTPBinding;
+import 
org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelector;
 import org.apache.tuscany.sca.invocation.Interceptor;
 import org.apache.tuscany.sca.invocation.Phase;
 import org.apache.tuscany.sca.provider.OperationSelectorProvider;
@@ -40,7 +43,15 @@
     }
     
     public Interceptor createInterceptor() {
-        return new JSONRPCOperationSelectorInterceptor((HTTPBinding) binding, 
service.getRuntimeWire(binding));
+        if(binding instanceof BindingRRB) {
+            BindingRRB rrbBinding = (BindingRRB) binding;
+            OperationSelector operationSelector = 
rrbBinding.getOperationSelector();
+            if(operationSelector != null && operationSelector instanceof 
JSONRPCOperationSelector) {
+                return new JSONRPCOperationSelectorInterceptor((HTTPBinding) 
binding, service.getRuntimeWire(binding));
+            }
+        }
+        
+        return null;
     }
 
     public String getPhase() {

Modified: 
tuscany/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
URL: 
http://svn.apache.org/viewvc/tuscany/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?rev=771209&r1=771208&r2=771209&view=diff
==============================================================================
--- 
tuscany/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
 (original)
+++ 
tuscany/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
 Mon May  4 07:04:07 2009
@@ -19,25 +19,35 @@
 
 package org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.provider;
 
+import org.apache.tuscany.sca.binding.http.HTTPBinding;
 import org.apache.tuscany.sca.invocation.Interceptor;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
 
 public class JSONRPCWireFormatInterceptor implements Interceptor {
+   private Invoker next;
+    
+    private RuntimeWire runtimeWire;
+    private HTTPBinding binding;
+    
+    public JSONRPCWireFormatInterceptor(HTTPBinding binding, RuntimeWire 
runtimeWire) {
+        this.binding = binding;
+        this.runtimeWire = runtimeWire;
+        
+    }
 
     public Invoker getNext() {
-        // TODO Auto-generated method stub
-        return null;
+        return next;
     }
 
     public void setNext(Invoker next) {
-        // TODO Auto-generated method stub
+        this.next = next;
         
     }
 
     public Message invoke(Message msg) {
-        // TODO Auto-generated method stub
-        return null;
+        return getNext().invoke(msg);
     }
 
 }

Modified: 
tuscany/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
URL: 
http://svn.apache.org/viewvc/tuscany/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?rev=771209&r1=771208&r2=771209&view=diff
==============================================================================
--- 
tuscany/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
 (original)
+++ 
tuscany/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
 Mon May  4 07:04:07 2009
@@ -20,6 +20,10 @@
 package org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.provider;
 
 import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.BindingRRB;
+import org.apache.tuscany.sca.assembly.WireFormat;
+import org.apache.tuscany.sca.binding.http.HTTPBinding;
+import 
org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormat;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.invocation.Interceptor;
@@ -32,12 +36,19 @@
  * @version $Rev$ $Date$
  */
 public class JSONRPCWireFormatServiceProvider implements WireFormatProvider {
+    private RuntimeComponent component;
+    private RuntimeComponentService service;
+    private Binding binding;
 
     public JSONRPCWireFormatServiceProvider(ExtensionPointRegistry 
extensionPoints,
                                             RuntimeComponent component, 
                                             RuntimeComponentService service, 
                                             Binding binding) {
         
+        super();
+        this.component = component;
+        this.service = service;
+        this.binding = binding;
     }
     
     public InterfaceContract 
configureWireFormatInterfaceContract(InterfaceContract interfaceContract) {
@@ -46,7 +57,14 @@
     }
 
     public Interceptor createInterceptor() {
-        // TODO Auto-generated method stub
+        if(binding instanceof BindingRRB) {
+            BindingRRB rrbBinding = (BindingRRB) binding;
+            WireFormat wireFormat = rrbBinding.getRequestWireFormat();
+            if(wireFormat != null && wireFormat instanceof JSONRPCWireFormat) {
+                return new JSONRPCWireFormatInterceptor((HTTPBinding) binding, 
service.getRuntimeWire(binding));
+            }
+        }
+        
         return null;
     }
 

Modified: 
tuscany/branches/sca-java-1.x/modules/binding-http-new-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-http-new-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java?rev=771209&r1=771208&r2=771209&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-http-new-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-http-new-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java
 Mon May  4 07:04:07 2009
@@ -37,7 +37,7 @@
 import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
 import 
org.apache.tuscany.sca.policy.authentication.AuthenticationConfigurationPolicy;
 import org.apache.tuscany.sca.policy.confidentiality.ConfidentialityPolicy;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 import org.apache.tuscany.sca.runtime.RuntimeWire;
@@ -47,7 +47,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class HTTPServiceBindingProvider implements ServiceBindingProvider {
+public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB {
     private static final QName AUTEHTICATION_INTENT = new 
QName("http://www.osoa.org/xmlns/sca/1.0","authentication";);
     private static final QName CONFIDENTIALITY_INTENT = new 
QName("http://www.osoa.org/xmlns/sca/1.0","confidentiality";);
     
@@ -185,5 +185,15 @@
     public boolean supportsOneWayInvocation() {
         return false;
     }
+    
+    /**
+     * Add specific http interceptor to invocation chain
+     * @param runtimeWire
+     */
+    public void configureBindingChain(RuntimeWire runtimeWire) {
+        InvocationChain bindingChain = runtimeWire.getBindingInvocationChain();
+        
+        
+    }
 
 }


Reply via email to