diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-16 12:45:54 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-16 12:45:54 +0000 |
commit | 99a63d6cbed9e5ec00f6ac414a6d2ed3baabef12 (patch) | |
tree | f853bee8f6cafc11440fd67d6d7ce392f2f0f861 /java | |
parent | 6109b6819a0186526b7d7b9088089137eba3a35e (diff) |
start at getting jms sca binding to use a native amq broker
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@705230 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
4 files changed, 75 insertions, 11 deletions
diff --git a/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/AMQJMSResourceFactory.java b/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/AMQJMSResourceFactory.java new file mode 100644 index 0000000000..3216e51d6e --- /dev/null +++ b/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/AMQJMSResourceFactory.java @@ -0,0 +1,39 @@ +/*
+ * 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.sca.jms;
+
+import javax.jms.JMSException;
+import javax.naming.NamingException;
+
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryImpl;
+
+public class AMQJMSResourceFactory extends JMSResourceFactoryImpl {
+
+ public AMQJMSResourceFactory(String connectionFactoryName, String initialContextFactoryName, String jndiURL) {
+ super(connectionFactoryName, initialContextFactoryName, jndiURL);
+ }
+
+ @Override
+ protected void createConnection() throws NamingException, JMSException {
+ super.createConnection();
+ ((ActiveMQConnection)connection).setWatchTopicAdvisories(false);
+ }
+}
diff --git a/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/AMQResourceFactoryExtensionPoint.java b/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/AMQResourceFactoryExtensionPoint.java new file mode 100644 index 0000000000..f1acdd8190 --- /dev/null +++ b/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/AMQResourceFactoryExtensionPoint.java @@ -0,0 +1,32 @@ +/*
+ * 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.sca.jms;
+
+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;
+
+public class AMQResourceFactoryExtensionPoint implements JMSResourceFactoryExtensionPoint{
+
+ public JMSResourceFactory createJMSResourceFactory(JMSBinding binding) {
+ return new AMQJMSResourceFactory(binding.getConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL());
+ }
+
+}
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 dc81f1dbab..28e7ff9797 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,9 +19,7 @@ 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;
@@ -40,7 +38,6 @@ public class JMSBroker implements ModuleActivator { public void start(ExtensionPointRegistry arg0) {
if (broker == null) {
- ps();
broker = new BrokerService();
broker.setPersistent(false);
broker.setUseJmx(false);
@@ -71,11 +68,8 @@ 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());
+ public static BrokerService getBroker() {
+ return broker;
}
+
}
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 caad644748..d839602198 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,7 +21,6 @@ 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; @@ -53,7 +52,7 @@ public class JMSSCABindingProviderFactory implements BindingProviderFactory<Dist assert workScheduler != null; jmsRFEP = (JMSResourceFactoryExtensionPoint)extensionPoints.getExtensionPoint(JMSResourceFactoryExtensionPoint.class); if (jmsRFEP == null) { - jmsRFEP = new DefaultJMSResourceFactoryExtensionPoint(); + jmsRFEP = new AMQResourceFactoryExtensionPoint(); } } |