diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-26 13:23:57 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-26 13:23:57 +0000 |
commit | aef1e52d6377f18516371655c32125c68bac0cce (patch) | |
tree | 598aeb93747d119998df3f87b22eacb0125efaa3 /branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache | |
parent | de53364092d375a98144b29e85e09abc8842268e (diff) |
TUSCANY-2931 - allow separate request and response wire formats in binding.jms. The tuscany binding.jms XSD has been extended to allow a response wireFormat element to be specified. The knock on effect of all this is that the Operation interface has been changed to allow input and output wrapper info to be held separately. Also Interface has some new operations. There are changes across the code base to take account of this interface change.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@758625 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache')
10 files changed, 241 insertions, 136 deletions
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java index f785a8fdb9..0e44b84ea0 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java @@ -52,7 +52,6 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi private RuntimeComponentReference reference; private JMSBinding jmsBinding; - private List<JMSBindingInvoker> jmsBindingInvokers = new ArrayList<JMSBindingInvoker>(); private JMSResourceFactory jmsResourceFactory; private RuntimeComponent component; private InterfaceContract interfaceContract; @@ -87,7 +86,18 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi (WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getResponseWireFormat().getClass()); if (this.responseWireFormatProviderFactory != null){ this.responseWireFormatProvider = responseWireFormatProviderFactory.createReferenceWireFormatProvider(component, reference, jmsBinding); - } + } + + // create an interface contract that reflects both request and response + // wire formats + try { + interfaceContract = (InterfaceContract)reference.getInterfaceContract().clone(); + + requestWireFormatProvider.configureWireFormatInterfaceContract(interfaceContract); + responseWireFormatProvider.configureWireFormatInterfaceContract(interfaceContract); + } catch (CloneNotSupportedException ex){ + interfaceContract = reference.getInterfaceContract(); + } } public Invoker createInvoker(Operation operation) { @@ -109,9 +119,6 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi } public InterfaceContract getBindingInterfaceContract() { - if (interfaceContract == null){ - interfaceContract = this.requestWireFormatProvider.getWireFormatInterfaceContract(); - } return interfaceContract; } diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java index 106d0b37cf..4a86a92b0e 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java @@ -59,12 +59,9 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR private JMSServiceListenerFactory serviceListenerFactory; private JMSServiceListener serviceListener; - private ExtensionPointRegistry extensionPoints; - private RuntimeComponent component; - private InterfaceContract wsdlInterfaceContract; + private InterfaceContract interfaceContract; - private ProviderFactoryExtensionPoint providerFactories; private ModelFactoryExtensionPoint modelFactories; @@ -85,7 +82,6 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR this.jmsBinding = binding; this.serviceListenerFactory = serviceListenerFactory; this.targetBinding = targetBinding; - this.extensionPoints = extensionPoints; this.jmsResourceFactory = jmsResourceFactory; // Set the default destination when using a connection factory. @@ -123,10 +119,21 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR if (this.responseWireFormatProviderFactory != null){ this.responseWireFormatProvider = responseWireFormatProviderFactory.createServiceWireFormatProvider(component, service, jmsBinding); } + + // create an interface contract that reflects both request and response + // wire formats + try { + interfaceContract = (InterfaceContract)service.getInterfaceContract().clone(); + + requestWireFormatProvider.configureWireFormatInterfaceContract(interfaceContract); + responseWireFormatProvider.configureWireFormatInterfaceContract(interfaceContract); + } catch (CloneNotSupportedException ex){ + interfaceContract = service.getInterfaceContract(); + } } public InterfaceContract getBindingInterfaceContract() { - return requestWireFormatProvider.getWireFormatInterfaceContract(); + return interfaceContract; } public boolean supportsOneWayInvocation() { diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java index 00aa060ce7..de5a83bfdb 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java @@ -19,27 +19,14 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime; -import java.util.List; - -import org.apache.axiom.om.OMElement; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; -import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; -import org.apache.tuscany.sca.binding.jms.provider.XMLTextMessageProcessor; -import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML; -import org.apache.tuscany.sca.binding.ws.WebServiceBinding; -import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; -import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator; +import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.WireFormatProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; @@ -69,8 +56,12 @@ public class WireFormatJMSBytesReferenceProvider implements WireFormatProvider { // currently maintaining the message processor structure which // contains the details of jms message processing however overried // any message processors specied in the SCDL in this case - this.binding.setRequestMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME); - this.binding.setResponseMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME); + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytes){ + this.binding.setRequestMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytes){ + this.binding.setResponseMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME); + } // just point to the reference interface contract so no // databinding transformation takes place @@ -80,6 +71,22 @@ public class WireFormatJMSBytesReferenceProvider implements WireFormatProvider { public InterfaceContract getWireFormatInterfaceContract() { return interfaceContract; } + + public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){ + + if (this.interfaceContract != null ) { + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytes){ + // set the request data transformation + interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface()); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytes){ + // set the response data transformation + interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface()); + } + } + + return interfaceContract; + } public Interceptor createInterceptor() { return new WireFormatJMSBytesReferenceInterceptor(binding, diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java index 8cf1bc7e4d..2fcb9ef118 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java @@ -19,20 +19,14 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime; -import java.util.List; - import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; +import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.WireFormatProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -60,10 +54,14 @@ public class WireFormatJMSBytesServiceProvider implements WireFormatProvider { // configure the service based on this wire format // currently maintaining the message processor structure which - // contains the details of jms message processing however overried - // any message processors specied in the SCDL in this case - this.binding.setRequestMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME); - this.binding.setResponseMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME); + // contains the details of jms message processing however override + // any message processors specified in the SCDL in this case + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytes){ + this.binding.setRequestMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytes){ + this.binding.setResponseMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME); + } // just point to the reference interface contract so no // databinding transformation takes place @@ -73,6 +71,22 @@ public class WireFormatJMSBytesServiceProvider implements WireFormatProvider { public InterfaceContract getWireFormatInterfaceContract() { return interfaceContract; } + + public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){ + + if (this.interfaceContract != null ) { + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytes){ + // set the request data transformation + interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface()); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytes){ + // set the response data transformation + interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface()); + } + } + + return interfaceContract; + } /** */ diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java index 42719e842f..e566764ce4 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java @@ -19,27 +19,14 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime; -import java.util.List; - -import org.apache.axiom.om.OMElement; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; -import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; -import org.apache.tuscany.sca.binding.jms.provider.XMLTextMessageProcessor; -import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML; -import org.apache.tuscany.sca.binding.ws.WebServiceBinding; -import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; -import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator; +import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.WireFormatProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; @@ -67,10 +54,14 @@ public class WireFormatJMSObjectReferenceProvider implements WireFormatProvider // configure the reference based on this wire format // currently maintaining the message processor structure which - // contains the details of jms message processing however overried - // any message processors specied in the SCDL in this case - this.binding.setRequestMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME); - this.binding.setResponseMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME); + // contains the details of jms message processing however override + // any message processors specified in the SCDL in this case + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSObject){ + this.binding.setRequestMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSObject){ + this.binding.setResponseMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME); + } // just point to the reference interface contract so no // databinding transformation takes place @@ -80,6 +71,22 @@ public class WireFormatJMSObjectReferenceProvider implements WireFormatProvider public InterfaceContract getWireFormatInterfaceContract() { return interfaceContract; } + + public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){ + + if (this.interfaceContract != null ) { + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSObject){ + // set the request data transformation + interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface()); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSObject){ + // set the response data transformation + interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface()); + } + } + + return interfaceContract; + } public Interceptor createInterceptor() { return new WireFormatJMSObjectReferenceInterceptor(binding, diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java index 9b1b405fac..4f4d4b4bb5 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java @@ -19,20 +19,15 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime; -import java.util.List; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; +import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.WireFormatProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -60,10 +55,14 @@ public class WireFormatJMSObjectServiceProvider implements WireFormatProvider { // configure the service based on this wire format // currently maintaining the message processor structure which - // contains the details of jms message processing however overried - // any message processors specied in the SCDL in this case - this.binding.setRequestMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME); - this.binding.setResponseMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME); + // contains the details of jms message processing however override + // any message processors specified in the SCDL in this case + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSObject){ + this.binding.setRequestMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSObject){ + this.binding.setResponseMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME); + } // just point to the reference interface contract so no // databinding transformation takes place @@ -73,6 +72,22 @@ public class WireFormatJMSObjectServiceProvider implements WireFormatProvider { public InterfaceContract getWireFormatInterfaceContract() { return interfaceContract; } + + public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){ + + if (this.interfaceContract != null ) { + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSObject){ + // set the request data transformation + interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface()); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSObject){ + // set the response data transformation + interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface()); + } + } + + return interfaceContract; + } /** */ diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java index f7d125dd3e..c2030f9d4c 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java @@ -19,27 +19,15 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime; -import java.util.List; -import org.apache.axiom.om.OMElement; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; -import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; -import org.apache.tuscany.sca.binding.jms.provider.XMLTextMessageProcessor; -import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML; -import org.apache.tuscany.sca.binding.ws.WebServiceBinding; -import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; -import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator; +import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.WireFormatProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; @@ -67,10 +55,14 @@ public class WireFormatJMSTextReferenceProvider implements WireFormatProvider { // configure the reference based on this wire format // currently maintaining the message processor structure which - // contains the details of jms message processing however overried - // any message processors specied in the SCDL in this case - this.binding.setRequestMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME); - this.binding.setResponseMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME); + // contains the details of jms message processing however override + // any message processors specified in the SCDL in this case + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSText){ + this.binding.setRequestMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSText){ + this.binding.setResponseMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME); + } // just point to the reference interface contract so no @@ -81,6 +73,22 @@ public class WireFormatJMSTextReferenceProvider implements WireFormatProvider { public InterfaceContract getWireFormatInterfaceContract() { return interfaceContract; } + + public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){ + + if (this.interfaceContract != null ) { + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSText){ + // set the request data transformation + interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface()); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSText){ + // set the response data transformation + interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface()); + } + } + + return interfaceContract; + } public Interceptor createInterceptor() { return new WireFormatJMSTextReferenceInterceptor(binding, diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java index f8fff8e981..d9ec72007a 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java @@ -19,20 +19,14 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime; -import java.util.List; - import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; +import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.WireFormatProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -60,10 +54,14 @@ public class WireFormatJMSTextServiceProvider implements WireFormatProvider { // configure the service based on this wire format // currently maintaining the message processor structure which - // contains the details of jms message processing however overried - // any message processors specied in the SCDL in this case - this.binding.setRequestMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME); - this.binding.setResponseMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME); + // contains the details of jms message processing however override + // any message processors specified in the SCDL in this case + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSText){ + this.binding.setRequestMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSText){ + this.binding.setResponseMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME); + } // just point to the reference interface contract so no // databinding transformation takes place @@ -73,6 +71,22 @@ public class WireFormatJMSTextServiceProvider implements WireFormatProvider { public InterfaceContract getWireFormatInterfaceContract() { return interfaceContract; } + + public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){ + + if (this.interfaceContract != null ) { + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSText){ + // set the request data transformation + interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface()); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSText){ + // set the response data transformation + interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface()); + } + } + + return interfaceContract; + } /** */ diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java index 69369cd268..0c383c0579 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java @@ -19,24 +19,18 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime; -import java.util.List; - import org.apache.axiom.om.OMElement; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; +import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.WireFormatProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; @@ -66,23 +60,27 @@ public class WireFormatJMSTextXMLReferenceProvider implements WireFormatProvider // currently maintaining the message processor structure which // contains the details of jms message processing so set the message // type here if not set explicitly in SCDL - if (this.binding.getRequestMessageProcessorName().equals(JMSBindingConstants.XML_MP_CLASSNAME) ){ + // + // defaults to JMSBindingConstants.XML_MP_CLASSNAME so no need to set it +/* + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSTextXML){ this.binding.setRequestMessageProcessorName(JMSBindingConstants.XML_MP_CLASSNAME); - this.binding.setResponseMessageProcessorName(JMSBindingConstants.XML_MP_CLASSNAME); } - - // set the binding interface contract to represent the WSDL for the - // xml messages that will be sent - if (reference.getInterfaceContract() != null && - !isOnMessage()) { - WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class); - WebServiceBinding wsBinding = wsFactory.createWebServiceBinding(); - BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null); - interfaceContract = wsBinding.getBindingInterfaceContract(); - interfaceContract.getInterface().resetDataBinding(OMElement.class.getName()); - } else { - interfaceContract = reference.getInterfaceContract(); + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSTextXML){ + this.binding.setResponseMessageProcessorName(JMSBindingConstants.XML_MP_CLASSNAME); } +*/ + + // create a local interface contract that is configured specifically to + // deal with the data format that this wire format is expecting to sent to + // and receive from the databinding interceptor. The request/response parts of + // this interface contract will be copied into the binding interface contract + // as required + WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class); + WebServiceBinding wsBinding = wsFactory.createWebServiceBinding(); + BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null); + interfaceContract = wsBinding.getBindingInterfaceContract(); + interfaceContract.getInterface().resetDataBinding(OMElement.class.getName()); } protected boolean isOnMessage() { @@ -97,6 +95,23 @@ public class WireFormatJMSTextXMLReferenceProvider implements WireFormatProvider return interfaceContract; } + public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){ + + if (this.interfaceContract != null && + !isOnMessage()) { + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSTextXML){ + // set the request data transformation + interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface()); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSTextXML){ + // set the response data transformation + interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface()); + } + } + + return interfaceContract; + } + public Interceptor createInterceptor() { return new WireFormatJMSTextXMLReferenceInterceptor((JMSBinding)binding, null, diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java index 2a2332f5fb..95dcbdf189 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java @@ -19,25 +19,19 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime; -import java.util.List; - import org.apache.axiom.om.OMElement; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; +import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.WireFormatProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -69,23 +63,23 @@ public class WireFormatJMSTextXMLServiceProvider implements WireFormatProvider { // currently maintaining the message processor structure which // contains the details of jms message processing so set the message // type here if not set explicitly in SCDL - if (this.binding.getRequestMessageProcessorName().equals(JMSBindingConstants.XML_MP_CLASSNAME) ){ + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSTextXML){ this.binding.setRequestMessageProcessorName(JMSBindingConstants.XML_MP_CLASSNAME); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSTextXML){ this.binding.setResponseMessageProcessorName(JMSBindingConstants.XML_MP_CLASSNAME); } - // set the binding interface contract to represent the WSDL for the - // xml messages that will be sent - if (service.getInterfaceContract() != null && - !isOnMessage()) { - WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class); - WebServiceBinding wsBinding = wsFactory.createWebServiceBinding(); - BindingWSDLGenerator.generateWSDL(component, service, wsBinding, registry, null); - interfaceContract = wsBinding.getBindingInterfaceContract(); - interfaceContract.getInterface().resetDataBinding(OMElement.class.getName()); - } else { - interfaceContract = service.getInterfaceContract(); - } + // create a local interface contract that is configured specifically to + // deal with the data format that this wire format is expecting to sent to + // and receive from the databinding interceptor. The request/response parts of + // this interface contract will be copied into the binding interface contract + // as required + WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class); + WebServiceBinding wsBinding = wsFactory.createWebServiceBinding(); + BindingWSDLGenerator.generateWSDL(component, service, wsBinding, registry, null); + interfaceContract = wsBinding.getBindingInterfaceContract(); + interfaceContract.getInterface().resetDataBinding(OMElement.class.getName()); } protected boolean isOnMessage() { @@ -99,7 +93,24 @@ public class WireFormatJMSTextXMLServiceProvider implements WireFormatProvider { public InterfaceContract getWireFormatInterfaceContract() { return interfaceContract; } - + + public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){ + + if (this.interfaceContract != null && + !isOnMessage()) { + if (this.binding.getRequestWireFormat() instanceof WireFormatJMSTextXML){ + // set the request data transformation + interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface()); + } + if (this.binding.getResponseWireFormat() instanceof WireFormatJMSTextXML){ + // set the response data transformation + interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface()); + } + } + + return interfaceContract; + } + public Interceptor createInterceptor() { return new WireFormatJMSTextXMLServiceInterceptor((JMSBinding)binding, jmsResourceFactory, |