This topic describes how to create new database tables in IBM Director.
Use the following steps to create a new database table in IBM Director:
Refer to Updating IBM Director database tables for information on performing operations on the IBM Director database.
When creating the database table subclass you must override the create() and getTableVersion() methods of TWGDatabaseTable.
The create() method:
Note: IBM Director changes all table and column names to upper case.
Sample code showing these procedures is in the BobCoDeviceTable.java file.
Use the getTableVersion() method to provide a string that returns the version identifier for your database table.
Each table column must be defined as an instance of a subclass of the TWGDbColumn class. A TWGDbColumnData instance is also created that will contain the collection of TWGDbColumn.
When a table is defined, IBM Director does not allow its columns to be deleted and does not allow the name, type, or length of a column to be changed.
The following table lists the IBM Director column classes:
Column Class | Description |
---|---|
TWGDbCharColumn | Fixed length character data up - maximum 255 |
TWGDbVarcharColumn | Varying length character data - maximum 255 |
TWGDbIntegerColumn | 32-bit signed integer |
TWGDbSmallintColumn | 16-bit signed integer |
TWGDbRealColumn | Single-precision floating point (generally 7-digit precision) |
TWGDbDoubleColumn | Double-precision floating point (generally 15-digit precision) |
TWGDbDateColumn | Year, month, and day |
TWGDbDatetimeColumn | Year, month, day, hour, minutes, seconds. The actual SQL data type used might allow fractional seconds, but they are not supported by Director. |
Every table in IBM Director must have a column called MANAGED_OBJ_ID as part of its key to hold the data of the managed object ID. The column type is TWGDbIntegerColumn.
When creating a column, specify two names for the column, the real name and the token name. Both names can be the same. The token name is used for updating or querying the table through the IBM Director database interfaces. When creating a character type column, specify the column's length.
When defining a column whose values are TCP/IP addresses, you should define the column as an instance of TWGDbTCPIPColumn to allow the column values to sort correctly.
Here are additional methods you can use to set options for columns:
After each table column is defined it must be added to your TWGDbColumnData object using the addColumn() method.
To define the optional parameters for a new database table you must create a TWGDbTableParms instance that is passed to the TWGInitTable() method. This class allows you to:
When defining new database table, you should provide a Java resource bundle that provides:
You can provide a separate bundle for each language.
To register your TWGDatabaseTable subclass:
IBM Director creates the new database table as part of server initialization.
Sample code on using the InitClassRegistration() method is provided in the SampleInventoryCollectorExtension.java file.
A filter factory contains a set of table class names. The names of all filter factories are displayed as Available Criteria in the Dynamic Group Editor window in Director.
An administrator can expand a factory to see the list of tables belonging to it. Creating a filter factory for tables in your extension is optional. If no filter factory exists, your tables will not display as available criteria in the creation of dynamic groups.
New TWGFilterFactory objects are created in the InitClassInstances() method of your TWGExtension subclass.
A sample extension subclass is provided in the SampleInventoryCollectorExtension.java file.