Solaris WBEM 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 3–1 Sample Client Programs

Directory 

Program 

Purpose 

./batching

./TestBatch host username 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|httpWQL-query

Perform the specified WQL query 

 

./systeminfo

./SystemInfo host username password rmi|http

Display Solaris platform 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.

ProcedureHow to Set the CLASSPATH

Step

    Set the CLASSPATH environment variable using one of the following methods:

    • To use 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
      
    • To use the Bourne 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
      

ProcedureHow to Run the Sample Client Programs

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

Step

    Run the sample client programs using the following format:


    % java program_name parameters
    

Example 3–1 Running a Sample Client Program

For instance, the following example 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