Index

DKFederatedCollection

Purpose:

A federated collection allows an application program to process data objects resulting from a query as a group or collection and at the same time preserves the sub-grouping relationships that exists between them. It provides the user with a mechanism to:

A federated collection is a collection of DKAny containing DKResults objects, it is created to hold the results of DKFederatedQuery, which may come from several heterogeneous datastores. Each DKResults contains the results of subquery of the federated query submitted to a specific native datastore associated with the federated datastore.

To iterate over federated collection members (which are DKResults objects), create and use dkIterator or DKSequentialIterator to pull each DKResults object. Then, create another dkIterator on this DKResults to iterate over it and to process the result according to its datastore origin. Alternatively, create a federated iterator, DKFederatedIterator, and use it to iterate over all element members across collection boundaries, regardless of which datastore the result came from.

In theory, a federated collection can contains other nested collections up to any arbitrary depth. In the current implementation, a federated collection is not queryable.

Class summary:

class DKFederatedCollection : public DKSequentialCollection
 {
     DKFederatedCollection();
     virtual ~DKFederatedCollection();
     
     virtual unsigned long cardinality();
     virtual unsigned long memberCardinality();
     
     virtual dkIterator* createIterator();
     virtual dkIterator* createMemberIterator();
     
     virtual DKAny& retrieveElementAt(dkIterator& where);
     virtual void addElement(const DKAny& element);
     virtual void addAllElements(dkCollection& elements);
     virtual void insertElementAt(const DKAny& element, dkIterator& where);
     virtual void replaceElementAt(const DKAny& element, dkIterator& where);
     virtual void removeElementAt(dkIterator& where);
     virtual void removeAllElements();
 };

Members:

Member functions

cardinality
Returns the number of all individual (leaf) elements (non-collection) across the collection boundaries. This is the total of all elements in each sub-collections.
virtual unsigned long cardinality();

memberCardinality
Returns the number of elements in the collection. The element could be a collection object, for example, a DKResults object, not necessarily a leaf element (non-collection).
 virtual unsigned long memberCardinality();

createIterator
Creates a new DKFederatedIterator for this federated collection. This iterator can be used to iterate over the federated collection, across collection boundaries, returning a (non-collection) member one at a time.
virtual dkIterator* createIterator();

createMemberIterator
Creates a new iterator for this federated collection. The new iterator would be supporting DKSequentialIterator interface. That is, the method next of this iterator would return a collection, such as DKResults object. You can then create an iterator on this DKResults to iterate over its member.
virtual dkIterator* createMemberIterator();

(c) Copyright International Business Machines Corporation 1996, 2003. IBM Corp. All rights reserved.