01: /*
02: * Copyright 2002-2005 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.jmx.export.notification;
18:
19: import javax.management.Notification;
20:
21: /**
22: * Simple interface allowing Spring-managed MBeans to publish JMX notifications
23: * without being aware of how those notifications are being transmitted to the
24: * {@link javax.management.MBeanServer}.
25: *
26: * <p>Managed resources can access a <code>NotificationPublisher</code> by
27: * implementing the {@link NotificationPublisherAware} interface. After a particular
28: * managed resource instance is registered with the {@link javax.management.MBeanServer},
29: * Spring will inject a <code>NotificationPublisher</code> instance into it if that
30: * resource implements the {@link NotificationPublisherAware} inteface.
31: *
32: * <p>Each managed resource instance will have a distinct instance of a
33: * <code>NotificationPublisher</code> implementation. This instance will keep
34: * track of all the {@link javax.management.NotificationListener NotificationListeners}
35: * registered for a particular mananaged resource.
36: *
37: * <p>Any existing, user-defined MBeans should use standard JMX APIs for notification
38: * publication; this interface is intended for use only by Spring-created MBeans.
39: *
40: * @author Rob Harrop
41: * @since 2.0
42: * @see NotificationPublisherAware
43: * @see org.springframework.jmx.export.MBeanExporter
44: */
45: public interface NotificationPublisher {
46:
47: /**
48: * Send the specified {@link javax.management.Notification} to all registered
49: * {@link javax.management.NotificationListener NotificationListeners}.
50: * Managed resources are <strong>not</strong> responsible for managing the list
51: * of registered {@link javax.management.NotificationListener NotificationListeners};
52: * that is performed automatically.
53: * @param notification the JMX Notification to send
54: * @throws UnableToSendNotificationException if sending failed
55: */
56: void sendNotification(Notification notification)
57: throws UnableToSendNotificationException;
58:
59: }
|