Sun WBEM SDK Developer's Guide

Installing a Provider

After you write a Provider, you must specify the location of the provider class files and any shared library files and then stop and restart the CIM Object Manager.

How to Install a Provider
  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 one of the directories specified by the LD_LIBRARY_PATH environment variable. The installation sets this environment variable to /usr/sadm/lib/wbem and /usr/snadm/lib. For example:

      % cp libnative.so /usr/sadm/lib/wbem% cp native.c /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/providers/myprovider/.

  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:


    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.



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

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


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

Setting the Solaris Provider CLASSPATH

To set the Solaris provider's CLASSPATH, use the client APIs to create an instance of the Solaris_ProviderPath class and set its pathurl property to the location of your provider class files. The Solaris_ProviderPath class is stored in the \root\system namespace.

You can also set the provider CLASSPATH to the location of your provider class files. You can set the class path to the jar file or to any directory that contains the classes. Use the standard URL format that Java uses for setting the CLASSPATH.

Provider CLASSPATH

Syntax 

Absolute path to directory 

file:///a/b/c/

Relative path to directory from which the CIM Object Manager was started (/). .

file://a/b/c

To Set the Provider CLASSPATH
  1. Create an instance of the Solaris_ProviderPath class. For example:

    /* Create a namespace object initialized with root\system  
    (name of namespace) on the local host. */   
    CIMNameSpace cns = new CIMNameSpace("", "root\system"); 
    
    // Connect to the root\system namespace 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();

  2. Set the pathurl property to the location of your provider class files. For example:

    ...
    /* Set the provider CLASSPATH to //com/mycomp/myproviders/.*/
    ci.setProperty("pathurl", new CIMValue(new String("//com/mycomp/myproviders/")); 
    ...

  3. Update the instance. For example:

    // Pass the updated instance to the CIM Object Manager 
    cc.setInstance(new CIMObjectPath(), ci);