src/java.naming/share/classes/javax/naming/ldap/LdapReferralException.java
author stefank
Mon, 25 Nov 2019 15:00:32 +0100
changeset 59255 a74627659f96
parent 47216 71c04702a3d5
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
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1999, 2004, 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.ReferralException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.naming.Context;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.naming.NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * This abstract class is used to represent an LDAP referral exception.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    35
 * It extends the base {@code ReferralException} by providing a
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    36
 * {@code getReferralContext()} method that accepts request controls.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * LdapReferralException is an abstract class. Concrete implementations of it
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * determine its synchronization and serialization properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    40
 * A {@code Control[]} array passed as a parameter to
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    41
 * the {@code getReferralContext()} method is owned by the caller.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * 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
    43
 * although it may keep references to the individual {@code Control} objects
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * in the array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @author Scott Seligman
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * @author Vincent Ryan
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
public abstract class LdapReferralException extends ReferralException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * Constructs a new instance of LdapReferralException using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * explanation supplied. All other fields are set to null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * @param   explanation     Additional detail about this exception. Can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * @see java.lang.Throwable#getMessage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    protected LdapReferralException(String explanation) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        super(explanation);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
      * Constructs a new instance of LdapReferralException.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
      * All fields are set to null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    protected LdapReferralException() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * Retrieves the context at which to continue the method using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * context's environment and no controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * The referral context is created using the environment properties of
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    76
     * the context that threw the {@code ReferralException} and no controls.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * This method is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     *<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * getReferralContext(ctx.getEnvironment(), null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     *</pre></blockquote>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    82
     * where {@code ctx} is the context that threw the {@code ReferralException.}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * It is overridden in this class for documentation purposes only.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    85
     * See {@code ReferralException} for how to use this method.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * @return The non-null context at which to continue the method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * @exception NamingException If a naming exception was encountered.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    89
     * Call either {@code retryReferral()} or {@code skipReferral()}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * to continue processing referrals.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public abstract Context getReferralContext() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * Retrieves the context at which to continue the method using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * environment properties and no controls.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    97
     * The referral context is created using {@code env} as its environment
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * properties and no controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * This method is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * getReferralContext(env, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *</pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * It is overridden in this class for documentation purposes only.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   106
     * See {@code ReferralException} for how to use this method.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @param env The possibly null environment to use when retrieving the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     *          referral context. If null, no environment properties will be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @return The non-null context at which to continue the method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @exception NamingException If a naming exception was encountered.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   113
     * Call either {@code retryReferral()} or {@code skipReferral()}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * to continue processing referrals.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    public abstract Context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        getReferralContext(Hashtable<?,?> env)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * Retrieves the context at which to continue the method using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * request controls and environment properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * Regardless of whether a referral is encountered directly during a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * context operation, or indirectly, for example, during a search
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * enumeration, the referral exception should provide a context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * at which to continue the operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * To continue the operation, the client program should re-invoke
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * the method using the same arguments as the original invocation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   130
     * {@code reqCtls} is used when creating the connection to the referred
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * server. These controls will be used as the connection request controls for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * the context and context instances
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * derived from the context.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   134
     * {@code reqCtls} will also be the context's request controls for
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   135
     * subsequent context operations. See the {@code LdapContext} class
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * description for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * This method should be used instead of the other two overloaded forms
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * when the caller needs to supply request controls for creating
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * the referral context. It might need to do this, for example, when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * it needs to supply special controls relating to authentication.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * Service provider implementors should read the "Service Provider" section
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   144
     * in the {@code LdapContext} class description for implementation details.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * @param reqCtls The possibly null request controls to use for the new context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * If null or the empty array means use no request controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * @param env The possibly null environment properties to use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * for the new context. If null, the context is initialized with no environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @return The non-null context at which to continue the method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * @exception NamingException If a naming exception was encountered.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   153
     * Call either {@code retryReferral()} or {@code skipReferral()}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * to continue processing referrals.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    public abstract Context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        getReferralContext(Hashtable<?,?> env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                           Control[] reqCtls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    private static final long serialVersionUID = -1668992791764950804L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
}