01: /*
02: * BEGIN_HEADER - DO NOT EDIT
03: *
04: * The contents of this file are subject to the terms
05: * of the Common Development and Distribution License
06: * (the "License"). You may not use this file except
07: * in compliance with the License.
08: *
09: * You can obtain a copy of the license at
10: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
11: * See the License for the specific language governing
12: * permissions and limitations under the License.
13: *
14: * When distributing Covered Code, include this CDDL
15: * HEADER in each file and include the License file at
16: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
17: * If applicable add the following below this CDDL HEADER,
18: * with the fields enclosed by brackets "[]" replaced with
19: * your own identifying information: Portions Copyright
20: * [year] [name of copyright owner]
21: */
22:
23: /*
24: * @(#)NotifyStandardMBean.java
25: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
26: *
27: * END_HEADER - DO NOT EDIT
28: */
29: package com.sun.jbi.management.support;
30:
31: import javax.management.StandardMBean;
32: import javax.management.MBeanNotificationInfo;
33: import javax.management.NotificationEmitter;
34: import javax.management.NotificationFilter;
35: import javax.management.NotificationListener;
36:
37: /**
38: * Notification-emitting wrapper for StandardMBean.
39: *
40: * @author Sun Microsystems, Inc.
41: */
42: public class NotifyStandardMBean extends StandardMBean implements
43: NotificationEmitter {
44: private NotificationEmitter mNotify;
45:
46: public NotifyStandardMBean(Object impl, Class intf)
47: throws javax.management.NotCompliantMBeanException {
48: super (impl, intf);
49:
50: if (!(impl instanceof NotificationEmitter)) {
51: throw new IllegalArgumentException(
52: "MBean impl does not implement NotificationEmitter");
53: }
54:
55: mNotify = (NotificationEmitter) impl;
56: }
57:
58: public void addNotificationListener(NotificationListener listener,
59: NotificationFilter filter, Object obj)
60: throws IllegalArgumentException {
61: mNotify.addNotificationListener(listener, filter, obj);
62: //System.out.println("notify mbean: added listener");
63: }
64:
65: public MBeanNotificationInfo[] getNotificationInfo() {
66: return mNotify.getNotificationInfo();
67: }
68:
69: public void removeNotificationListener(NotificationListener listener)
70: throws javax.management.ListenerNotFoundException {
71: mNotify.removeNotificationListener(listener);
72: }
73:
74: public void removeNotificationListener(
75: NotificationListener listener, NotificationFilter filter,
76: Object obj)
77: throws javax.management.ListenerNotFoundException {
78: mNotify.removeNotificationListener(listener, filter, obj);
79: }
80: }
|