Example 4–9 prints the value of the lockspeed property for all Solaris processes. This code segment uses the following methods:
enumInstances – to get the names of all instances of Solaris processor
getProperty – to get the value of the lockspeed for each instance
println – to print the lockspeed value
... { /* Create an object (CIMObjectPath) to store the name of the Solaris_Processor class. */ CIMObjectPath cop = new CIMObjectPath("Solaris_Processor"); /* The CIM Object Manager returns an enumeration containing the names of instances of the Solaris_Processor class and all its subclasses (cc.DEEP). */ Enumeration e = cc.enumInstances(cop, cc.DEEP); /* Iterate through the enumeration of instance object paths. Use the getProperty method to get the lockspeed value for each Solaris processor. */ while(e.hasMoreElements()) { CIMValue cv = cc.getProperty(e.nextElement(), "lockspeed"); System.out.println(cv); } ... }