Sun WBEM SDK Developer's Guide

Registering a Provider

Providers register with the CIM Object Manager to publish information about the data and operations they support and their physical implementation. The CIM Object Manager uses this information to load and initialize the provider and to determine the right provider for a particular client request. All types of providers follow the same procedure for registration.

How To Register a Provider
  1. Create a MOF file defining a CIM class.

  2. Assign the provider qualifier to the class. Assign a provider name to the provider qualifier.

    The provider name identifies the Java class to serve as the provider for this class. You must specify the complete class name. For example:

    [Provider("com.kailee.wbem.providers.provider_name")]
    Class_name {
    …
    };


    Note –

    We recommend following Java class and package naming conventions for providers so that provider names are unique. The prefix of a unique package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names, currently com, edu, gov, mil, net, org, or one of the English two-letter codes identifying countries as specified in ISO Standards 3166, 1981.

    Subsequent components of the package name vary according to an organizations own internal naming conventions. Such conventions might specify that certain directory name components be division, department, project, machine, or login names, for example, com.mycompany.wbem.myprovider.


  3. Compile the MOF file. For example:


    % mofcomp class_name
    

For more information on using the Managed Object Format (MOF) Compiler to compile a MOF file, see the Solaris WBEM Services Administrator's Guide.

Changing a MOF File

If you change a class definition in a MOF file that was previously compiled, you must delete the class from the CIM Object Manager Repository before recompiling the MOF file. Otherwise, you will get an error that the class already exists and the new information will not propagate to the CIM Object Manager. You can use the CIM WorkShop to delete a class as described in Deleting Classes and Their Attributes.

Example — Registering a Provider

The following example shows the MOF file that declares to the CIM Object Manager the Ex_SimpleInstanceProvider class that is served by the SimpleInstanceProvider (shown in Example 5–1). Provider and class names in a valid MOF file follow these rules:


Example 5–5 SimpleInstanceProvider MOF File

// ===================================================================
// Title:       SimpleInstanceProvider
// Filename:    SimpleInstanceProvider.mof
// Description:
// ===================================================================

// ==================================================================
// Pragmas
// ==================================================================
#pragma Locale ("en-US")

// ==================================================================
//   SimpleInstanceProvider
// ==================================================================
[Provider("SimpleInstanceProvider")]
class Ex_SimpleInstanceProvider
{
   // Properties
      [Key, Description("First Name of the User")]
   string First;
      [Description("Last Name of the User")]
   string Last;
};