WBEMfor Solaris on Sun Developer's Guide

Example -- Getting a Property

Example 6-7 prints the value of the lockspeed property for all Solaris processes. This code segment uses the following methods:


Example 6-7 Printing Processor Information (getProperty)

/* Connect to the CIM Object Manager as user mary with password 
contrary in the /root namespace on myhost */
{
CIMNameSpace cns = new CIMNamesSpace ("myhost" "/root");
cc = new CIMClient (cns, "/root", "mary", "contrary");
 
// Get names of all instances of Solaris_Processor
Vector op cc.enumInstances("Solaris_Processor")
 
// For each Solaris processor, get its instance data
while (vector has more elements) {
        cn.getNextElement();
        cc.getInstance (cn);
 
// Print the lockspeed of each processor
p = ci.getProperty("lockspeed")
        System.out.println(p.getValue().getValue());
}