1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 24 25 package javax.management.j2ee; 26 27 import java.rmi.RemoteException; 28 import javax.management.NotificationListener; 29 import javax.management.NotificationFilter; 30 import javax.management.ObjectName; 31 import javax.management.InstanceNotFoundException; 32 import javax.management.ListenerNotFoundException; 33 34 /** 35 * ListenerRegistration defines the methods which clients of the MEJB 36 * use to add and remove event listeners. 37 * 38 * @author Hans Hrasna 39 */ 40 public interface ListenerRegistration extends java.io.Serializable { 41 42 /** 43 * Add a listener to a registered managed object. 44 * 45 * @param name The name of the managed object on which the listener should be added. 46 * @param listener The listener object which will handle the notifications emitted by the registered managed object. 47 * @param filter The filter object. If filter is null, no filtering will be performed before handling notifications. 48 * @param handback The context to be sent to the listener when a notification is emitted. 49 * 50 * @exception InstanceNotFoundException The managed object name provided does not match any of the registered managed objects. 51 * @exception RemoteException A communication exception occurred during the execution of a remote method call 52 * 53 * 54 */ 55 void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) 56 throws InstanceNotFoundException, RemoteException; 57 58 59 60 /** 61 * Remove a listener from a registered managed object. 62 * 63 * @param name The name of the managed object on which the listener should be removed. 64 * @param listener The listener object which will handle the notifications emitted by the registered managed object. 65 * This method will remove all the information related to this listener. 66 * 67 * @exception InstanceNotFoundException The managed object name provided does not match any of the registered managed objects. 68 * @exception ListenerNotFoundException The listener is not registered in the managed object. 69 * @exception RemoteException A communication exception occurred during the execution of a remote method call 70 * 71 * 72 */ 73 void removeNotificationListener(ObjectName name, NotificationListener listener) 74 throws InstanceNotFoundException, ListenerNotFoundException, RemoteException; 75 } 76