01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: 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: /**
20: * @version $Revision: 1.3 $
21: */
22: public class Marshalling implements MarshallingMBean,
23: NotificationEmitter {
24: private NotificationBroadcasterSupport nbs = new NotificationBroadcasterSupport();
25: private long sequenceNo = 0;
26:
27: public Marshalling() {
28: }
29:
30: public Marshalling(Unknown u) {
31: }
32:
33: public Unknown unknownReturnValue() {
34: return new Unknown();
35: }
36:
37: public void unknownArgument(Unknown u) {
38: }
39:
40: public Unknown getUnknownAttribute() {
41: return new Unknown();
42: }
43:
44: public void setUnknownAttribute(Unknown u) {
45: Notification notification = new Notification(u.getClass()
46: .getName(), this , sequenceNo);
47: sequenceNo++;
48: nbs.sendNotification(notification);
49: }
50:
51: public void removeNotificationListener(
52: NotificationListener listener, NotificationFilter filter,
53: Object handback) throws ListenerNotFoundException {
54: nbs.removeNotificationListener(listener, filter, handback);
55: }
56:
57: public MBeanNotificationInfo[] getNotificationInfo() {
58: return nbs.getNotificationInfo();
59: }
60:
61: public void addNotificationListener(NotificationListener listener,
62: NotificationFilter filter, Object handback)
63: throws IllegalArgumentException {
64: nbs.addNotificationListener(listener, filter, handback);
65: }
66:
67: public void removeNotificationListener(NotificationListener listener)
68: throws ListenerNotFoundException {
69: nbs.removeNotificationListener(listener);
70: }
71:
72: }
|