Event filters describe the types of events to be delivered and the conditions under which they are delivered. To create an event filter, create an instance of the CIM_IndicationFilter class and define values for its properties. Each event filter works only on events that belong to the name space to which the filter belongs.
The CIM_IndicationFilter class has string properties. These properties can be set to uniquely identify the filter, specify a query string, and specify the query language that parses the query string. Currently, only the WBEM Query Language (WQL) is supported.
Table 4–6 CIM_IndicationFilter Properties
Property |
Description |
Required/Optional |
---|---|---|
SystemCreationClassName |
The name of the system on which the creation class for the filter resides or to which it applies. |
Optional. The value is decided by the CIM Object Manager. |
SystemName |
The name of the system on which the filter resides or to which it applies. |
Optional. The default for this key property is the name of the system on which the CIM Object Manager is running. |
CreationClassName |
The name of the class or subclass used to create the filter. |
Optional. The CIM Object Manager assigns CIM_IndicationFilteras the default for this key property. |
Name |
The unique name of the filter. |
Optional. The CIM Object Manager assigns a unique name. |
SourceNamespace |
The path to a local name space where the CIM indications originate. |
Optional. The default is null. |
Query |
A query expression that defines the conditions under which indications are generated. Currently, only Level 1 WBEM Query Language (WQL) expressions are supported. To learn more about WQL query expressions, see Chapter 5, Writing WBEM Queries. |
Required. |
QueryLanguage |
The language in which the query is expressed. |
Required. The default is WQL (WBEM Query Language). |
Create an instance of the CIM_IndicationFilter class
CIMClass cimfilter = cc.getClass (new CIMObjectPath "CIM_IndicationFilter"), true, true, true, null); CIMInstance ci = cimfilter.newInstance(); |
Specify the name of the event filter
Name = "filter_all_new_solarisdiskdrive" |
Create a WQL string identifying event indications to return
String filterString = "SELECT * FROM CIM_InstCreation WHERE sourceInstance ISA Solaris_DiskDrive"; |
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");)
Create a cimfilter instance tahat is called filter. Store the instance in the CIM Object Manager Repository
CIMObjectPath filter = cc.createInstance(new CIMObjectPath(), ci); |
CIMClass cimfilter = cc.getClass(new CIMObjectPath ("CIM_IndicationFilter"), true); CIMInstance ci = cimfilter.newInstance(); //Assuming that the test_a class exists in the namespace String filterString = "select * from CIM_InstCreation where sourceInstance isa test_a" ci.setProperty("query", new CIMValue(filterString)); CIMObjectPath filter = cc.createInstance(newCIMObjectPath(), ci);