WBEMfor Solaris on Sun Developer's Guide

Example -- Setting Instances

The code segment in Example 6-8 gets a CIM instance, updates one of its property values, and passes the updated instances to the CIM Object Manager.

A CIM property is a value used to describe a characteristic of a CIM class. Properties can be thought of as a pair of functions, one to set the property value and one to get the property value.


Example 6-8 Setting Instances (setInstance)

{
/* Get instances for each element in a vector, update the 
property value of b to 10 in each instance, 
and pass the updated instance to the CIM Object Manager. */
 
For (int i=0; i(v.size(); i++) {
		CIMInstance ci = cc.getInstance(v.elementAt(i));
		ci.setProperty("b",new CIMValue(10)); 
		cc.setInstance(new CIMObjectPath(),ci); 
 
}