|
Sonic Management API | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.sonicsw.mf.jmx.client.ExpressionBasedNotificationFilter
public class ExpressionBasedNotificationFilter
This implementation of the javax.management.NotificationFilter interface provides a filter that uses regular expressions to determine which notifications should be sent to associated listeners. The filter is a powerful alternative to the JMX supplied NotificationFilterSupport class, providing the ability to filter on both the notification type and the attribute values of Sonic notifications.
The filter allows specification of a single expression for the notification type and a single
expression per attribute. When a notification is tested against the filter (see
isNotificationEnabled)
the result of testing each expression are AND'd together to form an aggregate result. For
example if a type expression such as "application\.session\.Subscribe" and attribute
expressions for the attributes "TopicName" and "UserName" of "App1|App2" and "Guest"
respectively are specified, then the listener would be sent only
application.session.Subscribe
notifications that are associated with JMS subscriptions to topics "App1" or "App2" and
where the subscribing client's user name is "Guest".
Notifications will not be sent to associated listeners if an attribute expression is specified for an attribute that does not exist in the notification or the attribute exists but its value is null.
All filter expressions are case sensitive.
This filter uses the Java regular expression library when available (J2SE 1.4 or greater) or the GNU regular expression library if not. The libraries must appear on the classpath of the Sonic container hosting the source MBean, but are not generally required on the classpath of the listening management client.
| Constructor Summary | |
|---|---|
ExpressionBasedNotificationFilter()
|
|
| Method Summary | |
|---|---|
void |
clearAllAttributeExpressions()
Clear all previously defined attribute name expressions. |
boolean |
equals(java.lang.Object obj)
Compares to see if the given object matches the notification filter. |
java.util.Map |
getAttributeExpressions()
Gets previously set attribute expressions keyed by attribute name. |
java.lang.String |
getTypeExpression()
Gets a previously set name expression (or null if a name expression has not be set). |
boolean |
isNotificationEnabled(Notification notification)
Invoked before sending the specified notification to the listener. |
void |
setAttributeExpression(java.lang.String attributeName,
java.lang.String expression)
Enable notifications with an attribute that matches the specified expression (and any defined type or other attribute expressions) to be sent to the listener. |
void |
setTypeExpression(java.lang.String expression)
Enable notifications the type of which matches the specified expression (and any defined attribute expressions) to be sent to the listener. |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExpressionBasedNotificationFilter()
| Method Detail |
|---|
public void clearAllAttributeExpressions()
public boolean equals(java.lang.Object obj)
A match will occur if the given object is an ExpressionBasedNotificationFilter with the same type expression and same set of attribute expressions.
equals in class java.lang.Objectobj - The reference object with which to compare.
public java.util.Map getAttributeExpressions()
public java.lang.String getTypeExpression()
public boolean isNotificationEnabled(Notification notification)
NotificationFilter
isNotificationEnabled in interface NotificationFilternotification - The notification to be sent.
true if the notification has to be sent to the listener, false otherwise.
public void setAttributeExpression(java.lang.String attributeName,
java.lang.String expression)
public void setTypeExpression(java.lang.String expression)
|
Sonic Management API | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||