1 /* 2 * @(#)NamespaceChangeListener.java 1.7 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package javax.naming.event; 9 10 /** 11 * Specifies the methods that a listener interested in namespace changes 12 * must implement. 13 * Specifically, the listener is interested in <tt>NamingEvent</tt>s 14 * with event types of <tt>OBJECT_ADDED</TT>, <TT>OBJECT_RENAMED</TT>, or 15 * <TT>OBJECT_REMOVED</TT>. 16 *<p> 17 * Such a listener must: 18 *<ol> 19 *<li>Implement this interface and its methods. 20 *<li>Implement <tt>NamingListener.namingExceptionThrown()</tt> so that 21 * it will be notified of exceptions thrown while attempting to 22 * collect information about the events. 23 *<li>Register with the source using the source's <tt>addNamingListener()</tt> 24 * method. 25 *</ol> 26 * A listener that wants to be notified of <tt>OBJECT_CHANGED</tt> event types 27 * should also implement the <tt>ObjectChangeListener</tt> 28 * interface. 29 * 30 * @author Rosanna Lee 31 * @author Scott Seligman 32 * @version 1.7 03/12/19 33 * 34 * @see NamingEvent 35 * @see ObjectChangeListener 36 * @see EventContext 37 * @see EventDirContext 38 * @since 1.3 39 */ 40 public interface NamespaceChangeListener extends NamingListener { 41 42 /** 43 * Called when an object has been added. 44 *<p> 45 * The binding of the newly added object can be obtained using 46 * <tt>evt.getNewBinding()</tt>. 47 * @param evt The nonnull event. 48 * @see NamingEvent#OBJECT_ADDED 49 */ 50 void objectAdded(NamingEvent evt); 51 52 /** 53 * Called when an object has been removed. 54 *<p> 55 * The binding of the newly removed object can be obtained using 56 * <tt>evt.getOldBinding()</tt>. 57 * @param evt The nonnull event. 58 * @see NamingEvent#OBJECT_REMOVED 59 */ 60 void objectRemoved(NamingEvent evt); 61 62 /** 63 * Called when an object has been renamed. 64 *<p> 65 * The binding of the renamed object can be obtained using 66 * <tt>evt.getNewBinding()</tt>. Its old binding (before the rename) 67 * can be obtained using <tt>evt.getOldBinding()</tt>. 68 * One of these may be null if the old/new binding was outside the 69 * scope in which the listener has registered interest. 70 * @param evt The nonnull event. 71 * @see NamingEvent#OBJECT_RENAMED 72 */ 73 void objectRenamed(NamingEvent evt); 74 } 75