Flavors
Qualifiers also are characterized by how they transmit their information from parent to child class or from class to instance. To determine the rules by which a qualifier transmits its information, the MOF language defines special keywords called flavors. A colon always must precede qualifier flavors, as in Figure 4.7, and immediately after the description text, a semicolon precedes the qualifier flavor ToSubClass. This flavor indicates that every subclass of MySchema_CDROM inherits the qualifiers Description, Locale, and UUID. Figure 4.8 demonstrates some examples of flavors.
Figure 4.8 Example flavors
Custom Qualifiers
In designing the WBEM initiative, one of the goals of the DMTF was to provide technologies that were powerful and flexible enough to serve an environment as diverse as the enterprise. The CIM, for example, allows us to design specialized extensions using the extended schema. The MOF language also follows this philosophy to some extent with the creation of user-defined or custom qualifiers, whose only constraint is that qualifiers conform to one of the intrinsic data types defined in the MOF language. Schema designers can then use these qualifiers to represent specific characteristics unique to their schema. In Figure 4.8, the Locale qualifier and UUID qualifiers are both custom qualifiers defined by Microsoft and are not part of the default qualifiers defined by the DMTF. Examples of other qualifiers to which you will become accustomed in using WMI are Dynamic and Provider, which specify the use of Microsoft's dynamic providers for a class, instance, or property within the CIM repository.
The Locale qualifier is another Microsoft custom qualifier that provides WMI with a hex value that indicates the language and country of the class information that follows it. In this case, the locale ID 0x409 refers to US English. WMI can use this information to set specific information, such as date and time formats, character-sorting order, and decimal separators, when reading the following class or instance information.
In Figure 4.7, you can also see that the MySchema_CDROM class uses another custom qualifier, UUID. The UUID qualifier (which stands for Universally Unique IDentifier) assigns a unique 128-bit value to each class. UUIDs are randomly generated 8-byte values, which are represented by a string of hex values in the CIM repository. They are so random that no two UUIDs generated on two different machines at the same time ever should be the same. If you are familiar with COM, then you will know UUIDs as the unique means of representing Class Identifiers (CLSIDs) and Interface Identifiers (IIDs). UUIDs also are referred to as GUIDs or Globally Unique Identifiers; the two terms can be used interchangeably. The Microsoft Platform SDK supplies two executables, guidgen.exe and Uuidgen.exe, which can generate these random values on request. WMI uses these values automatically to identify classes and events internally. Then the properties and methods within each class are referred to using a unique index value in conjunction with this UUID. The advantage of using UUIDs/GUIDs is that they are locale independent, that is, they are represented by the same binary value regardless of the locale setting. Microsoft developed a technique called the "Data Block GUID Mapping control" method for WMI that maps these unique UUIDs to a two-character ID within the driver. The driver understands the two-character IDs and therefore can interact with WMI. This mapping between the ID and UUID also enables drivers to support custom events, methods, and properties, which can be instrumented via WMI.
User-Defined Qualifiers
New qualifier types are declared at the start of a MOF file: They begin with the qualifier keyword. The UUID qualifier, for example, could have been defined using MOF syntax similar to the following:
qualifier UUID :string = null, scope (class);
This syntax declares the qualifier called UUID, assigns it type string, and gives it a default value of zero. It then declares the qualifier to have a scope that affects only class declarations. Other settings that could have been used here include property, method, and reference, which would have allowed this qualifier to be used on these elements, also.
The read qualifier sets the property BIOSVersion to the read-only attribute. It then provides a description for the BIOSVersion property. ToSubClass signifies that any subclasses will inherit the BIOSVersion property.