1 /*
   2  * Copyright (c) 1999, Oracle and/or its affiliates. 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.naming.event;
  27 
  28 /**
  29   * Specifies the method that a listener of a <tt>NamingEvent</tt>
  30   * with event type of <tt>OBJECT_CHANGED</tt> must implement.
  31   *<p>
  32   * An <tt>OBJECT_CHANGED</tt> event type is fired when (the contents of)
  33   * an object has changed. This might mean that its attributes have been modified,
  34   * added, or removed, and/or that the object itself has been replaced.
  35   * How the object has changed can be determined by examining the
  36   * <tt>NamingEvent</tt>'s old and new bindings.
  37   *<p>
  38   * A listener interested in <tt>OBJECT_CHANGED</tt> event types must:
  39   *<ol>
  40   *
  41   *<li>Implement this interface and its method (<tt>objectChanged()</tt>)
  42   *<li>Implement <tt>NamingListener.namingExceptionThrown()</tt> so that
  43   * it will be notified of exceptions thrown while attempting to
  44   * collect information about the events.
  45   *<li>Register with the source using the source's <tt>addNamingListener()</tt>
  46   *    method.
  47   *</ol>
  48   * A listener that wants to be notified of namespace change events
  49   * should also implement the <tt>NamespaceChangeListener</tt>
  50   * interface.
  51   *
  52   * @author Rosanna Lee
  53   * @author Scott Seligman
  54   *
  55   * @see NamingEvent
  56   * @see NamespaceChangeListener
  57   * @see EventContext
  58   * @see EventDirContext
  59   * @since 1.3
  60   */
  61 public interface ObjectChangeListener extends NamingListener {
  62 
  63     /**
  64      * Called when an object has been changed.
  65      *<p>
  66      * The binding of the changed object can be obtained using
  67      * <tt>evt.getNewBinding()</tt>. Its old binding (before the change)
  68      * can be obtained using <tt>evt.getOldBinding()</tt>.
  69      * @param evt The nonnull naming event.
  70      * @see NamingEvent#OBJECT_CHANGED
  71      */
  72     void objectChanged(NamingEvent evt);
  73 }