Class AQBPCompoundQueryBuilder

  • Direct Known Subclasses:
    AndCompoundQueryBuilder, MatchCaseCompoundQueryBuilder, RlinkCompoundQueryBuilder

    public abstract class AQBPCompoundQueryBuilder
    extends com.netrics.likeit.ANetricsCompoundQueryBuilder
    Add method needed by GeneralCompoundQueryBuilder to generate compound queries. The standard compound query builders used by the GeneralCompoundQueryBuilder class must extend this class. When generating a query the GeneralCompoundQueryBuilder class uses its features to generate the feature queries. These must be passed into the standard compound query generator to generate the full compound query.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.netrics.likeit.ANetricsCompoundQueryBuilder

        com.netrics.likeit.ANetricsCompoundQueryBuilder.FeatureDef
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected IQBPFileMgr file_mgr  
      • Fields inherited from class com.netrics.likeit.ANetricsCompoundQueryBuilder

        features
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected com.netrics.likeit.ANetricsQueryBuilder getBuilderClassObject​(java.lang.String class_name)
      Retrieve a class as an ANetricsQueryBuilder object.
      protected abstract com.netrics.likeit.NetricsQuery getQuery​(com.netrics.likeit.NetricsQuery[] feature_querylets)
      Method to be used by GeneralCompoundQueryBuilder.
      protected java.lang.Object setBuilderConfig​(com.netrics.likeit.ANetricsQueryBuilder builder, java.lang.String feature_name, java.lang.String config_src, AQBPLogger logger)
      initialize a feature query builder with a configuration file.
      protected abstract void setConfiguration​(java.lang.Object config_object, java.util.List<com.netrics.likeit.ANetricsCompoundQueryBuilder.FeatureDef> used_features, AQBPLogger logger)
      Configure this query generator from an external configuration object and a set of features.
      void setFileMgr​(IQBPFileMgr file_manager)
      Set the file manager used by this query builder.
      • Methods inherited from class com.netrics.likeit.ANetricsCompoundQueryBuilder

        addDefaultItem, changeItemName, getCurInputFieldNames, getCurItemName, getCurJoinedFieldNames, getCurJoinedFieldNames, getCurOutputFieldNames, getCurrentInputTableNames, getCurrentOutputTableNames, getDefaultItemNames, getDefaultTableNames, getDfltInputNames, getDfltOutputNames, getFeatureQueryletLists, getFeatureQuerylets, getJoinConfig, getQuery, getUsedItemTypes, setConfiguration, setConfiguration, setConfiguration, setConfiguration, setDefaultValue, setFeatures, setFieldValuesFromList, setFieldValuesFromMap, setFieldValuesFromRecord, setInputFieldName, setInputFieldNames, setInputFieldOrdering, setInputTableName, setInputTableNames, setOutputFieldName, setOutputFieldNames, setOutputTableName, setQueryConfiguration, setSearchOpts, setTables
      • Methods inherited from class java.lang.Object

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

      • AQBPCompoundQueryBuilder

        public AQBPCompoundQueryBuilder()
        Default constructor. This sets the file manager to the default file manager.
    • Method Detail

      • setFileMgr

        public void setFileMgr​(IQBPFileMgr file_manager)
        Set the file manager used by this query builder. A file manager is used to enforce access restrictions on configuration files. It can also be used to enable reading of configuration data from non standard sources, such as a DBMS or a web-service.
        Parameters:
        file_manager - the file manager to use.
        Throws:
        java.lang.IllegalArgumentException - if file_manager is null.
      • setBuilderConfig

        protected java.lang.Object setBuilderConfig​(com.netrics.likeit.ANetricsQueryBuilder builder,
                                                    java.lang.String feature_name,
                                                    java.lang.String config_src,
                                                    AQBPLogger logger)
                                             throws AQBPLogger.QBPConfigException,
                                                    java.lang.IllegalArgumentException
        initialize a feature query builder with a configuration file. This is a common operation for most sub-classes. It applies a configuration to a query builder. The configuration source is opened with the current file manager.
        Parameters:
        builder - the ANetricsQueryBuilder to be initialized.
        feature_name - the name of the feature this is for.
        config_src - the id of the configuration source (normally a file or path name).
        logger - for logging errors encountered in setting configuration.
        Returns:
        the configuration object if one was set, null on error or if there was no configuration to set.
        Throws:
        java.lang.IllegalArgumentException - if logger is null.
        AQBPLogger.QBPConfigException - if there are problems with the configuration and the logger has exception mode turned on.
      • getBuilderClassObject

        protected com.netrics.likeit.ANetricsQueryBuilder getBuilderClassObject​(java.lang.String class_name)
                                                                         throws java.lang.ClassNotFoundException,
                                                                                java.lang.InstantiationException
        Retrieve a class as an ANetricsQueryBuilder object. This dynamically loads a class and creates an instance of it using the default constructor. It then casts the instance to ANetricsQueryBuilder and returns it. It is used by the derived classes to load their querylet builders.
        Parameters:
        class_name - the full name of the class to be instantiated.
        Returns:
        an instance of the class created with the default constructor.
        Throws:
        java.lang.ClassNotFoundException - if couldn't load class.
        java.lang.InstantiationException - if couldn't create object or cast it to ANetricsQueryBuilder.
      • setConfiguration

        protected abstract void setConfiguration​(java.lang.Object config_object,
                                                 java.util.List<com.netrics.likeit.ANetricsCompoundQueryBuilder.FeatureDef> used_features,
                                                 AQBPLogger logger)
                                          throws AQBPLogger.QBPConfigException,
                                                 java.lang.IllegalStateException
        Configure this query generator from an external configuration object and a set of features. This method is used by the GeneralCompoundQueryBuilder class to link this builder to its own set of features. This configures this compound query generator from a configuration object. This object is generated from the query builder XML configuration (as generated from the XML by JAXB). This call does not attempt to instantiate the actual feature classes. Instead it uses the features from the given list.
        Parameters:
        config_object - this must be a valid configuration object for the implementing class.
        used_features - the features for this object. The list must match the length of the features defined in the config_object.
        logger - the logger for recording errors in the configuration. If null a default logger that throws AQBPLogger.QBPConfigException for all errors is used.
        Throws:
        java.lang.IllegalStateException - if this object is already initialized.
        AQBPLogger.QBPConfigException - if config_object is null, not the correct object type, or is not a valid configuration.
      • getQuery

        protected abstract com.netrics.likeit.NetricsQuery getQuery​(com.netrics.likeit.NetricsQuery[] feature_querylets)
                                                             throws java.lang.IllegalStateException,
                                                                    java.lang.IllegalArgumentException,
                                                                    java.lang.Exception
        Method to be used by GeneralCompoundQueryBuilder. When generating a query the GeneralCompoundQueryBuilder class builds its own feature values, and then passes them on to one of the standard compound query builder classes to generate the full compound query. This method provides the means for passing the feature queries into the compound builder.

        Note this query builder must not require any data or field names be initialized for this method to be called. It should throw IllegalStateException only if the object was never initialized with a configuration.

        Parameters:
        feature_querylets - the querylet values for the compound query.
        Returns:
        the complete compound query.
        Throws:
        java.lang.IllegalStateException - if this object was never initialized with a configuration.
        java.lang.IllegalArgumentException - if feature_querylets is null or not the correct length.
        java.lang.Exception - on other errors.