diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-15 10:50:40 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-15 10:50:40 +0000 |
commit | f943cc0e4b33c40cbdc92daa76b5aefcd23b5102 (patch) | |
tree | c2332b498e2407eeabd72621ec7522495c33faed /java/sca/modules/binding-sca-jms/src/main | |
parent | 6a88a568b26135e77a60309f7b05af4c6a571083 (diff) |
Update to work with new jms resource factory support
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@704855 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-sca-jms/src/main')
2 files changed, 28 insertions, 4 deletions
diff --git a/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSBroker.java b/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSBroker.java index 6c13b550ba..dc81f1dbab 100644 --- a/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSBroker.java +++ b/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSBroker.java @@ -19,7 +19,9 @@ package org.apache.tuscany.sca.binding.sca.jms;
+import java.io.File;
import java.net.URI;
+import java.net.URL;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.TransportConnector;
@@ -27,8 +29,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.ModuleActivator;
/**
- * The JMS broker for the JMS based SCA binding
- * TODO: configure from a binding.jms in definitions.xml
+ * The JMS broker for the JMS based SCA binding TODO: configure from a binding.jms in definitions.xml
*/
public class JMSBroker implements ModuleActivator {
@@ -39,6 +40,7 @@ public class JMSBroker implements ModuleActivator { public void start(ExtensionPointRegistry arg0) {
if (broker == null) {
+ ps();
broker = new BrokerService();
broker.setPersistent(false);
broker.setUseJmx(false);
@@ -52,6 +54,7 @@ public class JMSBroker implements ModuleActivator { broker.start();
} catch (Exception e) {
+ e.printStackTrace();
throw new RuntimeException(e);
}
}
@@ -67,4 +70,12 @@ public class JMSBroker implements ModuleActivator { }
}
}
+
+ protected void ps() {
+ URL ps = Thread.currentThread().getContextClassLoader().getResource("domain.properties");
+ System.out.println("url " + ps);
+ File f = new File("/domain.properties");
+ System.out.println("f " + f.toURI());
+ System.out.println("f " + f.exists());
+ }
}
diff --git a/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSSCABindingProviderFactory.java b/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSSCABindingProviderFactory.java index cfb14e6d56..caad644748 100644 --- a/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSSCABindingProviderFactory.java +++ b/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSSCABindingProviderFactory.java @@ -21,8 +21,11 @@ package org.apache.tuscany.sca.binding.sca.jms; 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.DefaultJMSResourceFactoryExtensionPoint; import org.apache.tuscany.sca.binding.jms.provider.JMSBindingReferenceBindingProvider; import org.apache.tuscany.sca.binding.jms.provider.JMSBindingServiceBindingProvider; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint; import org.apache.tuscany.sca.binding.sca.DistributedSCABinding; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; @@ -41,12 +44,17 @@ public class JMSSCABindingProviderFactory implements BindingProviderFactory<Dist private WorkScheduler workScheduler; private ExtensionPointRegistry extensionPoints; + private JMSResourceFactoryExtensionPoint jmsRFEP; public JMSSCABindingProviderFactory(ExtensionPointRegistry extensionPoints) { this.extensionPoints = extensionPoints; UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); workScheduler = utilities.getUtility(WorkScheduler.class); assert workScheduler != null; + jmsRFEP = (JMSResourceFactoryExtensionPoint)extensionPoints.getExtensionPoint(JMSResourceFactoryExtensionPoint.class); + if (jmsRFEP == null) { + jmsRFEP = new DefaultJMSResourceFactoryExtensionPoint(); + } } public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, @@ -60,7 +68,8 @@ public class JMSSCABindingProviderFactory implements BindingProviderFactory<Dist // instead of JNDI // jmsBinding.setDestinationCreate(JMSBindingConstants.CREATE_NEVER); - return new JMSBindingReferenceBindingProvider(component, reference, jmsBinding, extensionPoints); + JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory(jmsBinding); + return new JMSBindingReferenceBindingProvider(component, reference, jmsBinding, extensionPoints, jmsRF); } public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, @@ -68,13 +77,17 @@ public class JMSSCABindingProviderFactory implements BindingProviderFactory<Dist DistributedSCABinding binding) { JMSBinding jmsBinding = createBinding(binding); jmsBinding.setDestinationCreate(JMSBindingConstants.CREATE_ALWAYS); - return new JMSBindingServiceBindingProvider(component, service, binding.getSCABinding(), jmsBinding, workScheduler, extensionPoints); + JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory(jmsBinding); + return new JMSBindingServiceBindingProvider(component, service, binding.getSCABinding(), jmsBinding, workScheduler, extensionPoints, jmsRF); } private JMSBinding createBinding(DistributedSCABinding binding) { JMSBinding b = new JMSBinding(); b.setInitialContextFactoryName("org.apache.activemq.jndi.ActiveMQInitialContextFactory"); b.setJndiURL("vm://localhost"); // TODO: plug in jndi url from definitions.xml + + b.setJMSTimeToLive(9); + b.setRequestMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME); b.setResponseMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME); if (binding.getSCABinding().getURI().startsWith("/")) { |