API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.naming. ReferralException View Javadoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187

/*
 * @(#)ReferralException.java	1.12 05/11/17
 *
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package javax.naming;

import java.util.Hashtable;

/**
 * This abstract class is used to represent a referral exception,
 * which is generated in response to a <em>referral</em>
 * such as that returned by LDAP v3 servers.
 * <p>
 * A service provider provides
 * a subclass of <tt>ReferralException</tt> by providing implementations
 * for <tt>getReferralInfo()</tt> and <tt>getReferralContext()</tt> (and appropriate
 * constructors and/or corresponding "set" methods).
 * <p>
 * The following code sample shows how <tt>ReferralException</tt> can be used.
 * <p><blockquote><pre>
 *	while (true) {
 *	    try {
 *		bindings = ctx.listBindings(name);
 *		while (bindings.hasMore()) {
 *		    b = bindings.next();
 *		    ...
 *		}
 *		break;
 *	    } catch (ReferralException e) {
 *		ctx = e.getReferralContext();
 *	    }
 *	}
 * </pre></blockquote></p>
 *<p>
 * <tt>ReferralException</tt> is an abstract class. Concrete implementations
 * determine its synchronization and serialization properties.
 *<p>
 * An environment parameter passed to the <tt>getReferralContext()</tt>
 * method is owned by the caller.
 * The service provider will not modify the object or keep a reference to it,
 * but may keep a reference to a clone of it.
 * 
 * @author Rosanna Lee
 * @author Scott Seligman
 * @version 1.12 05/11/17
 *
 * @since 1.3
 *
 */

public abstract class ReferralException extends NamingException {
    /**
     * Constructs a new instance of ReferralException using the
     * explanation supplied. All other fields are set to null.
     *
     * @param	explanation	Additional detail about this exception. Can be null.
     * @see java.lang.Throwable#getMessage
     */
    protected ReferralException(String explanation) {
	super(explanation);
    }

    /**
      * Constructs a new instance of ReferralException.
      * All fields are set to null.
      */
    protected ReferralException() {
	super();
    }

    /**
     * Retrieves information (such as URLs) related to this referral.
     * The program may examine or display this information
     * to the user to determine whether to continue with the referral,
     * or to determine additional information needs to be supplied in order
     * to continue with the referral.
     *
     * @return Non-null referral information related to this referral.
     */
    public abstract Object getReferralInfo();

    /**
     * Retrieves the context at which to continue the method.
     * Regardless of whether a referral is encountered directly during a 
     * context operation, or indirectly, for example, during a search
     * enumeration, the referral exception should provide a context
     * at which to continue the operation. The referral context is
     * created using the environment properties of the context
     * that threw the ReferralException.
     *
     *<p>
     * To continue the operation, the client program should re-invoke
     * the method using the same arguments as the original invocation.
     * 
     * @return The non-null context at which to continue the method.
     * @exception NamingException If a naming exception was encountered.
     * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
     * to continue processing referrals.
     */
    public abstract Context getReferralContext() throws NamingException;

    /**
     * Retrieves the context at which to continue the method using 
     * environment properties.
     * Regardless of whether a referral is encountered directly during a 
     * context operation, or indirectly, for example, during a search
     * enumeration, the referral exception should provide a context
     * at which to continue the operation.
     *<p>
     * The referral context is created using <tt>env</tt> as its environment
     * properties.
     * This method should be used instead of the no-arg overloaded form
     * when the caller needs to use different environment properties for
     * the referral context. It might need to do this, for example, when
     * it needs to supply different authentication information to the referred
     * server in order to create the referral context.
     *<p>
     * To continue the operation, the client program should re-invoke
     * the method using the same arguments as the original invocation.
     * 
     * @param env The possibly null environment to use when retrieving the 
     * 		referral context. If null, no environment properties will be used.
     *
     * @return The non-null context at which to continue the method.
     * @exception NamingException If a naming exception was encountered.
     * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
     * to continue processing referrals.
     */
    public abstract Context
	getReferralContext(Hashtable<?,?> env)
	throws NamingException;

    /**
     * Discards the referral about to be processed.
     * A call to this method should be followed by a call to
     * <code>getReferralContext</code> to allow the processing of
     * other referrals to continue.
     * The following code fragment shows a typical usage pattern.
     * <p><blockquote><pre>
     *	} catch (ReferralException e) {
     *	    if (!shallIFollow(e.getReferralInfo())) {
     *		if (!e.skipReferral()) {
     *		    return;
     *		}
     *	    }
     *	    ctx = e.getReferralContext();
     *	}
     * </pre></blockquote>
     *
     * @return true If more referral processing is pending; false otherwise.
     */
    public abstract boolean skipReferral();

    /**
     * Retries the referral currently being processed.
     * A call to this method should be followed by a call to
     * <code>getReferralContext</code> to allow the current
     * referral to be retried.
     * The following code fragment shows a typical usage pattern.
     * <p><blockquote><pre>
     *	} catch (ReferralException e) {
     *	    while (true) {
     *		try {
     *		    ctx = e.getReferralContext(env);
     *		    break;
     *		} catch (NamingException ne) {
     *		    if (! shallIRetry()) {
     *			return;
     *		    }
     *		    // modify environment properties (env), if necessary
     *		    e.retryReferral();
     *		}
     *	    }
     *	}
     * </pre></blockquote>
     *
     */
    public abstract void retryReferral();

    /**
     * Use serialVersionUID from JNDI 1.1.1 for interoperability
     */
    private static final long serialVersionUID = -2881363844695698876L;
}

Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar