                                        README

                             Running the Native Provider Example







The Native_Example.java, NativeProvider.java, native.c, and Native_Example.mof

files generate classes, a header file, and binary native c code to implement a

native provider. For more information, see the Sun WBEM SDK Developer's Guide.



Note that the examples are taken from Solaris platform with the WBEM files

installed on "/usr" directory and that /usr/java points to jdk1.2.



To run the Native Provider Example:



Make sure your environment setup includes JDK1.2 and the classpath:



CLASSPATH=.:/usr/sadm/lib/wbem:/usr/sadm/lib/wbem/cimapi.jar:/usr/sadm/lib/xml.jar



1. Log in to the root account or change to superuser. For example:



su

password:*****

#



2. Copy the NativeProvider.class, Native_Example.class and libnative.so files

   to the /usr/sadm/lib/wbem directory. For example:



# cp /usr/demo/wbem/provider/jni/*.class /usr/sadm/lib/wbem

# cp /usr/demo/wbem/provider/jni/*.so /usr/sadm/lib/wbem



3. Use the MOF Compiler to compile the Native_Example.mof file. For example:



# /usr/sadm/bin/mofcomp /usr/demo/wbem/provider/jni/Native_Example.mof  -u root -p "password"



NOTE: If the error message, "NO_CIMOM:CIMOM //localhost/CIMOM2 not detected,"

      is displayed, the CIM Object Manager is not running on your system. 

      Type the following commands to restart the CIM Object Manager, 

      and then type the mofcomp command in Step 3 again:



      /usr/sadm/bin/cimom stop

      /usr/sadm/bin/cimom



4. Start CIM WorkShop. For example:



/usr/sadm/bin/cimworkshop



5. Search for the Native_Example class:



In CIM WorkShop, click Action->Find Class and type Native_Example.

You can view the instance in this class.





Modifying the Native Provider Example

-------------------------------------



You may want to modify the Native Provider example.



1. Edit any of the Native Example files in  /usr/demo/wbem/provider/jni.



2. Make sure the LD_LIBRARY_PATH environment variable is set to the location

of the shared library files. 

For example, if the shared library files are stored in /wbem/provider:



  If you use the C shell, type:



  % setenv LD_LIBRARY_PATH /wbem/provider



  If you use the Borne shell, type:



  % set LD_LIBRARY_PATH /wbem/provider



3. Make sure the CLASSPATH environment variable is set to the directory that

contains the provider class files.



  If you use the C shell, type:



  % setenv CLASSPATH 

.:/usr/sadm/lib/wbem:/usr/sadm/lib/wbem/cimapi.jar:/usr/sadm/lib/xml.jar





  If you use the Borne shell, type:



  % set CLASSPATH 

.:/usr/sadm/lib/wbem:/usr/sadm/lib/wbem/cimapi.jar:/usr/sadm/lib/xml.jar





4. Compile the Native Example files. For example:



% cd /usr/demo/wbem/provider/jni

% javac -classpath $CLASSPATH Native_Example.java

% javac -classpath $CLASSPATH NativeProvider.java

% /usr/bin/javah  -o Native_Example.h -jni Native_Example

% cc -G -o libnative.so -I/usr/java/include -I/usr/java/include/solaris -L/usr/java/lib native.c





5. Copy the NativeProvider.class, Native_Example.class and libnative.so to the

/usr/sadm/lib/wbem directory. For example:



% cp /usr/demo/wbem/provider/jni/*.class /usr/sadm/lib/wbem

% cp /usr/demo/wbem/provider/jni/*.so /usr/sadm/lib/wbem



6. Use the MOF Compiler to compile the Native_Example.mof file. For example:



% /usr/sadm/bin/mofcomp /usr/demo/wbem/provider/jni/Native_Example.mof  -u root -p "password"



7. Log in as root or change to superuser and stop the CIM Object Manager.

For example:



su

password:******



     /usr/sadm/bin/cimom stop



8. Choose one of the following methods to restart the CIM Object Manager:



   Start the CIM Object Manager in normal mode:



     /usr/sadm/bin/cimom



   Start the CIM Object Manager in debug mode:



   a. Use any text editor to edit the file /usr/sadm/bin/cimom



   b. Locate the following line:

      ${JAVACMD} $JAVAOPTS $CIMOMSERVER "$@" &



   c. Replace it with the following line:

      ${JAVACMD} $JAVAOPTS $CIMOMSERVER -lDev "$@" &



   d. Start the CIM Object Manager:

     /usr/sadm/bin/cimom





Related URLs

-------------



- http://www.sun.com/solaris/wbem/download.html (Solaris WBEM Services)

- http://www.dmtf.org/spec/cims.html (DMTF CIM Specification)



