This topic describes how to extend IBM Director to create user-defined database queries. IBM Director enables you to create temporary queries and saved queries. Temporary queries are executed only once and their definitions are not saved in persistent storage. Saved queries are saved in persistent storage and are displayed as selectable queries on the IBM Director inventory query console. Saved queries can be either user-defined queries created using a user-defined query GUI or default queries created when the IBM Director Server is initialized.
The TWGDbCreateQueryCmd class is used to create and run temporary queries on the IBM Director database tables and on additional tables provided by IBM Director extensions. The TWGDbCreateQueryCmd class contains the parameters for a database command and is passed as an input parameter to an IPC command. The IPC command is sent to a database service node that processes the request. This create-and-run command code is used to specify that you want a temporary, rather than permanent, query.
Refer to IBM Director Interprocess Communication for information on programming service nodes and IPC commands.
Sample code on creating and running a temporary query is provided in the SampleCreateRunQuery.java file.
If you are defining new database tables, you can create default queries for those tables. Default queries are displayed automatically in the Available Queries window of the IBM Director Inventory Query Browser. You define default queries in the InitClassInstances() method of your extension's TWGExtension subclass.
A sample default query is provided in the SampleInventoryCollectorExtension.java file.
Use the following Java classes to retrieve information about tables and queries and to manipulate queries. These classes can help you create your own query GUI. Each of these classes contains the parameters for a database command, and each is passed as an input parameter to an IPC command. The IPC command is sent to a database query service node that processes the request.