class Association

An instance of a subclass of Association represents a dynamic collection of child Item(s) related to a parent Item identified by a selector. More...

Definition#include <sysadm/Association.h>
InheritsCategory
Inherited byChildAttrAssoc, ClustersAssocWithMachine, ComputedAssoc, MachinesAssocWithCluster, ParentAttrAssoc
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Static Methods

Public Members

Protected Methods

Protected Members


Detailed Description

An instance of a subclass of Association represents a dynamic collection of child Item(s) related to a parent Item identified by a selector. For example, the user account Item(s) that are related to a group account Item with selector "bar" could be represented by an Association. An Association represents an 1-to-n relationship. A 1-to-1 relationship is handled as a special case of 1-to-n relationship.

Association derives from Category and supports the same client mechanisms for obtaining dynamic information about the Item(s) in an Association instance. This class monitors the parent Item and subclasses are responsible for determining the child Item(s) that added, deleted and changed. The Association class notifies changes to listeners.

If an Item with the specified parent selector does not exist, the Association will monitor for the addition of an Item with that selector. When such an Item is added, the subclasses are notified and subclasses can do whatever is necessary to determine the child Item(s) at that time and monitor the system for future changes.

If an Item with the specified parent selector existed, but is deleted while a client is monitoring the Association, all Items are removed from the Association and the Association continues monitoring of the system for the addition of an Item with that parent selector.

The Association class (Vs. derived classes) is used only when sub-classes require logic very specific to the application to determine when items are added, changed and removed from the association. For example, the relationship may be calculated by queries on a database based on "parentSelector". The derived classes ComputedAssoc, ChildAttrAssoc and ParentAttrAssoc can be used when the data requiring for computing the relationship is contained within the Item(s) in the Category(s).

See AssocFactory.h for details on the steps required to plug-in an Association.

String  computeSelector (const String& parentCategoryName, const String& parentSelector, const String& childCategoryName)

[static]

Compute the name (selector) for this association instance.

static const char* NAME

Used internally for logging.

 Association (Category& parentCategory, const String& parentSelector, Category& childCategory)

[protected]

Constructor which initializes Category base class with a unique name based on the input parameters.

All subclasses of Association must support a constructor with this signature which will be called by AssocFactory when an instance of Association is requested and one does not exist for the specified combination of input parameters. "parentCategory" is the Category of the parent item. "parentSelector" is the Selector of the parent item. "childCategory" is the Category of the child item(s).

Association ()

[protected virtual]

Destructor.

void  startMonitor ()

[protected virtual]

Starts monitoring the system by registering for notifications about the parent Item (identified by "parentSelector" in constructor).

Reimplemented from Category.

void  parentAdded (const Item& item)

[protected virtual]

Called if the parent Item (identified by "parentSelector" in constructor) is determined to exist in the system at the time monitoring is started. Also called if that Item is added later to the system. "item" is the parent Item that was added. This class provides a trivial implementation. Subclasses can override this method to, for example, register for notifications on Items in the child Category. None of addItem(), changeItem(), orphanItem(), removeItem() or replaceItemList() should be called prior to the call to parentAdded().

void  parentChanged (const Item& oldItem, const Item& newItem)

[protected virtual]

Called when parent Item changes. "oldItem" and "newItem" hold the previous and current state of the parent Item respectively. This class provides a trivial implementation. Subclasses can override this method to do whatever is necessary to keep the list of child Item(s) up-to-date.

void  parentRemoved ()

[protected virtual]

Called when parentItem is removed. Removes all Items from its list and sends CategoryListener::itemRemoved() messages for each child Item to registered listeners.

const Item*  getParent ()

[protected virtual]

Get the parent item of this association.

friend class ParentCategoryListener

[protected]

Allow ParentCategoryListener to invoke our protected methods.

String  getParentSelector ()

[protected virtual]

Get the selector of the parent item.

String  getParentCategoryName ()

[protected virtual]

Get name of parent category.

String  getChildCategoryName ()

[protected virtual]

Get name of child category.


Generated by: rusty@irem on Mon Sep 18 18:07:52 2000, using kdoc 2.0a36.