WBEMfor Solaris on Sun Developer's Guide

Example -- Creating an Instance

The code segment in Example 6-4 uses the newInstance method to create a Java class representing a CIM instance (for example, a Solaris package) from the Solaris_Package class.


Example 6-4 Creating an Instance (newInstance())

 
/*Connect to the CIM Object Manager in the root\cimv2 namespace 
on the local host. */
CIMClient cc = new CIMClient();
 
// Get the Solaris_Package class
cimclass = cc.getClass(newCIMObjectPath("Solaris_Package");
 
/* Create a new instance of the Solaris_Package class,
 populated with the default values for properties. If the provider
 for the class does not specify default values, the values of the 
 properties will be null and must be explicitly set. */
 ci = cimclass.newInstance();