Sun WBEM SDK Developer's Guide

Working with Instances

In CIM WorkShop, you can create instances of classes. Instances inherit the characteristics of the class. You can then change the attributes of a new instance to create a unique instance of a class.

Displaying Instances

Before you create a new instance of a class, it is useful to view the instances of the class to see what properties and methods they contain.

How to Display Instances of an Existing Class
  1. In the class inheritance tree of the CIM WorkShop window, select the class for which you want to view instances.

  2. To display the Instances window:

    • Click Action->Instances->Deep Enumeration or Shallow Enumeration.

      or

    • Click the Show Instances icon on the CIM WorkShop toolbar.

      or

    • Right click a class and select either Deep Enumeration or Shallow Enumeration from the pop-up dialog box.

The Instances window is displayed. If the selected class has instances, the instances are displayed in the left frame of the Instances window. If the selected class does not have instances, the left frame of the Instances window is empty.

Adding Instances

Add instances to a class when you want to modify the inherited qualities of objects.

How to Add an Instance to a Class
  1. In the CIM WorkShop window:

    • Click Action->Instances->Deep Enumeration to list the instances of the current class and all its descendant classes.

      or

    • Click Action->Instances->Shallow Enumeration to list the instances of the current class.

      The Instances window is displayed. All instances of the class are displayed in the left side of the window.

  2. Right-click an instance listed in the Instances window.

    The Add Instances dialog box is displayed with options to Refresh, Add Instance, or Delete Instance.

  3. Click Add Instance.

  4. To modify the inherited properties of an instance:

    1. Click in the value field to be changed.

      A dialog box is displayed in which you can provide a value for the property. The dialog box displayed varies depending on the type of the selected property. For example, if you select a property that has a type string, the String dialog box will display. The Value field of this dialog box accepts only character strings.

    2. In the Value field of the dialog box, type the required value.

  5. Click OK to close the Add Instances window.

Deleting Instances

You can delete an instance that you no longer use.

How to Delete an Instance
  1. In the left frame of the CIM WorkShop window, right-click the class from which you want to delete an instance.

  2. In the pop-up menu, click Instances->Deep Enumeration to list instances of the selected class and its subclasses. Click Instances->Shallow Enumeration ot list instances of the selected class.

  3. In the Instance window, right-click the instance you want to delete and click Delete Instance in the pop-up menu.

    The instance is deleted.