Solaris WBEM Developer's Guide

Working With Qualifiers and Qualifier Types

A CIM qualifier is an element that characterizes one of the following: CIM class, instance, property, method, or parameter. Qualifiers have the following attributes:

In MOF syntax, each CIM qualifier must have a CIM qualifier type defined. Qualifiers do not have a scope attribute, which indicates the CIM elements that can use the qualifier. You can only define scope in the qualifier type declaration. You cannot change scope in a qualifier.

The following sample code shows the MOF syntax for a CIM qualifier type declaration. This statement defines a qualifier type which is named key, with a Boolean data type (default value false). This qualifier can describe only a property and a reference to an object. The DisableOverride flavor means that key qualifiers cannot change their value.

Qualifier Key : boolean = false, Scope(property, reference), 
                    Flavor(DisableOverride);

The following sample code shows the MOF syntax for a CIM qualifier. In this sample MOF file, key and description are qualifiers for the property a. The property data type is an integer with the property name a.

{
[key, Description("test")]
int a;
};

Getting and Setting CIM Qualifiers

A qualifier flavor is a flag that governs the use of a qualifier. Flavors describe rules that specify whether a qualifier can be propagated to derived classes and instances. Rules also determine whether a derived class or instance can override the qualifier's original value.


Example 4–19 Setting CIM Qualifiers

This example sets a list of CIM qualifiers for a new class to the qualifiers in its superclass.

{

 try {
     cimSuperClass = cimClient.getClass(new CIMObjectPath(scName));
     Vector v = new Vector();
     for (Enumeration e = cimSuperClass.getQualifiers().elements();
                          e.hasMoreElements();) { 
         CIMQualifier qual = (CIMQualifier)
                             ((CIMQualifier)e.nextElement()).clone();
         v.addElement(qual);
     }
     cimClass.setQualifiers(v); 
 } catch (CIMException exc) {
      return;
 }
}
...