A CIM qualifier is an element that characterizes a CIM class, instance, property, method, or parameter. Qualifiers have the following attributes:
Type
Value
Name
In Managed Object Format syntax, each CIM qualifier must have a CIM qualifier type declared in the same MOF file. Qualifiers do not have a scope attribute. Scope indicates which CIM elements can use the qualifier. Scope can only be defined in the qualifier type declaration; it cannot be changed in a qualifier.
The following sample code shows the MOF syntax for a CIM qualifier type declaration. This statement defines a qualifier type named key, with a Boolean data type (default value false), which 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 test. The property data type is an integer with the value a.
{ [key, Description("test")] int a }
The code segment in Example 4–24 uses the CIMQualifier class to identify the CIM qualifiers in a vector of CIM elements. The example returns the property name, value, and type for each CIM Qualifier.
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 and whether or not a derived class or instance can override the qualifier's original value.
{ ... } else if (tableType == QUALIFIER_TABLE) { CIMQualifier prop = (CIMQualifier)cimElements.elementAt(row); if (prop != null) { if (col == nameColumn) { return prop.getName(); } else if (col == typeColumn) { CIMValue cv = prop.getValue(); if (cv != null) { return cv.getType().toString(); } else { return "NULL"; } } ...
Example 4–25 is a code segment that 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; } } } ...