The associations sample, located in samples\javasrc\com\BobCo\associations, demonstrates the base functionality required to build a new Association class for managed systems presented in the IBM Director console. It shows a subclass that supports relationships based on DomainWorkgroup topology.
For this sample, the data used to define the relationships of the association are based on the DOMAIN and WORKGROUP fields of the TWG_WINDOWS_NETWORK_ID table in the IBM Director database. For systems in an NT domain, this data describes the name of the Windows NT domain of each system member. For systems in Windows workgroups, this data describes the name of the Windows workgroup of each system member.
For each different domain and workgroup name returned for each system passed to the association, a TWGRelationship object is defined and named according to the domain or workgroup name. Each system that is a member of a given domain or workgroup will then be down-linked below the TWGRelationship instance corresponding to its domain/workgroup.
Note that all the domain and workgroup TWGRelationship instances are linked to a root relationship. This root relationship is not displayed as a folder in the IBM Director console, but is required for the other TWGRelationships to be displayed properly.
The RunSimpleQuery class provides a static method to easily access the database using IPC Command communication with the database service node. This class requires BobCoAssociationsTable and BobCoTableResources to properly access the association tables. The query response is sent back through the Command and returned by the static method RunQuery.
Also note the full internationalization enabling of this association implementation. When a TWGRelationship is queried for its name for presentation in the IBM Director console, the Locale of the console is provided as input, allowing appropriate strings and formatting to be done. The TWGRelationship base class provides the setting of a reference to a static string resource in a java.util.ResourceBundle, but for variable data, such as our domain and workgroup names, a simple subclass of TWGRelationship (the DomainRelationship inner class in the sample) can be implemented that provides a custom implementation of the getName(Locale) method. In this sample, the java.text.MessageFormat class is used to produce a language-specific string corresponding to "Domain 'name'" or "Workgroup 'name'".