diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-05 23:07:02 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-05 23:07:02 +0000 |
commit | 08c90a78989469f04feaa242e33f719ddc3cd25a (patch) | |
tree | 3b7a2db33c3787f8fe92f2ba00796fc42a1ea6f1 /branches/sca-java-1.x/modules/binding-http-new-runtime/src | |
parent | d97fd3b777dcde26ae37b94ef698d6e3c1a95993 (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-runtime/src')
-rw-r--r-- | branches/sca-java-1.x/modules/binding-http-new-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java | 57 |
1 files changed, 38 insertions, 19 deletions
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 bd1c1737bb..9d474e6d71 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 @@ -58,12 +58,17 @@ 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"); + private ExtensionPointRegistry extensionPoints; + private RuntimeComponent component; private RuntimeComponentService service; + private InterfaceContract serviceContract; private HTTPBinding binding; private MessageFactory messageFactory; - private ExtensionPointRegistry extensionPoints; + private OperationSelectorProvider osProvider; + private WireFormatProvider wfProvider; + private ServletHost servletHost; private String servletMapping; private HTTPBindingListenerServlet bindingListenerServlet; @@ -76,10 +81,41 @@ public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB { ServletHost servletHost) { this.component = component; this.service = service; + this.binding = binding; this.extensionPoints = extensionPoints; this.messageFactory = messageFactory; this.servletHost = servletHost; + + // retrieve operation selector and wire format service providers + + ProviderFactoryExtensionPoint providerFactories = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class); + + // Configure the interceptors for operation selection + OperationSelectorProviderFactory osProviderFactory = (OperationSelectorProviderFactory) providerFactories.getProviderFactory(binding.getOperationSelector().getClass()); + if (osProviderFactory != null) { + this.osProvider = osProviderFactory.createServiceOperationSelectorProvider(component, service, binding); + } + + // Configure the interceptors for wire format + WireFormatProviderFactory wfProviderFactory = (WireFormatProviderFactory) providerFactories.getProviderFactory(binding.getRequestWireFormat().getClass()); + if (wfProviderFactory != null) { + this.wfProvider = wfProviderFactory.createServiceWireFormatProvider(component, service, binding); + } + + + //clone the service contract to avoid databinding issues + try { + this.serviceContract = (InterfaceContract) service.getInterfaceContract().clone(); + + // configure data binding + if (this.wfProvider != null) { + wfProvider.configureWireFormatInterfaceContract(service.getInterfaceContract()); + } + } catch(CloneNotSupportedException e) { + this.serviceContract = service.getInterfaceContract(); + } + } public void start() { @@ -195,7 +231,7 @@ public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB { } public InterfaceContract getBindingInterfaceContract() { - return null; + return service.getInterfaceContract(); } public boolean supportsOneWayInvocation() { @@ -210,27 +246,10 @@ public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB { InvocationChain bindingChain = runtimeWire.getBindingInvocationChain(); - ProviderFactoryExtensionPoint providerFactories = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class); - - // Configure the interceptors for operation selection - OperationSelectorProviderFactory osProviderFactory = (OperationSelectorProviderFactory) providerFactories.getProviderFactory(binding.getOperationSelector().getClass()); - OperationSelectorProvider osProvider = null; - if (osProviderFactory != null) { - osProvider = osProviderFactory.createServiceOperationSelectorProvider(component, service, binding); - } - if(osProvider != null) { bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR, osProvider.createInterceptor()); } - - // Configure the interceptors for wire format - WireFormatProviderFactory wfProviderFactory = (WireFormatProviderFactory) providerFactories.getProviderFactory(binding.getRequestWireFormat().getClass()); - WireFormatProvider wfProvider = null; - if (wfProviderFactory != null) { - wfProvider = wfProviderFactory.createServiceWireFormatProvider(component, service, binding); - } - if (wfProvider != null) { bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, wfProvider.createInterceptor()); } |