com.BobCo.associations
Class DomainWorkgroupAssociation

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGObject
      extended bycom.tivoli.twg.engine.TWGPersistentObject
          extended bycom.tivoli.twg.engine.TWGAssociation
              extended bycom.BobCo.associations.DomainWorkgroupAssociation
All Implemented Interfaces:
com.tivoli.twg.engine.TWGBaseShadowedObject, com.tivoli.twg.engine.TWGShadowedObject

public class DomainWorkgroupAssociation
extends com.tivoli.twg.engine.TWGAssociation

Sample association subclass for supporting Domain/Workgroup topology based relationships. This sample demonstrates the base functionality required to implement a new association for Director managed object presentation.

For this sample, the data used for defining the relationships of the association are based on the "DOMAIN" and "WORKGROUP" fields of the "TWG_WINDOWS_NETWORK_ID" table in the Director Database. This data describes the name of the Windows NT Domain that each system is a member of (if its a domain system) and the Windows Workgroup the system is a member of (if its a workgroup system). For each different domain and/or workgroup name returned for each of the systems passed to the association, a TWGRelationship object is defined, and named according to the domain or workgroup name. Each system which is a member of a given domain or workgroup will then be down-linked below the TWGRelationship instance corresponding to its domain/ workgroup.

Also, note that all the domain and workgroup TWGRelationship instances are linked to a root relationship. This root relationship is not displayed as a folder by the Director console, but is required for the other TWGRelationships to be displayed properly.

Also of note is the full internationalization enabling of this association implementation. When a TWGRelationship is queried for its name for presentation on the Director console, the Locale of the console is provided as input, allowing appropriate strings and formatting to be done. The TWGRelationship base class provides 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 shown below) can be implemented which provides a custom implementation of the getName(Locale) method. In our case, the java.text.MessageFormat class is used to produce a language-specific string corresponding to "Domain 'name'" or "Workgroup 'name'".

See Also:
TWGAssociation, TWGDatabaseTable, TWGRelationship, TWGRelationshipSet, TWGManagedObjectSet, TWGManagedObject

Field Summary
static java.lang.String DEFAULT_DOMAIN_ASSOC_ID
          ID of default "Domains/Workgroups" association
 
Fields inherited from class com.tivoli.twg.engine.TWGAssociation
DEFAULT_NONE_ASSOC_ID
 
Fields inherited from class com.tivoli.twg.engine.TWGPersistentObject
CLASS_NAME, SIZEOF_BYTE, SIZEOF_CHAR, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_INT, SIZEOF_LONG, SIZEOF_SHORT
 
Constructor Summary
DomainWorkgroupAssociation()
          Default constructor for sample Domain/Workgroups topology association
 
Method Summary
 void evaluateNewAndChangedObjects(com.tivoli.twg.engine.TWGRelationshipSet rel, com.tivoli.twg.libs.IntValueSet add_set, com.tivoli.twg.libs.IntValueSet chg_set, com.tivoli.twg.engine.TWGManagedObjectSet mos)
          Primary functional evaulation method for association object.
static void initializeDefault()
          Initializer method : used to build default instance, if needed
 
Methods inherited from class com.tivoli.twg.engine.TWGAssociation
Delete, findByIDString, GetConShadowClass, getExtensionClassName, getIDString, getMenuWeight, getName, getName, GetShadowRecord, GetShadowVersion, initBuiltInAssociations, isDatabaseDependent, isDisabled, isLicenseDisabled, restoreData, saveData, setExtensionClassName, setIDString, setMenuWeight, setName, setName, toString, UpdateShadowVersion
 
Methods inherited from class com.tivoli.twg.engine.TWGPersistentObject
Destroy, enableAsyncWrites, fromPersistID, initialize, isNewPersistentStore, isSaveRequired, PersistID, restore, restoreAll, save, save, setSaveRequired, terminate, toPersistID
 
Methods inherited from class com.tivoli.twg.engine.TWGObject
AllObjects, AllObjects, DumpTWGObjects, FindObject, isDeleted, isNewObject, isPersistent, isPersistent, isValid, isValid, ObjectID, setDistinctObjectID, SetObjectID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DOMAIN_ASSOC_ID

public static final java.lang.String DEFAULT_DOMAIN_ASSOC_ID
ID of default "Domains/Workgroups" association

See Also:
Constant Field Values
Constructor Detail

DomainWorkgroupAssociation

public DomainWorkgroupAssociation()
Default constructor for sample Domain/Workgroups topology association

Method Detail

initializeDefault

public static void initializeDefault()
                              throws com.tivoli.twg.engine.TWGPersistentObjectSaveException
Initializer method : used to build default instance, if needed

Throws:
TWGPersistentObjectSaveException - if error saving new objects
com.tivoli.twg.engine.TWGPersistentObjectSaveException

evaluateNewAndChangedObjects

public void evaluateNewAndChangedObjects(com.tivoli.twg.engine.TWGRelationshipSet rel,
                                         com.tivoli.twg.libs.IntValueSet add_set,
                                         com.tivoli.twg.libs.IntValueSet chg_set,
                                         com.tivoli.twg.engine.TWGManagedObjectSet mos)
Primary functional evaulation method for association object. This method creates a relationship object for each distinct workgroup and domain, containing the systems under each domain and workgroup.

Parameters:
rel - - Relationship set to be maintainted
add_set - - Set of persistent IDs for the managed objects which have been added to the TWGManagedObjectSet which was used to produce the relationship set
chg_set - - Set of persistent IDs for the managed objects which have been changed (and were previously in the MOS used for the relationship set).
mos - - TWGManagedObjectSet containing full population of objects for relationship set (with changes already applied)