Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/naming/ldap/LdapReferralException.java
38918 views
/*1* Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.naming.ldap;2627import javax.naming.ReferralException;28import javax.naming.Context;29import javax.naming.NamingException;30import java.util.Hashtable;3132/**33* This abstract class is used to represent an LDAP referral exception.34* It extends the base <tt>ReferralException</tt> by providing a35* <tt>getReferralContext()</tt> method that accepts request controls.36* LdapReferralException is an abstract class. Concrete implementations of it37* determine its synchronization and serialization properties.38*<p>39* A <tt>Control[]</tt> array passed as a parameter to40* the <tt>getReferralContext()</tt> method is owned by the caller.41* The service provider will not modify the array or keep a reference to it,42* although it may keep references to the individual <tt>Control</tt> objects43* in the array.44*45* @author Rosanna Lee46* @author Scott Seligman47* @author Vincent Ryan48* @since 1.349*/5051public abstract class LdapReferralException extends ReferralException {52/**53* Constructs a new instance of LdapReferralException using the54* explanation supplied. All other fields are set to null.55*56* @param explanation Additional detail about this exception. Can be null.57* @see java.lang.Throwable#getMessage58*/59protected LdapReferralException(String explanation) {60super(explanation);61}6263/**64* Constructs a new instance of LdapReferralException.65* All fields are set to null.66*/67protected LdapReferralException() {68super();69}7071/**72* Retrieves the context at which to continue the method using the73* context's environment and no controls.74* The referral context is created using the environment properties of75* the context that threw the <tt>ReferralException</tt> and no controls.76*<p>77* This method is equivalent to78*<blockquote><pre>79* getReferralContext(ctx.getEnvironment(), null);80*</pre></blockquote>81* where <tt>ctx</tt> is the context that threw the <tt>ReferralException.</tt>82*<p>83* It is overridden in this class for documentation purposes only.84* See <tt>ReferralException</tt> for how to use this method.85*86* @return The non-null context at which to continue the method.87* @exception NamingException If a naming exception was encountered.88* Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>89* to continue processing referrals.90*/91public abstract Context getReferralContext() throws NamingException;9293/**94* Retrieves the context at which to continue the method using95* environment properties and no controls.96* The referral context is created using <tt>env</tt> as its environment97* properties and no controls.98*<p>99* This method is equivalent to100*<blockquote><pre>101* getReferralContext(env, null);102*</pre></blockquote>103*<p>104* It is overridden in this class for documentation purposes only.105* See <tt>ReferralException</tt> for how to use this method.106*107* @param env The possibly null environment to use when retrieving the108* referral context. If null, no environment properties will be used.109*110* @return The non-null context at which to continue the method.111* @exception NamingException If a naming exception was encountered.112* Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>113* to continue processing referrals.114*/115public abstract Context116getReferralContext(Hashtable<?,?> env)117throws NamingException;118119/**120* Retrieves the context at which to continue the method using121* request controls and environment properties.122* Regardless of whether a referral is encountered directly during a123* context operation, or indirectly, for example, during a search124* enumeration, the referral exception should provide a context125* at which to continue the operation.126* To continue the operation, the client program should re-invoke127* the method using the same arguments as the original invocation.128*<p>129* <tt>reqCtls</tt> is used when creating the connection to the referred130* server. These controls will be used as the connection request controls for131* the context and context instances132* derived from the context.133* <tt>reqCtls</tt> will also be the context's request controls for134* subsequent context operations. See the <tt>LdapContext</tt> class135* description for details.136*<p>137* This method should be used instead of the other two overloaded forms138* when the caller needs to supply request controls for creating139* the referral context. It might need to do this, for example, when140* it needs to supply special controls relating to authentication.141*<p>142* Service provider implementors should read the "Service Provider" section143* in the <tt>LdapContext</tt> class description for implementation details.144*145* @param reqCtls The possibly null request controls to use for the new context.146* If null or the empty array means use no request controls.147* @param env The possibly null environment properties to use when148* for the new context. If null, the context is initialized with no environment149* properties.150* @return The non-null context at which to continue the method.151* @exception NamingException If a naming exception was encountered.152* Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>153* to continue processing referrals.154*/155public abstract Context156getReferralContext(Hashtable<?,?> env,157Control[] reqCtls)158throws NamingException;159160private static final long serialVersionUID = -1668992791764950804L;161}162163164