KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > javax > management > remote > support > Marshalling


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package test.javax.management.remote.support;
10
11 import javax.management.ListenerNotFoundException JavaDoc;
12 import javax.management.MBeanNotificationInfo JavaDoc;
13 import javax.management.Notification JavaDoc;
14 import javax.management.NotificationBroadcasterSupport JavaDoc;
15 import javax.management.NotificationEmitter JavaDoc;
16 import javax.management.NotificationFilter JavaDoc;
17 import javax.management.NotificationListener JavaDoc;
18
19 /**
20  * @version $Revision: 1.3 $
21  */

22 public class Marshalling implements MarshallingMBean, NotificationEmitter JavaDoc
23 {
24    private NotificationBroadcasterSupport JavaDoc nbs = new NotificationBroadcasterSupport JavaDoc();
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 JavaDoc notification = new Notification JavaDoc(u.getClass().getName(),
52                                                    this, sequenceNo);
53       sequenceNo++;
54       nbs.sendNotification(notification);
55    }
56
57    public void removeNotificationListener(NotificationListener JavaDoc listener, NotificationFilter JavaDoc filter, Object JavaDoc handback) throws ListenerNotFoundException JavaDoc
58    {
59       nbs.removeNotificationListener(listener, filter, handback);
60    }
61
62    public MBeanNotificationInfo JavaDoc[] getNotificationInfo()
63    {
64       return nbs.getNotificationInfo();
65    }
66
67    public void addNotificationListener(NotificationListener JavaDoc listener, NotificationFilter JavaDoc filter, Object JavaDoc handback) throws IllegalArgumentException JavaDoc
68    {
69       nbs.addNotificationListener(listener, filter, handback);
70    }
71
72    public void removeNotificationListener(NotificationListener JavaDoc listener) throws ListenerNotFoundException JavaDoc
73    {
74       nbs.removeNotificationListener(listener);
75    }
76
77 }
78
Popular Tags