public static List<CIMInstance> executeQuery(WBEMClient cimClient,CIMObjectPath objectPath,String query,String queryLanguage){
  _log.info(String.format("Executing query: %s, objectPath: %s, query language: %s",query,objectPath,queryLanguage));
  CloseableIterator<CIMInstance> iterator=null;
  List<CIMInstance> instanceList=new ArrayList<CIMInstance>();
  try {
    iterator=cimClient.execQuery(objectPath,query,queryLanguage);
    while (iterator.hasNext()) {
      instanceList.add(iterator.next());
    }
  }
 catch (  WBEMException we) {
    _log.error("Caught an error while attempting to execute query and process query result. Query: " + query,we);
  }
 finally {
    if (iterator != null) {
      iterator.close();
    }
  }
  return instanceList;
}

public static List < CIMInstance > executeQuery ( WBEMClient cimClient , CIMObjectPath objectPath , String query , String queryLanguage ) { _log . info ( String . format ( "Executing query: %s, objectPath: %s, query language: %s" , query , objectPath , queryLanguage ) ) ; CloseableIterator < CIMInstance > iterator = null ; List < CIMInstance > instanceList = new ArrayList < CIMInstance > ( ) ; try { iterator = cimClient . execQuery ( objectPath , query , queryLanguage ) ; while ( iterator . hasNext ( ) ) { instanceList . add ( iterator . next ( ) ) ; } } catch ( WBEMException we ) { _log . error ( "Caught an error while attempting to execute query and process query result. Query: " + query , we ) ; } finally { if ( iterator != null ) { iterator . close ( ) ; } } return instanceList ; }
run wbemclient execquery method
