Sun WBEM SDK Developer's Guide

Setting Up the Provider Example

The example provider program, NativeProvider, enumerates instances and gets properties for instances of the Native_Example class. You can use the CIM WorkShop to view this class and its instances.

How to Set Up the Provider Example
  1. Specify the location of shared library files in one of the following ways:

    • Set the LD_LIBRARY_PATH environment variable to the location of the shared library files. For example, using the C shell:


      Note –

      If you set the LD_LIBRARY_PATH environment variable in a shell, you must stop and restart the CIM Object Manager in the same shell for this new value to be recognized.



      % setenv LD_LIBRARY_PATH /wbem/provider/
      

      For example, using the Bourne shell:


      % LD_LIBRARY_PATH = /wbem/provider/
      

    • Copy the shared library files to the directory specified by the LD_LIBRARY_PATH environment variable. Installation sets this environment variable to /usr/sadm/lib/wbem. For example:


    % cp libnative.so /usr/sadm/lib/wbem 
    % cp native.c /usr/sadm/lib/wbem 
    % cp Native_Example.h /usr/sadm/lib/wbem
    

  2. Move the provider class files to /usr/sadm/lib/wbem.

    Move the provider class files to the same path as the package in which they are defined. For example, if the provider is packaged as com.sun.providers.myprovider.*, move the provider class files to /usr/sadm/lib/wbem/com/sun/wbem/myprovider/.class.

  3. Set the Solaris Provider CLASSPATH variable to the directory that contains the provider class files as described in To Set the Provider CLASSPATH.

  4. Stop the CIM Object Manager by typing the following command:


    # /etc/init.d/init.wbem -stop
    

  5. Restart the CIM Object Manager by typing the following command:


    # /etc/init.d/init.wbem -start
    

  6. Compile the Native_Example.mof file. For example:


    % mofcomp Native_Example.mof
    

    Compiling this MOF file loads the Native_Example class in the CIM Object Manager and identifies NativeProvider as its provider.

  7. Run CIM WorkShop and view the Native_Example class. For example:


    % /usr/sadm/bin/cimworkshop &
    

  8. In the Toolbar, click the Find Class icon.

  9. In the Input dialog box, type Native_Example and click OK.