tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r609163 - in /incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq: ActiveMQBroker.java ActiveMQHost.java ActiveMQModuleActivator.java JMSResourceFactoryImpl.java
Date Sat, 05 Jan 2008 16:08:12 GMT
Author: antelder
Date: Sat Jan  5 08:08:11 2008
New Revision: 609163

URL: http://svn.apache.org/viewvc?rev=609163&view=rev
Log:
Support either inbedded activemq broker or external jms broker

Added:
    incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQBroker.java
      - copied, changed from r609123, incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQHost.java
Removed:
    incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQHost.java
Modified:
    incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQModuleActivator.java
    incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/JMSResourceFactoryImpl.java

Copied: incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQBroker.java
(from r609123, incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQHost.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQBroker.java?p2=incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQBroker.java&p1=incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQHost.java&r1=609123&r2=609163&rev=609163&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQHost.java
(original)
+++ incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQBroker.java
Sat Jan  5 08:08:11 2008
@@ -22,17 +22,18 @@
 
 /**
  */
-public class ActiveMQHost {
+public class ActiveMQBroker {
 
+    public static final String CONNECTOR_URL = "tcp://localhost:61619";
     private BrokerService broker;
 
-    public ActiveMQHost() {
+    public ActiveMQBroker() {
     }
 
     public void start() {
         broker = new BrokerService();
         try {
-            broker.addConnector("tcp://localhost:61616");
+            broker.addConnector(CONNECTOR_URL);
             broker.start();
         } catch ( Exception e) {
             e.printStackTrace();

Modified: incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQModuleActivator.java?rev=609163&r1=609162&r2=609163&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQModuleActivator.java
(original)
+++ incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/ActiveMQModuleActivator.java
Sat Jan  5 08:08:11 2008
@@ -24,7 +24,7 @@
 
 public class ActiveMQModuleActivator implements ModuleActivator {
 
-    private static ActiveMQHost activeMQHost;
+    private static ActiveMQBroker activeMQHost;
 
     public void start(ExtensionPointRegistry registry) {
     }
@@ -38,7 +38,7 @@
 
     public static void startBroker() {
         if (activeMQHost == null) {
-            activeMQHost = new ActiveMQHost();
+            activeMQHost = new ActiveMQBroker();
             activeMQHost.start();
         }
     }

Modified: incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/JMSResourceFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/JMSResourceFactoryImpl.java?rev=609163&r1=609162&r2=609163&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/JMSResourceFactoryImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/host-jms-activemq/src/main/java/org/apache/tuscany/sca/host/jms/activemq/JMSResourceFactoryImpl.java
Sat Jan  5 08:08:11 2008
@@ -36,9 +36,10 @@
  */
 public class JMSResourceFactoryImpl implements JMSResourceFactory {
 
-    private String initialContextFactoryName = "org.apache.activemq.jndi.ActiveMQInitialContextFactory";
+    private static final String DEFAULT_ICFN = "org.apache.activemq.jndi.ActiveMQInitialContextFactory";
+    private String initialContextFactoryName = DEFAULT_ICFN;
     private String connectionFactoryName = "ConnectionFactory";
-    private String jndiURL = "tcp://localhost:61616";
+    private String jndiURL = ActiveMQBroker.CONNECTOR_URL;
     
     private Connection connection;
     private Context context;
@@ -103,8 +104,18 @@
     }
 
     public void startBroker() {
-        // ensure the broker has been started
-        ActiveMQModuleActivator.startBroker();
+        if (isEmbedded()) {
+            // ensure the broker has been started
+            ActiveMQModuleActivator.startBroker();
+        }
+    }
+
+    /**
+     * TODO: need to find a way to determine whether or not need to start the embedded broker
+     * for now it always starts it if the activemq icf is being used with our default jndiurl
+     */
+    protected boolean isEmbedded() {
+        return DEFAULT_ICFN.equals(initialContextFactoryName) && ActiveMQBroker.CONNECTOR_URL.equals(jndiURL);
     }
 
     private void createConnection() throws NamingException, JMSException {



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message