activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r379619 [20/30] - in /incubator/activemq/trunk: ./ activecluster/ activecluster/src/java/org/apache/activecluster/ activecluster/src/java/org/apache/activecluster/election/ activecluster/src/java/org/apache/activecluster/election/impl/ acti...
Date Tue, 21 Feb 2006 23:14:17 GMT
Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/RegExQueryFilter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/RegExQueryFilter.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/RegExQueryFilter.java (original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/RegExQueryFilter.java Tue Feb 21 15:12:56 2006
@@ -1,128 +1,128 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.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.Iterator;
-
-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
-     * @param next
-     */
-    protected RegExQueryFilter(QueryFilter next) {
-        super(next);
-    }
-
-    /**
-     * 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
-     */
-    public List query(List queries) throws Exception {
-        Map regex = new HashMap();
-        List newQueries = new ArrayList();
-
-        // Lets parse for regular expression queries
-        for (Iterator i=queries.iterator(); i.hasNext();) {
-            // Get key-value pair
-            String token = (String)i.next();
-            String key = "";
-            String val = "";
-            int pos = token.indexOf("=");
-            if (pos >= 0) {
-                val = token.substring(pos + 1);
-                key = token.substring(0, pos);
-            }
-
-            // 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
-            } else {
-                newQueries.add(token);
-            }
-        }
-
-        // Filter the result using the regular expressions specified
-        return filterCollectionUsingRegEx(regex, next.query(newQueries));
-    }
-
-    /**
-     * 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
-     */
-    protected boolean isRegularExpression(String query) {
-        return query.startsWith(REGEX_PREFIX);
-    }
-
-    /**
-     * Compiles the regex query to a pattern.
-     * @param query - query string to compile
-     * @return regex pattern
-     */
-    protected Pattern compileQuery(String query) {
-        return Pattern.compile(query.substring(REGEX_PREFIX.length()));
-    }
-
-    /**
-     * 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
-     * @throws Exception
-     */
-    protected List filterCollectionUsingRegEx(Map regex, List data) throws Exception {
-        // No regular expressions filtering needed
-        if (regex==null || regex.isEmpty()) {
-            return data;
-        }
-
-        List filteredElems = new ArrayList();
-
-        // Get each data object to filter
-        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)) {
-                filteredElems.add(dataElem);
-            }
-        }
-
-        return filteredElems;
-    }
-
-    /**
-     * 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
-     * @throws Exception
-     */
-    protected abstract boolean matches(Object data, Map regex) throws Exception;
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.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.Iterator;
+
+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
+     * @param next
+     */
+    protected RegExQueryFilter(QueryFilter next) {
+        super(next);
+    }
+
+    /**
+     * 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
+     */
+    public List query(List queries) throws Exception {
+        Map regex = new HashMap();
+        List newQueries = new ArrayList();
+
+        // Lets parse for regular expression queries
+        for (Iterator i=queries.iterator(); i.hasNext();) {
+            // Get key-value pair
+            String token = (String)i.next();
+            String key = "";
+            String val = "";
+            int pos = token.indexOf("=");
+            if (pos >= 0) {
+                val = token.substring(pos + 1);
+                key = token.substring(0, pos);
+            }
+
+            // 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
+            } else {
+                newQueries.add(token);
+            }
+        }
+
+        // Filter the result using the regular expressions specified
+        return filterCollectionUsingRegEx(regex, next.query(newQueries));
+    }
+
+    /**
+     * 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
+     */
+    protected boolean isRegularExpression(String query) {
+        return query.startsWith(REGEX_PREFIX);
+    }
+
+    /**
+     * Compiles the regex query to a pattern.
+     * @param query - query string to compile
+     * @return regex pattern
+     */
+    protected Pattern compileQuery(String query) {
+        return Pattern.compile(query.substring(REGEX_PREFIX.length()));
+    }
+
+    /**
+     * 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
+     * @throws Exception
+     */
+    protected List filterCollectionUsingRegEx(Map regex, List data) throws Exception {
+        // No regular expressions filtering needed
+        if (regex==null || regex.isEmpty()) {
+            return data;
+        }
+
+        List filteredElems = new ArrayList();
+
+        // Get each data object to filter
+        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)) {
+                filteredElems.add(dataElem);
+            }
+        }
+
+        return filteredElems;
+    }
+
+    /**
+     * 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
+     * @throws Exception
+     */
+    protected abstract boolean matches(Object data, Map regex) throws Exception;
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/RegExQueryFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/ResultTransformFilter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/ResultTransformFilter.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/ResultTransformFilter.java (original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/ResultTransformFilter.java Tue Feb 21 15:12:56 2006
@@ -1,76 +1,76 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.console.filter;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public abstract class ResultTransformFilter implements QueryFilter {
-    private QueryFilter next;
-
-    /**
-     * Contructs 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) {
-        this.next = next;
-    }
-
-    /**
-     * Transforms the queried results to a collection of different objects
-     * @param query - the query string
-     * @return collections of transformed objects
-     * @throws Exception
-     */
-    public List query(String query) throws Exception {
-        return transformList(next.query(query));
-    }
-
-    /**
-     * 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 {
-        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();
-
-        for (Iterator i=result.iterator(); i.hasNext();) {
-            props.add(transformElement(i.next()));
-        }
-
-        return props;
-    }
-
-    /**
-     * Transform a result object
-     * @param obj - the object instance to transform
-     * @return the transformed object
-     */
-    protected abstract Object transformElement(Object obj) throws Exception;
-
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.console.filter;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public abstract class ResultTransformFilter implements QueryFilter {
+    private QueryFilter next;
+
+    /**
+     * Contructs 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) {
+        this.next = next;
+    }
+
+    /**
+     * Transforms the queried results to a collection of different objects
+     * @param query - the query string
+     * @return collections of transformed objects
+     * @throws Exception
+     */
+    public List query(String query) throws Exception {
+        return transformList(next.query(query));
+    }
+
+    /**
+     * 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 {
+        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();
+
+        for (Iterator i=result.iterator(); i.hasNext();) {
+            props.add(transformElement(i.next()));
+        }
+
+        return props;
+    }
+
+    /**
+     * Transform a result object
+     * @param obj - the object instance to transform
+     * @return the transformed object
+     */
+    protected abstract Object transformElement(Object obj) throws Exception;
+
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/ResultTransformFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/StubQueryFilter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/StubQueryFilter.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/StubQueryFilter.java (original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/StubQueryFilter.java Tue Feb 21 15:12:56 2006
@@ -1,51 +1,51 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.console.filter;
-
-import java.util.List;
-
-public class StubQueryFilter implements QueryFilter{
-    private List data;
-
-    /**
-     * Creates a stub query that returns the given collections as the query result
-     * @param data - the stub query result
-     */
-    public StubQueryFilter(List data) {
-        this.data = data;
-    }
-
-    /**
-     * Returns the provided stub data as a stub query result
-     * @param queryStr - not use
-     * @return the stub query result
-     * @throws Exception
-     */
-    public List query(String queryStr) throws Exception {
-        return data;
-    }
-
-    /**
-     * Returns the provided stub data as a stub query result
-     * @param queries - not use
-     * @return the stub query result
-     * @throws Exception
-     */
-    public List query(List queries) throws Exception {
-        return data;
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.console.filter;
+
+import java.util.List;
+
+public class StubQueryFilter implements QueryFilter{
+    private List data;
+
+    /**
+     * Creates a stub query that returns the given collections as the query result
+     * @param data - the stub query result
+     */
+    public StubQueryFilter(List data) {
+        this.data = data;
+    }
+
+    /**
+     * Returns the provided stub data as a stub query result
+     * @param queryStr - not use
+     * @return the stub query result
+     * @throws Exception
+     */
+    public List query(String queryStr) throws Exception {
+        return data;
+    }
+
+    /**
+     * Returns the provided stub data as a stub query result
+     * @param queries - not use
+     * @return the stub query result
+     * @throws Exception
+     */
+    public List query(List queries) throws Exception {
+        return data;
+    }
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/StubQueryFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java (original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java Tue Feb 21 15:12:56 2006
@@ -1,68 +1,68 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.console.filter;
-
-public class WildcardToMsgSelectorTransformFilter extends WildcardTransformFilter{
-    /**
-     * 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) {
-        super(next);
-    }
-
-    /**
-     * 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
-     */
-    protected boolean isWildcardQuery(String query) {
-        // If the query is a key=value pair
-        String key = query;
-        String val = "";
-        int pos = key.indexOf("=");
-        if (pos >= 0) {
-            val = key.substring(pos + 1);
-            key = key.substring(0, pos);
-        }
-
-        // If the value contains wildcards and is enclose by '
-        return val.startsWith("'") && val.endsWith("'") && ((val.indexOf("*") >= 0) || (val.indexOf("?") >= 0));
-    }
-
-    /**
-     * Transform a wildcard query to message selector format
-     * @param query - query string to transform
-     * @return message selector format string
-     */
-    protected String transformWildcardQuery(String query) {
-        // If the query is a key=value pair
-        String key = query;
-        String val = "";
-        int pos = key.indexOf("=");
-        if (pos >= 0) {
-            val = key.substring(pos + 1);
-            key = key.substring(0, pos);
-        }
-
-        val = val.replaceAll("[?]", "_");
-        val = val.replaceAll("[*]", "%");
-
-        return key + " LIKE " + val;
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.console.filter;
+
+public class WildcardToMsgSelectorTransformFilter extends WildcardTransformFilter{
+    /**
+     * 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) {
+        super(next);
+    }
+
+    /**
+     * 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
+     */
+    protected boolean isWildcardQuery(String query) {
+        // If the query is a key=value pair
+        String key = query;
+        String val = "";
+        int pos = key.indexOf("=");
+        if (pos >= 0) {
+            val = key.substring(pos + 1);
+            key = key.substring(0, pos);
+        }
+
+        // If the value contains wildcards and is enclose by '
+        return val.startsWith("'") && val.endsWith("'") && ((val.indexOf("*") >= 0) || (val.indexOf("?") >= 0));
+    }
+
+    /**
+     * Transform a wildcard query to message selector format
+     * @param query - query string to transform
+     * @return message selector format string
+     */
+    protected String transformWildcardQuery(String query) {
+        // If the query is a key=value pair
+        String key = query;
+        String val = "";
+        int pos = key.indexOf("=");
+        if (pos >= 0) {
+            val = key.substring(pos + 1);
+            key = key.substring(0, pos);
+        }
+
+        val = val.replaceAll("[?]", "_");
+        val = val.replaceAll("[*]", "%");
+
+        return key + " LIKE " + val;
+    }
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java (original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java Tue Feb 21 15:12:56 2006
@@ -1,71 +1,71 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.console.filter;
-
-public class WildcardToRegExTransformFilter extends WildcardTransformFilter {
-    /**
-     * 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) {
-        super(next);
-    }
-
-    /**
-     * 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
-     */
-    protected boolean isWildcardQuery(String query) {
-        // If the query is a key=value pair
-        String key = query;
-        String val = "";
-        int pos = key.indexOf("=");
-        if (pos >= 0) {
-            val = key.substring(pos + 1);
-            key = key.substring(0, pos);
-        }
-
-        // If the value contains wildcards
-        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
-     */
-    protected String transformWildcardQuery(String query) {
-        // Get the key=value pair
-        String key = query;
-        String val = "";
-        int pos = key.indexOf("=");
-        if (pos >= 0) {
-            val = key.substring(pos + 1);
-            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
-
-        return key + "=" + val;
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.console.filter;
+
+public class WildcardToRegExTransformFilter extends WildcardTransformFilter {
+    /**
+     * 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) {
+        super(next);
+    }
+
+    /**
+     * 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
+     */
+    protected boolean isWildcardQuery(String query) {
+        // If the query is a key=value pair
+        String key = query;
+        String val = "";
+        int pos = key.indexOf("=");
+        if (pos >= 0) {
+            val = key.substring(pos + 1);
+            key = key.substring(0, pos);
+        }
+
+        // If the value contains wildcards
+        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
+     */
+    protected String transformWildcardQuery(String query) {
+        // Get the key=value pair
+        String key = query;
+        String val = "";
+        int pos = key.indexOf("=");
+        if (pos >= 0) {
+            val = key.substring(pos + 1);
+            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
+
+        return key + "=" + val;
+    }
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardTransformFilter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardTransformFilter.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardTransformFilter.java (original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardTransformFilter.java Tue Feb 21 15:12:56 2006
@@ -1,73 +1,73 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.console.filter;
-
-import java.util.Iterator;
-import java.util.ArrayList;
-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).
-     * @param next - the next query filter
-     */
-    protected WildcardTransformFilter(QueryFilter next) {
-        super(next);
-    }
-
-    /**
-     * Converts the query list to set of different queries
-     * @param queries - query list to transform
-     * @return - result of the query
-     * @throws Exception
-     */
-    public List query(List queries) throws Exception {
-        List newQueries = new ArrayList();
-
-        for (Iterator i=queries.iterator(); i.hasNext();) {
-            String queryToken = (String)i.next();
-
-            // Transform the wildcard query
-            if (isWildcardQuery(queryToken)) {
-                // Transform the value part only
-                newQueries.add(transformWildcardQuery(queryToken));
-
-            // Maintain the query as is
-            } else {
-                newQueries.add(queryToken);
-            }
-        }
-
-        return next.query(newQueries);
-    }
-
-    /**
-     * 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
-     */
-    protected abstract boolean isWildcardQuery(String query);
-
-    /**
-     * Use to transform a wildcard query string to another query format
-     * @param query - query string to transform
-     * @return transformed query
-     */
-    protected abstract String transformWildcardQuery(String query);
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.console.filter;
+
+import java.util.Iterator;
+import java.util.ArrayList;
+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).
+     * @param next - the next query filter
+     */
+    protected WildcardTransformFilter(QueryFilter next) {
+        super(next);
+    }
+
+    /**
+     * Converts the query list to set of different queries
+     * @param queries - query list to transform
+     * @return - result of the query
+     * @throws Exception
+     */
+    public List query(List queries) throws Exception {
+        List newQueries = new ArrayList();
+
+        for (Iterator i=queries.iterator(); i.hasNext();) {
+            String queryToken = (String)i.next();
+
+            // Transform the wildcard query
+            if (isWildcardQuery(queryToken)) {
+                // Transform the value part only
+                newQueries.add(transformWildcardQuery(queryToken));
+
+            // Maintain the query as is
+            } else {
+                newQueries.add(queryToken);
+            }
+        }
+
+        return next.query(newQueries);
+    }
+
+    /**
+     * 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
+     */
+    protected abstract boolean isWildcardQuery(String query);
+
+    /**
+     * Use to transform a wildcard query string to another query format
+     * @param query - query string to transform
+     * @return transformed query
+     */
+    protected abstract String transformWildcardQuery(String query);
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardTransformFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/CommandShellOutputFormatter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/CommandShellOutputFormatter.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/CommandShellOutputFormatter.java (original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/CommandShellOutputFormatter.java Tue Feb 21 15:12:56 2006
@@ -1,243 +1,243 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.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.util.Collection;
-import java.util.Iterator;
-import java.io.PrintStream;
-import java.io.OutputStream;
-
-public class CommandShellOutputFormatter implements OutputFormatter {
-    private OutputStream outputStream;
-    private PrintStream out;
-
-    public CommandShellOutputFormatter(OutputStream out) {
-
-        this.outputStream = out;
-        if (out instanceof PrintStream) {
-            this.out = (PrintStream)out;
-        } else {
-            this.out = new PrintStream(out);
-        }
-    }
-
-    /**
-     * Retrieve the output stream being used by the formatter
-     * @return
-     */
-    public OutputStream getOutputStream() {
-        return outputStream;
-    }
-
-    /**
-     * Print an ObjectInstance format of an mbean
-     * @param mbean - mbean to print
-     */
-    public void printMBean(ObjectInstance mbean) {
-        printMBean(mbean.getObjectName());
-    }
-
-    /**
-     * Print an ObjectName format of an mbean
-     * @param mbean - mbean to print
-     */
-    public void printMBean(ObjectName mbean) {
-        printMBean(mbean.getKeyPropertyList());
-    }
-
-    /**
-     * Print an AttributeList format of an mbean
-     * @param mbean - mbean to print
-     */
-    public void printMBean(AttributeList mbean) {
-        for (Iterator i=mbean.iterator(); i.hasNext();) {
-            Attribute attrib = (Attribute)i.next();
-            if (attrib.getValue() instanceof ObjectName) {
-                printMBean((ObjectName)attrib.getValue());
-            } else if (attrib.getValue() instanceof ObjectInstance) {
-                printMBean((ObjectInstance)attrib.getValue());
-            } else {
-                out.println(attrib.getName() + " = " + attrib.getValue().toString());
-                out.println();
-            }
-        }
-    }
-
-    /**
-     * 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();) {
-            String key = (String)i.next();
-            String val = mbean.get(key).toString();
-            out.println(key + " = " + val);
-        }
-        out.println();
-    }
-
-    /**
-     * Print a collection of mbean
-     * @param mbean - collection of mbeans
-     */
-    public void printMBean(Collection mbean) {
-        for (Iterator i=mbean.iterator(); i.hasNext();) {
-            Object obj = i.next();
-            if (obj instanceof ObjectInstance) {
-                printMBean((ObjectInstance)obj);
-            } else if (obj instanceof ObjectName) {
-                printMBean((ObjectName)obj);
-            } else if (obj instanceof Map) {
-                printMBean((Map)obj);
-            } else if (obj instanceof AttributeList) {
-                printMBean((AttributeList)obj);
-            } else if (obj instanceof Collection) {
-                printMessage((Collection)obj);
-            } else {
-                printException(new UnsupportedOperationException("Unknown mbean type: " + obj.getClass().getName()));
-            }
-        }
-    }
-
-    /**
-     * Print a Map format of a JMS message
-     * @param msg
-     */
-    public void printMessage(Map msg) {
-        for (Iterator i=msg.keySet().iterator(); i.hasNext();) {
-            String key = (String)i.next();
-            String val = msg.get(key).toString();
-            out.println(key + " = " + val);
-        }
-        out.println();
-    }
-
-    /**
-     * Print a Message format of a JMS message
-     * @param msg - JMS message to print
-     */
-    public void printMessage(Message msg) {
-        // TODO
-    }
-
-    /**
-     * Print a collection of JMS messages
-     * @param msg - collection of JMS messages
-     */
-    public void printMessage(Collection msg) {
-        for (Iterator i=msg.iterator(); i.hasNext();) {
-            Object obj = i.next();
-            if (obj instanceof Message) {
-                printMessage((Message)obj);
-            } else if (obj instanceof Map) {
-                printMessage((Map)obj);
-            } else if (obj instanceof Collection) {
-                printMessage((Collection)obj);
-            } else {
-                printException(new UnsupportedOperationException("Unknown message type: " + obj.getClass().getName()));
-            }
-        }
-    }
-
-    /**
-     * Print help messages
-     * @param helpMsgs - help messages to print
-     */
-    public void printHelp(String[] helpMsgs) {
-        for (int i=0; i<helpMsgs.length; i++) {
-            out.println(helpMsgs[i]);
-        }
-        out.println();
-    }
-
-    /**
-     * Print an information message
-     * @param info - information message to print
-     */
-    public void printInfo(String info) {
-        out.println("INFO: " + info);
-    }
-
-    /**
-     * Print an exception message
-     * @param e - exception to print
-     */
-    public void printException(Exception e) {
-        out.println("ERROR: " + e);
-    }
-
-    /**
-     * Print a version information
-     * @param version - version info to print
-     */
-    public void printVersion(String version) {
-        out.println("");
-        out.println("ActiveMQ " + version);
-        out.println("For help or more information please see: http://www.logicblaze.com");
-        out.println("");
-    }
-
-    /**
-     * Print a generic key value mapping
-     * @param map to print
-     */
-    public void print(Map map) {
-        for (Iterator i=map.keySet().iterator(); i.hasNext();) {
-            String key = (String)i.next();
-            String val = map.get(key).toString();
-            out.println(key + " = " + val);
-        }
-        out.println();
-    }
-
-    /**
-     * 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++) {
-            out.println(strings[i]);
-        }
-        out.println();
-    }
-
-    /**
-     * Print a collection of objects
-     * @param collection - collection to print
-     */
-    public void print(Collection collection) {
-        for (Iterator i=collection.iterator(); i.hasNext();) {
-            out.println(i.next().toString());
-        }
-        out.println();
-    }
-
-    /**
-     * Print a java string
-     * @param string - string to print
-     */
-    public void print(String string) {
-        out.println(string);
-    }
-
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.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.util.Collection;
+import java.util.Iterator;
+import java.io.PrintStream;
+import java.io.OutputStream;
+
+public class CommandShellOutputFormatter implements OutputFormatter {
+    private OutputStream outputStream;
+    private PrintStream out;
+
+    public CommandShellOutputFormatter(OutputStream out) {
+
+        this.outputStream = out;
+        if (out instanceof PrintStream) {
+            this.out = (PrintStream)out;
+        } else {
+            this.out = new PrintStream(out);
+        }
+    }
+
+    /**
+     * Retrieve the output stream being used by the formatter
+     * @return
+     */
+    public OutputStream getOutputStream() {
+        return outputStream;
+    }
+
+    /**
+     * Print an ObjectInstance format of an mbean
+     * @param mbean - mbean to print
+     */
+    public void printMBean(ObjectInstance mbean) {
+        printMBean(mbean.getObjectName());
+    }
+
+    /**
+     * Print an ObjectName format of an mbean
+     * @param mbean - mbean to print
+     */
+    public void printMBean(ObjectName mbean) {
+        printMBean(mbean.getKeyPropertyList());
+    }
+
+    /**
+     * Print an AttributeList format of an mbean
+     * @param mbean - mbean to print
+     */
+    public void printMBean(AttributeList mbean) {
+        for (Iterator i=mbean.iterator(); i.hasNext();) {
+            Attribute attrib = (Attribute)i.next();
+            if (attrib.getValue() instanceof ObjectName) {
+                printMBean((ObjectName)attrib.getValue());
+            } else if (attrib.getValue() instanceof ObjectInstance) {
+                printMBean((ObjectInstance)attrib.getValue());
+            } else {
+                out.println(attrib.getName() + " = " + attrib.getValue().toString());
+                out.println();
+            }
+        }
+    }
+
+    /**
+     * 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();) {
+            String key = (String)i.next();
+            String val = mbean.get(key).toString();
+            out.println(key + " = " + val);
+        }
+        out.println();
+    }
+
+    /**
+     * Print a collection of mbean
+     * @param mbean - collection of mbeans
+     */
+    public void printMBean(Collection mbean) {
+        for (Iterator i=mbean.iterator(); i.hasNext();) {
+            Object obj = i.next();
+            if (obj instanceof ObjectInstance) {
+                printMBean((ObjectInstance)obj);
+            } else if (obj instanceof ObjectName) {
+                printMBean((ObjectName)obj);
+            } else if (obj instanceof Map) {
+                printMBean((Map)obj);
+            } else if (obj instanceof AttributeList) {
+                printMBean((AttributeList)obj);
+            } else if (obj instanceof Collection) {
+                printMessage((Collection)obj);
+            } else {
+                printException(new UnsupportedOperationException("Unknown mbean type: " + obj.getClass().getName()));
+            }
+        }
+    }
+
+    /**
+     * Print a Map format of a JMS message
+     * @param msg
+     */
+    public void printMessage(Map msg) {
+        for (Iterator i=msg.keySet().iterator(); i.hasNext();) {
+            String key = (String)i.next();
+            String val = msg.get(key).toString();
+            out.println(key + " = " + val);
+        }
+        out.println();
+    }
+
+    /**
+     * Print a Message format of a JMS message
+     * @param msg - JMS message to print
+     */
+    public void printMessage(Message msg) {
+        // TODO
+    }
+
+    /**
+     * Print a collection of JMS messages
+     * @param msg - collection of JMS messages
+     */
+    public void printMessage(Collection msg) {
+        for (Iterator i=msg.iterator(); i.hasNext();) {
+            Object obj = i.next();
+            if (obj instanceof Message) {
+                printMessage((Message)obj);
+            } else if (obj instanceof Map) {
+                printMessage((Map)obj);
+            } else if (obj instanceof Collection) {
+                printMessage((Collection)obj);
+            } else {
+                printException(new UnsupportedOperationException("Unknown message type: " + obj.getClass().getName()));
+            }
+        }
+    }
+
+    /**
+     * Print help messages
+     * @param helpMsgs - help messages to print
+     */
+    public void printHelp(String[] helpMsgs) {
+        for (int i=0; i<helpMsgs.length; i++) {
+            out.println(helpMsgs[i]);
+        }
+        out.println();
+    }
+
+    /**
+     * Print an information message
+     * @param info - information message to print
+     */
+    public void printInfo(String info) {
+        out.println("INFO: " + info);
+    }
+
+    /**
+     * Print an exception message
+     * @param e - exception to print
+     */
+    public void printException(Exception e) {
+        out.println("ERROR: " + e);
+    }
+
+    /**
+     * Print a version information
+     * @param version - version info to print
+     */
+    public void printVersion(String version) {
+        out.println("");
+        out.println("ActiveMQ " + version);
+        out.println("For help or more information please see: http://www.logicblaze.com");
+        out.println("");
+    }
+
+    /**
+     * Print a generic key value mapping
+     * @param map to print
+     */
+    public void print(Map map) {
+        for (Iterator i=map.keySet().iterator(); i.hasNext();) {
+            String key = (String)i.next();
+            String val = map.get(key).toString();
+            out.println(key + " = " + val);
+        }
+        out.println();
+    }
+
+    /**
+     * 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++) {
+            out.println(strings[i]);
+        }
+        out.println();
+    }
+
+    /**
+     * Print a collection of objects
+     * @param collection - collection to print
+     */
+    public void print(Collection collection) {
+        for (Iterator i=collection.iterator(); i.hasNext();) {
+            out.println(i.next().toString());
+        }
+        out.println();
+    }
+
+    /**
+     * Print a java string
+     * @param string - string to print
+     */
+    public void print(String string) {
+        out.println(string);
+    }
+
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/CommandShellOutputFormatter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/GlobalWriter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/GlobalWriter.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/GlobalWriter.java (original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/GlobalWriter.java Tue Feb 21 15:12:56 2006
@@ -1,232 +1,232 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.console.formatter;
-
-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 {
-    private static OutputFormatter formatter;
-
-    /**
-     * Creates a singleton global writer
-     */
-    private GlobalWriter() {
-    }
-
-    /**
-     * Maintains a global output formatter
-     * @param formatter - the output formatter to use
-     */
-    public static void instantiate(OutputFormatter formatter) {
-        if (GlobalWriter.formatter == null) {
-            GlobalWriter.formatter = formatter;
-        }
-    }
-
-    /**
-     * Retrieve the output stream being used by the global formatter
-     * @return
-     */
-    public static OutputStream getOutputStream() {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        return formatter.getOutputStream();
-    }
-
-    /**
-     * Print an ObjectInstance format of an mbean
-     * @param mbean - mbean to print
-     */
-    public static void printMBean(ObjectInstance mbean) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printMBean(mbean);
-    }
-
-    /**
-     * Print an ObjectName format of an mbean
-     * @param mbean - mbean to print
-     */
-    public static void printMBean(ObjectName mbean) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printMBean(mbean);
-    }
-
-    /**
-     * Print an AttributeList format of an mbean
-     * @param mbean - mbean to print
-     */
-    public static void printMBean(AttributeList mbean) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printMBean(mbean);
-    }
-
-    /**
-     * Print a Map format of an mbean
-     * @param mbean
-     */
-    public static void printMBean(Map mbean) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printMBean(mbean);
-    }
-
-    /**
-     * Print a Collection format of mbeans
-     * @param mbean - collection of mbeans
-     */
-    public static void printMBean(Collection mbean) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printMBean(mbean);
-    }
-
-    /**
-     * Print a Map format of a JMS message
-     * @param msg
-     */
-    public static void printMessage(Map msg) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printMessage(msg);
-    }
-
-    /**
-     * Print a Message format of a JMS message
-     * @param msg - JMS message to print
-     */
-    public static void printMessage(Message msg) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printMessage(msg);
-    }
-
-    /**
-     * Print a collection of JMS messages
-     * @param msg - collection of JMS messages
-     */
-    public static void printMessage(Collection msg) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printMessage(msg);
-    }
-
-    /**
-     * Print help messages
-     * @param helpMsgs - help messages to print
-     */
-    public static void printHelp(String[] helpMsgs) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printHelp(helpMsgs);
-    }
-
-    /**
-     * Print an information message
-     * @param info - information message to print
-     */
-    public static void printInfo(String info) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printInfo(info);
-    }
-
-    /**
-     * Print an exception message
-     * @param e - exception to print
-     */
-    public static void printException(Exception e) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printException(e);
-    }
-
-    /**
-     * Print a version information
-     * @param version - version info to print
-     */
-    public static void printVersion(String version) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.printVersion(version);
-    }
-
-    /**
-     * Print a generic key value mapping
-     * @param map to print
-     */
-    public static void print(Map map) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.print(map);
-    }
-
-    /**
-     * Print a generic array of strings
-     * @param strings - string array to print
-     */
-    public static void print(String[] strings) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.print(strings);
-    }
-
-    /**
-     * Print a collection of objects
-     * @param collection - collection to print
-     */
-    public static void print(Collection collection) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.print(collection);
-    }
-
-    /**
-     * Print a java string
-     * @param string - string to print
-     */
-    public static void print(String string) {
-        if (formatter == null) {
-            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
-        }
-        formatter.print(string);
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.console.formatter;
+
+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 {
+    private static OutputFormatter formatter;
+
+    /**
+     * Creates a singleton global writer
+     */
+    private GlobalWriter() {
+    }
+
+    /**
+     * Maintains a global output formatter
+     * @param formatter - the output formatter to use
+     */
+    public static void instantiate(OutputFormatter formatter) {
+        if (GlobalWriter.formatter == null) {
+            GlobalWriter.formatter = formatter;
+        }
+    }
+
+    /**
+     * Retrieve the output stream being used by the global formatter
+     * @return
+     */
+    public static OutputStream getOutputStream() {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        return formatter.getOutputStream();
+    }
+
+    /**
+     * Print an ObjectInstance format of an mbean
+     * @param mbean - mbean to print
+     */
+    public static void printMBean(ObjectInstance mbean) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printMBean(mbean);
+    }
+
+    /**
+     * Print an ObjectName format of an mbean
+     * @param mbean - mbean to print
+     */
+    public static void printMBean(ObjectName mbean) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printMBean(mbean);
+    }
+
+    /**
+     * Print an AttributeList format of an mbean
+     * @param mbean - mbean to print
+     */
+    public static void printMBean(AttributeList mbean) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printMBean(mbean);
+    }
+
+    /**
+     * Print a Map format of an mbean
+     * @param mbean
+     */
+    public static void printMBean(Map mbean) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printMBean(mbean);
+    }
+
+    /**
+     * Print a Collection format of mbeans
+     * @param mbean - collection of mbeans
+     */
+    public static void printMBean(Collection mbean) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printMBean(mbean);
+    }
+
+    /**
+     * Print a Map format of a JMS message
+     * @param msg
+     */
+    public static void printMessage(Map msg) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printMessage(msg);
+    }
+
+    /**
+     * Print a Message format of a JMS message
+     * @param msg - JMS message to print
+     */
+    public static void printMessage(Message msg) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printMessage(msg);
+    }
+
+    /**
+     * Print a collection of JMS messages
+     * @param msg - collection of JMS messages
+     */
+    public static void printMessage(Collection msg) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printMessage(msg);
+    }
+
+    /**
+     * Print help messages
+     * @param helpMsgs - help messages to print
+     */
+    public static void printHelp(String[] helpMsgs) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printHelp(helpMsgs);
+    }
+
+    /**
+     * Print an information message
+     * @param info - information message to print
+     */
+    public static void printInfo(String info) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printInfo(info);
+    }
+
+    /**
+     * Print an exception message
+     * @param e - exception to print
+     */
+    public static void printException(Exception e) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printException(e);
+    }
+
+    /**
+     * Print a version information
+     * @param version - version info to print
+     */
+    public static void printVersion(String version) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.printVersion(version);
+    }
+
+    /**
+     * Print a generic key value mapping
+     * @param map to print
+     */
+    public static void print(Map map) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.print(map);
+    }
+
+    /**
+     * Print a generic array of strings
+     * @param strings - string array to print
+     */
+    public static void print(String[] strings) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.print(strings);
+    }
+
+    /**
+     * Print a collection of objects
+     * @param collection - collection to print
+     */
+    public static void print(Collection collection) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.print(collection);
+    }
+
+    /**
+     * Print a java string
+     * @param string - string to print
+     */
+    public static void print(String string) {
+        if (formatter == null) {
+            throw new IllegalStateException("No OutputFormatter specified. Use GlobalWriter.instantiate(OutputFormatter).");
+        }
+        formatter.print(string);
+    }
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/GlobalWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/OutputFormatter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/OutputFormatter.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/OutputFormatter.java (original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/OutputFormatter.java Tue Feb 21 15:12:56 2006
@@ -1,130 +1,130 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.console.formatter;
-
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.AttributeList;
-import javax.jms.Message;
-import java.util.Collection;
-import java.util.Map;
-import java.io.OutputStream;
-
-public interface OutputFormatter {
-
-    /**
-     * Retrieve the output stream being used by the formatter
-     * @return
-     */
-    public OutputStream getOutputStream();
-
-    /**
-     * Print an ObjectInstance format of an mbean
-     * @param mbean - mbean to print
-     */
-    public void printMBean(ObjectInstance mbean);
-
-    /**
-     * Print an ObjectName format of an mbean
-     * @param mbean - mbean to print
-     */
-    public void printMBean(ObjectName mbean);
-
-    /**
-     * Print an AttributeList format of an mbean
-     * @param mbean - mbean to print
-     */
-    public void printMBean(AttributeList mbean);
-
-    /**
-     * Print a Map format of an mbean
-     * @param mbean - mbean to print
-     */
-    public void printMBean(Map mbean);
-
-    /**
-     * Print a Collection format of mbeans
-     * @param mbean - collection of mbeans
-     */
-    public void printMBean(Collection mbean);
-
-    /**
-     * Print a Map format of a JMS message
-     * @param msg
-     */
-    public void printMessage(Map msg);
-
-    /**
-     * Print a Message format of a JMS message
-     * @param msg - JMS message to print
-     */
-    public void printMessage(Message msg);
-
-    /**
-     * Print a Collection format of JMS messages
-     * @param msg - collection of JMS messages
-     */
-    public void printMessage(Collection msg);
-
-    /**
-     * Print help messages
-     * @param helpMsgs - help messages to print
-     */
-    public void printHelp(String[] helpMsgs);
-
-    /**
-     * Print an information message
-     * @param info - information message to print
-     */
-    public void printInfo(String info);
-
-    /**
-     * Print an exception message
-     * @param e - exception to print
-     */
-    public void printException(Exception e);
-
-    /**
-     * Print a version information
-     * @param version - version info to print
-     */
-    public void printVersion(String version);
-
-    /**
-     * Print a generic key value mapping
-     * @param map to print
-     */
-    public void print(Map map);
-
-    /**
-     * Print a generic array of strings
-     * @param strings - string array to print
-     */
-    public void print(String[] strings);
-
-    /**
-     * Print a collection of objects
-     * @param collection - collection to print
-     */
-    public void print(Collection collection);
-
-    /**
-     * Print a java string
-     * @param string - string to print
-     */
-    public void print(String string);
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.console.formatter;
+
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.management.AttributeList;
+import javax.jms.Message;
+import java.util.Collection;
+import java.util.Map;
+import java.io.OutputStream;
+
+public interface OutputFormatter {
+
+    /**
+     * Retrieve the output stream being used by the formatter
+     * @return
+     */
+    public OutputStream getOutputStream();
+
+    /**
+     * Print an ObjectInstance format of an mbean
+     * @param mbean - mbean to print
+     */
+    public void printMBean(ObjectInstance mbean);
+
+    /**
+     * Print an ObjectName format of an mbean
+     * @param mbean - mbean to print
+     */
+    public void printMBean(ObjectName mbean);
+
+    /**
+     * Print an AttributeList format of an mbean
+     * @param mbean - mbean to print
+     */
+    public void printMBean(AttributeList mbean);
+
+    /**
+     * Print a Map format of an mbean
+     * @param mbean - mbean to print
+     */
+    public void printMBean(Map mbean);
+
+    /**
+     * Print a Collection format of mbeans
+     * @param mbean - collection of mbeans
+     */
+    public void printMBean(Collection mbean);
+
+    /**
+     * Print a Map format of a JMS message
+     * @param msg
+     */
+    public void printMessage(Map msg);
+
+    /**
+     * Print a Message format of a JMS message
+     * @param msg - JMS message to print
+     */
+    public void printMessage(Message msg);
+
+    /**
+     * Print a Collection format of JMS messages
+     * @param msg - collection of JMS messages
+     */
+    public void printMessage(Collection msg);
+
+    /**
+     * Print help messages
+     * @param helpMsgs - help messages to print
+     */
+    public void printHelp(String[] helpMsgs);
+
+    /**
+     * Print an information message
+     * @param info - information message to print
+     */
+    public void printInfo(String info);
+
+    /**
+     * Print an exception message
+     * @param e - exception to print
+     */
+    public void printException(Exception e);
+
+    /**
+     * Print a version information
+     * @param version - version info to print
+     */
+    public void printVersion(String version);
+
+    /**
+     * Print a generic key value mapping
+     * @param map to print
+     */
+    public void print(Map map);
+
+    /**
+     * Print a generic array of strings
+     * @param strings - string array to print
+     */
+    public void print(String[] strings);
+
+    /**
+     * Print a collection of objects
+     * @param collection - collection to print
+     */
+    public void print(Collection collection);
+
+    /**
+     * Print a java string
+     * @param string - string to print
+     */
+    public void print(String string);
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/formatter/OutputFormatter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/AmqMessagesUtil.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/AmqMessagesUtil.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/AmqMessagesUtil.java (original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/AmqMessagesUtil.java Tue Feb 21 15:12:56 2006
@@ -1,64 +1,64 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.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 {
-    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 List getAllMessages(URI brokerUrl, Destination dest) throws Exception {
-       return getMessages(brokerUrl, dest, "");
-    }
-
-    public static List getMessages(URI brokerUrl, Destination dest, String selector) throws Exception {
-        return createMessageQueryFilter(brokerUrl, dest).query(selector);
-    }
-
-    public static List getMessages(URI brokerUrl, Destination dest, List selectors) throws Exception {
-        return createMessageQueryFilter(brokerUrl, dest).query(selectors);
-    }
-
-    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("");
-    }
-
-    public static QueryFilter createMessageQueryFilter(URI brokerUrl, Destination dest) {
-        return new WildcardToMsgSelectorTransformFilter(
-            new AmqMessagesQueryFilter(brokerUrl, dest)
-        );
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.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 {
+    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 List getAllMessages(URI brokerUrl, Destination dest) throws Exception {
+       return getMessages(brokerUrl, dest, "");
+    }
+
+    public static List getMessages(URI brokerUrl, Destination dest, String selector) throws Exception {
+        return createMessageQueryFilter(brokerUrl, dest).query(selector);
+    }
+
+    public static List getMessages(URI brokerUrl, Destination dest, List selectors) throws Exception {
+        return createMessageQueryFilter(brokerUrl, dest).query(selectors);
+    }
+
+    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("");
+    }
+
+    public static QueryFilter createMessageQueryFilter(URI brokerUrl, Destination dest) {
+        return new WildcardToMsgSelectorTransformFilter(
+            new AmqMessagesQueryFilter(brokerUrl, dest)
+        );
+    }
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/AmqMessagesUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message