From af0cfc49958afa2ef6c44384cb5d5d8ca4c516da Mon Sep 17 00:00:00 2001 From: rsivaram Date: Wed, 12 Nov 2008 13:16:06 +0000 Subject: Event prototype: event binding with JMS-based default binding git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@713362 13f79535-47bb-0310-9956-ffa450edef68 --- .../provider/JMSBindingServiceBindingProvider.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'sandbox/event/modules/binding-jms-runtime') diff --git a/sandbox/event/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/sandbox/event/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java index fc9cacf5e1..9c4faae87c 100644 --- a/sandbox/event/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java +++ b/sandbox/event/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java @@ -41,6 +41,7 @@ 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.provider.AsyncServiceBindingProvider; import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -51,10 +52,11 @@ import org.apache.tuscany.sca.work.WorkScheduler; * * @version $Rev$ $Date$ */ -public class JMSBindingServiceBindingProvider implements ServiceBindingProvider { +public class JMSBindingServiceBindingProvider implements ServiceBindingProvider, AsyncServiceBindingProvider { private static final Logger logger = Logger.getLogger(JMSBindingServiceBindingProvider.class.getName()); private RuntimeComponentService service; + private RuntimeComponentService targetService; private Binding targetBinding; private JMSBinding jmsBinding; private JMSResourceFactory jmsResourceFactory; @@ -75,6 +77,7 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider this.jmsBinding = binding; this.workScheduler = workScheduler; this.targetBinding = targetBinding; + this.targetService = service; this.extensionPoints = extensionPoints; this.jmsResourceFactory = jmsResourceFactory; @@ -159,7 +162,7 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider // if using an embedded broker then when shutting down Tuscany the broker may get closed // before this stop method is called. I can't see how to detect that so for now just // ignore the exception if the message is that the transport is already disposed - if (!"Transport disposed.".equals(e.getMessage())) { + if (e.getMessage() == null || !e.getMessage().contains("disposed")) { throw new JMSBindingException("Error stopping JMSServiceBinding", e); } } @@ -179,7 +182,7 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider consumer = session.createConsumer(destination); } - final JMSBindingListener listener = new JMSBindingListener(jmsBinding, jmsResourceFactory, service, targetBinding); + final JMSBindingListener listener = new JMSBindingListener(jmsBinding, jmsResourceFactory, targetService, targetBinding); try { consumer.setMessageListener(listener); @@ -303,4 +306,14 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider throw new JMSBindingException(e); } } + + public Binding getTargetBinding() { + return targetBinding; + } + + public void setTargetBinding(Binding binding) { + this.targetBinding = binding; + } + + } -- cgit v1.2.3