Class QueryValidator


  • public class QueryValidator
    extends java.lang.Object
    A validator for query. Invalid queries either log a warning, or throw an exception when trying to execute.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String QUERY_VALIDATOR
      The name of the query validator node.
    • Constructor Summary

      Constructors 
      Constructor Description
      QueryValidator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkStatement​(java.lang.String statement)
      Check if a query is valid.
      java.lang.String getJson()
      Get the current set of pattern data.
      void init​(NodeStore store)  
      void setPattern​(java.lang.String key, java.lang.String pattern, java.lang.String comment, boolean failQuery)
      Add a pattern.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • QUERY_VALIDATOR

        public static final java.lang.String QUERY_VALIDATOR
        The name of the query validator node.
        See Also:
        Constant Field Values
    • Constructor Detail

      • QueryValidator

        public QueryValidator()
    • Method Detail

      • setPattern

        public void setPattern​(java.lang.String key,
                               java.lang.String pattern,
                               java.lang.String comment,
                               boolean failQuery)
        Add a pattern.
        Parameters:
        key - the key
        pattern - the pattern regular expression - if empty, the entry is removed
        comment - the comment
        failQuery - - if true, trying to run such a query will fail; otherwise the queries that will work, but will log a warning. A warning is logged at most once every 10 seconds.
      • getJson

        public java.lang.String getJson()
        Get the current set of pattern data.
        Returns:
        the json representation
      • checkStatement

        public void checkStatement​(java.lang.String statement)
                            throws java.text.ParseException
        Check if a query is valid. It is either valid, logs a warning, or throws a exception if invalid.
        Parameters:
        statement - the query statement
        Throws:
        java.text.ParseException - if it is invalid
      • init

        public void init​(NodeStore store)