Source Code Cross Referenced for ReferralException.java in  » 6.0-JDK-Core » naming » javax » naming » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » naming » javax.naming 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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;
027
028        import java.util.Hashtable;
029
030        /**
031         * This abstract class is used to represent a referral exception,
032         * which is generated in response to a <em>referral</em>
033         * such as that returned by LDAP v3 servers.
034         * <p>
035         * A service provider provides
036         * a subclass of <tt>ReferralException</tt> by providing implementations
037         * for <tt>getReferralInfo()</tt> and <tt>getReferralContext()</tt> (and appropriate
038         * constructors and/or corresponding "set" methods).
039         * <p>
040         * The following code sample shows how <tt>ReferralException</tt> can be used.
041         * <p><blockquote><pre>
042         *	while (true) {
043         *	    try {
044         *		bindings = ctx.listBindings(name);
045         *		while (bindings.hasMore()) {
046         *		    b = bindings.next();
047         *		    ...
048         *		}
049         *		break;
050         *	    } catch (ReferralException e) {
051         *		ctx = e.getReferralContext();
052         *	    }
053         *	}
054         * </pre></blockquote></p>
055         *<p>
056         * <tt>ReferralException</tt> is an abstract class. Concrete implementations
057         * determine its synchronization and serialization properties.
058         *<p>
059         * An environment parameter passed to the <tt>getReferralContext()</tt>
060         * method is owned by the caller.
061         * The service provider will not modify the object or keep a reference to it,
062         * but may keep a reference to a clone of it.
063         * 
064         * @author Rosanna Lee
065         * @author Scott Seligman
066         * @version 1.18 07/05/05
067         *
068         * @since 1.3
069         *
070         */
071
072        public abstract class ReferralException extends NamingException {
073            /**
074             * Constructs a new instance of ReferralException using the
075             * explanation supplied. All other fields are set to null.
076             *
077             * @param	explanation	Additional detail about this exception. Can be null.
078             * @see java.lang.Throwable#getMessage
079             */
080            protected ReferralException(String explanation) {
081                super (explanation);
082            }
083
084            /**
085             * Constructs a new instance of ReferralException.
086             * All fields are set to null.
087             */
088            protected ReferralException() {
089                super ();
090            }
091
092            /**
093             * Retrieves information (such as URLs) related to this referral.
094             * The program may examine or display this information
095             * to the user to determine whether to continue with the referral,
096             * or to determine additional information needs to be supplied in order
097             * to continue with the referral.
098             *
099             * @return Non-null referral information related to this referral.
100             */
101            public abstract Object getReferralInfo();
102
103            /**
104             * Retrieves the context at which to continue the method.
105             * Regardless of whether a referral is encountered directly during a 
106             * context operation, or indirectly, for example, during a search
107             * enumeration, the referral exception should provide a context
108             * at which to continue the operation. The referral context is
109             * created using the environment properties of the context
110             * that threw the ReferralException.
111             *
112             *<p>
113             * To continue the operation, the client program should re-invoke
114             * the method using the same arguments as the original invocation.
115             * 
116             * @return The non-null context at which to continue the method.
117             * @exception NamingException If a naming exception was encountered.
118             * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
119             * to continue processing referrals.
120             */
121            public abstract Context getReferralContext() throws NamingException;
122
123            /**
124             * Retrieves the context at which to continue the method using 
125             * environment properties.
126             * Regardless of whether a referral is encountered directly during a 
127             * context operation, or indirectly, for example, during a search
128             * enumeration, the referral exception should provide a context
129             * at which to continue the operation.
130             *<p>
131             * The referral context is created using <tt>env</tt> as its environment
132             * properties.
133             * This method should be used instead of the no-arg overloaded form
134             * when the caller needs to use different environment properties for
135             * the referral context. It might need to do this, for example, when
136             * it needs to supply different authentication information to the referred
137             * server in order to create the referral context.
138             *<p>
139             * To continue the operation, the client program should re-invoke
140             * the method using the same arguments as the original invocation.
141             * 
142             * @param env The possibly null environment to use when retrieving the 
143             * 		referral context. If null, no environment properties will be used.
144             *
145             * @return The non-null context at which to continue the method.
146             * @exception NamingException If a naming exception was encountered.
147             * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
148             * to continue processing referrals.
149             */
150            public abstract Context getReferralContext(Hashtable<?, ?> env)
151                    throws NamingException;
152
153            /**
154             * Discards the referral about to be processed.
155             * A call to this method should be followed by a call to
156             * <code>getReferralContext</code> to allow the processing of
157             * other referrals to continue.
158             * The following code fragment shows a typical usage pattern.
159             * <p><blockquote><pre>
160             *	} catch (ReferralException e) {
161             *	    if (!shallIFollow(e.getReferralInfo())) {
162             *		if (!e.skipReferral()) {
163             *		    return;
164             *		}
165             *	    }
166             *	    ctx = e.getReferralContext();
167             *	}
168             * </pre></blockquote>
169             *
170             * @return true If more referral processing is pending; false otherwise.
171             */
172            public abstract boolean skipReferral();
173
174            /**
175             * Retries the referral currently being processed.
176             * A call to this method should be followed by a call to
177             * <code>getReferralContext</code> to allow the current
178             * referral to be retried.
179             * The following code fragment shows a typical usage pattern.
180             * <p><blockquote><pre>
181             *	} catch (ReferralException e) {
182             *	    while (true) {
183             *		try {
184             *		    ctx = e.getReferralContext(env);
185             *		    break;
186             *		} catch (NamingException ne) {
187             *		    if (! shallIRetry()) {
188             *			return;
189             *		    }
190             *		    // modify environment properties (env), if necessary
191             *		    e.retryReferral();
192             *		}
193             *	    }
194             *	}
195             * </pre></blockquote>
196             *
197             */
198            public abstract void retryReferral();
199
200            /**
201             * Use serialVersionUID from JNDI 1.1.1 for interoperability
202             */
203            private static final long serialVersionUID = -2881363844695698876L;
204        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.