blob: 40a22a76ef4f7984c4df7d10e91d5e8065784eae [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package com.sun.jmx.remote.security;
27
28import javax.management.Notification;
29import javax.management.ObjectName;
30import javax.security.auth.Subject;
31
32/**
33 * <p>This interface allows to control remote access to the
34 * {@code addNotificationListener} and {@code removeNotificationListener}
35 * methods when the notification listener parameter is of type
36 * {@code NotificationListener} and also allows to control remote access
37 * to the notifications being forwarded to the interested remote listeners.</p>
38 *
39 * <p>An implementation of this interface can be supplied to a
40 * {@code JMXConnectorServer} in the environment map through the
41 * {@code com.sun.jmx.remote.notification.access.controller}
42 * environment map property.</p>
43 *
44 * @since 1.6
45 */
46public interface NotificationAccessController {
47
48 /**
49 * This method is called when a remote
50 * {@link javax.management.remote.JMXConnector} invokes the method
51 * {@link javax.management.MBeanServerConnection#addNotificationListener(ObjectName,NotificationListener,NotificationFilter,Object)}.
52 *
53 * @param connectionId the {@code connectionId} of the remote client
54 * adding the listener.
55 * @param name the name of the MBean where the listener is to be added.
56 * @param subject the authenticated subject representing the remote client.
57 *
58 * @throws SecurityException if the remote client with the supplied
59 * authenticated subject does not have the rights to add a listener
60 * to the supplied MBean.
61 */
62 public void addNotificationListener(String connectionId,
63 ObjectName name,
64 Subject subject)
65 throws SecurityException;
66
67 /**
68 * This method is called when a remote
69 * {@link javax.management.remote.JMXConnector} invokes the method
70 * {@link javax.management.MBeanServerConnection#removeNotificationListener(ObjectName,NotificationListener)}
71 * or the method
72 * {@link javax.management.MBeanServerConnection#removeNotificationListener(ObjectName,NotificationListener,NotificationFilter,Object)}.
73 *
74 * @param connectionId the {@code connectionId} of the remote client
75 * removing the listener.
76 * @param name the name of the MBean where the listener is to be removed.
77 * @param subject the authenticated subject representing the remote client.
78 *
79 * @throws SecurityException if the remote client with the supplied
80 * authenticated subject does not have the rights to remove a listener
81 * from the supplied MBean.
82 */
83 public void removeNotificationListener(String connectionId,
84 ObjectName name,
85 Subject subject)
86 throws SecurityException;
87
88 /**
89 * This method is called before the
90 * {@link javax.management.remote.JMXConnectorServer}
91 * forwards the notification to the interested remote
92 * listener represented by the authenticated subject.
93 *
94 * @param connectionId the {@code connectionId} of the remote client
95 * receiving the notification.
96 * @param name the name of the MBean forwarding the notification.
97 * @param notification the notification to be forwarded to the interested
98 * remote listener.
99 * @param subject the authenticated subject representing the remote client.
100 *
101 * @throws SecurityException if the remote client with
102 * the supplied authenticated subject does not have the
103 * rights to receive the notification.
104 */
105 public void fetchNotification(String connectionId,
106 ObjectName name,
107 Notification notification,
108 Subject subject)
109 throws SecurityException;
110}