1. Overview of Solaris Web-Based Enterprise Management
2. Using the CIM Object Manager
Implementing the Provider Interfaces
Writing an Associator Provider
Writing an Indication Provider
How To Generate an Event Indication
Creating and Delivering Indications
Follow these steps to create a provider:
Create or edit your provider program.
Compile the Java program to create the class files.
Copy any shared object files (.so) to /usr/sadm/lib/wbem.
Set your CLASSPATH to the location of your .class and .jar files.
You set the provider CLASSPATH to tell the CIM Object Manager where the .class and .jar files are located.
For example:
/* Create a name space object initialized with root\system (name of name space) on the local host. */ CIMNameSpace cns = new CIMNameSpace("", "root\system"); // Connect to the root\system name space as root. cc = new CIMClient(cns, "root", "root_password"); // Get the Solaris_ProviderPath class cimclass = cc.getClass(new CIMObjectPath("Solaris_ProviderPath"); // Create a new instance of Solaris_ProviderPath. class ci = cimclass.newInstance();
For example:
/* Set the provider CLASSPATH to /myhome/myproviders */ ci.setProperty("pathurl", new CIMValue(new String ("file:///myhome/myproviders/")));
The standard URL format is shown in the following table.
|
For example:
// Pass the updated instance to the CIM Object Manager cc.createInstance(new CIMObjectPath(), ci);
You register a new or modified provider with the CIM Object Manager to communicate information about the data and operations that the provider supports. You also register a provider to notify the CIM Object Manager of the provider's location. The CIM Object Manager uses this information to load and initialize the provider, and to determine the appropriate provider for a particular client request.
For example:
[Provider("java:com.sun.providers.myprovider")] Class_name { … };
This qualifier indicates the following information:
java: – The provider is written in the Java language and implements the javax.wbem.provider interfaces
com.sun.providers.myprovider – The name of the Java class that implements the provider
Example 6-4 Registering a Provider
This MOF file declares the Ex_SimpleCIMInstanceProvider class that is served by SimpleCIMInstanceProvider.
// ======================================================== // Title: SimpleCIMInstanceProvider // Filename: SimpleCIMInstanceProvider.mof // Description: // ================================================================== // ================================================================== // Pragmas // ================================================================== #pragma Locale ("en-US") // ================================================================== // SimpleCIMInstanceProvider // ================================================================== [Provider("java:SimpleCIMInstanceProvider")] class Ex_SimpleCIMInstanceProvider { // Properties [Key, Description("First Name of the User")] string First; [Description("Last Name of the User")] string Last; };