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.
This example enumerates the instances in the op class and its subclasses, 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); ... }