Solaris WBEM Developer's Guide

ProcedureTo Create an Event Filter

Steps
  1. Create an instance of the CIM_IndicationFilter class

    CIMClass cimfilter = cc.getClass
            (new CIMObjectPath "CIM_IndicationFilter"),
             true, true, true, null);
    CIMInstance ci = cimfilter.newInstance();
  2. Specify the name of the event filter

    Name = "filter_all_new_solarisdiskdrive"
  3. Create a WQL string identifying event indications to return

    String filterString = "SELECT * 
            FROM CIM_InstCreation WHERE sourceInstance 
            ISA Solaris_DiskDrive";
  4. Set property values in the cimfilter instance to identify the following information:

    • Name of the filter

    • Filter string to select CIM events

    • Query language (WQL) to parse the query string

    ci.setProperty("Name", new 
            CIMValue("filter_all_new_solarisdiskdrives"));
    ci.setProperty("Query", new CIMValue(filterString));
    ci.setProperty("QueryLanguage", new CIMValue("WQL");)
  5. Create a cimfilter instance that is called filter. Store the instance in the CIM Object Manager Repository

    CIMObjectPath filter = 
                             cc.createInstance(new CIMObjectPath(), 
                                                               ci);

Example 4–22 Creating an Event Filter

CIMClass cimfilter = cc.getClass(new CIMObjectPath
                                ("CIM_IndicationFilter"), true);
CIMInstance ci = cimfilter.newInstance();
//Assuming that the test_a class exists in the name space
String filterString = "select * from CIM_InstCreation where 
                       sourceInstance isa test_a"

ci.setProperty("query", new CIMValue(filterString));
CIMObjectPath filter = cc.createInstance(newCIMObjectPath(), ci);