001 /*
002 * Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package javax.naming.ldap;
027
028 import javax.naming.ReferralException;
029 import javax.naming.Context;
030 import javax.naming.NamingException;
031 import java.util.Hashtable;
032
033 /**
034 * This abstract class is used to represent an LDAP referral exception.
035 * It extends the base <tt>ReferralException</tt> by providing a
036 * <tt>getReferralContext()</tt> method that accepts request controls.
037 * LdapReferralException is an abstract class. Concrete implementations of it
038 * determine its synchronization and serialization properties.
039 *<p>
040 * A <tt>Control[]</tt> array passed as a parameter to
041 * the <tt>getReferralContext()</tt> method is owned by the caller.
042 * The service provider will not modify the array or keep a reference to it,
043 * although it may keep references to the individual <tt>Control</tt> objects
044 * in the array.
045 *
046 * @author Rosanna Lee
047 * @author Scott Seligman
048 * @author Vincent Ryan
049 * @version 1.19 07/05/05
050 * @since 1.3
051 */
052
053 public abstract class LdapReferralException extends ReferralException {
054 /**
055 * Constructs a new instance of LdapReferralException using the
056 * explanation supplied. All other fields are set to null.
057 *
058 * @param explanation Additional detail about this exception. Can be null.
059 * @see java.lang.Throwable#getMessage
060 */
061 protected LdapReferralException(String explanation) {
062 super (explanation);
063 }
064
065 /**
066 * Constructs a new instance of LdapReferralException.
067 * All fields are set to null.
068 */
069 protected LdapReferralException() {
070 super ();
071 }
072
073 /**
074 * Retrieves the context at which to continue the method using the
075 * context's environment and no controls.
076 * The referral context is created using the environment properties of
077 * the context that threw the <tt>ReferralException</tt> and no controls.
078 *<p>
079 * This method is equivalent to
080 *<blockquote><pre>
081 * getReferralContext(ctx.getEnvironment(), null);
082 *</pre></blockquote>
083 * where <tt>ctx</tt> is the context that threw the <tt>ReferralException.</tt>
084 *<p>
085 * It is overridden in this class for documentation purposes only.
086 * See <tt>ReferralException</tt> for how to use this method.
087 *
088 * @return The non-null context at which to continue the method.
089 * @exception NamingException If a naming exception was encountered.
090 * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
091 * to continue processing referrals.
092 */
093 public abstract Context getReferralContext() throws NamingException;
094
095 /**
096 * Retrieves the context at which to continue the method using
097 * environment properties and no controls.
098 * The referral context is created using <tt>env</tt> as its environment
099 * properties and no controls.
100 *<p>
101 * This method is equivalent to
102 *<blockquote><pre>
103 * getReferralContext(env, null);
104 *</pre></blockquote>
105 *<p>
106 * It is overridden in this class for documentation purposes only.
107 * See <tt>ReferralException</tt> for how to use this method.
108 *
109 * @param env The possibly null environment to use when retrieving the
110 * referral context. If null, no environment properties will be used.
111 *
112 * @return The non-null context at which to continue the method.
113 * @exception NamingException If a naming exception was encountered.
114 * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
115 * to continue processing referrals.
116 */
117 public abstract Context getReferralContext(Hashtable<?, ?> env)
118 throws NamingException;
119
120 /**
121 * Retrieves the context at which to continue the method using
122 * request controls and environment properties.
123 * Regardless of whether a referral is encountered directly during a
124 * context operation, or indirectly, for example, during a search
125 * enumeration, the referral exception should provide a context
126 * at which to continue the operation.
127 * To continue the operation, the client program should re-invoke
128 * the method using the same arguments as the original invocation.
129 *<p>
130 * <tt>reqCtls</tt> is used when creating the connection to the referred
131 * server. These controls will be used as the connection request controls for
132 * the context and context instances
133 * derived from the context.
134 * <tt>reqCtls</tt> will also be the context's request controls for
135 * subsequent context operations. See the <tt>LdapContext</tt> class
136 * description for details.
137 *<p>
138 * This method should be used instead of the other two overloaded forms
139 * when the caller needs to supply request controls for creating
140 * the referral context. It might need to do this, for example, when
141 * it needs to supply special controls relating to authentication.
142 *<p>
143 * Service provider implementors should read the "Service Provider" section
144 * in the <tt>LdapContext</tt> class description for implementation details.
145 *
146 * @param reqCtls The possibly null request controls to use for the new context.
147 * If null or the empty array means use no request controls.
148 * @param env The possibly null environment properties to use when
149 * for the new context. If null, the context is initialized with no environment
150 * properties.
151 * @return The non-null context at which to continue the method.
152 * @exception NamingException If a naming exception was encountered.
153 * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
154 * to continue processing referrals.
155 */
156 public abstract Context getReferralContext(Hashtable<?, ?> env,
157 Control[] reqCtls) throws NamingException;
158
159 private static final long serialVersionUID = -1668992791764950804L;
160 }
|