Class RegExQueryFilter

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

public abstract class RegExQueryFilter extends AbstractQueryFilter
  • Field Details

  • Constructor Details

    • 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 Details

    • 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