Class QueryRunner


  • public class QueryRunner
    extends java.lang.Object
    Run a set of queries using a compound query builder. A configuration file is used to define a source of data for the queries and a target TIBCO Patterns - Search server for the queries. Query data can be read from a set of one or more CSV files, or from a TIBCO Patterns - Search server. If reading data from CSV files they must be in a format compatible with NetricsCompoundReader. Queries are generated using an ANetricsCompoundQueryBuilder object passed into the QueryRunner. The input data format is taken from the table structure defined in the ANetricsCompountQueryBuilder. The query runner configuration supports mapping input and output table names and field names. See the RunQuery.xsd schema for an explanation of the query run configuration options.

    This class is used by the main of the GeneralCompoundQueryBuilder class to implement the run query option. It may also be used by outside applications to implement similar functionality.

    • Constructor Summary

      Constructors 
      Constructor Description
      QueryRunner​(java.io.File run_config_file, com.netrics.likeit.ANetricsCompoundQueryBuilder our_builder, AQBPLogger run_logger)
      Create a query runner from a configuration file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean run()
      Run the set of queries for this query runner.
      • Methods inherited from class java.lang.Object

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

      • QueryRunner

        public QueryRunner​(java.io.File run_config_file,
                           com.netrics.likeit.ANetricsCompoundQueryBuilder our_builder,
                           AQBPLogger run_logger)
                    throws java.lang.IllegalArgumentException,
                           AQBPLogger.QBPException
        Create a query runner from a configuration file. This creates a query runner from a query runner configuration file. It validates the configuration file against the query builder it is given. All errors in the configuration are logged to the given logger as errors, not configuration errors (as this is not a query builder configuration). If any configuration errors are found a AQBPLogger.QBPException is thrown.
        Parameters:
        run_config_file - the configuration for the query run.
        our_builder - the query builder to be used to construct the queries.
        run_logger - logger for reporting errors.
        Throws:
        java.lang.IllegalArgumentException - if run_logger is null.
        AQBPLogger.QBPException - for all other errors.
    • Method Detail

      • run

        public boolean run()
                    throws AQBPLogger.QBPException
        Run the set of queries for this query runner. The query records are scanned only once. This method picks up where the previous call to run left off. If a previous run completed, subsequent calls to this method produce no queries.
        Returns:
        true if all source records were processed successfully, false if there were any errors in the query processing.
        Throws:
        AQBPLogger.QBPException - on unrecoverable errors, or any error if the logger for this runner is in exception mode.