activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r516117 - in /activemq/trunk/activemq-web-console/src/main: java/org/apache/activemq/web/ java/org/apache/activemq/web/controller/ webapp/ webapp/WEB-INF/
Date Thu, 08 Mar 2007 17:47:43 GMT
Author: jstrachan
Date: Thu Mar  8 09:47:38 2007
New Revision: 516117

URL: http://svn.apache.org/viewvc?view=rev&rev=516117
Log:
added support for message deletion on the web console to fix AMQ-1197

Added:
    activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/DeleteMessage.java
  (with props)
Modified:
    activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/BrokerFacade.java
    activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
    activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/DestinationFacade.java
    activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml
    activemq/trunk/activemq-web-console/src/main/webapp/browse.jsp

Modified: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/BrokerFacade.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/BrokerFacade.java?view=diff&rev=516117&r1=516116&r2=516117
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/BrokerFacade.java
(original)
+++ activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/BrokerFacade.java
Thu Mar  8 09:47:38 2007
@@ -18,6 +18,8 @@
 package org.apache.activemq.web;
 
 import org.apache.activemq.broker.jmx.BrokerViewMBean;
+import org.apache.activemq.broker.jmx.QueueViewMBean;
+import org.apache.activemq.broker.jmx.TopicViewMBean;
 import org.apache.activemq.command.ActiveMQDestination;
 
 import java.util.Collection;
@@ -43,4 +45,8 @@
      * @throws Exception
      */
     void purgeQueue(ActiveMQDestination destination) throws Exception;
+
+    QueueViewMBean getQueue(String name) throws Exception;
+
+    TopicViewMBean getTopic(String name) throws Exception;
 }

Modified: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java?view=diff&rev=516117&r1=516116&r2=516117
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
(original)
+++ activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
Thu Mar  8 09:47:38 2007
@@ -22,6 +22,7 @@
 import org.apache.activemq.broker.jmx.ManagementContext;
 import org.apache.activemq.broker.jmx.TopicViewMBean;
 import org.apache.activemq.broker.jmx.QueueViewMBean;
+import org.apache.activemq.broker.jmx.DestinationViewMBean;
 
 import javax.management.MBeanServer;
 import javax.management.MBeanServerInvocationHandler;
@@ -30,6 +31,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Iterator;
 
 /**
  * A useful base class for an implementation of {@link BrokerFacade}
@@ -64,6 +66,25 @@
         }
         ObjectName[] queues = broker.getDurableTopicSubscribers();
         return getManagedObjects(queues, DurableSubscriptionViewMBean.class);
+    }
+
+    public QueueViewMBean getQueue(String name) throws Exception {
+        return (QueueViewMBean) getDestinationByName(getQueues(), name);
+    }
+
+    public TopicViewMBean getTopic(String name) throws Exception {
+        return (TopicViewMBean) getDestinationByName(getTopics(), name);
+    }
+
+    protected DestinationViewMBean getDestinationByName(Collection collection, String name)
{
+        Iterator iter = collection.iterator();
+        while (iter.hasNext()) {
+            DestinationViewMBean destinationViewMBean = (DestinationViewMBean) iter.next();
+            if (name.equals(destinationViewMBean.getName())) {
+                return destinationViewMBean;
+            }
+        }
+        return null;
     }
 
     protected Collection getManagedObjects(ObjectName[] names, Class type) {

Modified: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/DestinationFacade.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/DestinationFacade.java?view=diff&rev=516117&r1=516116&r2=516117
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/DestinationFacade.java
(original)
+++ activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/DestinationFacade.java
Thu Mar  8 09:47:38 2007
@@ -99,12 +99,8 @@
     }
 
     protected ActiveMQDestination createDestination() {
-        if (isQueue()) {
-            return new ActiveMQQueue(getValidDestination());
-        }
-        else {
-            return new ActiveMQTopic(getValidDestination());
-        }
+        byte destinationType = isQueue() ? ActiveMQDestination.QUEUE_TYPE : ActiveMQDestination.TOPIC_TYPE;
+        return ActiveMQDestination.createDestination(getValidDestination(), destinationType);
     }
 
     protected String getValidDestination() {
@@ -126,5 +122,7 @@
         return new ModelAndView("redirect:" + (isQueue() ? "queues.jsp" : "topics.jsp"));
     }
 
-
+    protected String getPhysicalDestinationName() {
+        return createDestination().getPhysicalName();
+    }
 }

Added: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/DeleteMessage.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/DeleteMessage.java?view=auto&rev=516117
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/DeleteMessage.java
(added)
+++ activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/DeleteMessage.java
Thu Mar  8 09:47:38 2007
@@ -0,0 +1,66 @@
+/**
+ *
+ * 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.activemq.web.controller;
+
+import org.apache.activemq.broker.jmx.QueueViewMBean;
+import org.apache.activemq.web.BrokerFacade;
+import org.apache.activemq.web.DestinationFacade;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.Controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @version $Revision$
+ */
+public class DeleteMessage extends DestinationFacade implements Controller {
+    private String messageId;
+
+    public DeleteMessage(BrokerFacade brokerFacade) {
+        super(brokerFacade);
+    }
+
+    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws Exception {
+        if (messageId != null) {
+            QueueViewMBean queueView = getQueue();
+            if (queueView != null) {
+                System.out.println("#### removing message: " + messageId);
+                queueView.removeMessage(messageId);
+            }
+            else {
+                System.out.println("#### NO QUEUE!");
+            }
+        }
+        return redirectToBrowseView();
+    }
+
+    public String getMessageId() {
+        return messageId;
+    }
+
+    public void setMessageId(String messageId) {
+        this.messageId = messageId;
+    }
+
+    protected QueueViewMBean getQueue() throws Exception {
+        String name = getPhysicalDestinationName();
+        System.out.println("####ĂŠlooking up queue: " + name);
+        return getBrokerFacade().getQueue(name);
+    }
+}

Propchange: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/DeleteMessage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/DeleteMessage.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/DeleteMessage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml?view=diff&rev=516117&r1=516116&r2=516117
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml Thu
Mar  8 09:47:38 2007
@@ -32,7 +32,8 @@
   <bean name="/deleteSubscriber.action" class="org.apache.activemq.web.controller.DeleteSubscriber"
autowire="constructor"  singleton="false"/>
   <bean name="/sendMessage.action" class="org.apache.activemq.web.controller.SendMessage"
autowire="constructor"  singleton="false"/>
   <bean name="/purgeDestination.action" class="org.apache.activemq.web.controller.PurgeDestination"
autowire="constructor"  singleton="false"/>
-  
+  <bean name="/deleteMessage.action" class="org.apache.activemq.web.controller.DeleteMessage"
autowire="constructor"  singleton="false"/>
+
   <!--
     - This bean resolves specific types of exception to corresponding error views.
     - The default behaviour of DispatcherServlet is to propagate all exceptions to the

Modified: activemq/trunk/activemq-web-console/src/main/webapp/browse.jsp
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/browse.jsp?view=diff&rev=516117&r1=516116&r2=516117
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/browse.jsp (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/browse.jsp Thu Mar  8 09:47:38 2007
@@ -52,7 +52,7 @@
 <td>${row.JMSTimestamp}</td>
 <td>${row.JMSType}</td>
 <td>
-    <a href="deleteDestination.action?JMSDestination=${row.JMSDestination}">Delete</a>
+    <a href="deleteMessage.action?JMSDestination=${row.JMSDestination}&messageId=${row.JMSMessageID}">Delete</a>
 </td>
 </tr>
 </jms:forEachMessage>



Mime
View raw message