You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2007/08/11 23:29:33 UTC
svn commit: r564977 [3/8] - in /activemq/trunk:
activemq-console/src/main/java/org/apache/activemq/console/
activemq-console/src/main/java/org/apache/activemq/console/command/
activemq-console/src/main/java/org/apache/activemq/console/filter/
activemq-...
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansObjectNameQueryFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansObjectNameQueryFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansObjectNameQueryFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansObjectNameQueryFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,28 +16,31 @@
*/
package org.apache.activemq.console.filter;
-import javax.management.remote.JMXServiceURL;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
-import javax.management.MBeanServerConnection;
-import javax.management.QueryExp;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.ArrayList;
-import java.net.MalformedURLException;
-import java.io.IOException;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.QueryExp;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
public class MBeansObjectNameQueryFilter extends AbstractQueryFilter {
public static final String DEFAULT_JMX_DOMAIN = "org.apache.activemq";
- public static final String QUERY_EXP_PREFIX = "MBeans.QueryExp.";
+ public static final String QUERY_EXP_PREFIX = "MBeans.QueryExp.";
private JMXServiceURL jmxServiceUrl;
/**
- * Creates an mbeans object name query filter that will query on the given JMX Service URL
+ * Creates an mbeans object name query filter that will query on the given
+ * JMX Service URL
+ *
* @param jmxUrl - JMX service URL to connect to
* @throws MalformedURLException
*/
@@ -47,7 +49,9 @@
}
/**
- * Creates an mbeans objecet name query filter that will query on the given JMX Service URL
+ * Creates an mbeans objecet name query filter that will query on the given
+ * JMX Service URL
+ *
* @param jmxUrl - JMX service URL to connect to
*/
public MBeansObjectNameQueryFilter(JMXServiceURL jmxUrl) {
@@ -56,10 +60,13 @@
}
/**
- * Queries the JMX service using a mapping of keys and values to construct the object name
+ * Queries the JMX service using a mapping of keys and values to construct
+ * the object name
+ *
* @param queries - mapping of keys and values
* @return collection of ObjectInstance that matches the query
- * @throws MalformedObjectNameException - if the given string is an invalid object name
+ * @throws MalformedObjectNameException - if the given string is an invalid
+ * object name
* @throws IOException - if there is a problem querying the JMX context
*/
public List query(List queries) throws MalformedObjectNameException, IOException {
@@ -72,7 +79,7 @@
// Constructs object name query
String objNameQuery = "";
String queryExp = "";
- for (Iterator i=queries.iterator(); i.hasNext();) {
+ for (Iterator i = queries.iterator(); i.hasNext();) {
String key = (String)i.next();
String val = "";
int pos = key.indexOf("=");
@@ -83,7 +90,7 @@
if (val.startsWith(QUERY_EXP_PREFIX)) {
// do nothing as of the moment
- } else if (key != "" && val != "") {
+ } else if (!key.equals("") && !val.equals("")) {
objNameQuery = objNameQuery + key + "=" + val + ",";
}
}
@@ -95,8 +102,9 @@
}
/**
- * Advance query that enables you to specify both the object name and the query expression to use.
- * Note: Query expression is currently unsupported.
+ * Advance query that enables you to specify both the object name and the
+ * query expression to use. Note: Query expression is currently unsupported.
+ *
* @param objName - object name to use for query
* @param queryExpStr - query expression string
* @return set of mbeans that matches the query
@@ -108,7 +116,8 @@
QueryExp queryExp = createQueryExp(queryExpStr);
- // Convert mbeans set to list to make it standard throughout the query filter
+ // Convert mbeans set to list to make it standard throughout the query
+ // filter
List mbeans = new ArrayList(server.queryMBeans(objName, queryExp));
jmxConn.close();
@@ -118,6 +127,7 @@
/**
* Get the JMX service URL the query is connecting to.
+ *
* @return JMX service URL
*/
public JMXServiceURL getJmxServiceUrl() {
@@ -126,6 +136,7 @@
/**
* Sets the JMX service URL the query is going to connect to.
+ *
* @param jmxServiceUrl - new JMX service URL
*/
public void setJmxServiceUrl(JMXServiceURL jmxServiceUrl) {
@@ -134,6 +145,7 @@
/**
* Sets the JMX service URL the query is going to connect to.
+ *
* @param jmxServiceUrl - new JMX service URL
*/
public void setJmxServiceUrl(String jmxServiceUrl) throws MalformedURLException {
@@ -142,6 +154,7 @@
/**
* Creates a JMX connector
+ *
* @return JMX connector
* @throws IOException
*/
@@ -150,8 +163,9 @@
}
/**
- * Creates a query expression based on the query expression string
- * Note: currently unsupported
+ * Creates a query expression based on the query expression string Note:
+ * currently unsupported
+ *
* @param queryExpStr - query expression string
* @return the created query expression
*/
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansRegExQueryFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansRegExQueryFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansRegExQueryFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansRegExQueryFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,18 +16,21 @@
*/
package org.apache.activemq.console.filter;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.AttributeList;
-import javax.management.Attribute;
-import java.util.Map;
+import java.lang.reflect.Method;
import java.util.Iterator;
+import java.util.Map;
import java.util.regex.Pattern;
-import java.lang.reflect.Method;
+
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
public class MBeansRegExQueryFilter extends RegExQueryFilter {
/**
- * Creates a regular expression query that is able to match the values of specific mbeans
+ * Creates a regular expression query that is able to match the values of
+ * specific mbeans
+ *
* @param next - next query filter
*/
public MBeansRegExQueryFilter(QueryFilter next) {
@@ -36,9 +38,13 @@
}
/**
- * Try to match the object data using the regular expression map. The regex map contains a key-value mapping of an attribute
- * key to a regular expression the value of the key should match. The basic rule of matching is that the data must contain
- * a property key that is included in the regex map, and that the value of the property key should match the regex specified.
+ * Try to match the object data using the regular expression map. The regex
+ * map contains a key-value mapping of an attribute key to a regular
+ * expression the value of the key should match. The basic rule of matching
+ * is that the data must contain a property key that is included in the
+ * regex map, and that the value of the property key should match the regex
+ * specified.
+ *
* @param data - object data to match
* @param regex - regex map
* @return true if the data matches the regex map specified
@@ -49,8 +55,12 @@
// Use reflection to determine where the object should go
try {
- Method method = this.getClass().getDeclaredMethod("matches", new Class[] {data.getClass(), Map.class});
- return ((Boolean)method.invoke(this, new Object[] {data, regex})).booleanValue();
+ Method method = this.getClass().getDeclaredMethod("matches", new Class[] {
+ data.getClass(), Map.class
+ });
+ return ((Boolean)method.invoke(this, new Object[] {
+ data, regex
+ })).booleanValue();
} catch (NoSuchMethodException e) {
return false;
}
@@ -58,6 +68,7 @@
/**
* Try to match the object instance using the regular expression map
+ *
* @param data - object instance to match
* @param regex - regex map
* @return true if the object instance matches the regex map
@@ -68,12 +79,13 @@
/**
* Try to match the object name instance using the regular expression map
+ *
* @param data - object name to match
* @param regex - regex map
* @return true if the object name matches the regex map
*/
protected boolean matches(ObjectName data, Map regex) {
- for (Iterator i=regex.keySet().iterator(); i.hasNext();) {
+ for (Iterator i = regex.keySet().iterator(); i.hasNext();) {
String key = (String)i.next();
String target = data.getKeyProperty(key);
@@ -87,16 +99,18 @@
/**
* Try to match the attribute list using the regular expression map
+ *
* @param data - attribute list to match
* @param regex - regex map
* @return true if the attribute list matches the regex map
*/
protected boolean matches(AttributeList data, Map regex) {
- for (Iterator i=regex.keySet().iterator(); i.hasNext();) {
+ for (Iterator i = regex.keySet().iterator(); i.hasNext();) {
String key = (String)i.next();
- // Try to match each regex to the attributes of the mbean including its ObjectName
- for (Iterator j=data.iterator(); j.hasNext();) {
+ // Try to match each regex to the attributes of the mbean including
+ // its ObjectName
+ for (Iterator j = data.iterator(); j.hasNext();) {
Attribute attrib = (Attribute)j.next();
// Try to match to the properties of the ObjectName
@@ -110,7 +124,7 @@
break;
}
- // Try to match to the mbean attributes
+ // Try to match to the mbean attributes
} else if (attrib.getName().equals(key)) {
if (!((Pattern)regex.get(key)).matcher(attrib.getValue().toString()).matches()) {
return false;
@@ -119,7 +133,7 @@
break;
}
- // If mbean does not contain the specified attribute
+ // If mbean does not contain the specified attribute
} else {
return false;
}
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MapTransformFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MapTransformFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MapTransformFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MapTransformFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,32 +16,36 @@
*/
package org.apache.activemq.console.filter;
-import org.apache.activemq.console.formatter.GlobalWriter;
-import org.apache.activemq.console.util.AmqMessagesUtil;
-import org.apache.activemq.command.ActiveMQDestination;
-import org.apache.activemq.command.ActiveMQObjectMessage;
-import org.apache.activemq.command.ActiveMQBytesMessage;
-import org.apache.activemq.command.ActiveMQTextMessage;
-import org.apache.activemq.command.ActiveMQMapMessage;
-import org.apache.activemq.command.ActiveMQStreamMessage;
-import org.apache.activemq.command.ActiveMQMessage;
+import java.lang.reflect.Method;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.management.Attribute;
+import javax.management.AttributeList;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
-import javax.management.AttributeList;
-import javax.management.Attribute;
import javax.management.openmbean.CompositeDataSupport;
-import javax.jms.JMSException;
-import javax.jms.DeliveryMode;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Iterator;
-import java.util.Enumeration;
-import java.lang.reflect.Method;
+
+import org.apache.activemq.command.ActiveMQBytesMessage;
+import org.apache.activemq.command.ActiveMQDestination;
+import org.apache.activemq.command.ActiveMQMapMessage;
+import org.apache.activemq.command.ActiveMQMessage;
+import org.apache.activemq.command.ActiveMQObjectMessage;
+import org.apache.activemq.command.ActiveMQStreamMessage;
+import org.apache.activemq.command.ActiveMQTextMessage;
+import org.apache.activemq.console.formatter.GlobalWriter;
+import org.apache.activemq.console.util.AmqMessagesUtil;
public class MapTransformFilter extends ResultTransformFilter {
/**
- * Creates a Map transform filter that is able to transform a variety of objects to a properties map object
+ * Creates a Map transform filter that is able to transform a variety of
+ * objects to a properties map object
+ *
* @param next - the next query filter
*/
public MapTransformFilter(QueryFilter next) {
@@ -51,14 +54,19 @@
/**
* Transform the given object to a Map object
+ *
* @param object - object to transform
* @return map object
*/
protected Object transformElement(Object object) throws Exception {
// Use reflection to determine how the object should be transformed
try {
- Method method = this.getClass().getDeclaredMethod("transformToMap", new Class[] {object.getClass()});
- return (Map)method.invoke(this, new Object[] {object});
+ Method method = this.getClass().getDeclaredMethod("transformToMap", new Class[] {
+ object.getClass()
+ });
+ return (Map)method.invoke(this, new Object[] {
+ object
+ });
} catch (NoSuchMethodException e) {
GlobalWriter.print("Unable to transform mbean of type: " + object.getClass().getName() + ". No corresponding transformToMap method found.");
return null;
@@ -67,6 +75,7 @@
/**
* Transform an ObjectInstance mbean to a Map
+ *
* @param obj - ObjectInstance format of an mbean
* @return map object
*/
@@ -76,6 +85,7 @@
/**
* Transform an ObjectName mbean to a Map
+ *
* @param objname - ObjectName format of an mbean
* @return map object
*/
@@ -84,7 +94,7 @@
// Parse object properties
Map objProps = objname.getKeyPropertyList();
- for (Iterator i=objProps.keySet().iterator(); i.hasNext();) {
+ for (Iterator i = objProps.keySet().iterator(); i.hasNext();) {
Object key = i.next();
Object val = objProps.get(key);
if (val != null) {
@@ -97,12 +107,13 @@
/**
* Transform an Attribute List format of an mbean to a Map
+ *
* @param list - AttributeList format of an mbean
* @return map object
*/
protected Map transformToMap(AttributeList list) {
Properties props = new Properties();
- for (Iterator i=list.iterator(); i.hasNext();) {
+ for (Iterator i = list.iterator(); i.hasNext();) {
Attribute attrib = (Attribute)i.next();
// If attribute is an ObjectName
@@ -120,6 +131,7 @@
/**
* Transform an ActiveMQTextMessage to a Map
+ *
* @param msg - text message to trasnform
* @return map object
* @throws JMSException
@@ -137,6 +149,7 @@
/**
* Transform an ActiveMQBytesMessage to a Map
+ *
* @param msg - bytes message to transform
* @return map object
* @throws JMSException
@@ -148,20 +161,21 @@
long bodyLength = msg.getBodyLength();
byte[] msgBody;
- int i=0;
+ int i = 0;
// Create separate bytes messages
- for (i=0; i<(bodyLength/Integer.MAX_VALUE); i++) {
+ for (i = 0; i < (bodyLength / Integer.MAX_VALUE); i++) {
msgBody = new byte[Integer.MAX_VALUE];
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSBytes:" + (i+1), new String(msgBody));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSBytes:" + (i + 1), new String(msgBody));
}
msgBody = new byte[(int)(bodyLength % Integer.MAX_VALUE)];
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSBytes:" + (i+1), new String(msgBody));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSBytes:" + (i + 1), new String(msgBody));
return props;
}
/**
* Transform an ActiveMQMessage to a Map
+ *
* @param msg - object message to transform
* @return map object
* @throws JMSException
@@ -180,6 +194,7 @@
/**
* Transform an ActiveMQMapMessage to a Map
+ *
* @param msg - map message to transform
* @return map object
* @throws JMSException
@@ -204,6 +219,7 @@
/**
* Transform an ActiveMQStreamMessage to a Map
+ *
* @param msg - stream message to transform
* @return map object
* @throws JMSException
@@ -212,7 +228,8 @@
Properties props = new Properties();
props.putAll(transformToMap((ActiveMQMessage)msg));
- // Just set the toString of the message as the body of the stream message
+ // Just set the toString of the message as the body of the stream
+ // message
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSStreamMessage", msg.toString());
return props;
@@ -220,31 +237,32 @@
/**
* Transform an ActiveMQMessage to a Map
+ *
* @param msg - message to transform
* @return map object
* @throws JMSException
*/
- protected Map transformToMap(ActiveMQMessage msg) throws JMSException {
- Properties props = new Properties();
+ protected Map<String, String> transformToMap(ActiveMQMessage msg) throws JMSException {
+ Map<String, String> props = new HashMap<String, String>();
// Get JMS properties
if (msg.getJMSCorrelationID() != null) {
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSCorrelationID", msg.getJMSCorrelationID());
+ props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSCorrelationID", msg.getJMSCorrelationID());
}
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDeliveryMode", (msg.getJMSDeliveryMode()==DeliveryMode.PERSISTENT) ? "persistent" : "non-persistent");
+ props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDeliveryMode", (msg.getJMSDeliveryMode() == DeliveryMode.PERSISTENT) ? "persistent" : "non-persistent");
if (msg.getJMSDestination() != null) {
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDestination", ((ActiveMQDestination)msg.getJMSDestination()).getPhysicalName());
+ props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDestination", ((ActiveMQDestination)msg.getJMSDestination()).getPhysicalName());
}
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSExpiration", Long.toString(msg.getJMSExpiration()));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSMessageID", msg.getJMSMessageID());
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSPriority", Integer.toString(msg.getJMSPriority()));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSRedelivered", Boolean.toString(msg.getJMSRedelivered()));
+ props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSExpiration", Long.toString(msg.getJMSExpiration()));
+ props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSMessageID", msg.getJMSMessageID());
+ props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSPriority", Integer.toString(msg.getJMSPriority()));
+ props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSRedelivered", Boolean.toString(msg.getJMSRedelivered()));
if (msg.getJMSReplyTo() != null) {
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSReplyTo", ((ActiveMQDestination)msg.getJMSReplyTo()).getPhysicalName());
+ props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSReplyTo", ((ActiveMQDestination)msg.getJMSReplyTo()).getPhysicalName());
}
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSTimestamp", Long.toString(msg.getJMSTimestamp()));
+ props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSTimestamp", Long.toString(msg.getJMSTimestamp()));
if (msg.getJMSType() != null) {
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSType", msg.getJMSType());
+ props.put(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSType", msg.getJMSType());
}
// Get custom properties
@@ -252,7 +270,7 @@
while (e.hasMoreElements()) {
String name = (String)e.nextElement();
if (msg.getObjectProperty(name) != null) {
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + name, msg.getObjectProperty(name).toString());
+ props.put(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + name, msg.getObjectProperty(name).toString());
}
}
@@ -261,6 +279,7 @@
/**
* Transform an openMBean composite data to a Map
+ *
* @param data - composite data to transform
* @return map object
*/
@@ -273,40 +292,38 @@
if (typeName.equals(ActiveMQTextMessage.class.getName())) {
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "Text", data.get("Text").toString());
- // Retrieve byte preview
+ // Retrieve byte preview
} else if (typeName.equals(ActiveMQBytesMessage.class.getName())) {
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "BodyLength", data.get("BodyLength").toString());
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "BodyPreview", new String((byte[])data.get("BodyPreview")));
- // Expand content map
+ // Expand content map
} else if (typeName.equals(ActiveMQMapMessage.class.getName())) {
Map contentMap = (Map)data.get("ContentMap");
- for (Iterator i=contentMap.keySet().iterator(); i.hasNext();) {
+ for (Iterator i = contentMap.keySet().iterator(); i.hasNext();) {
String key = (String)i.next();
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + key, contentMap.get(key).toString());
}
- // Do nothing
- } else if (typeName.equals(ActiveMQObjectMessage.class.getName()) ||
- typeName.equals(ActiveMQStreamMessage.class.getName()) ||
- typeName.equals(ActiveMQMessage.class.getName())) {
+ // Do nothing
+ } else if (typeName.equals(ActiveMQObjectMessage.class.getName()) || typeName.equals(ActiveMQStreamMessage.class.getName()) || typeName.equals(ActiveMQMessage.class.getName())) {
- // Unrecognized composite data. Throw exception.
+ // Unrecognized composite data. Throw exception.
} else {
throw new IllegalArgumentException("Unrecognized composite data to transform. composite type: " + typeName);
}
// Process the JMS message header values
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSCorrelationID", "" + data.get("JMSCorrelationID"));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDestination", "" + data.get("JMSDestination"));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSMessageID", "" + data.get("JMSMessageID"));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSReplyTo", "" + data.get("JMSReplyTo"));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSType", "" + data.get("JMSType"));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDeliveryMode", "" + data.get("JMSDeliveryMode"));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSExpiration", "" + data.get("JMSExpiration"));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSPriority", "" + data.get("JMSPriority"));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSRedelivered", "" + data.get("JMSRedelivered"));
- props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSTimestamp", "" + data.get("JMSTimestamp"));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDestination", "" + data.get("JMSDestination"));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSMessageID", "" + data.get("JMSMessageID"));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSReplyTo", "" + data.get("JMSReplyTo"));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSType", "" + data.get("JMSType"));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSDeliveryMode", "" + data.get("JMSDeliveryMode"));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSExpiration", "" + data.get("JMSExpiration"));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSPriority", "" + data.get("JMSPriority"));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSRedelivered", "" + data.get("JMSRedelivered"));
+ props.setProperty(AmqMessagesUtil.JMS_MESSAGE_HEADER_PREFIX + "JMSTimestamp", "" + data.get("JMSTimestamp"));
// Process the JMS custom message properties
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_CUSTOM_PREFIX + "Properties", "" + data.get("Properties"));
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MessagesQueryFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MessagesQueryFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MessagesQueryFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MessagesQueryFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,36 +16,39 @@
*/
package org.apache.activemq.console.filter;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXServiceURL;
-import javax.management.remote.JMXConnectorFactory;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.openmbean.CompositeData;
-import java.net.MalformedURLException;
-import java.util.List;
-import java.util.Iterator;
-import java.util.Arrays;
-import java.io.IOException;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
public class MessagesQueryFilter extends AbstractQueryFilter {
private JMXServiceURL jmxServiceUrl;
- private ObjectName destName;
+ private ObjectName destName;
/**
* Create a JMS message query filter
+ *
* @param jmxServiceUrl - JMX service URL to connect to
* @param destName - object name query to retrieve the destination
*/
public MessagesQueryFilter(JMXServiceURL jmxServiceUrl, ObjectName destName) {
super(null);
this.jmxServiceUrl = jmxServiceUrl;
- this.destName = destName;
+ this.destName = destName;
}
/**
* Queries the specified destination using the message selector format query
+ *
* @param queries - message selector queries
* @return list messages that matches the selector
* @throws Exception
@@ -55,12 +57,12 @@
String selector = "";
// Convert to message selector
- for (Iterator i=queries.iterator(); i.hasNext();) {
+ for (Iterator i = queries.iterator(); i.hasNext();) {
selector = selector + "(" + i.next().toString() + ") AND ";
}
// Remove last AND
- if (selector != "") {
+ if (!selector.equals("")) {
selector = selector.substring(0, selector.length() - 5);
}
@@ -69,6 +71,7 @@
/**
* Query the messages of a queue destination using JMX
+ *
* @param selector - message selector
* @return list of messages that matches the selector
* @throws Exception
@@ -84,6 +87,7 @@
/**
* Get the JMX service URL the query is connecting to.
+ *
* @return JMX service URL
*/
public JMXServiceURL getJmxServiceUrl() {
@@ -92,6 +96,7 @@
/**
* Sets the JMX service URL the query is going to connect to.
+ *
* @param jmxServiceUrl - new JMX service URL
*/
public void setJmxServiceUrl(JMXServiceURL jmxServiceUrl) {
@@ -100,6 +105,7 @@
/**
* Sets the JMX service URL the query is going to connect to.
+ *
* @param jmxServiceUrl - new JMX service URL
*/
public void setJmxServiceUrl(String jmxServiceUrl) throws MalformedURLException {
@@ -108,6 +114,7 @@
/**
* Creates a JMX connector
+ *
* @return JMX connector
* @throws java.io.IOException
*/
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/PropertiesViewFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/PropertiesViewFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/PropertiesViewFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/PropertiesViewFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,13 +16,13 @@
*/
package org.apache.activemq.console.filter;
-import java.util.Set;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collection;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
public class PropertiesViewFilter implements QueryFilter {
protected QueryFilter next;
@@ -31,6 +30,7 @@
/**
* Creates a filter that will select the properties of a map object to view
+ *
* @param next - the next query filter that will return a collection of maps
*/
public PropertiesViewFilter(QueryFilter next) {
@@ -39,6 +39,7 @@
/**
* Creates a filter that will select the properties of a map object to view
+ *
* @param viewFilter - the properties to view
* @param next - the next query filter that will return a collection of maps
*/
@@ -49,35 +50,38 @@
/**
* Filter the properties to view of the query result
+ *
* @param query - the query string
* @return list of objects that has been view filtered
*/
- public List query(String query) throws Exception {
+ public List<Map<Object, Object>> query(String query) throws Exception {
return filterViewCollection(next.query(query), viewFilter);
}
/**
* Filter the properties to view of the query result
+ *
* @param queries - the query map
* @return list of objects that has been view filtered
* @throws Exception
*/
- public List query(List queries) throws Exception {
+ public List<Map<Object, Object>> query(List queries) throws Exception {
return filterViewCollection(next.query(queries), viewFilter);
}
/**
* Filter the view of each element in the collection
+ *
* @param result - the lists to filter the view from
* @param viewFilter - the views to select
- * @return lsit of objects whose view has been filtered
+ * @return list of objects whose view has been filtered
*/
- protected List filterViewCollection(Collection result, Set viewFilter) {
+ protected List<Map<Object, Object>> filterViewCollection(Collection<Map<Object, Object>> result, Set viewFilter) {
// Use a list to allow duplicate entries
- List newCollection = new ArrayList();
+ List<Map<Object, Object>> newCollection = new ArrayList<Map<Object, Object>>();
- for (Iterator i=result.iterator(); i.hasNext();) {
- newCollection.add(filterView((Map)i.next()));
+ for (Iterator<Map<Object, Object>> i = result.iterator(); i.hasNext();) {
+ newCollection.add(filterView(i.next()));
}
return newCollection;
@@ -85,26 +89,27 @@
/**
* Select only the attributes to view from the map data
+ *
* @param data - data to filter the view from
* @return - data with the view filtered
*/
- protected Map filterView(Map data) {
+ protected Map<Object, Object> filterView(Map<Object, Object> data) {
// If no view specified, display all attributes
if (viewFilter == null || viewFilter.isEmpty()) {
return data;
}
- Map newData;
+ Map<Object, Object> newData;
try {
// Lets try to use the same class as the original
- newData = (Map)data.getClass().newInstance();
+ newData = data.getClass().newInstance();
} catch (Exception e) {
// Lets use a default HashMap
- newData = new HashMap();
+ newData = new HashMap<Object, Object>();
}
// Filter the keys to view
- for (Iterator i=viewFilter.iterator(); i.hasNext();) {
+ for (Iterator i = viewFilter.iterator(); i.hasNext();) {
Object key = i.next();
Object val = data.get(key);
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/QueryFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/QueryFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/QueryFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/QueryFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -18,9 +17,11 @@
package org.apache.activemq.console.filter;
import java.util.List;
+import java.util.Map;
public interface QueryFilter {
- public static final String QUERY_DELIMETER = ",";
+
+ String QUERY_DELIMETER = ",";
/**
* Interface for querying
@@ -28,7 +29,7 @@
* @return collection of objects that satisfies the query
* @throws Exception
*/
- public List query(String queryStr) throws Exception;
+ List query(String queryStr) throws Exception;
/**
* Interface for querying
@@ -36,5 +37,5 @@
* @return collection of objects that satisfies the query
* @throws Exception
*/
- public List query(List queries) throws Exception;
+ List query(List queries) throws Exception;
}
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/RegExQueryFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/RegExQueryFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/RegExQueryFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/RegExQueryFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,18 +16,20 @@
*/
package org.apache.activemq.console.filter;
-import java.util.regex.Pattern;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
public abstract class RegExQueryFilter extends AbstractQueryFilter {
public static final String REGEX_PREFIX = "REGEX:QUERY:";
/**
- * Creates a regular expression query that is able to match an object using key-value pattern regex filtering
+ * Creates a regular expression query that is able to match an object using
+ * key-value pattern regex filtering
+ *
* @param next
*/
protected RegExQueryFilter(QueryFilter next) {
@@ -36,8 +37,10 @@
}
/**
- * Separates the regular expressions queries from the usual queries. A query is a regex query, if it is key-value pair
- * with the format <key>=<value>, and value is a pattern that satisfies the isRegularExpression method.
+ * Separates the regular expressions queries from the usual queries. A query
+ * is a regex query, if it is key-value pair with the format <key>=<value>,
+ * and value is a pattern that satisfies the isRegularExpression method.
+ *
* @param queries - list of queries
* @return filtered objects that matches the regex query
* @throws Exception
@@ -47,7 +50,7 @@
List newQueries = new ArrayList();
// Lets parse for regular expression queries
- for (Iterator i=queries.iterator(); i.hasNext();) {
+ for (Iterator i = queries.iterator(); i.hasNext();) {
// Get key-value pair
String token = (String)i.next();
String key = "";
@@ -58,11 +61,12 @@
key = token.substring(0, pos);
}
- // Add the regex query to list and make it a non-factor in the succeeding queries
+ // Add the regex query to list and make it a non-factor in the
+ // succeeding queries
if (isRegularExpression(val)) {
regex.put(key, compileQuery(val));
- // Add the normal query to the query list
+ // Add the normal query to the query list
} else {
newQueries.add(token);
}
@@ -73,8 +77,10 @@
}
/**
- * Checks if a given string is a regular expression query. Currently, a pattern is a regex query, if it starts with
- * the RegExQueryFilter.REGEX_PREFIX.
+ * Checks if a given string is a regular expression query. Currently, a
+ * pattern is a regex query, if it starts with the
+ * RegExQueryFilter.REGEX_PREFIX.
+ *
* @param query
* @return
*/
@@ -84,6 +90,7 @@
/**
* Compiles the regex query to a pattern.
+ *
* @param query - query string to compile
* @return regex pattern
*/
@@ -93,6 +100,7 @@
/**
* Filter the specified colleciton using the regex patterns extracted.
+ *
* @param regex - regex map
* @param data - list of objects to filter
* @return filtered list of objects that matches the regex map
@@ -100,14 +108,14 @@
*/
protected List filterCollectionUsingRegEx(Map regex, List data) throws Exception {
// No regular expressions filtering needed
- if (regex==null || regex.isEmpty()) {
+ if (regex == null || regex.isEmpty()) {
return data;
}
List filteredElems = new ArrayList();
// Get each data object to filter
- for (Iterator i=data.iterator(); i.hasNext();) {
+ for (Iterator i = data.iterator(); i.hasNext();) {
Object dataElem = i.next();
// If properties of data matches all the regex pattern, add it
if (matches(dataElem, regex)) {
@@ -120,6 +128,7 @@
/**
* Determines how the object is to be matched to the regex map.
+ *
* @param data - object to match
* @param regex - regex map
* @return true, if the object matches the regex map, false otherwise
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/ResultTransformFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/ResultTransformFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/ResultTransformFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/ResultTransformFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -25,7 +24,8 @@
private QueryFilter next;
/**
- * Contructs a query filter that transform the format of the query result
+ * Constructs a query filter that transform the format of the query result
+ *
* @param next - the query filter to retrieve the results from
*/
protected ResultTransformFilter(QueryFilter next) {
@@ -34,6 +34,7 @@
/**
* Transforms the queried results to a collection of different objects
+ *
* @param query - the query string
* @return collections of transformed objects
* @throws Exception
@@ -44,23 +45,25 @@
/**
* Transforms the queried results to a collection of different objects
+ *
* @param queries - the query map
* @return collections of transformed objects
* @throws Exception
*/
- public List query(List queries) throws Exception {
+ public List<Object> query(List queries) throws Exception {
return transformList(next.query(queries));
}
/**
* Transforms a collection to a collection of different objects.
+ *
* @param result - the collection to transform
* @return collection of properties objects
*/
- protected List transformList(List result) throws Exception {
- List props = new ArrayList();
+ protected List<Object> transformList(List<Object> result) throws Exception {
+ List<Object> props = new ArrayList<Object>();
- for (Iterator i=result.iterator(); i.hasNext();) {
+ for (Iterator<Object> i = result.iterator(); i.hasNext();) {
props.add(transformElement(i.next()));
}
@@ -69,6 +72,7 @@
/**
* Transform a result object
+ *
* @param obj - the object instance to transform
* @return the transformed object
*/
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/StubQueryFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/StubQueryFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/StubQueryFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/StubQueryFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -19,11 +18,13 @@
import java.util.List;
-public class StubQueryFilter implements QueryFilter{
+public class StubQueryFilter implements QueryFilter {
private List data;
/**
- * Creates a stub query that returns the given collections as the query result
+ * Creates a stub query that returns the given collections as the query
+ * result
+ *
* @param data - the stub query result
*/
public StubQueryFilter(List data) {
@@ -32,6 +33,7 @@
/**
* Returns the provided stub data as a stub query result
+ *
* @param queryStr - not use
* @return the stub query result
* @throws Exception
@@ -42,6 +44,7 @@
/**
* Returns the provided stub data as a stub query result
+ *
* @param queries - not use
* @return the stub query result
* @throws Exception
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,9 +16,11 @@
*/
package org.apache.activemq.console.filter;
-public class WildcardToMsgSelectorTransformFilter extends WildcardTransformFilter{
+public class WildcardToMsgSelectorTransformFilter extends WildcardTransformFilter {
/**
- * Creates a filter that is able to transform a wildcard query to a message selector format
+ * Creates a filter that is able to transform a wildcard query to a message
+ * selector format
+ *
* @param next - next query filter
*/
public WildcardToMsgSelectorTransformFilter(QueryFilter next) {
@@ -27,8 +28,10 @@
}
/**
- * Use to determine if a query string is a wildcard query. A query string is a wildcard query if it is a key-value
- * pair with the format <key>=<value> and the value is enclosed in '' and contains '*' and '?'.
+ * Use to determine if a query string is a wildcard query. A query string is
+ * a wildcard query if it is a key-value pair with the format <key>=<value>
+ * and the value is enclosed in '' and contains '*' and '?'.
+ *
* @param query - query string
* @return true, if the query string is a wildcard query, false otherwise
*/
@@ -47,6 +50,7 @@
/**
* Transform a wildcard query to message selector format
+ *
* @param query - query string to transform
* @return message selector format string
*/
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -19,7 +18,9 @@
public class WildcardToRegExTransformFilter extends WildcardTransformFilter {
/**
- * Creates a filter that is able to transform a wildcard query to a regular expression query string
+ * Creates a filter that is able to transform a wildcard query to a regular
+ * expression query string
+ *
* @param next - next query filter
*/
public WildcardToRegExTransformFilter(RegExQueryFilter next) {
@@ -27,8 +28,10 @@
}
/**
- * Use to determine if a query string is a wildcard query. A query string is a wildcard query if it is a key-value
- * pair with the format <key>=<value> and the value contains '*' and '?'.
+ * Use to determine if a query string is a wildcard query. A query string is
+ * a wildcard query if it is a key-value pair with the format <key>=<value>
+ * and the value contains '*' and '?'.
+ *
* @param query - query string
* @return true, if the query string is a wildcard query, false otherwise
*/
@@ -42,11 +45,12 @@
}
// If the value contains wildcards
- return ((val.indexOf("*") >= 0) || (val.indexOf("?") >= 0));
+ return (val.indexOf("*") >= 0) || (val.indexOf("?") >= 0);
}
/**
* Transform a wildcard query to regular expression format
+ *
* @param query - query string to transform
* @return regex query string
*/
@@ -60,11 +64,14 @@
key = key.substring(0, pos);
}
- val = val.replaceAll("[.]", "\\\\."); // Escape all dot characters. From (.) to (\.)
- val = val.replaceAll("[?]", "."); // Match single characters
- val = val.replaceAll("[*]", ".*?"); // Match all characters, use reluctant quantifier
- val = "(" + val +")"; // Let's group the query for clarity
- val = RegExQueryFilter.REGEX_PREFIX + val; // Flag as a regular expression query
+ val = val.replaceAll("[.]", "\\\\."); // Escape all dot characters.
+ // From (.) to (\.)
+ val = val.replaceAll("[?]", "."); // Match single characters
+ val = val.replaceAll("[*]", ".*?"); // Match all characters, use
+ // reluctant quantifier
+ val = "(" + val + ")"; // Let's group the query for clarity
+ val = RegExQueryFilter.REGEX_PREFIX + val; // Flag as a regular
+ // expression query
return key + "=" + val;
}
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardTransformFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardTransformFilter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardTransformFilter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardTransformFilter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,15 +16,17 @@
*/
package org.apache.activemq.console.filter;
-import java.util.Iterator;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
public abstract class WildcardTransformFilter extends AbstractQueryFilter {
/**
- * Creates a wildcard transform filter that is able to convert a wildcard expression (determined by isWildcardQuery)
- * to a another query type (use transformWildcardQuery).
+ * Creates a wildcard transform filter that is able to convert a wildcard
+ * expression (determined by isWildcardQuery) to a another query type (use
+ * transformWildcardQuery).
+ *
* @param next - the next query filter
*/
protected WildcardTransformFilter(QueryFilter next) {
@@ -34,6 +35,7 @@
/**
* Converts the query list to set of different queries
+ *
* @param queries - query list to transform
* @return - result of the query
* @throws Exception
@@ -41,7 +43,7 @@
public List query(List queries) throws Exception {
List newQueries = new ArrayList();
- for (Iterator i=queries.iterator(); i.hasNext();) {
+ for (Iterator i = queries.iterator(); i.hasNext();) {
String queryToken = (String)i.next();
// Transform the wildcard query
@@ -49,7 +51,7 @@
// Transform the value part only
newQueries.add(transformWildcardQuery(queryToken));
- // Maintain the query as is
+ // Maintain the query as is
} else {
newQueries.add(queryToken);
}
@@ -60,6 +62,7 @@
/**
* Use to determine is a query string is a wildcard query
+ *
* @param query - query string
* @return true, if the query string is a wildcard query, false otherwise
*/
@@ -67,6 +70,7 @@
/**
* Use to transform a wildcard query string to another query format
+ *
* @param query - query string to transform
* @return transformed query
*/
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/CommandShellOutputFormatter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/CommandShellOutputFormatter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/CommandShellOutputFormatter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/CommandShellOutputFormatter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,16 +16,17 @@
*/
package org.apache.activemq.console.formatter;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.AttributeList;
-import javax.management.Attribute;
-import javax.jms.Message;
-import java.util.Map;
+import java.io.OutputStream;
+import java.io.PrintStream;
import java.util.Collection;
import java.util.Iterator;
-import java.io.PrintStream;
-import java.io.OutputStream;
+import java.util.Map;
+
+import javax.jms.Message;
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
public class CommandShellOutputFormatter implements OutputFormatter {
private OutputStream outputStream;
@@ -44,6 +44,7 @@
/**
* Retrieve the output stream being used by the formatter
+ *
* @return
*/
public OutputStream getOutputStream() {
@@ -52,6 +53,7 @@
/**
* Print an ObjectInstance format of an mbean
+ *
* @param mbean - mbean to print
*/
public void printMBean(ObjectInstance mbean) {
@@ -60,6 +62,7 @@
/**
* Print an ObjectName format of an mbean
+ *
* @param mbean - mbean to print
*/
public void printMBean(ObjectName mbean) {
@@ -68,10 +71,11 @@
/**
* Print an AttributeList format of an mbean
+ *
* @param mbean - mbean to print
*/
public void printMBean(AttributeList mbean) {
- for (Iterator i=mbean.iterator(); i.hasNext();) {
+ for (Iterator i = mbean.iterator(); i.hasNext();) {
Attribute attrib = (Attribute)i.next();
if (attrib.getValue() instanceof ObjectName) {
printMBean((ObjectName)attrib.getValue());
@@ -86,10 +90,11 @@
/**
* Print a Map format of an mbean
+ *
* @param mbean - mbean to print
*/
public void printMBean(Map mbean) {
- for (Iterator i=mbean.keySet().iterator(); i.hasNext();) {
+ for (Iterator i = mbean.keySet().iterator(); i.hasNext();) {
String key = (String)i.next();
String val = mbean.get(key).toString();
out.println(key + " = " + val);
@@ -99,10 +104,11 @@
/**
* Print a collection of mbean
+ *
* @param mbean - collection of mbeans
*/
public void printMBean(Collection mbean) {
- for (Iterator i=mbean.iterator(); i.hasNext();) {
+ for (Iterator i = mbean.iterator(); i.hasNext();) {
Object obj = i.next();
if (obj instanceof ObjectInstance) {
printMBean((ObjectInstance)obj);
@@ -122,10 +128,11 @@
/**
* Print a Map format of a JMS message
+ *
* @param msg
*/
public void printMessage(Map msg) {
- for (Iterator i=msg.keySet().iterator(); i.hasNext();) {
+ for (Iterator i = msg.keySet().iterator(); i.hasNext();) {
String key = (String)i.next();
String val = msg.get(key).toString();
out.println(key + " = " + val);
@@ -135,6 +142,7 @@
/**
* Print a Message format of a JMS message
+ *
* @param msg - JMS message to print
*/
public void printMessage(Message msg) {
@@ -143,10 +151,11 @@
/**
* Print a collection of JMS messages
+ *
* @param msg - collection of JMS messages
*/
public void printMessage(Collection msg) {
- for (Iterator i=msg.iterator(); i.hasNext();) {
+ for (Iterator i = msg.iterator(); i.hasNext();) {
Object obj = i.next();
if (obj instanceof Message) {
printMessage((Message)obj);
@@ -162,10 +171,11 @@
/**
* Print help messages
+ *
* @param helpMsgs - help messages to print
*/
public void printHelp(String[] helpMsgs) {
- for (int i=0; i<helpMsgs.length; i++) {
+ for (int i = 0; i < helpMsgs.length; i++) {
out.println(helpMsgs[i]);
}
out.println();
@@ -173,6 +183,7 @@
/**
* Print an information message
+ *
* @param info - information message to print
*/
public void printInfo(String info) {
@@ -181,6 +192,7 @@
/**
* Print an exception message
+ *
* @param e - exception to print
*/
public void printException(Exception e) {
@@ -190,6 +202,7 @@
/**
* Print a version information
+ *
* @param version - version info to print
*/
public void printVersion(String version) {
@@ -201,10 +214,11 @@
/**
* Print a generic key value mapping
+ *
* @param map to print
*/
public void print(Map map) {
- for (Iterator i=map.keySet().iterator(); i.hasNext();) {
+ for (Iterator i = map.keySet().iterator(); i.hasNext();) {
String key = (String)i.next();
String val = map.get(key).toString();
out.println(key + " = " + val);
@@ -214,10 +228,11 @@
/**
* Print a generic array of strings
+ *
* @param strings - string array to print
*/
public void print(String[] strings) {
- for (int i=0; i<strings.length; i++) {
+ for (int i = 0; i < strings.length; i++) {
out.println(strings[i]);
}
out.println();
@@ -225,10 +240,11 @@
/**
* Print a collection of objects
+ *
* @param collection - collection to print
*/
public void print(Collection collection) {
- for (Iterator i=collection.iterator(); i.hasNext();) {
+ for (Iterator i = collection.iterator(); i.hasNext();) {
out.println(i.next().toString());
}
out.println();
@@ -236,6 +252,7 @@
/**
* Print a java string
+ *
* @param string - string to print
*/
public void print(String string) {
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/GlobalWriter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/GlobalWriter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/GlobalWriter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/GlobalWriter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,15 +16,16 @@
*/
package org.apache.activemq.console.formatter;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.Map;
+
+import javax.jms.Message;
+import javax.management.AttributeList;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
-import javax.management.AttributeList;
-import javax.jms.Message;
-import java.util.Map;
-import java.util.Collection;
-import java.io.OutputStream;
-public class GlobalWriter {
+public final class GlobalWriter {
private static OutputFormatter formatter;
/**
@@ -36,14 +36,16 @@
/**
* Maintains a global output formatter
+ *
* @param formatter - the output formatter to use
*/
public static void instantiate(OutputFormatter formatter) {
- GlobalWriter.formatter = formatter;
+ GlobalWriter.formatter = formatter;
}
/**
* Retrieve the output stream being used by the global formatter
+ *
* @return
*/
public static OutputStream getOutputStream() {
@@ -55,6 +57,7 @@
/**
* Print an ObjectInstance format of an mbean
+ *
* @param mbean - mbean to print
*/
public static void printMBean(ObjectInstance mbean) {
@@ -66,6 +69,7 @@
/**
* Print an ObjectName format of an mbean
+ *
* @param mbean - mbean to print
*/
public static void printMBean(ObjectName mbean) {
@@ -77,6 +81,7 @@
/**
* Print an AttributeList format of an mbean
+ *
* @param mbean - mbean to print
*/
public static void printMBean(AttributeList mbean) {
@@ -88,6 +93,7 @@
/**
* Print a Map format of an mbean
+ *
* @param mbean
*/
public static void printMBean(Map mbean) {
@@ -99,6 +105,7 @@
/**
* Print a Collection format of mbeans
+ *
* @param mbean - collection of mbeans
*/
public static void printMBean(Collection mbean) {
@@ -110,6 +117,7 @@
/**
* Print a Map format of a JMS message
+ *
* @param msg
*/
public static void printMessage(Map msg) {
@@ -121,6 +129,7 @@
/**
* Print a Message format of a JMS message
+ *
* @param msg - JMS message to print
*/
public static void printMessage(Message msg) {
@@ -132,6 +141,7 @@
/**
* Print a collection of JMS messages
+ *
* @param msg - collection of JMS messages
*/
public static void printMessage(Collection msg) {
@@ -143,6 +153,7 @@
/**
* Print help messages
+ *
* @param helpMsgs - help messages to print
*/
public static void printHelp(String[] helpMsgs) {
@@ -154,6 +165,7 @@
/**
* Print an information message
+ *
* @param info - information message to print
*/
public static void printInfo(String info) {
@@ -165,6 +177,7 @@
/**
* Print an exception message
+ *
* @param e - exception to print
*/
public static void printException(Exception e) {
@@ -176,6 +189,7 @@
/**
* Print a version information
+ *
* @param version - version info to print
*/
public static void printVersion(String version) {
@@ -187,6 +201,7 @@
/**
* Print a generic key value mapping
+ *
* @param map to print
*/
public static void print(Map map) {
@@ -198,6 +213,7 @@
/**
* Print a generic array of strings
+ *
* @param strings - string array to print
*/
public static void print(String[] strings) {
@@ -209,6 +225,7 @@
/**
* Print a collection of objects
+ *
* @param collection - collection to print
*/
public static void print(Collection collection) {
@@ -220,6 +237,7 @@
/**
* Print a java string
+ *
* @param string - string to print
*/
public static void print(String string) {
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/OutputFormatter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/OutputFormatter.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/OutputFormatter.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/OutputFormatter.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,115 +16,116 @@
*/
package org.apache.activemq.console.formatter;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.AttributeList;
-import javax.jms.Message;
+import java.io.OutputStream;
import java.util.Collection;
import java.util.Map;
-import java.io.OutputStream;
-public interface OutputFormatter {
+import javax.jms.Message;
+import javax.management.AttributeList;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+interface OutputFormatter {
/**
* Retrieve the output stream being used by the formatter
* @return
*/
- public OutputStream getOutputStream();
+ OutputStream getOutputStream();
/**
* Print an ObjectInstance format of an mbean
* @param mbean - mbean to print
*/
- public void printMBean(ObjectInstance mbean);
+ void printMBean(ObjectInstance mbean);
/**
* Print an ObjectName format of an mbean
* @param mbean - mbean to print
*/
- public void printMBean(ObjectName mbean);
+ void printMBean(ObjectName mbean);
/**
* Print an AttributeList format of an mbean
* @param mbean - mbean to print
*/
- public void printMBean(AttributeList mbean);
+ void printMBean(AttributeList mbean);
/**
* Print a Map format of an mbean
* @param mbean - mbean to print
*/
- public void printMBean(Map mbean);
+ void printMBean(Map mbean);
/**
* Print a Collection format of mbeans
* @param mbean - collection of mbeans
*/
- public void printMBean(Collection mbean);
+ void printMBean(Collection mbean);
/**
* Print a Map format of a JMS message
* @param msg
*/
- public void printMessage(Map msg);
+ void printMessage(Map msg);
/**
* Print a Message format of a JMS message
* @param msg - JMS message to print
*/
- public void printMessage(Message msg);
+ void printMessage(Message msg);
/**
* Print a Collection format of JMS messages
* @param msg - collection of JMS messages
*/
- public void printMessage(Collection msg);
+ void printMessage(Collection msg);
/**
* Print help messages
* @param helpMsgs - help messages to print
*/
- public void printHelp(String[] helpMsgs);
+ void printHelp(String[] helpMsgs);
/**
* Print an information message
* @param info - information message to print
*/
- public void printInfo(String info);
+ void printInfo(String info);
/**
* Print an exception message
* @param e - exception to print
*/
- public void printException(Exception e);
+ void printException(Exception e);
/**
* Print a version information
* @param version - version info to print
*/
- public void printVersion(String version);
+ void printVersion(String version);
/**
* Print a generic key value mapping
* @param map to print
*/
- public void print(Map map);
+ void print(Map map);
/**
* Print a generic array of strings
* @param strings - string array to print
*/
- public void print(String[] strings);
+ void print(String[] strings);
/**
* Print a collection of objects
* @param collection - collection to print
*/
- public void print(Collection collection);
+ void print(Collection collection);
/**
* Print a java string
* @param string - string to print
*/
- public void print(String string);
+ void print(String string);
}
Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/AmqMessagesUtil.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/AmqMessagesUtil.java?view=diff&rev=564977&r1=564976&r2=564977
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/AmqMessagesUtil.java (original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/AmqMessagesUtil.java Sat Aug 11 14:29:21 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,26 +16,31 @@
*/
package org.apache.activemq.console.util;
-import org.apache.activemq.console.filter.QueryFilter;
-import org.apache.activemq.console.filter.WildcardToMsgSelectorTransformFilter;
-import org.apache.activemq.console.filter.PropertiesViewFilter;
-import org.apache.activemq.console.filter.StubQueryFilter;
-import org.apache.activemq.console.filter.MapTransformFilter;
-import org.apache.activemq.console.filter.GroupPropertiesViewFilter;
-import org.apache.activemq.console.filter.AmqMessagesQueryFilter;
-
-import javax.jms.Destination;
import java.net.URI;
import java.util.List;
import java.util.Set;
-public class AmqMessagesUtil {
+import javax.jms.Destination;
+
+import org.apache.activemq.console.filter.AmqMessagesQueryFilter;
+import org.apache.activemq.console.filter.GroupPropertiesViewFilter;
+import org.apache.activemq.console.filter.MapTransformFilter;
+import org.apache.activemq.console.filter.PropertiesViewFilter;
+import org.apache.activemq.console.filter.QueryFilter;
+import org.apache.activemq.console.filter.StubQueryFilter;
+import org.apache.activemq.console.filter.WildcardToMsgSelectorTransformFilter;
+
+public final class AmqMessagesUtil {
+
public static final String JMS_MESSAGE_HEADER_PREFIX = "JMS_HEADER_FIELD:";
public static final String JMS_MESSAGE_CUSTOM_PREFIX = "JMS_CUSTOM_FIELD:";
- public static final String JMS_MESSAGE_BODY_PREFIX = "JMS_BODY_FIELD:";
+ public static final String JMS_MESSAGE_BODY_PREFIX = "JMS_BODY_FIELD:";
+
+ private AmqMessagesUtil() {
+ }
public static List getAllMessages(URI brokerUrl, Destination dest) throws Exception {
- return getMessages(brokerUrl, dest, "");
+ return getMessages(brokerUrl, dest, "");
}
public static List getMessages(URI brokerUrl, Destination dest, String selector) throws Exception {
@@ -48,18 +52,10 @@
}
public static List filterMessagesView(List messages, Set groupViews, Set attributeViews) throws Exception {
- return (new PropertiesViewFilter(attributeViews,
- new GroupPropertiesViewFilter(groupViews,
- new MapTransformFilter(
- new StubQueryFilter(messages)
- )
- )
- )).query("");
+ return (new PropertiesViewFilter(attributeViews, new GroupPropertiesViewFilter(groupViews, new MapTransformFilter(new StubQueryFilter(messages))))).query("");
}
public static QueryFilter createMessageQueryFilter(URI brokerUrl, Destination dest) {
- return new WildcardToMsgSelectorTransformFilter(
- new AmqMessagesQueryFilter(brokerUrl, dest)
- );
+ return new WildcardToMsgSelectorTransformFilter(new AmqMessagesQueryFilter(brokerUrl, dest));
}
}