Sun WBEM SDK Developer's Guide

Example — Setting a Property

The code segment in Example — Setting a Property sets a hypothetical lockspeed value for all Solaris processors. This code segment uses the following methods:


Example 4–10 Setting Processor Information (setProperty)

...
{
    /* 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. */
 
    Enumeration e = cc.enumerateInstanceNames(cop); 
 
    /* Iterate through the enumeration of instance object paths.
    Use the setProperty method to set the lockspeed
    value to 500 for each Solaris processor. */
 
    for (; e.hasMoreElements(); cc.setProperty(e.nextElement(), "lockspeed", 
        new CIMValue(new Integer(500))));
 
...
}