Solaris WBEM SDK Developer's Guide

Sample Client Programs

The sample client programs are located in subdirectories of /usr/demo/wbem/client and are described in the following table.

Table 6-1 Sample Client Programs

Directory 

Program 

Purpose 

./batching

./TestBatch host_name user_name password classname [[rmi|http]]

Perform enumerateInstanceName, getClass, and enumerateInstances in a single batching call.

./enumeration

./ClientEnum host username password classname [[rmi|http]]

Enumerate classes and instances in the specified class in the default namespace root\cimv2 on the specified host.

./events

./Subscribe host username password classname

Subscribe to lifecycle events for a specified class, print events that occur within one minute of the subscription, and then unsubscribe to the events. 

./logging

./CreateLog host root_username root_password [[rmi|http]]

Create a log record on the specified host.  

./ReadLog host root_username root_password [[rmi|http]]

Read a log record on the specified host. 

./misc

./DeleteClass host classname root_username root_password [[rmi|http]]

Delete the specified class in the default namespace root\cimv2 on the specified host.

./DeleteInstances host classname root_username root_password [[rmi|http]]

Delete instances of the specified class in the default namespace root\cimv2 on the specified host.

./namespace

 

./CreateNameSpace host parentNS childNS root_username root_password [[rmi|http]]

Connect to the CIM Object Manager as the specified user, and create a namespace on the specified host.  

./DeleteNameSpace host parentNS childNS root_username root_password [[rmi|http]]

Delete the specified namespace on the specified host. 

./query

./ExampleQuery host username password [[rmi|http]] WQL_query

Create a test class with sample instances, and perform queries on that class. 

./TestQuery host username password [[rmi|http]]WQL_query

Perform the specified WQL query. 

./systeminfo

./SystemInfo host username password [[rmi|http]]

Display Solaris processor and system information for the specified host in a separate window. 

Running the Sample Client Programs

You must first set the CLASSPATH to include the necessary .jar files before you run the client programs.

How to Set the CLASSPATH
  1. Do one of the following:

    • Using the C shell, type:


      % setenv CLASSPATH .:/usr/sadm/lib/wbem.jar:/usr/sadm/lib/xml.jar
      :/usr/sadm/lib/wbem/sunwbem.jar:/usr/sadm/lib/wbem/extension
      
    • Using the Bourne shell, type:


      % set CLASSPATH=.:/usr/sadm/lib/wbem.jar:/usr/sadm/lib/xml.jar
      :/usr/sadm/lib/wbem/sunwbem.jar:/usr/sadm/lib/wbem/extension
      
How to Run the Sample Client Programs

Most of the client sample programs accept an optional parameter that specifies the protocol that you want to use to connect to the CIM Object Manager. RMI is the default protocol.

  1. Run the sample client programs using the following format:


    % java program_name parameters
    

For example, the following runs the SystemInfo program by connecting to myhost as the root user with the secret password using the HTTP protocol.


% java SystemInfo myhost root secret http