User: ejort
Date: 02/01/20 06:32:28
Modified: src/main/javax/management NotificationFilter.java
Added: src/main/javax/management NotificationFilterSupport.java
Log:
Missing NotificationFilterSupport
Revision Changes Path
1.2 +30 -5 jmx/src/main/javax/management/NotificationFilter.java
Index: NotificationFilter.java
===================================================================
RCS file: /cvsroot/jboss/jmx/src/main/javax/management/NotificationFilter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NotificationFilter.java 2001/12/03 01:42:58 1.1
+++ NotificationFilter.java 2002/01/20 14:32:28 1.2
@@ -1,12 +1,37 @@
/*
- * LGPL
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
*/
package javax.management;
-public interface NotificationFilter extends java.io.Serializable {
-
- public boolean isNotificationEnabled(Notification notification);
+/**
+ * This interface is implemented by any class acting as a notification
+ * filter.<p>
+ *
+ * The filter is used before the notification is sent to see whether
+ * the notification is required.
+ *
+ * @see javax.management.NotificationFilterSupport
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Adrian Brock</a>.
+ * @version $Revision: 1.2 $
+ *
+ */
+public interface NotificationFilter
+ extends java.io.Serializable
+{
+ // Constants ---------------------------------------------------
+ // Public ------------------------------------------------------
+ /**
+ * This method is called before a notification is sent to see whether
+ * the listener wants the notification.
+ *
+ * @param notification the notification to be sent.
+ * @return true if the listener wants the notification, false otherwise
+ */
+ public boolean isNotificationEnabled(Notification notification);
}
-
1.1 jmx/src/main/javax/management/NotificationFilterSupport.java
Index: NotificationFilterSupport.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management;
import java.util.Vector;
/**
* An implementation of the {@link NotificationFilter} interface.<p>
*
* It filters on the notification type. It Maintains a list of enabled
* notification types. By default no notifications are enabled.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adrian Brock</a>.
* @version $Revision: 1.1 $
*
*/
public class NotificationFilterSupport
implements NotificationFilter
{
// Constants ---------------------------------------------------
// Attributes --------------------------------------------------
/**
* Enabled notification types.
*/
private Vector enabled;
// Static ------------------------------------------------------
// Constructors ------------------------------------------------
/**
* Create a filter that filters out all notification types.
*/
public NotificationFilterSupport()
{
enabled = new Vector();
}
// Public ------------------------------------------------------
/**
* Disable all notification types. Rejects all notifications.
*/
public synchronized void disableAllTypes()
{
enabled = new Vector();
}
/**
* Disable a notification type.
*
* @param type the notification type to disable.
*/
public synchronized void disableType(String type)
{
// Null won't be in the list anyway.
enabled.removeElement(type);
}
/**
* Enable a notification type.
*
* @param type the notification type to enable.
* @exception IllegalArgumentException for a null type
*/
public synchronized void enableType(String type)
{
if (type == null)
throw new IllegalArgumentException("null notification type");
if (enabled.contains(type) == false)
enabled.addElement(type);
}
/**
* Get all the enabled notification types.<p>
*
* Returns a vector of enabled notification type.<br>
* An empty vector means all types disabled.
*
* @return the vector of enabled types.
*/
public synchronized Vector getEnabledTypes()
{
return (Vector) enabled.clone();
}
// NotificationFilter implementation ---------------------------
/**
* Test to see whether this notification is enabled
*
* @param notification the notification to filter
* @return true when the notification should be sent, false otherwise
* @exception IllegalArgumentException for null notification.
*/
public synchronized boolean isNotificationEnabled(Notification notification)
{
// Is it enabled?
return enabled.contains(notification.getType());
}
// Private -----------------------------------------------------
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development