Open topic with navigation

TIBCO® Patterns 6.1.2

# Using the Query Builder Platform in an Application

Because of its flexibility in allowing queries to be changed quickly and easily, most applications using the Java API should use the query builder platform to implement queries. The production experience, or changes in requirements, often require that you modify the query. It is much easier to update a configuration file than to install new code.

The `GeneralCompoundQueryBuilder` and `GeneralQueryBuilder` classes are extensions of `ANetricsCompoundQueryBuilder` and `ANetricsQueryBuilder`. Therefore, they can be used in any Java application that expects an implementation of one of these classes. The `GeneralCompoundQueryBuilder` or `GeneralQueryBuilder` class must be initialized with the desired configuration, either in the constructor when created, or by calling one of the `setConfiguration` methods before being used.

Note: To use these classes, include the `TIB_tps_qbp.jar` file in the class path of the Java application.

Some applications must handle both compound record matching and single table record matching. In such cases, the application can use `GeneralCompoundQueryBuilde`r. Standard and single table record matching is provided as one of the compound record matching types available in the query configuration.

To allow the `GeneralCompoundQueryBuilder` and `GeneralQueryBuilder` classes to fit seamlessly into almost any application, the following interfaces are defined by the query builder platform: `AQBPLogger`, `IQBPFileMgr`, and `IQBPLoaderMgr`.

Default implementations of these interfaces are available, which are automatically applied if the application does not supply its own. Therefore, it is not necessary to provide an implementation of any of these classes. An implementation is needed only if the default behavior is not suitable.

Interfaces of Query Builder Platform

Interface | Description
`AQBPLogger` | Gives the application control over the reporting of errors. The application can provide its own implementation of this abstract class to integrate the logging and error reporting of the query builder platform classes with the application's logging or the application can use the provided `QBPFileLogger` class and set options to control the reporting of errors. When using `QBPFileLogger` class, you can set options to perform the following actions:
| • | Throw exceptions for errors rather than log them.
| • | Add or omit error annotations to the configuration file.
| • | Control the types of log entries reported.
`IQBPFileMgr` | Gives the application control over the reading of configuration files. This can include enforcing restrictions on which files can be read. It can also include allowing configurations to be read from non-standard locations, such as a DBMS or a web service. A basic implementation of this interface, `DfltFileMgr,` is provided. It reads configuration files from a standard file system. By default, it imposes no restrictions, but it can be configured to restrict configuration files to a specific directory (and all subdirectories).
`IQBPLoaderMgr` | Gives the application control over the dynamic loading of classes. If the configuration file contains custom classes, these classes must be dynamically loaded. For security reasons, by default, classes are only loaded from the JVM class path. Applications might want to allow classes to be loaded from other locations (such as a directory for custom class files). Applications can define their own rules for the dynamic loading of classes by providing an appropriate implementation of this interface. As with the loading of configurations, this can also be used to allow custom classes to be loaded from non-standard sources, such as a DBMS or web-service. A basic implementation of this interface, `DfltLoaderMgr`, is provided. By default the `DfltLoaderMgr` loads classes only from the JVM class path. It can be set to load classes from a specific directory in addition to the JVM class path.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO® Patterns

Copyright © 2010-2025. Cloud Software Group, Inc. All Rights Reserved.