01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package javax.management;
23:
24: import org.jboss.mx.util.JBossNotificationBroadcasterSupport;
25:
26: /**
27: * A helper class for notification broadcasters/emitters
28: *
29: * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
30: * @author <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
31: * @version $Revision: 57200 $
32: */
33: public class NotificationBroadcasterSupport implements
34: NotificationEmitter {
35: /** The delegate */
36: private JBossNotificationBroadcasterSupport delegate = new JBossNotificationBroadcasterSupport();
37:
38: /**
39: * Construct the new notification broadcaster support object
40: */
41: public NotificationBroadcasterSupport() {
42: }
43:
44: public void addNotificationListener(NotificationListener listener,
45: NotificationFilter filter, Object handback) {
46: delegate.addNotificationListener(listener, filter, handback);
47: }
48:
49: public void removeNotificationListener(NotificationListener listener)
50: throws ListenerNotFoundException {
51: delegate.removeNotificationListener(listener);
52: }
53:
54: public void removeNotificationListener(
55: NotificationListener listener, NotificationFilter filter,
56: Object handback) throws ListenerNotFoundException {
57: delegate.removeNotificationListener(listener, filter, handback);
58: }
59:
60: public MBeanNotificationInfo[] getNotificationInfo() {
61: return delegate.getNotificationInfo();
62: }
63:
64: public void sendNotification(Notification notification) {
65: delegate.sendNotification(notification);
66: }
67:
68: /**
69: * Handle the notification, the default implementation is to synchronously invoke the listener.
70: *
71: * @param listener the listener to notify
72: * @param notification the notification
73: * @param handback the handback object
74: */
75: protected void handleNotification(NotificationListener listener,
76: Notification notification, Object handback) {
77: delegate.handleNotification(listener, notification, handback);
78: }
79: }
|