org.apache.activemq.console.filter
Class RegExQueryFilter

java.lang.Object
  extended by org.apache.activemq.console.filter.AbstractQueryFilter
      extended by org.apache.activemq.console.filter.RegExQueryFilter
All Implemented Interfaces:
QueryFilter
Direct Known Subclasses:
MBeansRegExQueryFilter

public abstract class RegExQueryFilter
extends AbstractQueryFilter


Field Summary
static String REGEX_PREFIX
           
 
Fields inherited from class org.apache.activemq.console.filter.AbstractQueryFilter
next
 
Fields inherited from interface org.apache.activemq.console.filter.QueryFilter
QUERY_DELIMETER
 
Constructor Summary
protected RegExQueryFilter(QueryFilter next)
          Creates a regular expression query that is able to match an object using key-value pattern regex filtering
 
Method Summary
protected  Pattern compileQuery(String query)
          Compiles the regex query to a pattern.
protected  List filterCollectionUsingRegEx(Map regex, List data)
          Filter the specified colleciton using the regex patterns extracted.
protected  boolean isRegularExpression(String query)
          Checks if a given string is a regular expression query.
protected abstract  boolean matches(Object data, Map regex)
          Determines how the object is to be matched to the regex map.
 List query(List queries)
          Separates the regular expressions queries from the usual queries.
 
Methods inherited from class org.apache.activemq.console.filter.AbstractQueryFilter
query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REGEX_PREFIX

public static final String REGEX_PREFIX
See Also:
Constant Field Values
Constructor Detail

RegExQueryFilter

protected RegExQueryFilter(QueryFilter next)
Creates a regular expression query that is able to match an object using key-value pattern regex filtering

Parameters:
next -
Method Detail

query

public List query(List queries)
           throws Exception
Separates the regular expressions queries from the usual queries. A query is a regex query, if it is key-value pair with the format =, and value is a pattern that satisfies the isRegularExpression method.

Parameters:
queries - - list of queries
Returns:
filtered objects that matches the regex query
Throws:
Exception

isRegularExpression

protected boolean isRegularExpression(String query)
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.

Parameters:
query -
Returns:
boolean result of query check

compileQuery

protected Pattern compileQuery(String query)
Compiles the regex query to a pattern.

Parameters:
query - - query string to compile
Returns:
regex pattern

filterCollectionUsingRegEx

protected List filterCollectionUsingRegEx(Map regex,
                                          List data)
                                   throws Exception
Filter the specified colleciton using the regex patterns extracted.

Parameters:
regex - - regex map
data - - list of objects to filter
Returns:
filtered list of objects that matches the regex map
Throws:
Exception

matches

protected abstract boolean matches(Object data,
                                   Map regex)
                            throws Exception
Determines how the object is to be matched to the regex map.

Parameters:
data - - object to match
regex - - regex map
Returns:
true, if the object matches the regex map, false otherwise
Throws:
Exception


Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.