diff options
Diffstat (limited to '')
7 files changed, 69 insertions, 16 deletions
diff --git a/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java b/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java index a982bb7ff6..e9e5b43944 100644 --- a/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java +++ b/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java @@ -24,8 +24,6 @@ import junit.framework.Assert; 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 @@ public class JSONRPCServiceTestCase { 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(); } diff --git a/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 b/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 index f189b940ad..094a27d7a2 100644 --- a/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 +++ b/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 @@ -38,15 +38,15 @@ public class JSONRPCOperationSelectorInterceptor implements Interceptor { } 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); } } diff --git a/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 b/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 index 786e8f8855..12c4bd7cf4 100644 --- a/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 +++ b/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 @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.provider; 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.RuntimeComponentReference; 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, diff --git a/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 b/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 index a57105ed3f..d1581fff95 100644 --- a/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 +++ b/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 @@ -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 class JSONRPCOperationSelectorServiceProvider implements OperationSelecto } 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() { 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 68152b0321..5778a2908c 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 @@ -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); } } 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 983e54c1a7..91d35546ae 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 @@ -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 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService; * @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 class JSONRPCWireFormatServiceProvider implements WireFormatProvider { } 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; } diff --git a/branches/sca-java-1.x/modules/binding-http-new-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java b/branches/sca-java-1.x/modules/binding-http-new-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java index 6e01ac5f9f..a9873b4166 100644 --- a/branches/sca-java-1.x/modules/binding-http-new-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java +++ b/branches/sca-java-1.x/modules/binding-http-new-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java @@ -37,7 +37,7 @@ import org.apache.tuscany.sca.policy.PolicySet; 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 @@ import org.apache.tuscany.sca.runtime.RuntimeWire; * * @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 class HTTPServiceBindingProvider implements ServiceBindingProvider { public boolean supportsOneWayInvocation() { return false; } + + /** + * Add specific http interceptor to invocation chain + * @param runtimeWire + */ + public void configureBindingChain(RuntimeWire runtimeWire) { + InvocationChain bindingChain = runtimeWire.getBindingInvocationChain(); + + + } } |