1 22 package org.jboss.test.jmx.compliance.server.support; 23 24 import javax.management.ListenerNotFoundException ; 25 import javax.management.MBeanNotificationInfo ; 26 import javax.management.Notification ; 27 import javax.management.NotificationBroadcasterSupport ; 28 import javax.management.NotificationEmitter ; 29 import javax.management.NotificationFilter ; 30 import javax.management.NotificationListener ; 31 32 36 public class EmitterInvocationHandlerTest 37 extends InvocationHandlerTest 38 implements NotificationEmitter 39 { 40 NotificationBroadcasterSupport emitter = new NotificationBroadcasterSupport (); 41 42 public void addNotificationListener(NotificationListener listener, 43 NotificationFilter filter, 44 Object handback) 45 { 46 emitter.addNotificationListener(listener, filter, handback); 47 } 48 49 public MBeanNotificationInfo [] getNotificationInfo() 50 { 51 String [] types = { "test" }; 52 return new MBeanNotificationInfo [] 53 { 54 new MBeanNotificationInfo (types, "name", "description") 55 }; 56 } 57 58 public void removeNotificationListener(NotificationListener listener) 59 throws ListenerNotFoundException 60 { 61 emitter.removeNotificationListener(listener); 62 } 63 64 public void removeNotificationListener(NotificationListener listener, 65 NotificationFilter filter, 66 Object handback) 67 throws ListenerNotFoundException 68 { 69 emitter.removeNotificationListener(listener, filter, handback); 70 } 71 72 public void sendNotification() 73 { 74 Notification notification = new Notification ("test", this, 1l); 75 emitter.sendNotification(notification); 76 } 77 } | Popular Tags |