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