activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1395293 - in /activemq/trunk/activemq-web: ./ src/main/java/org/apache/activemq/web/MessageQuery.java
Date Sun, 07 Oct 2012 13:03:43 GMT
Author: davsclaus
Date: Sun Oct  7 13:03:42 2012
New Revision: 1395293

URL: http://svn.apache.org/viewvc?rev=1395293&view=rev
Log:
AMQ-3173: activemq-web can now show more JMS message types.

Modified:
    activemq/trunk/activemq-web/   (props changed)
    activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java

Propchange: activemq/trunk/activemq-web/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Oct  7 13:03:42 2012
@@ -10,3 +10,4 @@ bin
 surefire.properties
 surefire-classloader.properties
 eclipse-classes
+*.idea

Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java?rev=1395293&r1=1395292&r2=1395293&view=diff
==============================================================================
--- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java (original)
+++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java Sun
Oct  7 13:03:42 2012
@@ -19,12 +19,13 @@ package org.apache.activemq.web;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
-
+import javax.jms.BytesMessage;
 import javax.jms.JMSException;
 import javax.jms.MapMessage;
 import javax.jms.Message;
 import javax.jms.ObjectMessage;
 import javax.jms.QueueBrowser;
+import javax.jms.StreamMessage;
 import javax.jms.TextMessage;
 
 /**
@@ -88,21 +89,27 @@ public class MessageQuery extends QueueB
         if (message instanceof MapMessage) {
             return createMapBody((MapMessage) message);
         }
-        return null;
-    }
-
-    public Map<String, Object> getPropertiesMap() throws JMSException {
-        Map<String, Object> answer = new HashMap<String, Object>();
-        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);
+        if (message instanceof BytesMessage) {
+            BytesMessage msg = (BytesMessage) message;
+            int len = (int) msg.getBodyLength();
+            if (len > -1) {
+                byte[] data = new byte[len];
+                msg.readBytes(data);
+                return new String(data);
+            } else {
+                return "";
             }
         }
-        return answer;
+        if (message instanceof StreamMessage) {
+            return "StreamMessage is not viewable";
+        }
+
+        // unknown message type
+        if (message != null) {
+            return "Unknown message type [" + message.getClass().getName() + "] " + message;
+        }
+
+        return null;
     }
 
     protected Map<String, Object> createMapBody(MapMessage mapMessage) throws JMSException
{



Mime
View raw message