01: package deploytest;
02:
03: import java.util.Collection;
04:
05: import javax.management.MalformedObjectNameException;
06: import javax.management.Notification;
07: import javax.management.NotificationBroadcasterSupport;
08: import javax.management.ObjectName;
09: import javax.management.openmbean.CompositeData;
10:
11: public class TestEventManagementSupport extends
12: NotificationBroadcasterSupport implements
13: TestEventManagementSupportMBean {
14:
15: private static final String EVENTMANAGEMENT_CHANNEL_MBEAN_NAME = "EventManagement:name=EventManagementChannelSupportMBean";
16: private long mNotificationSeqNum;
17: private Notification NotificationInstance = null;
18:
19: public void forwardEvent(CompositeData data) {
20: try {
21: NotificationInstance = new Notification("JCAPSEvent",
22: new ObjectName(EVENTMANAGEMENT_CHANNEL_MBEAN_NAME),
23: mNotificationSeqNum, System.currentTimeMillis());
24: } catch (MalformedObjectNameException e) {
25: // should not fail - its this object object name
26: } catch (NullPointerException e) {
27: // should not fail - the name defined in the same package
28: }
29: NotificationInstance.setUserData(data);
30: sendNotification(NotificationInstance);
31:
32: }
33:
34: }
|