diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-23 15:42:42 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-23 15:42:42 +0000 |
commit | 3336ce7cd343c5b5ec51c1762f3133d044cff3be (patch) | |
tree | fab70d14ee4ea840beeff82759c1b01628f0de5a /java/sca/modules/binding-jms-runtime | |
parent | 3a62e18e7392a2a4ef9eca611443fa1966f31360 (diff) |
Merge the runtime wire changes to add a binding invocation wire with the jms binding changes to exploit the binding wire. Still early days so see the ongoing conversation on the ML. This function is only enabled if you include a wire format in a jms service binding element.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@707394 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-jms-runtime')
16 files changed, 567 insertions, 97 deletions
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java index 74a5368dc6..71d1298c9b 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java @@ -21,7 +21,7 @@ package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault; import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.assembly.WireFormat; +import org.apache.tuscany.sca.assembly.OperationSelector; /** * Implementation for policies that could be injected as parameter @@ -29,7 +29,7 @@ import org.apache.tuscany.sca.assembly.WireFormat; * * @version $Rev$ $Date$ */ -public class OperationSelectorJMSDefault implements WireFormat { +public class OperationSelectorJMSDefault implements OperationSelector { public static final QName OPERATION_SELECTOR_JMS_DEFAULT_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "operationSelector.JMSDefault"); public QName getSchemaName() { diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java index be483c66dd..4a8e4a1bd2 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java @@ -18,8 +18,6 @@ */ package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault; -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; @@ -27,7 +25,6 @@ import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProviderFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProviderFactory.java new file mode 100644 index 0000000000..cf9e55a54d --- /dev/null +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProviderFactory.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault; + +import org.apache.tuscany.sca.assembly.Binding; +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; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * @version $Rev$ $Date$ + */ +public class OperationSelectorJMSDefaultProviderFactory implements OperationSelectorProviderFactory<OperationSelectorJMSDefault> { + private ExtensionPointRegistry registry; + + public OperationSelectorJMSDefaultProviderFactory(ExtensionPointRegistry registry) { + super(); + this.registry = registry; + } + + /** + */ + public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component, + RuntimeComponentReference reference, + Binding binding) { + return new OperationSelectorJMSDefaultReferenceProvider(component, reference, binding); + } + + /** + */ + public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component, + RuntimeComponentService service, + Binding binding) { + return new OperationSelectorJMSDefaultServiceProvider(component, service, binding); + } + + /** + * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() + */ + public Class getModelType() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultReferenceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultReferenceInterceptor.java index fbe4bd048d..52433ed3ca 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultReferenceInterceptor.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultReferenceInterceptor.java @@ -20,21 +20,12 @@ package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault; import java.util.List; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.naming.NamingException; -import org.apache.tuscany.sca.assembly.OperationSelector; 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.impl.JMSBindingException; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.BindingInterceptor; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -47,10 +38,11 @@ import org.apache.tuscany.sca.runtime.RuntimeWire; * * @version $Rev$ $Date$ */ -public class OperationSelectorJMSDefaultReferenceInterceptor implements BindingInterceptor { +public class OperationSelectorJMSDefaultReferenceInterceptor implements Interceptor { private static final String ON_MESSAGE_METHOD_NAME = "onMessage"; + private Invoker next; private OperationSelectorJMSDefault operationSelector; private RuntimeWire runtimeWire; private JMSResourceFactory jmsResourceFactory; @@ -85,5 +77,13 @@ public class OperationSelectorJMSDefaultReferenceInterceptor implements BindingI public Message invokeResponse(Message msg) { // TODO binding interceptor iface TBD return null; - } + } + + public Invoker getNext() { + return next; + } + + public void setNext(Invoker next) { + this.next = next; + } } diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultReferenceProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultReferenceProvider.java new file mode 100644 index 0000000000..e7e1fff0ca --- /dev/null +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultReferenceProvider.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.provider.OperationSelectorProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; + +/** + * @version $Rev$ $Date$ + */ +public class OperationSelectorJMSDefaultReferenceProvider implements OperationSelectorProvider { + private RuntimeComponent component; + private RuntimeComponentReference reference; + private Binding binding; + + public OperationSelectorJMSDefaultReferenceProvider(RuntimeComponent component, + RuntimeComponentReference reference, + Binding binding) { + super(); + this.component = component; + this.reference = reference; + this.binding = binding; + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) + */ + public Interceptor createInterceptor() { + return new OperationSelectorJMSDefaultReferenceInterceptor((JMSBinding)binding, + null, + reference.getRuntimeWire(binding)); + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() + */ + public String getPhase() { + return Phase.REFERENCE_BINDING_TRANSPORT; + } + +} diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceInterceptor.java index 8fdcc355aa..6791bc4641 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceInterceptor.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceInterceptor.java @@ -23,29 +23,18 @@ import java.util.List; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.MessageProducer; -import javax.jms.Queue; import javax.jms.Session; -import javax.jms.Topic; -import javax.security.auth.Subject; -import org.apache.tuscany.sca.assembly.OperationSelector; 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.impl.JMSBindingException; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; -import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl; -import org.apache.tuscany.sca.core.invocation.MessageImpl; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.BindingInterceptor; 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.policy.SecurityUtil; -import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal; -import org.apache.tuscany.sca.runtime.EndpointReference; -import org.apache.tuscany.sca.runtime.ReferenceParameters; import org.apache.tuscany.sca.runtime.RuntimeComponentService; import org.apache.tuscany.sca.runtime.RuntimeWire; @@ -55,10 +44,11 @@ import org.apache.tuscany.sca.runtime.RuntimeWire; * * @version $Rev$ $Date$ */ -public class OperationSelectorJMSDefaultServiceInterceptor implements BindingInterceptor { +public class OperationSelectorJMSDefaultServiceInterceptor implements Interceptor { private static final String ON_MESSAGE_METHOD_NAME = "onMessage"; + private Invoker next; private RuntimeWire runtimeWire; private JMSResourceFactory jmsResourceFactory; private JMSBinding jmsBinding; @@ -80,8 +70,7 @@ public class OperationSelectorJMSDefaultServiceInterceptor implements BindingInt } public Message invoke(Message msg) { - // TODO binding interceptor iface TBD - return null; + return invokeResponse(next.invoke(invokeRequest(msg))); } public Message invokeRequest(Message msg) { @@ -153,5 +142,13 @@ public class OperationSelectorJMSDefaultServiceInterceptor implements BindingInt return operation; } + + public Invoker getNext() { + return next; + } + + public void setNext(Invoker next) { + this.next = next; + } } diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceProvider.java new file mode 100644 index 0000000000..a1cfa02072 --- /dev/null +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceProvider.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.provider.OperationSelectorProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * @version $Rev$ $Date$ + */ +public class OperationSelectorJMSDefaultServiceProvider implements OperationSelectorProvider { + private RuntimeComponent component; + private RuntimeComponentService service; + private Binding binding; + + public OperationSelectorJMSDefaultServiceProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) { + super(); + this.component = component; + this.service = service; + this.binding = binding; + } + + /** + */ + public Interceptor createInterceptor() { + return new OperationSelectorJMSDefaultServiceInterceptor((JMSBinding)binding, + null, + service.getRuntimeWire(binding)); + } + + /** + */ + public String getPhase() { + return Phase.SERVICE_BINDING_TRANSPORT; + } + +} diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java index 39e4cf0558..a96e53d9e1 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java @@ -49,6 +49,7 @@ public class JMSBindingProviderFactory implements BindingProviderFactory<JMSBind jmsRFEP = (JMSResourceFactoryExtensionPoint)extensionPoints.getExtensionPoint(JMSResourceFactoryExtensionPoint.class); if (jmsRFEP == null) { jmsRFEP = new DefaultJMSResourceFactoryExtensionPoint(); + extensionPoints.addExtensionPoint(jmsRFEP); } } diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java index e32d298967..9d64c4a16b 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java @@ -35,21 +35,35 @@ import javax.naming.NamingException; import org.apache.axiom.om.OMElement; import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.OperationSelector; +import org.apache.tuscany.sca.assembly.WireFormat; 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.impl.JMSBindingException; +import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault; import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefaultReferenceInterceptor; import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefaultServiceInterceptor; +import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault; import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefaultReferenceInterceptor; import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefaultServiceInterceptor; 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.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.provider.BindingProviderFactory; +import org.apache.tuscany.sca.provider.OperationSelectorProvider; +import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory; +import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint; import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB; +import org.apache.tuscany.sca.provider.WireFormatProvider; +import org.apache.tuscany.sca.provider.WireFormatProviderFactory; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentService; import org.apache.tuscany.sca.runtime.RuntimeWire; @@ -77,6 +91,21 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR private RuntimeComponent component; private InterfaceContract wsdlInterfaceContract; + + + private ProviderFactoryExtensionPoint providerFactories; + private ModelFactoryExtensionPoint modelFactories; + + private MessageFactory messageFactory; + + private OperationSelectorProviderFactory operationSelectorProviderFactory; + private OperationSelectorProvider operationSelectorProvider; + + private WireFormatProviderFactory requestWireFormatProviderFactory; + private WireFormatProvider requestWireFormatProvider; + + private WireFormatProviderFactory responseWireFormatProviderFactory; + private WireFormatProvider responseWireFormatProvider; public JMSBindingServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, Binding targetBinding, JMSBinding binding, WorkScheduler workScheduler, ExtensionPointRegistry extensionPoints, JMSResourceFactory jmsResourceFactory) { this.component = component; @@ -99,7 +128,42 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR setXMLDataBinding(service); } } + + // Get Message factory + modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + messageFactory = modelFactories.getFactory(MessageFactory.class); + // Get the factories/providers for operation selection + + // if no operation selector is specified then assume the default + if (jmsBinding.getOperationSelector() == null){ + jmsBinding.setOperationSelector(new OperationSelectorJMSDefault()); + } + + this.providerFactories = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class); + this.operationSelectorProviderFactory = + (OperationSelectorProviderFactory)providerFactories.getProviderFactory(jmsBinding.getOperationSelector().getClass()); + this.operationSelectorProvider = operationSelectorProviderFactory.createServiceOperationSelectorProvider(component, service, jmsBinding); + + // Get the factories/providers for wire format + + // if no request wire format specified then assume the default + if (jmsBinding.getRequestWireFormat() == null){ + jmsBinding.setRequestWireFormat(new WireFormatJMSDefault()); + } + + // if no response wire format specific then assume the default + if (jmsBinding.getResponseWireFormat() == null){ + jmsBinding.setResponseWireFormat(new WireFormatJMSDefault()); + } + + this.requestWireFormatProviderFactory = + (WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getRequestWireFormat().getClass()); + this.requestWireFormatProvider = requestWireFormatProviderFactory.createServiceWireFormatProvider(component, service, jmsBinding); + + this.responseWireFormatProviderFactory = + (WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getResponseWireFormat().getClass()); + this.responseWireFormatProvider = responseWireFormatProviderFactory.createServiceWireFormatProvider(component, service, jmsBinding); } protected boolean isOnMessage() { @@ -194,8 +258,8 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR * TODO a test to allow RRB experiments to take place without breaking everything else * RRB stuff only happens if you add a wireFormat to a composite file */ - if (jmsBinding.getWireFormat() != null ){ - tmpListener = new RRBJMSBindingListener(jmsBinding, jmsResourceFactory, service, targetBinding); + if (jmsBinding.getRequestWireFormat() != null ){ + tmpListener = new RRBJMSBindingListener(jmsBinding, jmsResourceFactory, service, targetBinding, messageFactory); } else { tmpListener = new DefaultJMSBindingListener(jmsBinding, jmsResourceFactory, service, targetBinding); } @@ -332,14 +396,19 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR * pick up the appropriate interceptor based on wireFormat and operationSelector * elements in the SCDL */ - public void configureServiceBindingRequestChain(List<Invoker> bindingRequestChain, RuntimeWire runtimeWire) { - - bindingRequestChain.add(new OperationSelectorJMSDefaultServiceInterceptor(jmsBinding, jmsResourceFactory, runtimeWire)); - bindingRequestChain.add(new WireFormatJMSDefaultServiceInterceptor(jmsBinding, jmsResourceFactory, runtimeWire)); - } - - public void configureServiceBindingResponseChain(List<Invoker> bindingResponseChain, RuntimeWire runtimeWire) { - bindingResponseChain.add(new WireFormatJMSDefaultServiceInterceptor(jmsBinding, jmsResourceFactory, runtimeWire)); - bindingResponseChain.add(new OperationSelectorJMSDefaultServiceInterceptor(jmsBinding, jmsResourceFactory, runtimeWire)); + public void configureBindingChain(RuntimeWire runtimeWire) { + + InvocationChain bindingChain = runtimeWire.getBindingInvocationChain(); + + // add operation selector interceptor + bindingChain.addInterceptor(operationSelectorProvider.getPhase(), operationSelectorProvider.createInterceptor()); + + // add request wire format + bindingChain.addInterceptor(requestWireFormatProvider.getPhase(), requestWireFormatProvider.createInterceptor()); + + // add response wire format, but only add it if it's different from the request + if (!jmsBinding.getRequestWireFormat().equals(jmsBinding.getResponseWireFormat())){ + bindingChain.addInterceptor(responseWireFormatProvider.getPhase(), responseWireFormatProvider.createInterceptor()); + } } } diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingListener.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingListener.java index c61552299d..615251610c 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingListener.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingListener.java @@ -43,8 +43,9 @@ import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAu import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl; import org.apache.tuscany.sca.core.invocation.MessageImpl; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.BindingInterceptor; +import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.policy.PolicySetAttachPoint; import org.apache.tuscany.sca.policy.SecurityUtil; @@ -73,6 +74,7 @@ public class RRBJMSBindingListener implements MessageListener { private JMSMessageProcessor responseMessageProcessor; private String correlationScheme; private List<Operation> serviceOperations; + private MessageFactory messageFactory; protected JMSTokenAuthenticationPolicy jmsTokenAuthenticationPolicy = null; /* @@ -82,11 +84,13 @@ public class RRBJMSBindingListener implements MessageListener { private List<Invoker> bindingRequestChain; private List<Invoker> bindingResponseChain; - public RRBJMSBindingListener(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeComponentService service, Binding targetBinding) throws NamingException { + public RRBJMSBindingListener(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeComponentService service, Binding targetBinding, MessageFactory messageFactory) throws NamingException { this.jmsBinding = jmsBinding; this.jmsResourceFactory = jmsResourceFactory; this.service = service; this.targetBinding = targetBinding; + this.messageFactory = messageFactory; + requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding); responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding); correlationScheme = jmsBinding.getCorrelationScheme(); @@ -105,15 +109,6 @@ public class RRBJMSBindingListener implements MessageListener { } } } - - // Set up request/response chains for RRB - bindingRequestChain = new ArrayList<Invoker>(); - bindingResponseChain = new ArrayList<Invoker>(); - - ServiceBindingProviderRRB provider = (ServiceBindingProviderRRB)service.getBindingProvider(jmsBinding); - provider.configureServiceBindingRequestChain(bindingRequestChain, service.getRuntimeWire(targetBinding)); - provider.configureServiceBindingResponseChain(bindingResponseChain, service.getRuntimeWire(targetBinding)); - } public void onMessage(Message requestJMSMsg) { @@ -143,40 +138,23 @@ public class RRBJMSBindingListener implements MessageListener { protected void invokeService(Message requestJMSMsg) throws JMSException, InvocationTargetException { // create the tuscany message - MessageImpl tuscanyMsg = new MessageImpl(); + org.apache.tuscany.sca.invocation.Message tuscanyMsg = messageFactory.createMessage(); // populate the message context with JMS binding information tuscanyMsg.getHeaders().add(requestJMSMsg); - - // call the request wire - for (Invoker invoker : bindingRequestChain){ - ((BindingInterceptor)invoker).invokeRequest(tuscanyMsg); - } + tuscanyMsg.setBody(requestJMSMsg); // call the runtime wire setHeaderProperties(requestJMSMsg, tuscanyMsg, tuscanyMsg.getOperation()); - Object response = service.getRuntimeWire(targetBinding).invoke(tuscanyMsg.getOperation(), tuscanyMsg); + InvocationChain chain = service.getRuntimeWire(targetBinding).getBindingInvocationChain(); + chain.getHeadInvoker().invoke(tuscanyMsg); - tuscanyMsg.setBody(response); - - if (requestJMSMsg.getJMSReplyTo() == null) { - // assume no reply is expected - if (response != null) { - logger.log(Level.FINE, "JMS service '" + service.getName() + "' dropped response as request has no replyTo"); - } - return; - } - - // call the response wire - for (Invoker invoker : bindingResponseChain){ - ((BindingInterceptor)invoker).invokeResponse(tuscanyMsg); - } } /** * TODO - RRB experiment. Needs refactoring */ - protected void setHeaderProperties(javax.jms.Message requestJMSMsg, MessageImpl tuscanyMsg, Operation operation) throws JMSException { + protected void setHeaderProperties(javax.jms.Message requestJMSMsg, org.apache.tuscany.sca.invocation.Message tuscanyMsg, Operation operation) throws JMSException { EndpointReference from = new EndpointReferenceImpl(null); tuscanyMsg.setFrom(from); diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefault.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefault.java index 8cce4b0d10..6edb6f8b33 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefault.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefault.java @@ -40,4 +40,9 @@ public class WireFormatJMSDefault implements WireFormat { public void setUnresolved(boolean unresolved) { } + + @Override + public boolean equals(Object obj) { + return this.getClass() == obj.getClass(); + } } diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultProviderFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultProviderFactory.java new file mode 100644 index 0000000000..c89638736b --- /dev/null +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultProviderFactory.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.provider.WireFormatProvider; +import org.apache.tuscany.sca.provider.WireFormatProviderFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * @version $Rev$ $Date$ + */ +public class WireFormatJMSDefaultProviderFactory implements WireFormatProviderFactory<WireFormatJMSDefault> { + private ExtensionPointRegistry registry; + private JMSResourceFactoryExtensionPoint jmsRFEP; + + public WireFormatJMSDefaultProviderFactory(ExtensionPointRegistry registry) { + super(); + this.registry = registry; + jmsRFEP = (JMSResourceFactoryExtensionPoint)registry.getExtensionPoint(JMSResourceFactoryExtensionPoint.class); + + } + + /** + */ + public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component, + RuntimeComponentReference reference, + Binding binding) { + return new WireFormatJMSDefaultReferenceProvider(component, reference, binding); + } + + /** + */ + public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component, + RuntimeComponentService service, + Binding binding) { + JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)binding); + return new WireFormatJMSDefaultServiceProvider(component, service, binding, jmsRF); + } + + /** + * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() + */ + public Class getModelType() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultReferenceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultReferenceInterceptor.java index e17c9a8c9b..8df0349a21 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultReferenceInterceptor.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultReferenceInterceptor.java @@ -19,18 +19,13 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault; -import javax.jms.JMSException; -import javax.jms.Session; -import javax.naming.NamingException; + import org.apache.tuscany.sca.assembly.WireFormat; 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.impl.JMSBindingException; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; -import org.apache.tuscany.sca.invocation.BindingInterceptor; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -40,7 +35,7 @@ import org.apache.tuscany.sca.runtime.RuntimeWire; * * @version $Rev$ $Date$ */ -public class WireFormatJMSDefaultReferenceInterceptor implements BindingInterceptor { +public class WireFormatJMSDefaultReferenceInterceptor implements Interceptor { private Invoker next; private RuntimeWire runtimeWire; @@ -49,6 +44,8 @@ public class WireFormatJMSDefaultReferenceInterceptor implements BindingIntercep private JMSMessageProcessor requestMessageProcessor; private JMSMessageProcessor responseMessageProcessor; private String correlationScheme; + private WireFormat requestWireFormat; + private WireFormat responseWireFormat; public WireFormatJMSDefaultReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) { super(); @@ -58,11 +55,28 @@ public class WireFormatJMSDefaultReferenceInterceptor implements BindingIntercep this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding); this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding); this.correlationScheme = jmsBinding.getCorrelationScheme(); + + if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault){ + this.requestWireFormat = jmsBinding.getRequestWireFormat(); + } + + if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSDefault){ + this.responseWireFormat = jmsBinding.getResponseWireFormat(); + } } public Message invoke(Message msg) { - // TODO binding interceptor iface TBD - return null; + if (requestWireFormat != null){ + msg = invokeRequest(msg); + } + + msg = getNext().invoke(msg); + + if (responseWireFormat != null){ + msg = invokeRequest(msg); + } + + return msg; } public Message invokeRequest(Message msg) { diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultReferenceProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultReferenceProvider.java new file mode 100644 index 0000000000..5d3dcd9dd3 --- /dev/null +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultReferenceProvider.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault; + +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.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; + +/** + * @version $Rev$ $Date$ + */ +public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider { + private RuntimeComponent component; + private RuntimeComponentReference reference; + private Binding binding; + + public WireFormatJMSDefaultReferenceProvider(RuntimeComponent component, + RuntimeComponentReference reference, + Binding binding) { + super(); + this.component = component; + this.reference = reference; + this.binding = binding; + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) + */ + public Interceptor createInterceptor() { + return new WireFormatJMSDefaultReferenceInterceptor((JMSBinding)binding, + null, + reference.getRuntimeWire(binding)); + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() + */ + public String getPhase() { + return Phase.REFERENCE_BINDING_WIREFORMAT; + } + +} diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultServiceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultServiceInterceptor.java index 5c53bcf009..7c7c44f627 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultServiceInterceptor.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultServiceInterceptor.java @@ -29,7 +29,6 @@ import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; -import org.apache.tuscany.sca.invocation.BindingInterceptor; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -41,7 +40,7 @@ import org.apache.tuscany.sca.runtime.RuntimeWire; * * @version $Rev$ $Date$ */ -public class WireFormatJMSDefaultServiceInterceptor implements BindingInterceptor { +public class WireFormatJMSDefaultServiceInterceptor implements Interceptor { private Invoker next; private RuntimeWire runtimeWire; private JMSResourceFactory jmsResourceFactory; @@ -49,6 +48,8 @@ public class WireFormatJMSDefaultServiceInterceptor implements BindingIntercepto private JMSMessageProcessor requestMessageProcessor; private JMSMessageProcessor responseMessageProcessor; private String correlationScheme; + private WireFormat requestWireFormat; + private WireFormat responseWireFormat; public WireFormatJMSDefaultServiceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) { super(); @@ -58,11 +59,29 @@ public class WireFormatJMSDefaultServiceInterceptor implements BindingIntercepto this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding); this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding); this.correlationScheme = jmsBinding.getCorrelationScheme(); + + if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault){ + this.requestWireFormat = jmsBinding.getRequestWireFormat(); + } + + if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSDefault){ + this.responseWireFormat = jmsBinding.getResponseWireFormat(); + } } public Message invoke(Message msg) { - // TODO binding interceptor iface TBD - return null; + + if (requestWireFormat != null){ + msg = invokeRequest(msg); + } + + msg = getNext().invoke(msg); + + if (responseWireFormat != null){ + msg = invokeResponse(msg); + } + + return msg; } public Message invokeRequest(Message msg) { @@ -76,11 +95,7 @@ public class WireFormatJMSDefaultServiceInterceptor implements BindingIntercepto msg.setBody(requestPayload); } - if (next != null){ - return getNext().invoke(msg); - } else { - return msg; - } + return msg; } public Message invokeResponse(Message msg) { @@ -109,11 +124,7 @@ public class WireFormatJMSDefaultServiceInterceptor implements BindingIntercepto msg.setBody(responseJMSMsg); - if (next != null){ - return getNext().invoke(msg); - } else { - return msg; - } + return msg; } catch (JMSException e) { throw new JMSBindingException(e); } catch (NamingException e) { diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultServiceProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultServiceProvider.java new file mode 100644 index 0000000000..9bf355c27b --- /dev/null +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultServiceProvider.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault; + +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.provider.JMSResourceFactory; +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; + +/** + * @version $Rev$ $Date$ + */ +public class WireFormatJMSDefaultServiceProvider implements WireFormatProvider { + private RuntimeComponent component; + private RuntimeComponentService service; + private Binding binding; + private JMSResourceFactory jmsResourceFactory; + + public WireFormatJMSDefaultServiceProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding, JMSResourceFactory jmsResourceFactory) { + super(); + this.component = component; + this.service = service; + this.binding = binding; + this.jmsResourceFactory = jmsResourceFactory; + } + + /** + */ + public Interceptor createInterceptor() { + return new WireFormatJMSDefaultServiceInterceptor((JMSBinding)binding, + jmsResourceFactory, + service.getRuntimeWire(binding)); + } + + /** + */ + public String getPhase() { + return Phase.SERVICE_BINDING_WIREFORMAT; + } + +} |