Sun WBEM SDK Developer's Guide

Example — Getting a Property

Example 4–9 prints the value of the lockspeed property for all Solaris processes. This code segment uses the following methods:


Example 4–9 Printing Processor Information (getProperty)

...
{
/* 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);
}
...
}