JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Solaris WBEM Developer's Guide
search filter icon
search icon

Document Information


1.  Overview of Solaris Web-Based Enterprise Management

2.  Using the CIM Object Manager

3.  Using the Sample Programs

4.  Writing a Client Program

Client API Overview

Sequence of a Client Application

Opening and Closing a Client Connection

About Name Spaces

Opening a Client Connection

Closing a Client Connection

Performing Basic Client Operations

Creating an Instance

Deleting an Instance

Getting and Setting Instances

Getting and Setting Properties

Enumerating Objects

Enumerating Objects

Creating Associations

About the Association Methods

Passing a Class to the Association Methods

Passing Instances to the Association Methods

Using Optional Arguments With the Association Methods

Calling Methods

Retrieving Class Definitions

Handling Exceptions

Creating a Name Space

Deleting a Name Space

Creating a Base Class

Deleting a Class

Setting Access Control

Solaris_UserAcl Class

To Set Access Control for a User

Solaris_NamespaceAcl Class

To Set Access Control for a Name Space

Working With Qualifiers and Qualifier Types

Getting and Setting CIM Qualifiers

Batching Client Requests

Handling CIM Events

About Indications

About Subscriptions

To Create a Subscription

Adding a CIM Listener

Creating an Event Filter

To Create an Event Filter

Creating an Event Handler

Binding an Event Filter to an Event Handler

Reading and Writing Log Messages

About Log Files

5.  Writing WBEM Queries

6.  Writing a Provider Program

7.  Creating JavaBeans Components Using the MOF Compiler

8.  Administering Security

9.  Troubleshooting

A.  Solaris Platform Schema


Batching Client Requests

You can batch multiple CIMClient API calls into a single remote call to reduce the delay introduced by multiple remote message exchanges. You use an instance of the BatchCIMClient class to build the list of operations that you want to execute in a batch request. Then use the performBatchOperations method of the CIMClient class to send the list of operations to the CIM Object Manager.

Note - A batch operation does not imply a single transaction. Each operation is independent of the other operations in the batch. The operations have no dependencies on the success or failure of the preceding operations.

The BatchCIMClient class contains methods that enable you to perform the same CIM operations as in non-batch mode. These methods are similar to CIMClient methods except that the BatchCIMClient methods do not return the same types as their equivalents in the CIMClient class. The types are different because the values are returned as a list after the batch operation is complete. The methods return an integer operation ID that you can use to get the result of the operation later. As methods of BatchCIMClient are invoked, the BatchCIMClient object builds a list of CIMOperation objects that will be executed later.

The client executes the batch operation list by invoking the performBatchOperations method of CIMClient. The results of the batch operation are returned in a BatchResult object. Clients can then pass the operation ID to the getResult method of the BatchResult class to get the results of the operations. If an operation on the list generates an exception, an exception object is embedded in the BatchResult object. When you invoke the getResult method with the ID of the operation that failed, the exception is thrown by the getResult method.

Example 4-20 Batching Example

The following example shows how you can use the batching API to perform multiple operations in one remote call. In this example, three operations are performed as a single batch operation. The operations are enumerateInstanceNames, getClass, and enumerateInstances.

import java.util.Enumeration;
import java.util.ArrayList;
import java.util.Vector;
import java.lang.String;

import javax.wbem.cim.*;
import javax.wbem.client.*;
import javax.wbem.client.UserPrincipal;
import javax.wbem.client.PasswordCredential;

public class TestBatch {
    public static void main(String args[]) throws CIMException {
           CIMClient cc = null;
           CIMObjectPath cop = null;
           String protocol = CIMClient.CIM_RMI;
           if (args.length < 4) {
               System.out.println("Usage: TestBatch host user passwd 
                                classname " + "[rmi|http]");
           try {
               CIMNameSpace cns = new CIMNameSpace(args[0]);

               UserPrincipal up = new UserPrincipal(args[1]);
               PasswordCredential pc = new PasswordCredential(args[2]);
               if (args.length == 5 && args[4].equalsIgnoreCase("http")) {
                       protocol = CIMClient.CIM_XML;
               cc = new CIMClient(cns, up, pc, protocol);

               CIMObjectPath op = new CIMObjectPath(args[3]);

               BatchCIMClient bc = new BatchCIMClient();
               int[] ids = new int[3];

               ids[0] = bc.enumerateInstanceNames(op);
               ids[1] = bc.getClass(op, false, true, true, null);
               ids[2] = bc.enumerateInstances(op, true, false, false, 
                                           false, null);

               BatchResult br = cc.performBatchOperations(bc);

             Enumeration instanceNames = (Enumeration)br.getResult
               CIMClass cl = (CIMClass)br.getResult(ids[1]);
               Enumeration instances = (Enumeration)br.getResult(ids[2]);

               while (instanceNames.hasMoreElements()) {


               while (instances.hasMoreElements()) {

          catch (Exception e) {
              System.out.println("Exception: "+e);

          // close session.
          if (cc != null) {