src/java.naming/share/classes/javax/naming/ldap/LdapContext.java
author stefank
Mon, 25 Nov 2019 15:00:32 +0100
changeset 59255 a74627659f96
parent 54126 478f1483c511
permissions -rw-r--r--
8234602: ZGC: Windows compile error in ZHeuristic Reviewed-by: pliden, eosterlund
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
     2
 * Copyright (c) 1999, 2019, 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.ldap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.naming.NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.naming.directory.DirContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * This interface represents a context in which you can perform
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * operations with LDAPv3-style controls and perform LDAPv3-style
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * extended operations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * For applications that do not require such controls or extended
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    38
 * operations, the more generic {@code javax.naming.directory.DirContext}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * should be used instead.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
    41
 * <h2>Usage Details About Controls</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * This interface provides support for LDAP v3 controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * At a high level, this support allows a user
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * program to set request controls for LDAP operations that are executed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * in the course of the user program's invocation of
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    47
 * {@code Context}/{@code DirContext}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * methods, and read response controls resulting from LDAP operations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * At the implementation level, there are some details that developers of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * both the user program and service providers need to understand in order
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * to correctly use request and response controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
    53
 * <h2>Request Controls</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * There are two types of request controls:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * <li>Request controls that affect how a connection is created
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * <li>Request controls that affect context methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * The former is used whenever a connection needs to be established or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * re-established with an LDAP server. The latter is used when all other
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * LDAP operations are sent to the LDAP server.  The reason why a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * distinction between these two types of request controls is necessary
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * is because JNDI is a high-level API that does not deal directly with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * connections.  It is the job of service providers to do any necessary
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * connection management. Consequently, a single
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * connection may be shared by multiple context instances, and a service provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * is free to use its own algorithms to conserve connection and network
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * usage. Thus, when a method is invoked on the context instance, the service
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * provider might need to do some connection management in addition to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * performing the corresponding LDAP operations. For connection management,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * it uses the <em>connection request controls</em>, while for the normal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * LDAP operations, it uses the <em>context request controls</em>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *<p>Unless explicitly qualified, the term "request controls" refers to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * context request controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
    78
 * <h3>Context Request Controls</h3>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * There are two ways in which a context instance gets its request controls:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * <ol>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    81
 * <li><code>ldapContext.newInstance(<strong>reqCtls</strong>)</code>
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    82
 * <li><code>ldapContext.setRequestControls(<strong>reqCtls</strong>)</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * </ol>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    84
 * where {@code ldapContext} is an instance of {@code LdapContext}.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    85
 * Specifying {@code null} or an empty array for {@code reqCtls}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * means no request controls.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    87
 * {@code newInstance()} creates a new instance of a context using
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    88
 * {@code reqCtls}, while {@code setRequestControls()}
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    89
 * updates an existing context instance's request controls to {@code reqCtls}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * Unlike environment properties, request controls of a context instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * <em>are not inherited</em> by context instances that are derived from
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    93
 * it.  Derived context instances have {@code null} as their context
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * request controls.  You must set the request controls of a derived context
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    95
 * instance explicitly using {@code setRequestControls()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * A context instance's request controls are retrieved using
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    98
 * the method {@code getRequestControls()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
   100
 * <h3>Connection Request Controls</h3>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * There are three ways in which connection request controls are set:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * <ol>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   103
 * <li><code>
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   104
 * new InitialLdapContext(env, <strong>connCtls</strong>)</code>
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   105
 * <li><code>refException.getReferralContext(env, <strong>connCtls</strong>)</code>
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   106
 * <li><code>ldapContext.reconnect(<strong>connCtls</strong>);</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * </ol>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   108
 * where {@code refException} is an instance of
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   109
 * {@code LdapReferralException}, and {@code ldapContext} is an
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   110
 * instance of {@code LdapContext}.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   111
 * Specifying {@code null} or an empty array for {@code connCtls}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * means no connection request controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * Like environment properties, connection request controls of a context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * <em>are inherited</em> by contexts that are derived from it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * Typically, you initialize the connection request controls using the
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   117
 * {@code InitialLdapContext} constructor or
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   118
 * {@code LdapReferralContext.getReferralContext()}. These connection
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 * request controls are inherited by contexts that share the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 * connection--that is, contexts derived from the initial or referral
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 * contexts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * <p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   123
 * Use {@code reconnect()} to change the connection request controls of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * a context.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   125
 * Invoking {@code ldapContext.reconnect()} affects only the
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   126
 * connection used by {@code ldapContext} and any new contexts instances that are
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   127
 * derived form {@code ldapContext}. Contexts that previously shared the
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   128
 * connection with {@code ldapContext} remain unchanged. That is, a context's
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 * connection request controls must be explicitly changed and is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 * affected by changes to another context's connection request
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * A context instance's connection request controls are retrieved using
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   134
 * the method {@code getConnectControls()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
   136
 * <h3>Service Provider Requirements</h3>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 * A service provider supports connection and context request controls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 * in the following ways.  Context request controls must be associated on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * a per context instance basis while connection request controls must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * associated on a per connection instance basis.  The service provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * must look for the connection request controls in the environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * property "java.naming.ldap.control.connect" and pass this environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * property on to context instances that it creates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
   146
 * <h2>Response Controls</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 *
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   148
 * The method {@code LdapContext.getResponseControls()} is used to
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 * retrieve the response controls generated by LDAP operations executed
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   150
 * as the result of invoking a {@code Context}/{@code DirContext}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 * operation. The result is all of the responses controls generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 * by the underlying LDAP operations, including any implicit reconnection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 * To get only the reconnection response controls,
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   154
 * use {@code reconnect()} followed by {@code getResponseControls()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
   156
 * <h2>Parameters</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 *
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   158
 * A {@code Control[]} array
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 * passed as a parameter to any method is owned by the caller.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 * The service provider will not modify the array or keep a reference to it,
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   161
 * although it may keep references to the individual {@code Control} objects
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 * in the array.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   163
 * A {@code Control[]} array returned by any method is immutable, and may
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 * not subsequently be modified by either the caller or the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 * @author Scott Seligman
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 * @author Vincent Ryan
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * @see InitialLdapContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 * @see LdapReferralException#getReferralContext(java.util.Hashtable,javax.naming.ldap.Control[])
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
public interface LdapContext extends DirContext {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    * Performs an extended operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    * This method is used to support LDAPv3 extended operations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    * @param request The non-null request to be performed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    * @return The possibly null response of the operation. null means
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    * the operation did not generate any response.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    * @throws NamingException If an error occurred while performing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    * extended operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    public ExtendedResponse extendedOperation(ExtendedRequest request)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * Creates a new instance of this context initialized using request controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * This method is a convenience method for creating a new instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * of this context for the purposes of multithreaded access.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * For example, if multiple threads want to use different context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * request controls,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * each thread may use this method to get its own copy of this context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * and set/get context request controls without having to synchronize with other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * threads.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * The new context has the same environment properties and connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * request controls as this context. See the class description for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * Implementations might also allow this context and the new context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * to share the same network connection or other resources if doing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * so does not impede the independence of either context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * @param requestControls The possibly null request controls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * to use for the new context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * If null, the context is initialized with no request controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     *
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   210
     * @return A non-null {@code LdapContext} instance.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * @exception NamingException If an error occurred while creating
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * the new instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @see InitialLdapContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    public LdapContext newInstance(Control[] requestControls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * Reconnects to the LDAP server using the supplied controls and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * this context's environment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * This method is a way to explicitly initiate an LDAP "bind" operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * For example, you can use this method to set request controls for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * the LDAP "bind" operation, or to explicitly connect to the server
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * to get response controls returned by the LDAP "bind" operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   227
     * This method sets this context's {@code connCtls}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * to be its new connection request controls. This context's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * context request controls are not affected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * After this method has been invoked, any subsequent
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   231
     * implicit reconnections will be done using {@code connCtls}.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   232
     * {@code connCtls} are also used as
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * connection request controls for new context instances derived from this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * These connection request controls are not
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   236
     * affected by {@code setRequestControls()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * Service provider implementors should read the "Service Provider" section
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * in the class description for implementation details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * @param connCtls The possibly null controls to use. If null, no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * controls are used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @exception NamingException If an error occurred while reconnecting.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @see #getConnectControls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @see #newInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    public void reconnect(Control[] connCtls) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * Retrieves the connection request controls in effect for this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * The controls are owned by the JNDI implementation and are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * immutable. Neither the array nor the controls may be modified by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * caller.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * @return A possibly-null array of controls. null means no connect controls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * have been set for this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * @exception NamingException If an error occurred while getting the request
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    public Control[] getConnectControls() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * Sets the request controls for methods subsequently
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * invoked on this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * The request controls are owned by the JNDI implementation and are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * immutable. Neither the array nor the controls may be modified by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * caller.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * This removes any previous request controls and adds
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   269
     * {@code requestControls}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * for use by subsequent methods invoked on this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * This method does not affect this context's connection request controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   273
     * Note that {@code requestControls} will be in effect until the next
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   274
     * invocation of {@code setRequestControls()}. You need to explicitly
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   275
     * invoke {@code setRequestControls()} with {@code null} or an empty
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * array to clear the controls if you don't want them to affect the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * context methods any more.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * To check what request controls are in effect for this context, use
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   279
     * {@code getRequestControls()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * @param requestControls The possibly null controls to use. If null, no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * controls are used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * @exception NamingException If an error occurred while setting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * request controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * @see #getRequestControls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    public void setRequestControls(Control[] requestControls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * Retrieves the request controls in effect for this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * The request controls are owned by the JNDI implementation and are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * immutable. Neither the array nor the controls may be modified by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * caller.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @return A possibly-null array of controls. null means no request controls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * have been set for this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * @exception NamingException If an error occurred while getting the request
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * @see #setRequestControls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    public Control[] getRequestControls() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * Retrieves the response controls produced as a result of the last
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * method invoked on this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * The response controls are owned by the JNDI implementation and are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * immutable. Neither the array nor the controls may be modified by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * caller.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * These response controls might have been generated by a successful or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * failed operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * When a context method that may return response controls is invoked,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * response controls from the previous method invocation are cleared.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   315
     * {@code getResponseControls()} returns all of the response controls
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * generated by LDAP operations used by the context method in the order
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * received from the LDAP server.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   318
     * Invoking {@code getResponseControls()} does not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * clear the response controls. You can call it many times (and get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * back the same controls) until the next context method that may return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * controls is invoked.
23712
d46a902c1aed 8039041: Tidy warnings cleanup for javax.naming
yan
parents: 21285
diff changeset
   322
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * @return A possibly null array of controls. If null, the previous
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * method invoked on this context did not produce any controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * @exception NamingException If an error occurred while getting the response
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    public Control[] getResponseControls() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * Constant that holds the name of the environment property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * for specifying the list of control factories to use. The value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * of the property should be a colon-separated list of the fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * qualified class names of factory classes that will create a control
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * given another control. See
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   336
     * {@code ControlFactory.getControlInstance()} for details.
25752
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 23712
diff changeset
   337
     * This property may be specified in the environment, a system property,
8df7ddac1cb3 8051422: Remove JNDI dependency on java.applet.Applet
prappo
parents: 23712
diff changeset
   338
     * or one or more resource files.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * The value of this constant is "java.naming.factory.control".
21285
e740104a04f1 8026840: Fix new doclint issues in javax.naming
darcy
parents: 18580
diff changeset
   341
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * @see ControlFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * @see javax.naming.Context#addToEnvironment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * @see javax.naming.Context#removeFromEnvironment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    static final String CONTROL_FACTORIES = "java.naming.factory.control";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
}