Sun WBEM SDK Developer's Guide

The execQuery Method

The execQuery method retrieves an enumeration of CIM instances that match a query string. The query string must be formed using the WBEM Query Language (WQL).

Syntax

The syntax for the execQuery method is:

Enumeration execQuery(CIMObjectPath relNS, java.lang.String query, int ql)

The execQuery method takes the following parameters and returns an enumeration of CIM instances:

Parameter 

Data Type 

Description 

relNS 

CIMObjectPath 

The namespace relative to the namespace to which you are connected. For example, if you are connected to the root namespace and want to query classes in the root\cimv2 namespace, you would pass new CIMObjectPath("", "cimv2");.

query 

String 

The text of the query in WBEM Query Language 

ql 

Integer constant 

Identifies the query language. WQL level 1 is the only currently supported query language. 

Example

The following execQuery call returns an enumeration of all instances of the CIM_device class in the current namespace.

cc.execQuery(new CIMObjectPath(), SELECT * FROM CIM_device, cc.WQL)