1 8 9 package test.javax.management.remote.support; 10 11 import javax.management.ListenerNotFoundException ; 12 import javax.management.MBeanNotificationInfo ; 13 import javax.management.Notification ; 14 import javax.management.NotificationBroadcasterSupport ; 15 import javax.management.NotificationEmitter ; 16 import javax.management.NotificationFilter ; 17 import javax.management.NotificationListener ; 18 19 22 public class Marshalling implements MarshallingMBean, NotificationEmitter 23 { 24 private NotificationBroadcasterSupport nbs = new NotificationBroadcasterSupport (); 25 private long sequenceNo = 0; 26 27 public Marshalling() 28 { 29 } 30 31 public Marshalling(Unknown u) 32 { 33 } 34 35 public Unknown unknownReturnValue() 36 { 37 return new Unknown(); 38 } 39 40 public void unknownArgument(Unknown u) 41 { 42 } 43 44 public Unknown getUnknownAttribute() 45 { 46 return new Unknown(); 47 } 48 49 public void setUnknownAttribute(Unknown u) 50 { 51 Notification notification = new Notification (u.getClass().getName(), 52 this, sequenceNo); 53 sequenceNo++; 54 nbs.sendNotification(notification); 55 } 56 57 public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException 58 { 59 nbs.removeNotificationListener(listener, filter, handback); 60 } 61 62 public MBeanNotificationInfo [] getNotificationInfo() 63 { 64 return nbs.getNotificationInfo(); 65 } 66 67 public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException 68 { 69 nbs.addNotificationListener(listener, filter, handback); 70 } 71 72 public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException 73 { 74 nbs.removeNotificationListener(listener); 75 } 76 77 } 78 | Popular Tags |