jdk/src/java.naming/share/classes/javax/naming/event/EventContext.java
author igerasim
Tue, 09 Sep 2014 19:02:36 +0400
changeset 26458 d6a5aed9204b
parent 25859 3317bb8137f4
child 32029 a5538163e144
permissions -rw-r--r--
7010989: Duplicate closure of file descriptors leads to unexpected and incorrect closure of sockets Reviewed-by: chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
     2
 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.naming.event;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.naming.Name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.naming.Context;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.naming.NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * Contains methods for registering/deregistering listeners to be notified of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * events fired when objects named in a context changes.
21285
e740104a04f1 8026840: Fix new doclint issues in javax.naming
darcy
parents: 18580
diff changeset
    36
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
    37
 *<h1>Target</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * The name parameter in the <tt>addNamingListener()</tt> methods is referred
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * to as the <em>target</em>. The target, along with the scope, identify
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * the object(s) that the listener is interested in.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * It is possible to register interest in a target that does not exist, but
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * there might be limitations in the extent to which this can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * supported by the service provider and underlying protocol/service.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * If a service only supports registration for existing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * targets, an attempt to register for a nonexistent target
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * results in a <tt>NameNotFoundException</tt> being thrown as early as possible,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * preferably at the time <tt>addNamingListener()</tt> is called, or if that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * not possible, the listener will receive the exception through the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * <tt>NamingExceptionEvent</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * Also, for service providers that only support registration for existing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * targets, when the target that a listener has registered for is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * subsequently removed from the namespace, the listener is notified
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * via a <tt>NamingExceptionEvent</tt> (containing a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *<tt>NameNotFoundException</tt>).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * An application can use the method <tt>targetMustExist()</tt> to check
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * whether a <tt>EventContext</tt> supports registration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * of nonexistent targets.
21285
e740104a04f1 8026840: Fix new doclint issues in javax.naming
darcy
parents: 18580
diff changeset
    61
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
    62
 *<h1>Event Source</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * The <tt>EventContext</tt> instance on which you invoke the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * registration methods is the <em>event source</em> of the events that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * (potentially) generated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * The source is <em>not necessarily</em> the object named by the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * Only when the target is the empty name is the object named by the target
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * the source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * In other words, the target,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * along with the scope parameter, are used to identify
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * the object(s) that the listener is interested in, but the event source
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * is the <tt>EventContext</tt> instance with which the listener
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * has registered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * For example, suppose a listener makes the following registration:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *      NamespaceChangeListener listener = ...;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *      src.addNamingListener("x", SUBTREE_SCOPE, listener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *</pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * When an object named "x/y" is subsequently deleted, the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * <tt>NamingEvent</tt> (<tt>evt</tt>)  must contain:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *      evt.getEventContext() == src
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 *      evt.getOldBinding().getName().equals("x/y")
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 *</pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * Furthermore, listener registration/deregistration is with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * the <tt>EventContext</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * <em>instance</em>, and not with the corresponding object in the namespace.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * If the program intends at some point to remove a listener, then it needs to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * keep a reference to the <tt>EventContext</tt> instance on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * which it invoked <tt>addNamingListener()</tt> (just as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * it needs to keep a reference to the listener in order to remove it
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * later). It cannot expect to do a <tt>lookup()</tt> and get another instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * a <tt>EventContext</tt> on which to perform the deregistration.
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
    96
 *<h1>Lifetime of Registration</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * A registered listener becomes deregistered when:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 *<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 *<li>It is removed using <tt>removeNamingListener()</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *<li>An exception is thrown while collecting information about the events.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 *  That is, when the listener receives a <tt>NamingExceptionEvent</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 *<li><tt>Context.close()</tt> is invoked on the <tt>EventContext</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * instance with which it has registered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * Until that point, a <tt>EventContext</tt> instance that has outstanding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * listeners will continue to exist and be maintained by the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
   108
 *<h1>Listener Implementations</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * The registration/deregistration methods accept an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * <tt>NamingListener</tt>. There are subinterfaces of <tt>NamingListener</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * for different of event types of <tt>NamingEvent</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * For example, the <tt>ObjectChangeListener</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * interface is for the <tt>NamingEvent.OBJECT_CHANGED</tt> event type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * To register interest in multiple event types, the listener implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * should implement multiple <tt>NamingListener</tt> subinterfaces and use a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * single invocation of <tt>addNamingListener()</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * In addition to reducing the number of method calls and possibly the code size
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * of the listeners, this allows some service providers to optimize the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 * registration.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
   121
 *<h1>Threading Issues</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * Like <tt>Context</tt> instances in general, instances of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * <tt>EventContext</tt> are not guaranteed to be thread-safe.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * Care must be taken when multiple threads are accessing the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * <tt>EventContext</tt> concurrently.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 * See the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 * <a href=package-summary.html#THREADING>package description</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 * for more information on threading issues.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 * @author Scott Seligman
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
public interface EventContext extends Context {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * Constant for expressing interest in events concerning the object named
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * by the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * The value of this constant is <tt>0</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    public final static int OBJECT_SCOPE = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * Constant for expressing interest in events concerning objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * in the context named by the target,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * excluding the context named by the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * The value of this constant is <tt>1</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    public final static int ONELEVEL_SCOPE = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * Constant for expressing interest in events concerning objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * in the subtree of the object named by the target, including the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * named by the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * The value of this constant is <tt>2</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    public final static int SUBTREE_SCOPE = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * Adds a listener for receiving naming events fired
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * when the object(s) identified by a target and scope changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * The event source of those events is this context. See the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * class description for a discussion on event source and target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * See the descriptions of the constants <tt>OBJECT_SCOPE</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * <tt>ONELEVEL_SCOPE</tt>, and <tt>SUBTREE_SCOPE</tt> to see how
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * <tt>scope</tt> affects the registration.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * <tt>target</tt> needs to name a context only when <tt>scope</tt> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * <tt>ONELEVEL_SCOPE</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * <tt>target</tt> may name a non-context if <tt>scope</tt> is either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * <tt>OBJECT_SCOPE</tt> or <tt>SUBTREE_SCOPE</tt>.  Using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * <tt>SUBTREE_SCOPE</tt> for a non-context might be useful,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * for example, if the caller does not know in advance whether <tt>target</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * is a context and just wants to register interest in the (possibly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * degenerate subtree) rooted at <tt>target</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * When the listener is notified of an event, the listener may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * in invoked in a thread other than the one in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * <tt>addNamingListener()</tt> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * Care must be taken when multiple threads are accessing the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * <tt>EventContext</tt> concurrently.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * See the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * <a href=package-summary.html#THREADING>package description</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * for more information on threading issues.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @param target A nonnull name to be resolved relative to this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @param scope One of <tt>OBJECT_SCOPE</tt>, <tt>ONELEVEL_SCOPE</tt>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * <tt>SUBTREE_SCOPE</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * @param l  The nonnull listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @exception NamingException If a problem was encountered while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * adding the listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * @see #removeNamingListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    void addNamingListener(Name target, int scope, NamingListener l)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * Adds a listener for receiving naming events fired
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * when the object named by the string target name and scope changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * See the overload that accepts a <tt>Name</tt> for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * @param target The nonnull string name of the object resolved relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * to this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * @param scope One of <tt>OBJECT_SCOPE</tt>, <tt>ONELEVEL_SCOPE</tt>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * <tt>SUBTREE_SCOPE</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @param l  The nonnull listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * @exception NamingException If a problem was encountered while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * adding the listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * @see #removeNamingListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    void addNamingListener(String target, int scope, NamingListener l)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * Removes a listener from receiving naming events fired
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * by this <tt>EventContext</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * The listener may have registered more than once with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * <tt>EventContext</tt>, perhaps with different target/scope arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * After this method is invoked, the listener will no longer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * receive events with this <tt>EventContext</tt> instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * as the event source (except for those events already in the process of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * being dispatched).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * If the listener was not, or is no longer, registered with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * this <tt>EventContext</tt> instance, this method does not do anything.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * @param l  The nonnull listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * @exception NamingException If a problem was encountered while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * removing the listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * @see #addNamingListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    void removeNamingListener(NamingListener l) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * Determines whether a listener can register interest in a target
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * that does not exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @return true if the target must exist; false if the target need not exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @exception NamingException If the context's behavior in this regard cannot
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * be determined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    boolean targetMustExist() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
}