Sample Provider Programs
The sample provider programs are located in subdirectories of /usr/demo/wbem/provider, and are
described in the following table.
Table 3-2 Sample Provider Programs
|
|
NativeProvider.java |
Top-level provider program that fulfills requests from
the CIM Object Manager and routes these requests to the Native_Example provider.
This program implements the instanceProvider and methodProvider APIs. This program also declares
methods to enumerate instances and to get an instance of the Native_Example
class. This program also declares a method that invokes a method to
print the string “Hello World.” |
Native_Example.mof |
Creates a class that registers the NativeProvider provider
with the CIM Object Manager. This MOF file identifies NativeProvider as the
provider to service requests for dynamic data in the Native_Example class. The
file also declares the properties and methods to be implemented by the
NativeProvider. |
Native_Example.java |
The NativeProvider program calls this provider to enumerate instances and to get
an instance of the Native_Example class. The Native_Example provider uses the APIs
to enumerate objects and to create instances of objects. The Native_Example class
declares native methods, which call C functions in the native.c file to
get system-specific values. Examples of such values include host name, serial number,
release, machine, architecture, and manufacturer. |
native.c |
This C program implements methods in the Native_Example
Java provider in native C code. |
Native_Example.h |
A machine-generated header file for the Native_Example
class. Defines the correspondence between the names of native method in the
Java programming language and the native C functions that execute those methods. |
libnative.so |
Binary
native C code compiled from the native.c file. |
|
How to Run the Sample Provider Programs
You must set up your environment before you can run the sample
provider programs.
- Set the LD_LIBRARY_PATH environment variable to the location of the provider class
files.
-
To use the C shell, type:
% setenv LD_LIBRARY_PATH /usr/sadm/lib/wbem
-
To use the Bourne shell, type:
% LD_LIBRARY_PATH = /usr/sadm/lib/wbem
- Copy the libnative.so shared library file to the directory specified by the
LD_LIBRARY_PATH environment variable.
% cp libnative.so /usr/sadm/lib/wbem
- Move the provider class files to the same path as the package
to which those files belong.
% mv *.class /usr/sadm/lib/wbem
- Become root superuser.
- Stop the CIM Object Manager in the same shell in which you
set the LD_LIBRARY_PATH environment variable.
# /etc/init.d/init.wbem stop
Note - When you set the LD_LIBRARY_PATH environment variable in a shell, you must
stop and restart the CIMOM in the same shell to recognize the
new variable.
- Start the CIM Object Manager.
# /etc/init.d/init.wbem start
- Exit being superuser.
- Compile the program's associated .mof file to load the appropriate class in
the CIMOM and to identify the provider.
% mofcomp -u root -p root-password Native_Example.mof
- Start CIM Workshop.
% /usr/sadm/bin/cimworkshop
- In the CIM Workshop toolbar, click the Find Class icon.
- In the Input dialog box, type the name of the class that
you want to display and then click OK.
The class displays in CIM Workshop.