Solaris WBEM Developer's Guide

Passing Instances to the Association Methods

You use the enumerateInstances method to return all instances of a given class, and a loop structure to iterate through the instances. In the loop, you can pass each instance to an association method.

Example 4–14 Passing Instances

This example enumerates the instances in the op class and its subclasses. The example uses a while loop to cast each instance to a CIMObjectPath (op), and passes each instance as the first argument to the associators method.

    Enumeration e = cc.enumerateInstances(op, true);
    while (e.hasMoreElements()) {
        op = (CIMObjectPath)e.nextElement();
        Enumeration e1 = cc.associators(op, null, null, 
                null, null, false, false, null);