activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r504257 - in /activemq/trunk/activemq-web-console/src/main: java/org/apache/activemq/web/JMXBrokerFacade.java webapp/WEB-INF/applicationContext.xml webapp/queueGraph.jsp webapp/xml/queues.jsp
Date Tue, 06 Feb 2007 19:46:34 GMT
Author: jstrachan
Date: Tue Feb  6 11:46:33 2007
New Revision: 504257

URL: http://svn.apache.org/viewvc?view=rev&rev=504257
Log:
not far off getting the web console working with remote brokers

Modified:
    activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/JMXBrokerFacade.java
    activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml
    activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp
    activemq/trunk/activemq-web-console/src/main/webapp/xml/queues.jsp

Modified: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/JMXBrokerFacade.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/JMXBrokerFacade.java?view=diff&rev=504257&r1=504256&r2=504257
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/JMXBrokerFacade.java
(original)
+++ activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/JMXBrokerFacade.java
Tue Feb  6 11:46:33 2007
@@ -21,7 +21,10 @@
 import org.apache.activemq.broker.jmx.ManagementContext;
 import org.apache.activemq.command.ActiveMQDestination;
 
-import java.util.Collection;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 
 /**
  * A {@link BrokerFacade} which uses JMX to communicate with a remote broker
@@ -30,9 +33,11 @@
  */
 public class JMXBrokerFacade extends BrokerFacadeSupport {
     private ManagementContext managementContext;
+    private ObjectName brokerName;
 
     public BrokerViewMBean getBrokerAdmin() throws Exception {
-        return null;  /** TODO */
+        MBeanServerConnection mbeanServer = getManagementContext().getMBeanServer();
+        return (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
getBrokerName(), BrokerViewMBean.class, true);
     }
 
     public void purgeQueue(ActiveMQDestination destination) throws Exception {
@@ -42,11 +47,27 @@
     public ManagementContext getManagementContext() {
         if (managementContext == null) {
             managementContext = new ManagementContext();
+            managementContext.setCreateConnector(true);
         }
         return managementContext;
     }
 
     public void setManagementContext(ManagementContext managementContext) {
         this.managementContext = managementContext;
+    }
+
+    public ObjectName getBrokerName() throws MalformedObjectNameException {
+        if (brokerName == null) {
+            brokerName = createBrokerName();
+        }
+        return brokerName;
+    }
+
+    public void setBrokerName(ObjectName brokerName) {
+        this.brokerName = brokerName;
+    }
+
+    protected ObjectName createBrokerName() throws MalformedObjectNameException {
+        return new ObjectName(getManagementContext().getJmxDomainName() + ":Type=Broker");
     }
 }

Modified: activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml?view=diff&rev=504257&r1=504256&r2=504257
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml Tue
Feb  6 11:46:33 2007
@@ -21,13 +21,20 @@
   <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
/>
   
   
-	<bean id="brokerService" class="org.apache.activemq.xbean.BrokerFactoryBean">
-	  <property name="config" value="/WEB-INF/activemq.xml"/>
-	</bean>
-
   <bean id="sessionPool" class="org.apache.activemq.web.SessionPool"/>
   
+  <!-- use the following bean for a local in-JVM broker -->
+
   <bean id="brokerQuery" class="org.apache.activemq.web.LocalBrokerFacade" autowire='constructor'
singleton="false"/>
+
+  <bean id="brokerService" class="org.apache.activemq.xbean.BrokerFactoryBean">
+    <property name="config" value="/WEB-INF/activemq.xml"/>
+  </bean>
+
+  <!-- use the following for a remote JMX based broker -->
+  <!--<bean id="brokerQuery" class="org.apache.activemq.web.JMXBrokerFacade" autowire='constructor'
singleton="false"/>-->
+
+
   <bean id="queueBrowser" class="org.apache.activemq.web.QueueBrowseQuery" autowire='constructor'
singleton="false"/>
   <bean id="messageQuery" class="org.apache.activemq.web.MessageQuery" autowire='constructor'
singleton="false"/>
 

Modified: activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp?view=diff&rev=504257&r1=504256&r2=504257
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp Tue Feb  6 11:46:33
2007
@@ -42,7 +42,7 @@
     var layout = new PlotKit.Layout("bar", options);
     
     layout.addDataset("sqrt",  [<c:forEach items="${requestContext.brokerQuery.queues}"
var="row" varStatus="status"><c:if 
-         test="${status.count > 1}">, </c:if> [${status.count},  ${row.destinationStatistics.messages.count}]
</c:forEach> ]);
+         test="${status.count > 1}">, </c:if> [${status.count},  ${row.queueSize}]
</c:forEach> ]);
     layout.evaluate();
     
     var canvas = MochiKit.DOM.getElement("graph");

Modified: activemq/trunk/activemq-web-console/src/main/webapp/xml/queues.jsp
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/xml/queues.jsp?view=diff&rev=504257&r1=504256&r2=504257
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/xml/queues.jsp (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/xml/queues.jsp Tue Feb  6 11:46:33
2007
@@ -19,10 +19,10 @@
 <c:forEach items="${requestContext.brokerQuery.queues}" var="row">
 <queue name="${row.name}">
 
-  <stats size="${row.destinationStatistics.messages.count}"
-         consumerCount="${row.destinationStatistics.consumers.count}"
-         enqueueCount="${row.destinationStatistics.enqueues.count}"
-         dequeueCount="${row.destinationStatistics.dequeues.count}"/>
+  <stats size="${row.queueSize}"
+         consumerCount="${row.consumerCount}"
+         enqueueCount="${row.enqueueCount}"
+         dequeueCount="${row.dequeueCount}"/>
 
 
   <feed>



Mime
View raw message