activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject git commit: https://issues.apache.org/jira/browse/AMQ-5239
Date Tue, 24 Jun 2014 15:19:47 GMT
Repository: activemq
Updated Branches:
  refs/heads/trunk bbd61084e -> d9b03acff


https://issues.apache.org/jira/browse/AMQ-5239

Add a getter for the BrokerService map.

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/d9b03acf
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/d9b03acf
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/d9b03acf

Branch: refs/heads/trunk
Commit: d9b03acffbbab90dc0b0a1922d28c60893624348
Parents: bbd6108
Author: Timothy Bish <tabish121@gmail.com>
Authored: Tue Jun 24 11:18:58 2014 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Tue Jun 24 11:18:58 2014 -0400

----------------------------------------------------------------------
 .../activemq/osgi/ActiveMQServiceFactory.java   | 32 ++++++++++++--------
 1 file changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/d9b03acf/activemq-osgi/src/main/java/org/apache/activemq/osgi/ActiveMQServiceFactory.java
----------------------------------------------------------------------
diff --git a/activemq-osgi/src/main/java/org/apache/activemq/osgi/ActiveMQServiceFactory.java
b/activemq-osgi/src/main/java/org/apache/activemq/osgi/ActiveMQServiceFactory.java
index 16da689..430a300 100644
--- a/activemq-osgi/src/main/java/org/apache/activemq/osgi/ActiveMQServiceFactory.java
+++ b/activemq-osgi/src/main/java/org/apache/activemq/osgi/ActiveMQServiceFactory.java
@@ -16,6 +16,13 @@
  */
 package org.apache.activemq.osgi;
 
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.spring.SpringBrokerContext;
 import org.apache.activemq.spring.Utils;
@@ -29,8 +36,6 @@ import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.Resource;
 
-import java.util.*;
-
 public class ActiveMQServiceFactory implements ManagedServiceFactory {
 
     private static final Logger LOG = LoggerFactory.getLogger(ActiveMQServiceFactory.class);
@@ -43,17 +48,22 @@ public class ActiveMQServiceFactory implements ManagedServiceFactory {
         return "ActiveMQ Server Controller";
     }
 
+    public Map<String, BrokerService> getBrokersMap() {
+        return Collections.unmodifiableMap(brokers);
+    }
+
+    @SuppressWarnings("rawtypes")
     @Override
     synchronized public void updated(String pid, Dictionary properties) throws ConfigurationException
{
 
         // First stop currently running broker (if any)
         deleted(pid);
 
-        String config = (String)properties.get("config");
+        String config = (String) properties.get("config");
         if (config == null) {
             throw new ConfigurationException("config", "Property must be set");
         }
-        String name = (String)properties.get("broker-name");
+        String name = (String) properties.get("broker-name");
         if (name == null) {
             throw new ConfigurationException("broker-name", "Property must be set");
         }
@@ -65,18 +75,18 @@ public class ActiveMQServiceFactory implements ManagedServiceFactory {
             Resource resource = Utils.resourceFromString(config);
 
             ResourceXmlApplicationContext ctx = new ResourceXmlApplicationContext(resource,
Collections.EMPTY_LIST, null, Collections.EMPTY_LIST, false) {
+                @Override
                 protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
                     reader.setValidating(false);
                 }
             };
 
             // Handle properties in configuration
-            PropertyPlaceholderConfigurer configurator =
-                        new PropertyPlaceholderConfigurer();
+            PropertyPlaceholderConfigurer configurator = new PropertyPlaceholderConfigurer();
 
-            //convert dictionary to properties. Is there a better way?
+            // convert dictionary to properties. Is there a better way?
             Properties props = new Properties();
-            Enumeration elements = properties.keys();
+            Enumeration<?> elements = properties.keys();
             while (elements.hasMoreElements()) {
                 Object key = elements.nextElement();
                 props.put(key, properties.get(key));
@@ -94,7 +104,7 @@ public class ActiveMQServiceFactory implements ManagedServiceFactory {
             if (broker == null) {
                 throw new ConfigurationException(null, "Broker not defined");
             }
-            //TODO deal with multiple brokers
+            // TODO deal with multiple brokers
 
             SpringBrokerContext brokerContext = new SpringBrokerContext();
             brokerContext.setConfigurationUrl(resource.getURL().toExternalForm());
@@ -104,8 +114,6 @@ public class ActiveMQServiceFactory implements ManagedServiceFactory {
             broker.start();
             broker.waitUntilStarted();
             brokers.put(pid, broker);
-
-
         } catch (Exception e) {
             throw new ConfigurationException(null, "Cannot start the broker", e);
         }
@@ -127,7 +135,7 @@ public class ActiveMQServiceFactory implements ManagedServiceFactory {
     }
 
     synchronized public void destroy() {
-        for (String broker: brokers.keySet()) {
+        for (String broker : brokers.keySet()) {
             deleted(broker);
         }
     }


Mime
View raw message