You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2006/04/26 19:00:05 UTC

svn commit: r397237 - in /incubator/activemq/trunk/activemq-web-console/src/main: java/org/apache/activemq/web/ webapp/ webapp/WEB-INF/ webapp/WEB-INF/tags/form/ webapp/WEB-INF/tags/jms/ webapp/styles/

Author: jstrachan
Date: Wed Apr 26 10:00:01 2006
New Revision: 397237

URL: http://svn.apache.org/viewcvs?rev=397237&view=rev
Log:
added a message detail page

Added:
    incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/MessageQuery.java
      - copied, changed from r397217, incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/MessageFacade.java
    incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/tags/form/forEachMapEntry.tag
    incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/layouttable.css   (with props)
Removed:
    incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/MessageFacade.java
    incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/tags/jms/body.tag
Modified:
    incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/QueueBrowseQuery.java
    incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml
    incubator/activemq/trunk/activemq-web-console/src/main/webapp/browse.jsp
    incubator/activemq/trunk/activemq-web-console/src/main/webapp/message.jsp
    incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/sorttable.css

Copied: incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/MessageQuery.java (from r397217, incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/MessageFacade.java)
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/MessageQuery.java?p2=incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/MessageQuery.java&p1=incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/MessageFacade.java&r1=397217&r2=397237&rev=397237&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/MessageFacade.java (original)
+++ incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/MessageQuery.java Wed Apr 26 10:00:01 2006
@@ -17,27 +17,99 @@
 package org.apache.activemq.web;
 
 import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.command.ActiveMQMessage;
 
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
 import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
 
 /**
- *
+ * Allow the user to browse a message on a queue by its ID
+ * 
  * @version $Revision$
  */
-public class MessageFacade extends BrokerFacade {
+public class MessageQuery extends QueueBrowseQuery {
 
     private String id;
-    private ActiveMQMessage message;
-    
-    public MessageFacade(BrokerService brokerService) {
-        super(brokerService);
+    private Message message;
+
+    public MessageQuery(BrokerService brokerService, SessionPool sessionPool) throws JMSException {
+        super(brokerService, sessionPool);
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setMessage(Message message) {
+        this.message = message;
     }
 
-    public ActiveMQMessage getMessage() {
-        if (message != null) {
-            // TODO ??
+    public Message getMessage() throws JMSException {
+        if (message == null) {
+            if (id != null) {
+                Enumeration iter = getBrowser().getEnumeration();
+                while (iter.hasMoreElements()) {
+                    Message item = (Message) iter.nextElement();
+                    if (id.equals(item.getJMSMessageID())) {
+                        message = item;
+                        break;
+                    }
+                }
+            }
+
         }
         return message;
+    }
+
+    public Object getBody() throws JMSException {
+        Message message = getMessage();
+        if (message instanceof TextMessage) {
+            return ((TextMessage) message).getText();
+        }
+        if (message instanceof ObjectMessage) {
+            return ((ObjectMessage) message).getObject();
+        }
+        if (message instanceof MapMessage) {
+            return createMapBody((MapMessage) message);
+        }
+        return null;
+    }
+
+    public Map getPropertiesMap() throws JMSException {
+        Map answer = new HashMap();
+        Message aMessage = getMessage();
+        Enumeration iter = aMessage.getPropertyNames();
+        while (iter.hasMoreElements()) {
+            String name = (String) iter.nextElement();
+            Object value = aMessage.getObjectProperty(name);
+            if (value != null) {
+                answer.put(name, value);
+            }
+        }
+        return answer;
+    }
+
+    protected Map createMapBody(MapMessage mapMessage) throws JMSException {
+        Map answer = new HashMap();
+        Enumeration iter = mapMessage.getMapNames();
+        while (iter.hasMoreElements()) {
+            String name = (String) iter.nextElement();
+            Object value = mapMessage.getObject(name);
+            if (value != null) {
+                answer.put(name, value);
+            }
+        }
+        return answer;
     }
 }

Modified: incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/QueueBrowseQuery.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/QueueBrowseQuery.java?rev=397237&r1=397236&r2=397237&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/QueueBrowseQuery.java (original)
+++ incubator/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/QueueBrowseQuery.java Wed Apr 26 10:00:01 2006
@@ -39,7 +39,7 @@
         super(brokerService);
         this.sessionPool = sessionPool;
         this.session = sessionPool.borrowSession();
-
+        setJMSDestinationType("query");
     }
 
     public void destroy() throws Exception {

Modified: incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml?rev=397237&r1=397236&r2=397237&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml (original)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml Wed Apr 26 10:00:01 2006
@@ -11,7 +11,8 @@
 
   <bean id="sessionPool" class="org.apache.activemq.web.SessionPool"/>
   
-  <bean id="brokerQuery" class="org.apache.activemq.web.BrokerFacade" autowire='constructor'/>
+  <bean id="brokerQuery" class="org.apache.activemq.web.BrokerFacade" 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"/>
 
 </beans>

Added: incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/tags/form/forEachMapEntry.tag
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/tags/form/forEachMapEntry.tag?rev=397237&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/tags/form/forEachMapEntry.tag (added)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/tags/form/forEachMapEntry.tag Wed Apr 26 10:00:01 2006
@@ -0,0 +1,13 @@
+<%@ attribute name="var" type="java.lang.String" required="true"  %>
+<%@ attribute name="items" type="java.util.Map" required="true"  %>
+<%@ tag import="java.util.Iterator" %>
+<%
+  Iterator iter = items.entrySet().iterator();
+  while (iter.hasNext()) {
+  		 request.setAttribute(var, iter.next());
+%>
+<jsp:doBody/>
+<%
+	}
+%>       
+    
\ No newline at end of file

Modified: incubator/activemq/trunk/activemq-web-console/src/main/webapp/browse.jsp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/browse.jsp?rev=397237&r1=397236&r2=397237&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/browse.jsp (original)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/browse.jsp Wed Apr 26 10:00:01 2006
@@ -26,8 +26,8 @@
 ---%>
 <jms:forEachMessage queueBrowser="${requestContext.queueBrowser.browser}" var="row">
 <tr>
-<jms:body message="${row}" var="body"/>
-<td><a href="message.jsp?id=${row.JMSMessageID}" title="${body}">${row.JMSMessageID}</a></td>
+<td><a href="message.jsp?id=${row.JMSMessageID}&JMSDestination=${requestContext.queueBrowser.JMSDestination}" 
+    title="${row.properties}">${row.JMSMessageID}</a></td>
 <td>${row.JMSCorrelationID}</td>
 <td><jms:persistent message="${row}"/></td>
 <td>${row.JMSPriority}</td>

Modified: incubator/activemq/trunk/activemq-web-console/src/main/webapp/message.jsp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/message.jsp?rev=397237&r1=397236&r2=397237&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/message.jsp (original)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/message.jsp Wed Apr 26 10:00:01 2006
@@ -1,57 +1,121 @@
 <html>
 <head>
-<title>Message ${requestContext.messageBrowser.id}</title>
+<c:set var="row" value="${requestContext.messageQuery.message}"/>
+<title>Message ${requestContext.messageQuery.id}</title>
 </head>
 <body>
 
-<table id="message" class="sortable autostripe">
-<thead>
-<tr>
-<th>
-    Message Details
-</th>
-</tr>
-</thead>
-
-<tbody>
-<tr>
-<td class="label">Message ID</td>
-<td>${row.JMSMessageID</td>
-</tr>
-<tr>
-<td class="label">Destination</td>
-<td>${row.JMSDestination}</td>
-</tr>
-<tr>
-<td class="label">Correlation ID</td>
-<td>${row.JMSCorrelationID}</td>
-</tr>
-<tr>
-<td class="label">Persistence</td>
-<td><jms:persistent message="${row}"/></td>
-</tr>
-<tr>
-<td class="label">Priority</td>
-<td>${row.JMSPriority}</td>
-</tr>
-<tr>
-<td class="label">Redelivered</td>
-<td>${row.JMSRedelivered}</td>
-</tr>
-<tr>
-<td class="label">Reply To</td>
-<td>${row.JMSReplyTo}</td>
-</tr>
-<tr>
-<td class="label">Timestamp</td>
-<td>${row.JMSTimestamp}</td>
-</tr>
-<tr>
-<td class="label">Type</td>
-<td>${row.JMSType}</td>
-</tr>
-</tbody>
+
+<c:choose>
+<c:when test="${empty row}">
+
+<div>
+No message could be found for ID ${requestContext.messageQuery.JMSMessageID}
+</div>
+
+</c:when>
+
+<c:otherwise>
+
+<table class="layout">
+	<tr>
+		<td class="layout"  valign="top">
+			<table id="header" class="sortable autostripe">
+				<thead>
+					<tr>
+						<th colspan="2">
+						    Headers
+						</th>
+					</tr>
+				</thead>
+				<tbody>
+					<tr>
+						<td class="label">Message ID</td>
+						<td>${row.JMSMessageID}</td>
+					</tr>
+					<tr>
+						<td class="label">Destination</td>
+						<td>${row.JMSDestination}</td>
+					</tr>
+					<tr>
+						<td class="label">Correlation ID</td>
+						<td>${row.JMSCorrelationID}</td>
+					</tr>
+					<tr>
+						<td class="label">Persistence</td>
+						<td><jms:persistent message="${row}"/></td>
+					</tr>
+					<tr>
+						<td class="label">Priority</td>
+						<td>${row.JMSPriority}</td>
+					</tr>
+					<tr>
+						<td class="label">Redelivered</td>
+					    <td>${row.JMSRedelivered}</td>
+					</tr>
+					<tr>
+						<td class="label">Reply To</td>
+						<td>${row.JMSReplyTo}</td>
+					</tr>
+					<tr>
+						<td class="label">Timestamp</td>
+						<td>${row.JMSTimestamp}</td>
+					</tr>
+					<tr>
+						<td class="label">Type</td>
+						<td>${row.JMSType}</td>
+					</tr>
+				</tbody>
+			</table>
+        </td>
+
+        <td  class="layout" valign="top">
+			<table id="properties" class="sortable autostripe">
+				<thead>
+					<tr>
+						<th colspan="2">
+						    Properties
+						</th>
+					</tr>
+				</thead>
+				<tbody>
+                   <form:forEachMapEntry items="${requestContext.messageQuery.propertiesMap}" var="row">
+						<tr>
+							<td class="label">${row.key}</td>
+							<td>${row.value}</td>
+						</tr>
+						<tr>
+					</form:forEachMapEntry>
+				</tbody>
+			</table>
+		</td>
+	</tr>
+	<tr>
+		<td class="layout" colspan="2">
+			<table id="body" width="100%">
+				<thead>
+					<tr>
+						<th>
+						    Message Details
+						</th>
+					</tr>
+				</thead>
+				<tbody>
+					<tr>
+						<td>${requestContext.messageQuery.body}</td>
+					</tr>
+				</tbody>
+			</table>
+		</td>
+	</tr>
 </table>
+
+
+</c:otherwise>
+</c:choose>
+
+
+
 
 
 </body>

Added: incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/layouttable.css
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/layouttable.css?rev=397237&view=auto
==============================================================================
    (empty)

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/layouttable.css
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/layouttable.css
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/layouttable.css
------------------------------------------------------------------------------
    svn:mime-type = text/css

Modified: incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/sorttable.css
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/sorttable.css?rev=397237&r1=397236&r2=397237&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/sorttable.css (original)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/styles/sorttable.css Wed Apr 26 10:00:01 2006
@@ -7,9 +7,8 @@
   border-right: 1px solid #aaa;
   margin-bottom: 1em;
   
-width: 80%;
-margin: 1em auto;
-border-collapse: collapse;
+ margin: 1em auto;
+ border-collapse: collapse;
 }
 
 th {
@@ -19,13 +18,15 @@
 	background-color: #cccccc;
 }
 
-tfoot td {
+tfoot {
 	border-top: 1px solid black;
 }
 
 td {
 	padding: 0.5em;
         border: 1px solid black;
+	
+	/** border-top: 1px solid black; */
 }
 
 	
@@ -46,4 +47,15 @@
 /** forms using table layout */
 td.label {
 	background-color: #f3f3f3;
+}
+
+table.layout {
+  border-bottom: solid white;
+  border-right:  solid white;
+  margin-bottom: solid white;
+}
+
+td.layout {
+	border-top: 1px solid black;
+        border: solid white;
 }