Top Description Fields Constructors Methods
org.apache.tomcat.util.modeler

public Class BaseAttributeFilter

extends Object
implements NotificationFilter
Class Inheritance
All Implemented Interfaces
javax.management.NotificationFilter, java.io.Serializable
Imports
java.util.HashSet, .Set, javax.management.AttributeChangeNotification, .Notification, .NotificationFilter

Implementation of NotificationFilter for attribute change notifications. This class is used by BaseModelMBean to construct attribute change notification event filters when a filter is not supplied by the application.

Author
Craig R. McClanahan

Field Summary

Modifier and TypeField and Description
private Set<String>
names

The set of attribute names that are accepted by this filter.

private static final long

Constructor Summary

AccessConstructor and Description
public
BaseAttributeFilter(String
Name of the attribute to be accepted by this filter, or null to accept all attribute names
name
)

Construct a new filter that accepts only the specified attribute name.

Method Summary

Modifier and TypeMethod and Description
public void
addAttribute(String
Name of the attribute to be accepted
name
)

Add a new attribute name to the set of names accepted by this filter.

public void
clear()

Clear all accepted names from this filter, so that it will accept all attribute names.

public String[]

Returns:

the array of names
getNames
()

Return the set of names that are accepted by this filter.

public boolean
isNotificationEnabled(Notification
The notification to be sent.
notification
)

Implements javax.management.NotificationFilter.isNotificationEnabled.

Test whether notification enabled for this event.

public void
removeAttribute(String
Name of the attribute to be removed
name
)

Remove an attribute name from the set of names accepted by this filter.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

namesback to summary
private Set<String> names

The set of attribute names that are accepted by this filter. If this list is empty, all attribute names are accepted.

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

BaseAttributeFilterback to summary
public BaseAttributeFilter(String name)

Construct a new filter that accepts only the specified attribute name.

Parameters
name:String

Name of the attribute to be accepted by this filter, or null to accept all attribute names

Method Detail

addAttributeback to summary
public void addAttribute(String name)

Add a new attribute name to the set of names accepted by this filter.

Parameters
name:String

Name of the attribute to be accepted

clearback to summary
public void clear()

Clear all accepted names from this filter, so that it will accept all attribute names.

getNamesback to summary
public String[] getNames()

Return the set of names that are accepted by this filter. If this filter accepts all attribute names, a zero length array will be returned.

Returns:String[]

the array of names

isNotificationEnabledback to summary
public boolean isNotificationEnabled(Notification notification)

Implements javax.management.NotificationFilter.isNotificationEnabled.

Test whether notification enabled for this event. Return true if:

  • This is an attribute change notification
  • Either the set of accepted names is empty (implying that all attribute names are of interest) or the set of accepted names includes the name of the attribute in this notification
Parameters
notification:Notification

Doc from javax.management.NotificationFilter.isNotificationEnabled.

The notification to be sent.

Returns:boolean

Doc from javax.management.NotificationFilter.isNotificationEnabled.

true if the notification has to be sent to the listener, false otherwise.

Annotations
@Override
removeAttributeback to summary
public void removeAttribute(String name)

Remove an attribute name from the set of names accepted by this filter.

Parameters
name:String

Name of the attribute to be removed