1 23 package com.sun.appserv.management.alert; 24 25 import javax.management.NotificationFilter ; 26 import javax.management.Notification ; 27 28 33 public class MailFilter implements NotificationFilter { 34 35 private static String WARNING_LOG = "WarningLogMessages"; 36 37 private boolean filterWarningMessages; 41 42 45 public MailFilter( ) { 46 filterWarningMessages = true; 47 } 48 49 53 public void setFilterWarningMessages( boolean filter ) { 54 filterWarningMessages = filter; 55 } 56 57 boolean getFilterWarningMessages( ) { 58 return filterWarningMessages; 59 } 60 61 65 public boolean isNotificationEnabled( Notification notification ) { 66 if( !filterWarningMessages ) return true; 67 return !notification.getType().equals( WARNING_LOG ); 68 } 69 70 73 public void setUnitTestData( String unitTestData ) { 74 new UnitTest( 75 UnitTest.UNIT_TEST_MAIL_FILTER, unitTestData, this ).start(); 76 } 77 } 78 79 80 81 82 | Popular Tags |