class AssocFactory

AssocFactory is the factory class for Association objects. More...

Definition#include <sysadm/AssocFactory.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Static Methods

Public Members


Detailed Description

AssocFactory is the factory class for Association objects. AssocFactory methods are used by the Association Service to fulfill requests from remote clients. They can also be used by any server-side components that require information from an Association. Association subclasses will use the macros defined here.

To make information about an Association between any Item of type "parentCategory" and Item(s) of type "childCategory" available to the rest of the system the following steps are required:

1. Information about the Category(s) "parentCategory" and "childCategory" should be available as detailed in CategoryFactory.h. 2. Implement a subclass of Association called <parentCategory>AssocWith<childCategory>. 2a. The subclass must have a constructor with the signature (Category& parentCategory, const String& parentSelector, Category&). Typically, this calls the corresponding Association constructor or an Association subclass constructor. "parentSelector" is the name of the parent Item of type "parentCategory" for which related Item(s) from "childCategory" are to be determined. 2b. Use the convenience macro SaASSOC_REF_DECL in the header file to provide declaration for the routines used by the Association Service for obtaining Association instances. 2c. In most cases, only one instance of a particular subclass of Association should exist for a given "parentCategory", "parentSelector", "childCategory" combination in an address space. To enforce this, subclasses should protect their constructors and use the convenience macro SaASSOC_FRIEND_DEF in the class declaration in the header file. 2d. Use the convenience macro SaASSOC_REF_DEF in the c++ file to provide the definition for the routines used by the Association Service for obtaining Association instances. This in turn will use the constructor described in 2a. 2. Create a library called <parentCategory>AssocWith<childCategory>.so. 3. Install it in /usr/sysadm/association/

The above steps will allow clients to obtain the Association instance to determine the relationship between any Item of type "parentCategory" and Item(s) of type "childCategory". Association.h describes the different methods supported by Association.

Association*  getAssociation (const String& parentCategoryName, const String& parentSelector, const String& childCategoryName, String& errorString)

[static]

Static get method. Creates an Association instance for the specified parent Category, parent Item and child Category, if it does not exist. Returns a reference counted Association instance.

The method fails if the Association instance cannot be created. On failure, returns NULL and errorString is initialized with the localized error string. This can happen if the library corresponding to the parent/child Category or Association cannot be loaded or if any library does not define the symbols required. See Association.h for details on the steps required to plug-in an Association.

bool  releaseAssociation (Association* assoc, String& errorString)

[static]

Static release method. Decrements reference count for Association instance. Deletes the instance, if there are no references to it.

If no error is encountered in uninitializing the internal data structures used for creating the Association, returns true. Otherwise, returns false and errorString is initialized with the localized error string. This can happen if any library loaded for creation of the Association instance cannot be unloaded.

static const char* NAME

Used internally for logging.


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