geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r831661 - in /geronimo/server/trunk/plugins/activemq: activemq-broker/src/main/plan/ activemq-broker/src/main/resources/ geronimo-activemq/src/main/java/org/apache/geronimo/activemq/ geronimo-activemq/src/main/java/org/apache/geronimo/activ...
Date Sun, 01 Nov 2009 10:00:04 GMT
Author: xuhaihong
Date: Sun Nov  1 10:00:04 2009
New Revision: 831661

URL: http://svn.apache.org/viewvc?rev=831661&view=rev
Log:
GERONIMO-4941 JMS connector ports are not listed on the console after the server started

Added:
    geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java
  (with props)
Modified:
    geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/resources/activemq-template.xml
    geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/resources/activemq.xml
    geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/management/ActiveMQTransportConnector.java

Modified: geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/plan/plan.xml?rev=831661&r1=831660&r2=831661&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/plan/plan.xml Sun Nov
 1 10:00:04 2009
@@ -38,5 +38,6 @@
             <name>MBeanServerReference</name>
         </reference>
     </gbean>
-
+    
+    <gbean name="ActiveMQBrokerServiceMonitor" class="org.apache.geronimo.activemq.ActiveMQBrokerServiceMonitorGBean"/>
 </module>

Modified: geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/resources/activemq-template.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/resources/activemq-template.xml?rev=831661&r1=831660&r2=831661&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/resources/activemq-template.xml
(original)
+++ geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/resources/activemq-template.xml
Sun Nov  1 10:00:04 2009
@@ -27,7 +27,7 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
  
-  http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
+  http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
     <!-- Allows us to use system properties as variables in this configuration file-->
     <bean class="org.apache.geronimo.activemq.GeronimoPropertyPlaceholderConfigurer">
@@ -196,7 +196,7 @@
       
        http://activemq.apache.org/enterprise-integration-patterns.html
     
-    <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
      -->
      <!--</camelContext>-->
 

Modified: geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/resources/activemq.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/resources/activemq.xml?rev=831661&r1=831660&r2=831661&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/resources/activemq.xml
(original)
+++ geronimo/server/trunk/plugins/activemq/activemq-broker/src/main/resources/activemq.xml
Sun Nov  1 10:00:04 2009
@@ -27,7 +27,7 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
  
-  http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
+  http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
     <!-- Allows us to use system properties as variables in this configuration file-->
     <bean class="org.apache.geronimo.activemq.GeronimoPropertyPlaceholderConfigurer">
@@ -197,7 +197,7 @@
       
        http://activemq.apache.org/enterprise-integration-patterns.html
     
-    <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
      -->
      <!--</camelContext>-->
 

Added: geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java?rev=831661&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java
(added)
+++ geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java
Sun Nov  1 10:00:04 2009
@@ -0,0 +1,130 @@
+/**
+ *  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.geronimo.activemq;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.TransportConnector;
+import org.apache.geronimo.activemq.management.ActiveMQTransportConnector;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.AnnotationGBeanInfoFactory;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.lifecycle.LifecycleListener;
+import org.osgi.framework.BundleContext;
+
+public class ActiveMQBrokerServiceMonitorGBean implements GBeanLifecycle, LifecycleListener
{
+
+    private Kernel kernel;
+
+    private Map<AbstractName, List<AbstractName>> brokerNameConnectorNamesMap
= new ConcurrentHashMap<AbstractName, List<AbstractName>>();
+
+    private BundleContext bundleContext;
+
+    public ActiveMQBrokerServiceMonitorGBean(@ParamSpecial(type = SpecialAttributeType.kernel)
Kernel kernel, @ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext)
{
+        this.kernel = kernel;
+        this.bundleContext = bundleContext;
+    }
+
+    public void doFail() {
+        kernel.getLifecycleMonitor().removeLifecycleListener(this);
+    }
+
+    public void doStart() throws Exception {
+        AbstractNameQuery brokerServiceQuery = new AbstractNameQuery(new URI("?#org.apache.geronimo.activemq.BrokerServiceGBean"));
+        kernel.getLifecycleMonitor().addLifecycleListener(this, brokerServiceQuery);
+        Set<AbstractName> brokerServiceNames = kernel.listGBeans(brokerServiceQuery);
+        for (AbstractName brokerServiceName : brokerServiceNames) {
+            if (kernel.isRunning(brokerServiceName)) {
+                startConnectorWrapperGBeans(brokerServiceName);
+            }
+        }
+    }
+
+    public void doStop() throws Exception {
+        kernel.getLifecycleMonitor().removeLifecycleListener(this);
+    }
+
+    public void failed(AbstractName abstractName) {
+        stopConnectorWrapperGBeans(abstractName);
+    }
+
+    public void loaded(AbstractName abstractName) {
+    }
+
+    public void running(AbstractName abstractName) {
+        startConnectorWrapperGBeans(abstractName);
+    }
+
+    public void starting(AbstractName abstractName) {
+    }
+
+    public void stopped(AbstractName abstractName) {
+        stopConnectorWrapperGBeans(abstractName);
+    }
+
+    public void stopping(AbstractName abstractName) {
+    }
+
+    public void unloaded(AbstractName abstractName) {
+    }
+
+    protected void startConnectorWrapperGBeans(AbstractName brokerAbstractName) {
+        try {
+            BrokerService brokerService = ((BrokerServiceGBean) kernel.getGBean(brokerAbstractName)).getBrokerContainer();
+            List<AbstractName> connectorNames = new ArrayList<AbstractName>();
+            GBeanInfo gBeanInfo = new AnnotationGBeanInfoFactory().getGBeanInfo(ActiveMQTransportConnector.class);
+            for (TransportConnector transportConnector : brokerService.getTransportConnectors())
{
+                AbstractName connectorAbName = kernel.getNaming().createSiblingName(brokerAbstractName,
transportConnector.getUri().toString().replace(':', '_'), GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+                GBeanData gbeanData = new GBeanData(connectorAbName, gBeanInfo);
+                gbeanData.setAttribute("transportConnector", transportConnector);
+                kernel.loadGBean(gbeanData, bundleContext);
+                kernel.startGBean(connectorAbName);
+                connectorNames.add(connectorAbName);
+            }
+            brokerNameConnectorNamesMap.put(brokerAbstractName, connectorNames);
+        } catch (Exception e) {
+        }
+    }
+
+    protected void stopConnectorWrapperGBeans(AbstractName brokerAbstractName) {
+        List<AbstractName> connectorNames = brokerNameConnectorNamesMap.remove(brokerAbstractName);
+        if (connectorNames == null) {
+            return;
+        }
+        for (AbstractName connectorName : connectorNames) {
+            try {
+                kernel.stopGBean(connectorName);
+                kernel.unloadGBean(connectorName);
+            } catch (Exception e) {
+            }
+        }
+    }
+}

Propchange: geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/management/ActiveMQTransportConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/management/ActiveMQTransportConnector.java?rev=831661&r1=831660&r2=831661&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/management/ActiveMQTransportConnector.java
(original)
+++ geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/management/ActiveMQTransportConnector.java
Sun Nov  1 10:00:04 2009
@@ -17,36 +17,36 @@
  * under the License.
  */
 
-
 package org.apache.geronimo.activemq.management;
 
-import java.net.UnknownHostException;
 import java.net.InetSocketAddress;
-import java.net.URISyntaxException;
-import java.io.IOException;
+import java.net.UnknownHostException;
 
-import org.apache.geronimo.activemq.ActiveMQConnector;
 import org.apache.activemq.broker.TransportConnector;
+import org.apache.geronimo.activemq.ActiveMQConnector;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
+@GBean(name="ActiveMQ Transport Connector")
 public class ActiveMQTransportConnector implements ActiveMQConnector {
 
     private static final Logger log = LoggerFactory.getLogger(ActiveMQTransportConnector.class);
 
     private final TransportConnector transportConnector;
 
-    public ActiveMQTransportConnector(TransportConnector transportConnector) {
+    public ActiveMQTransportConnector(@ParamAttribute(manageable = false, name = "transportConnector")
TransportConnector transportConnector) {
         this.transportConnector = transportConnector;
     }
 
     // Additional stuff you can add to an ActiveMQ connector URI
     public String getPath() {
         try {
-            return transportConnector.getConnectUri().toString();
+            return transportConnector.getUri().toString();
         } catch (Exception e) {
             log.warn("error", e);
             return "Error: " + e.getMessage();
@@ -60,7 +60,7 @@
     //????
     public String getQuery() {
         try {
-            return transportConnector.getConnectUri().getQuery();
+            return transportConnector.getUri().getQuery();
         } catch (Exception e) {
             log.warn("error", e);
             return "Error: " + e.getMessage();
@@ -76,7 +76,7 @@
      */
     public String getProtocol() {
         try {
-            return transportConnector.getConnectUri().getScheme();
+            return transportConnector.getUri().getScheme();
         } catch (Exception e) {
             log.warn("error", e);
             return "Error: " + e.getMessage();
@@ -88,7 +88,7 @@
      */
     public int getPort() {
         try {
-            return transportConnector.getConnectUri().getPort();
+            return transportConnector.getUri().getPort();
         } catch (Exception e) {
             log.warn("error", e);
             return -1;
@@ -107,7 +107,7 @@
      */
     public String getHost() {
         try {
-            return transportConnector.getConnectUri().getHost();
+            return transportConnector.getUri().getHost();
         } catch (Exception e) {
             log.warn("error", e);
             return "Error: " + e.getMessage();



Mime
View raw message