jdk/src/java.naming/share/classes/javax/naming/Context.java
author chegar
Sun, 17 Aug 2014 15:54:13 +0100
changeset 25859 3317bb8137f4
parent 25752 jdk/src/share/classes/javax/naming/Context.java@8df7ddac1cb3
child 27565 729f9700483a
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
     2
 * Copyright (c) 1999, 2014, 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;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * This interface represents a naming context, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * consists of a set of name-to-object bindings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * It contains methods for examining and updating these bindings.
21285
e740104a04f1 8026840: Fix new doclint issues in javax.naming
darcy
parents: 18580
diff changeset
    34
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
    35
 * <h1>Names</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * Each name passed as an argument to a <tt>Context</tt> method is relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * to that context.  The empty name is used to name the context itself.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * A name parameter may never be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * Most of the methods have overloaded versions with one taking a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <code>Name</code> parameter and one taking a <code>String</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * These overloaded versions are equivalent in that if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * the <code>Name</code> and <code>String</code> parameters are just
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * different representations of the same name, then the overloaded
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * versions of the same methods behave the same.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * In the method descriptions below, only one version is fully documented.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * The second version instead has a link to the first:  the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * documentation applies to both.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * For systems that support federation, <tt>String</tt> name arguments to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * <tt>Context</tt> methods are composite names. Name arguments that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * instances of <tt>CompositeName</tt> are treated as composite names,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * while <tt>Name</tt> arguments that are not instances of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <tt>CompositeName</tt> are treated as compound names (which might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * instances of <tt>CompoundName</tt> or other implementations of compound
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * names). This allows the results of <tt>NameParser.parse()</tt> to be used as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * arguments to the <tt>Context</tt> methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * Prior to JNDI 1.2, all name arguments were treated as composite names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * Furthermore, for systems that support federation, all names returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * in a <tt>NamingEnumeration</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * from <tt>list()</tt> and <tt>listBindings()</tt> are composite names
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * represented as strings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * See <tt>CompositeName</tt> for the string syntax of names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * For systems that do not support federation, the name arguments (in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * either <tt>Name</tt> or <tt>String</tt> forms) and the names returned in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * <tt>NamingEnumeration</tt> may be names in their own namespace rather than
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * names in a composite namespace, at the discretion of the service
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * provider.
21285
e740104a04f1 8026840: Fix new doclint issues in javax.naming
darcy
parents: 18580
diff changeset
    71
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
    72
 *<h1>Exceptions</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * All the methods in this interface can throw a <tt>NamingException</tt> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * any of its subclasses. See <tt>NamingException</tt> and their subclasses
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * for details on each exception.
21285
e740104a04f1 8026840: Fix new doclint issues in javax.naming
darcy
parents: 18580
diff changeset
    76
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
    77
 *<h1>Concurrent Access</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * A Context instance is not guaranteed to be synchronized against
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * concurrent access by multiple threads.  Threads that need to access
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * a single Context instance concurrently should synchronize amongst
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * themselves and provide the necessary locking.  Multiple threads
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * each manipulating a different Context instance need not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * synchronize.  Note that the {@link #lookup(Name) <tt>lookup</tt>}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * method, when passed an empty name, will return a new Context instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * representing the same naming context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * For purposes of concurrency control,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * a Context operation that returns a <tt>NamingEnumeration</tt> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * not considered to have completed while the enumeration is still in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * use, or while any referrals generated by that operation are still
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * being followed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *
21285
e740104a04f1 8026840: Fix new doclint issues in javax.naming
darcy
parents: 18580
diff changeset
    93
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
    94
 *<h1>Parameters</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * A <tt>Name</tt> parameter passed to any method of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * <tt>Context</tt> interface or one of its subinterfaces
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * will not be modified by the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * The service provider may keep a reference to it
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * for the duration of the operation, including any enumeration of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * method's results and the processing of any referrals generated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * The caller should not modify the object during this time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * A <tt>Name</tt> returned by any such method is owned by the caller.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * The caller may subsequently modify it; the service provider may not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 *
21285
e740104a04f1 8026840: Fix new doclint issues in javax.naming
darcy
parents: 18580
diff changeset
   105
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
   106
 *<h1>Environment Properties</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * JNDI applications need a way to communicate various preferences
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * and properties that define the environment in which naming and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * directory services are accessed. For example, a context might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * require specification of security credentials in order to access
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * the service. Another context might require that server configuration
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * information be supplied. These are referred to as the <em>environment</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * of a context. The <tt>Context</tt> interface provides methods for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * retrieving and updating this environment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * The environment is inherited from the parent context as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * context methods proceed from one context to the next. Changes to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 * the environment of one context do not directly affect those
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 * of other contexts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * It is implementation-dependent when environment properties are used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * and/or verified for validity.  For example, some of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * security-related properties are used by service providers to "log in"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * to the directory.  This login process might occur at the time the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * context is created, or the first time a method is invoked on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 * context.  When, and whether this occurs at all, is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 * implementation-dependent.  When environment properties are added or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 * removed from the context, verifying the validity of the changes is again
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 * implementation-dependent. For example, verification of some properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * might occur at the time the change is made, or at the time the next
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 * operation is performed on the context, or not at all.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 * Any object with a reference to a context may examine that context's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 * environment.  Sensitive information such as clear-text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 * passwords should not be stored there unless the implementation is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 * known to protect it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 *<a name=RESOURCEFILES></a>
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
   141
 *<h1>Resource Files</h1>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * To simplify the task of setting up the environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * required by a JNDI application,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 * application components and service providers may be distributed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * along with <em>resource files.</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 * A JNDI resource file is a file in the properties file format (see
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 * {@link java.util.Properties#load <tt>java.util.Properties</tt>}),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 * containing a list of key/value pairs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 * The key is the name of the property (e.g. "java.naming.factory.object")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 * and the value is a string in the format defined
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 * for that property.  Here is an example of a JNDI resource file:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
   154
 * <blockquote>{@code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 * java.naming.factory.object=com.sun.jndi.ldap.AttrsToCorba:com.wiz.from.Person
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 * java.naming.factory.state=com.sun.jndi.ldap.CorbaToAttrs:com.wiz.from.Person
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 * java.naming.factory.control=com.sun.jndi.ldap.ResponseControlFactory
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
   158
 * }</blockquote>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 * The JNDI class library reads the resource files and makes the property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 * values freely available.  Thus JNDI resource files should be considered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 * to be "world readable", and sensitive information such as clear-text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 * passwords should not be stored there.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 * There are two kinds of JNDI resource files:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 * <em>provider</em> and <em>application</em>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
   168
 * <h2>Provider Resource Files</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * Each service provider has an optional resource that lists properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 * specific to that provider.  The name of this resource is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 * <blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 * [<em>prefix</em>/]<tt>jndiprovider.properties</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 * </blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 * where <em>prefix</em> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 * the package name of the provider's context implementation(s),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * with each period (".") converted to a slash ("/").
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 * For example, suppose a service provider defines a context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 * implementation with class name <tt>com.sun.jndi.ldap.LdapCtx</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * The provider resource for this provider is named
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * <tt>com/sun/jndi/ldap/jndiprovider.properties</tt>.  If the class is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 * not in a package, the resource's name is simply
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 * <tt>jndiprovider.properties</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 * <a name=LISTPROPS></a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 * Certain methods in the JNDI class library make use of the standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 * JNDI properties that specify lists of JNDI factories:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 * <li>java.naming.factory.object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 * <li>java.naming.factory.state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 * <li>java.naming.factory.control
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 * <li>java.naming.factory.url.pkgs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
 * The JNDI library will consult the provider resource file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * when determining the values of these properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 * Properties other than these may be set in the provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 * resource file at the discretion of the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 * The service provider's documentation should clearly state which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * properties are allowed; other properties in the file will be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
   203
 * <h2>Application Resource Files</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 * When an application is deployed, it will generally have several
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   206
 * codebase directories and JARs in its classpath. JNDI locates (using
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 * {@link ClassLoader#getResources <tt>ClassLoader.getResources()</tt>})
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 * all <em>application resource files</em> named <tt>jndi.properties</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 * in the classpath.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 * In addition, if the file <i>java.home</i><tt>/lib/jndi.properties</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 * exists and is readable,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 * JNDI treats it as an additional application resource file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 * (<i>java.home</i> indicates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 * directory named by the <tt>java.home</tt> system property.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 * All of the properties contained in these files are placed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 * into the environment of the initial context.  This environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 * is then inherited by other contexts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
 * For each property found in more than one application resource file,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
 * JNDI uses the first value found or, in a few cases where it makes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
 * sense to do so, it concatenates all of the values (details are given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 * below).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
 * For example, if the "java.naming.factory.object" property is found in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
 * three <tt>jndi.properties</tt> resource files, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
 * list of object factories is a concatenation of the property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
 * values from all three files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
 * Using this scheme, each deployable component is responsible for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
 * listing the factories that it exports.  JNDI automatically
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 * collects and uses all of these export lists when searching for factory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
 * classes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
 *
18580
6c4badf4ffba 8019407: Fix doclint issues in javax.naming.*
darcy
parents: 5506
diff changeset
   233
 * <h2>Search Algorithm for Properties</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
 * When JNDI constructs an initial context, the context's environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
 * is initialized with properties defined in the environment parameter
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   237
 * passed to the constructor, the system properties,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
 * and the application resource files.  See
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
 * <a href=InitialContext.html#ENVIRONMENT><tt>InitialContext</tt></a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
 * for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
 * This initial environment is then inherited by other context instances.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
 * When the JNDI class library needs to determine
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * the value of a property, it does so by merging
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 * the values from the following two sources, in order:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
 * <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
 * <li>The environment of the context being operated on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
 * <li>The provider resource file (<tt>jndiprovider.properties</tt>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
 * for the context being operated on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
 * </ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
 * For each property found in both of these two sources,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
 * JNDI determines the property's value as follows.  If the property is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
 * one of the standard JNDI properties that specify a list of JNDI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
 * factories (listed <a href=#LISTPROPS>above</a>), the values are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
 * concatenated into a single colon-separated list.  For other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
 * properties, only the first value found is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
 * When a service provider needs to determine the value of a property,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
 * it will generally take that value directly from the environment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
 * A service provider may define provider-specific properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
 * to be placed in its own provider resource file.  In that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
 * case it should merge values as described in the previous paragraph.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
 * In this way, each service provider developer can specify a list of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
 * factories to use with that service provider. These can be modified by
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   269
 * the application resources specified by the deployer of the application,
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   270
 * which in turn can be modified by the user.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
 * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
 * @author Scott Seligman
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
 * @author R. Vasudevan
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
 * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
public interface Context {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * Retrieves the named object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * If <tt>name</tt> is empty, returns a new instance of this context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * (which represents the same naming context as this context, but its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * environment may be modified independently and it may be accessed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * concurrently).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     *          the name of the object to look up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * @return  the object bound to <tt>name</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * @see #lookup(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * @see #lookupLink(Name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    public Object lookup(Name name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * Retrieves the named object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * See {@link #lookup(Name)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     *          the name of the object to look up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * @return  the object bound to <tt>name</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    public Object lookup(String name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * Binds a name to an object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * All intermediate contexts and the target context (that named by all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * but terminal atomic component of the name) must already exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     *          the name to bind; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * @param obj
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     *          the object to bind; possibly null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * @throws  NameAlreadyBoundException if name is already bound
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * @throws  javax.naming.directory.InvalidAttributesException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     *          if object did not supply all mandatory attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * @see #bind(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * @see #rebind(Name, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * @see javax.naming.directory.DirContext#bind(Name, Object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     *          javax.naming.directory.Attributes)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    public void bind(Name name, Object obj) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * Binds a name to an object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * See {@link #bind(Name, Object)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     *          the name to bind; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * @param obj
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     *          the object to bind; possibly null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * @throws  NameAlreadyBoundException if name is already bound
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * @throws  javax.naming.directory.InvalidAttributesException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     *          if object did not supply all mandatory attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    public void bind(String name, Object obj) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * Binds a name to an object, overwriting any existing binding.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * All intermediate contexts and the target context (that named by all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * but terminal atomic component of the name) must already exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * <p> If the object is a <tt>DirContext</tt>, any existing attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * associated with the name are replaced with those of the object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * Otherwise, any existing attributes associated with the name remain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * unchanged.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     *          the name to bind; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * @param obj
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     *          the object to bind; possibly null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * @throws  javax.naming.directory.InvalidAttributesException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     *          if object did not supply all mandatory attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * @see #rebind(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * @see #bind(Name, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * @see javax.naming.directory.DirContext#rebind(Name, Object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     *          javax.naming.directory.Attributes)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * @see javax.naming.directory.DirContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    public void rebind(Name name, Object obj) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * Binds a name to an object, overwriting any existing binding.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * See {@link #rebind(Name, Object)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     *          the name to bind; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * @param obj
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     *          the object to bind; possibly null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * @throws  javax.naming.directory.InvalidAttributesException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     *          if object did not supply all mandatory attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    public void rebind(String name, Object obj) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * Unbinds the named object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * Removes the terminal atomic name in <code>name</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * from the target context--that named by all but the terminal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * atomic part of <code>name</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * <p> This method is idempotent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * It succeeds even if the terminal atomic name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * is not bound in the target context, but throws
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * <tt>NameNotFoundException</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * if any of the intermediate contexts do not exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * <p> Any attributes associated with the name are removed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * Intermediate contexts are not changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     *          the name to unbind; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * @throws  NameNotFoundException if an intermediate context does not exist
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * @see #unbind(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    public void unbind(Name name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * Unbinds the named object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * See {@link #unbind(Name)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     *          the name to unbind; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * @throws  NameNotFoundException if an intermediate context does not exist
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    public void unbind(String name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * Binds a new name to the object bound to an old name, and unbinds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * the old name.  Both names are relative to this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * Any attributes associated with the old name become associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * with the new name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * Intermediate contexts of the old name are not changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * @param oldName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     *          the name of the existing binding; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * @param newName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     *          the name of the new binding; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * @throws  NameAlreadyBoundException if <tt>newName</tt> is already bound
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     * @see #rename(String, String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * @see #bind(Name, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * @see #rebind(Name, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
    public void rename(Name oldName, Name newName) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     * Binds a new name to the object bound to an old name, and unbinds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * the old name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * See {@link #rename(Name, Name)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * @param oldName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     *          the name of the existing binding; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * @param newName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     *          the name of the new binding; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     * @throws  NameAlreadyBoundException if <tt>newName</tt> is already bound
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    public void rename(String oldName, String newName) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * Enumerates the names bound in the named context, along with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * class names of objects bound to them.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     * The contents of any subcontexts are not included.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     * <p> If a binding is added to or removed from this context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     * its effect on an enumeration previously returned is undefined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     *          the name of the context to list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * @return  an enumeration of the names and class names of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     *          bindings in this context.  Each element of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     *          enumeration is of type <tt>NameClassPair</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * @see #list(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * @see #listBindings(Name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * @see NameClassPair
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
    public NamingEnumeration<NameClassPair> list(Name name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * Enumerates the names bound in the named context, along with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * class names of objects bound to them.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     * See {@link #list(Name)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     *          the name of the context to list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * @return  an enumeration of the names and class names of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     *          bindings in this context.  Each element of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     *          enumeration is of type <tt>NameClassPair</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    public NamingEnumeration<NameClassPair> list(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * Enumerates the names bound in the named context, along with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     * objects bound to them.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     * The contents of any subcontexts are not included.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     * <p> If a binding is added to or removed from this context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     * its effect on an enumeration previously returned is undefined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     *          the name of the context to list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * @return  an enumeration of the bindings in this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     *          Each element of the enumeration is of type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     *          <tt>Binding</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     * @see #listBindings(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     * @see #list(Name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     * @see Binding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    public NamingEnumeration<Binding> listBindings(Name name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * Enumerates the names bound in the named context, along with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * objects bound to them.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * See {@link #listBindings(Name)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     *          the name of the context to list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     * @return  an enumeration of the bindings in this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     *          Each element of the enumeration is of type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     *          <tt>Binding</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    public NamingEnumeration<Binding> listBindings(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     * Destroys the named context and removes it from the namespace.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     * Any attributes associated with the name are also removed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
     * Intermediate contexts are not destroyed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     * <p> This method is idempotent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     * It succeeds even if the terminal atomic name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     * is not bound in the target context, but throws
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * <tt>NameNotFoundException</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * if any of the intermediate contexts do not exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     * <p> In a federated naming system, a context from one naming system
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     * may be bound to a name in another.  One can subsequently
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     * look up and perform operations on the foreign context using a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     * composite name.  However, an attempt destroy the context using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * this composite name will fail with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * <tt>NotContextException</tt>, because the foreign context is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * a "subcontext" of the context in which it is bound.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     * Instead, use <tt>unbind()</tt> to remove the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * binding of the foreign context.  Destroying the foreign context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * requires that the <tt>destroySubcontext()</tt> be performed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     * on a context from the foreign context's "native" naming system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     *          the name of the context to be destroyed; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     * @throws  NameNotFoundException if an intermediate context does not exist
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
     * @throws  NotContextException if the name is bound but does not name a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
     *          context, or does not name a context of the appropriate type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     * @throws  ContextNotEmptyException if the named context is not empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     * @see #destroySubcontext(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
    public void destroySubcontext(Name name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     * Destroys the named context and removes it from the namespace.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * See {@link #destroySubcontext(Name)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     *          the name of the context to be destroyed; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     * @throws  NameNotFoundException if an intermediate context does not exist
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     * @throws  NotContextException if the name is bound but does not name a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     *          context, or does not name a context of the appropriate type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * @throws  ContextNotEmptyException if the named context is not empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    public void destroySubcontext(String name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
     * Creates and binds a new context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     * Creates a new context with the given name and binds it in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
     * the target context (that named by all but terminal atomic
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     * component of the name).  All intermediate contexts and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     * target context must already exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     *          the name of the context to create; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     * @return  the newly created context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     * @throws  NameAlreadyBoundException if name is already bound
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     * @throws  javax.naming.directory.InvalidAttributesException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     *          if creation of the subcontext requires specification of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     *          mandatory attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     * @see #createSubcontext(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     * @see javax.naming.directory.DirContext#createSubcontext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
    public Context createSubcontext(Name name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * Creates and binds a new context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     * See {@link #createSubcontext(Name)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     *          the name of the context to create; may not be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
     * @return  the newly created context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
     * @throws  NameAlreadyBoundException if name is already bound
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
     * @throws  javax.naming.directory.InvalidAttributesException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     *          if creation of the subcontext requires specification of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     *          mandatory attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
    public Context createSubcontext(String name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     * Retrieves the named object, following links except
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     * for the terminal atomic component of the name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * If the object bound to <tt>name</tt> is not a link,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     * returns the object itself.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     *          the name of the object to look up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     * @return  the object bound to <tt>name</tt>, not following the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     *          terminal link (if any).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     * @see #lookupLink(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    public Object lookupLink(Name name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     * Retrieves the named object, following links except
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     * for the terminal atomic component of the name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     * See {@link #lookupLink(Name)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
     *          the name of the object to look up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
     * @return  the object bound to <tt>name</tt>, not following the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
     *          terminal link (if any)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
    public Object lookupLink(String name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     * Retrieves the parser associated with the named context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
     * In a federation of namespaces, different naming systems will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
     * parse names differently.  This method allows an application
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
     * to get a parser for parsing names into their atomic components
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
     * using the naming convention of a particular naming system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
     * Within any single naming system, <tt>NameParser</tt> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
     * returned by this method must be equal (using the <tt>equals()</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     * test).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     *          the name of the context from which to get the parser
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     * @return  a name parser that can parse compound names into their atomic
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
     *          components
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     * @see #getNameParser(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     * @see CompoundName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
    public NameParser getNameParser(Name name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
     * Retrieves the parser associated with the named context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
     * See {@link #getNameParser(Name)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     *          the name of the context from which to get the parser
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     * @return  a name parser that can parse compound names into their atomic
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     *          components
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
    public NameParser getNameParser(String name) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     * Composes the name of this context with a name relative to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     * this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     * Given a name (<code>name</code>) relative to this context, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     * the name (<code>prefix</code>) of this context relative to one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     * of its ancestors, this method returns the composition of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     * two names using the syntax appropriate for the naming
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
     * system(s) involved.  That is, if <code>name</code> names an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     * object relative to this context, the result is the name of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     * same object, but relative to the ancestor context.  None of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     * names may be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     * For example, if this context is named "wiz.com" relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * to the initial context, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
     *  composeName("east", "wiz.com")  </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
     * might return <code>"east.wiz.com"</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     * If instead this context is named "org/research", then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
     *  composeName("user/jane", "org/research")        </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
     * might return <code>"org/research/user/jane"</code> while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
     *  composeName("user/jane", "research")    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     * returns <code>"research/user/jane"</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
     *          a name relative to this context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
     * @param prefix
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
     *          the name of this context relative to one of its ancestors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
     * @return  the composition of <code>prefix</code> and <code>name</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * @see #composeName(String, String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
    public Name composeName(Name name, Name prefix)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * Composes the name of this context with a name relative to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     * this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     * See {@link #composeName(Name, Name)} for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
     * @param name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
     *          a name relative to this context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
     * @param prefix
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
     *          the name of this context relative to one of its ancestors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
     * @return  the composition of <code>prefix</code> and <code>name</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
    public String composeName(String name, String prefix)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
            throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     * Adds a new environment property to the environment of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
     * context.  If the property already exists, its value is overwritten.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
     * See class description for more details on environment properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
     * @param propName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
     *          the name of the environment property to add; may not be null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
     * @param propVal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
     *          the value of the property to add; may not be null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
     * @return  the previous value of the property, or null if the property was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     *          not in the environment before
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     * @see #getEnvironment()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
    public Object addToEnvironment(String propName, Object propVal)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
     * Removes an environment property from the environment of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
     * context.  See class description for more details on environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     * properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * @param propName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     *          the name of the environment property to remove; may not be null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
     * @return  the previous value of the property, or null if the property was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     *          not in the environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     * @see #getEnvironment()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
    public Object removeFromEnvironment(String propName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     * Retrieves the environment in effect for this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     * See class description for more details on environment properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     * <p> The caller should not make any changes to the object returned:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
     * their effect on the context is undefined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
     * The environment of this context may be changed using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
     * <tt>addToEnvironment()</tt> and <tt>removeFromEnvironment()</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
     * @return  the environment of this context; never null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
    public Hashtable<?,?> getEnvironment() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * Closes this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     * This method releases this context's resources immediately, instead of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
     * waiting for them to be released automatically by the garbage collector.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
     * <p> This method is idempotent:  invoking it on a context that has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
     * already been closed has no effect.  Invoking any other method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
     * on a closed context is not allowed, and results in undefined behaviour.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
    public void close() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
     * Retrieves the full name of this context within its own namespace.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
     * <p> Many naming services have a notion of a "full name" for objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
     * in their respective namespaces.  For example, an LDAP entry has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     * a distinguished name, and a DNS record has a fully qualified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     * This method allows the client application to retrieve this name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
     * The string returned by this method is not a JNDI composite name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     * and should not be passed directly to context methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
     * In naming systems for which the notion of full name does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
     * make sense, <tt>OperationNotSupportedException</tt> is thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     * @return  this context's name in its own namespace; never null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
     * @throws  OperationNotSupportedException if the naming system does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
     *          not have the notion of a full name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
     * @throws  NamingException if a naming exception is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
    public String getNameInNamespace() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
// public static final:  JLS says recommended style is to omit these modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
// because they are the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * Constant that holds the name of the environment property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     * for specifying the initial context factory to use. The value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     * of the property should be the fully qualified class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
     * of the factory class that will create an initial context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
     * This property may be specified in the environment parameter
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   823
     * passed to the initial context constructor,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
     * a system property, or an application resource file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     * If it is not specified in any of these sources,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     * <tt>NoInitialContextException</tt> is thrown when an initial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     * context is required to complete an operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
     * <p> The value of this constant is "java.naming.factory.initial".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
     * @see InitialContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
     * @see javax.naming.directory.InitialDirContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
     * @see javax.naming.spi.NamingManager#getInitialContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * @see javax.naming.spi.InitialContextFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     * @see NoInitialContextException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
    String INITIAL_CONTEXT_FACTORY = "java.naming.factory.initial";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
     * Constant that holds the name of the environment property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     * for specifying the list of object factories to use. The value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     * of the property should be a colon-separated list of the fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     * qualified class names of factory classes that will create an object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     * given information about the object.
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   847
     * This property may be specified in the environment, a system property,
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   848
     * or one or more resource files.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
     * <p> The value of this constant is "java.naming.factory.object".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
     * @see javax.naming.spi.NamingManager#getObjectInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
     * @see javax.naming.spi.ObjectFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
    String OBJECT_FACTORIES = "java.naming.factory.object";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
     * Constant that holds the name of the environment property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
     * for specifying the list of state factories to use. The value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
     * of the property should be a colon-separated list of the fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
     * qualified class names of state factory classes that will be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
     * to get an object's state given the object itself.
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   865
     * This property may be specified in the environment, a system property,
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   866
     * or one or more resource files.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
     * <p> The value of this constant is "java.naming.factory.state".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
     * @see javax.naming.spi.NamingManager#getStateToBind
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
     * @see javax.naming.spi.StateFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
    String STATE_FACTORIES = "java.naming.factory.state";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
     * Constant that holds the name of the environment property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
     * for specifying the list of package prefixes to use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
     * loading in URL context factories. The value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
     * of the property should be a colon-separated list of package
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
     * prefixes for the class name of the factory class that will create
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
     * a URL context factory.
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   885
     * This property may be specified in the environment, a system property,
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   886
     * or one or more resource files.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
     * The prefix <tt>com.sun.jndi.url</tt> is always appended to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
     * the possibly empty list of package prefixes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
     * <p> The value of this constant is "java.naming.factory.url.pkgs".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
     * @see javax.naming.spi.NamingManager#getObjectInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
     * @see javax.naming.spi.NamingManager#getURLContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
     * @see javax.naming.spi.ObjectFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
     * @see #removeFromEnvironment(String)
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   897
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
    String URL_PKG_PREFIXES = "java.naming.factory.url.pkgs";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
     * Constant that holds the name of the environment property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
     * for specifying configuration information for the service provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
     * to use. The value of the property should contain a URL string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
     * (e.g. "ldap://somehost:389").
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   905
     * This property may be specified in the environment, a system property,
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   906
     * or a resource file.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
     * If it is not specified in any of these sources,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
     * the default configuration is determined by the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
     * <p> The value of this constant is "java.naming.provider.url".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
    String PROVIDER_URL = "java.naming.provider.url";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
     * Constant that holds the name of the environment property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
     * for specifying the DNS host and domain names to use for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
     * JNDI URL context (for example, "dns://somehost/wiz.com").
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   921
     * This property may be specified in the environment, a system property,
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
   922
     * or a resource file.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
     * If it is not specified in any of these sources
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
     * and the program attempts to use a JNDI URL containing a DNS name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
     * a <tt>ConfigurationException</tt> will be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
     * <p> The value of this constant is "java.naming.dns.url".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
    String DNS_URL = "java.naming.dns.url";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
     * Constant that holds the name of the environment property for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
     * specifying the authoritativeness of the service requested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
     * If the value of the property is the string "true", it means
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
     * that the access is to the most authoritative source (i.e. bypass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
     * any cache or replicas). If the value is anything else,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
     * the source need not be (but may be) authoritative.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
     * If unspecified, the value defaults to "false".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
     * <p> The value of this constant is "java.naming.authoritative".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
    String AUTHORITATIVE = "java.naming.authoritative";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
     * Constant that holds the name of the environment property for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
     * specifying the batch size to use when returning data via the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
     * service's protocol. This is a hint to the provider to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
     * the results of operations in batches of the specified size, so
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
     * the provider can optimize its performance and usage of resources.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
     * The value of the property is the string representation of an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
     * integer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
     * If unspecified, the batch size is determined by the service
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
     * provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
     * <p> The value of this constant is "java.naming.batchsize".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
    String BATCHSIZE = "java.naming.batchsize";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
     * Constant that holds the name of the environment property for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
     * specifying how referrals encountered by the service provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
     * are to be processed. The value of the property is one of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
     * following strings:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
     * <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
     * <dt>"follow"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
     * <dd>follow referrals automatically
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
     * <dt>"ignore"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
     * <dd>ignore referrals
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
     * <dt>"throw"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
     * <dd>throw <tt>ReferralException</tt> when a referral is encountered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
     * </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
     * If this property is not specified, the default is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
     * determined by the provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
     * <p> The value of this constant is "java.naming.referral".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
    String REFERRAL = "java.naming.referral";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
     * Constant that holds the name of the environment property for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
     * specifying the security protocol to use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
     * Its value is a string determined by the service provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
     * (e.g. "ssl").
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
     * If this property is unspecified,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
     * the behaviour is determined by the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
     * <p> The value of this constant is "java.naming.security.protocol".
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
    String SECURITY_PROTOCOL = "java.naming.security.protocol";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
     * Constant that holds the name of the environment property for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
     * specifying the security level to use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
     * Its value is one of the following strings:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
     * "none", "simple", "strong".
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
     * If this property is unspecified,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
     * the behaviour is determined by the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
     * <p> The value of this constant is "java.naming.security.authentication".
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
    String SECURITY_AUTHENTICATION = "java.naming.security.authentication";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
     * Constant that holds the name of the environment property for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
     * specifying the identity of the principal for authenticating
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
     * the caller to the service. The format of the principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
     * depends on the authentication scheme.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
     * If this property is unspecified,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
     * the behaviour is determined by the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
     * <p> The value of this constant is "java.naming.security.principal".
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
    String SECURITY_PRINCIPAL = "java.naming.security.principal";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
     * Constant that holds the name of the environment property for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
     * specifying the credentials of the principal for authenticating
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
     * the caller to the service. The value of the property depends
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
     * on the authentication scheme. For example, it could be a hashed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
     * password, clear-text password, key, certificate, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
     * If this property is unspecified,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
     * the behaviour is determined by the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
     * <p> The value of this constant is "java.naming.security.credentials".
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
    String SECURITY_CREDENTIALS = "java.naming.security.credentials";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
     * Constant that holds the name of the environment property for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
     * specifying the preferred language to use with the service.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
     * The value of the property is a colon-separated list of language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
     * tags as defined in RFC 1766.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
     * If this property is unspecified,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
     * the language preference is determined by the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
     * <p> The value of this constant is "java.naming.language".
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
     * @see #addToEnvironment(String, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
     * @see #removeFromEnvironment(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
    String LANGUAGE = "java.naming.language";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
    /**
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1068
     * @deprecated An environment property with this name is ignored
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1069
     *             while constructing an initial context.
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1070
     * This constant was originally used as a property name to specify an
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1071
     * {@code Applet} to retrieve parameters from, when creating an initial
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1072
     * context. Currently any applet properties that need to be passed to an
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1073
     * initial context should be copied into the environment hashtable:
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1074
     * <pre>{@code
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1075
     *     Hashtable env = new Hashtable();
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1076
     *     env.put(Context.INITIAL_CONTEXT_FACTORY,
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1077
     *       ((Applet) this).getParameter(Context.INITIAL_CONTEXT_FACTORY));
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1078
     *     env.put(Context.PROVIDER_URL,
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1079
     *       ((Applet) this).getParameter(Context.PROVIDER_URL));
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1080
     *     // ... other properties ...
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
     *
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1082
     *     Context ctx = new InitialContext(env);
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1083
     * }</pre>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
     */
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 21285
diff changeset
  1087
    @Deprecated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
    String APPLET = "java.naming.applet";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
};