This chapter describes, the grammar supported by
To be able to filter events we must create a filter and associate it with one, or more, of the administrative or proxy objects. In the example below, we choose to associate the filter with a ConsumerAdmin object.
FilterFactory = cosNotificationApp:start_filter_factory(),
Filter = 'CosNotifyFilter_FilterFactory':
create_filter(FilterFactory,"EXTENDED_TCL"),
ConstraintInfoSeq = 'CosNotifyFilter_Filter':
add_constraints(Filter, ConstraintExpSeq),
FilterID = 'CosNotifyChannelAdmin_ConsumerAdmin':
add_filter(AdminConsumer, Filter),
Depending on which operation type the Admin object uses, i.e.,
'AND_OP' - must be approved by the proxy's and its parent admin's filters. If all filters associated with an object (Admin or Proxy) return false the event will be discarded. In this situation it is pointless to try and verify with the other object's associated filters since the outcome still would be the same.
'OR_OP' - if one of the object's (Admin or Proxy) filters return true, the event will not be checked against any other filter associated with a proxy or its parent admin. If a object's associated filters all return false, the event will be forwarded to related proxies/admins, and tested against any associated filters.
Initially, filters are empty and will always return true. Hence, we must
add constraints by using
#'CosNotifyFilter_ConstraintExp'{
event_types = [#'CosNotification_EventType'{
domain_name = string(),
type_name = string()}],
constraint_expr = string()}
The
If a constraint expression is supposed to apply for all events, then the
In the following sections we will take a closer look on how to write constraint expressions.
The constraint language supported by the Notification Service is:
:= /* empty */
|
:=
:= or
|
:= and
|
:= ==
| !=
| <
| <=
| >
| >=
|
:= in /* sequence only */
|
| in $ /* sequence only */
:= ~ /* string data types only */
|
:= +
| -
|
:= *
| /
|
:= not
|
:= ( )
| exist
|
|
| -
|
| TRUE
| FALSE
| +
| exist $
| $
| default $ /* discriminated unions only */
:= /* empty */
| .
|
|
| /* run-time variable */
:= /* empty */
| .
|
|
:=
|
|
| _length /* only valid for arrays or sequences */
| _d /* discriminated unions only */
| _type_id /* only valid if possible to obtain */
| _repos_id /* only valid if possible to obtain */
:= [ ]
:= ( )
:=
:= ( )
:= /* empty */
|
| -
| +
|
/* Character set issues */
:=
| \ < Leader>
:= /* */
|
:=
|
:=
| .
| .
| .
:=
:= +
| -
:= E
| e
:=
|
:= ' '
:= /* */
|
:=
|
|
|
:= \\
| \'
:=
:=
|
| _
is the set of alphabetic characters [A-Za-z]
is the set of digits [0-9]
is the set of ASCII characters that are not , , or
]]>
In the absence of parentheses, the following precedence relations hold :
The Notification Service Constraint Language, defines how to write constraint expressions, which can be used to filter events. The representation does, however, differ slightly from ordinary Erlang terms.
When creating a
Basic - arithmetics, strings, constants, numbers etc.
Complex - accessing members of complex data types, such as unions.
Some of the basic types, e.g., integer, are self explanatory. Hence, they are not described further.
In the next section we will take a closer look at how it is possible to write constraints using different types of notation etc.
To filter events, the supplied constraints must describe the contents of
the events and desired values. We can, for example, state that we are only
interested in receiving events which are of type CommunicationsAlarm.
To be able to achieve this, the constraint must contain information
that points out which fields to compare with. Figure one illustrates a conceptual overview of a
structured event. The exact definition is found in the
The Notification Service supports different constraint expressions notation:
Fully scoped, e.g., "$.header.fixed_header.event_type.type_name == 'CommunicationsAlarm'"
Short hand, e.g., "$type_name == 'CommunicationsAlarm'"
Positional Notation, e.g., "$.0.0.0.1 == 'CommunicationsAlarm'"
Which notation to use is up to the user, however, the fully scoped may be easier to understand, but in some cases, if received from an ORB that do not populate ID:s of named parts, the positional notation is the only option.
If a constraint, which access fields in a structured event structure, is supposed to handle unstructured events as well, the CORBA::Any must contain the same type of members.
How to filter against the fixed header fields, is described in the table below.
If we are only interested in receiving events regarding 'Domain', 'Event'
and 'Type', the constraint can look like
The variable event header consists of a sequence of name-value pairs. One way to filter on these are to use a constraint that looks
like
Accessing the event body is done in the same way as for the event header
fields. The user must, however, be aware of, that if a run-time variable
(
Mapping Filters may only be associated with Consumer Administrators or Proxy Suppliers. The purpose of a Mapping Filter is to override Quality of Service settings.
Initially, Mapping Filters are empty and will always return true. Hence, we must
add constraints by using
As input, the second argument must be a sequence of:
#'CosNotifyFilter_MappingConstraintPair'{
constraint_expression = #'CosNotifyFilter_ConstraintExp'{
event_types = [#'CosNotification_EventType'{
domain_name = string(),
type_name = string()}],
constraint_expr = string()},
result_to_set = any()}