1. /*
  2. * @(#)LdapReferralException.java 1.8 01/02/09
  3. *
  4. * Copyright 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.naming.ldap;
  11. import javax.naming.ReferralException;
  12. import javax.naming.Context;
  13. import javax.naming.NamingException;
  14. import java.util.Hashtable;
  15. /**
  16. * This abstract class is used to represent an LDAP referral exception.
  17. * It extends the base <tt>ReferralException</tt> by providing a
  18. * <tt>getReferralContext()</tt> method that accepts request controls.
  19. * LdapReferralException is an abstract class. Concrete implementations of it
  20. * determine its synchronization and serialization properties.
  21. *<p>
  22. * A <tt>Control[]</tt> array passed as a parameter to
  23. * the <tt>getReferralContext()</tt> method is owned by the caller.
  24. * The service provider will not modify the array or keep a reference to it,
  25. * although it may keep references to the individual <tt>Control</tt> objects
  26. * in the array.
  27. *
  28. * @author Rosanna Lee
  29. * @author Scott Seligman
  30. * @author Vincent Ryan
  31. * @version 1.8 01/02/09
  32. * @since 1.3
  33. */
  34. public abstract class LdapReferralException extends ReferralException {
  35. /**
  36. * Constructs a new instance of LdapReferralException using the
  37. * explanation supplied. All other fields are set to null.
  38. *
  39. * @param explanation Additional detail about this exception. Can be null.
  40. * @see java.lang.Throwable#getMessage
  41. */
  42. protected LdapReferralException(String explanation) {
  43. super(explanation);
  44. }
  45. /**
  46. * Constructs a new instance of LdapReferralException.
  47. * All fields are set to null.
  48. */
  49. protected LdapReferralException() {
  50. super();
  51. }
  52. /**
  53. * Retrieves the context at which to continue the method using the
  54. * context's environment and no controls.
  55. * The referral context is created using the environment properties of
  56. * the context that threw the <tt>ReferralException</tt> and no controls.
  57. *<p>
  58. * This method is equivalent to
  59. *<blockquote><pre>
  60. * getReferralContext(ctx.getEnvironment(), null);
  61. *</pre></blockquote>
  62. * where <tt>ctx</tt> is the context that threw the <tt>ReferralException.</tt>
  63. *<p>
  64. * It is overridden in this class for documentation purposes only.
  65. * See <tt>ReferralException</tt> for how to use this method.
  66. *
  67. * @return The non-null context at which to continue the method.
  68. * @exception NamingException If a naming exception was encountered.
  69. * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
  70. * to continue processing referrals.
  71. */
  72. public abstract Context getReferralContext() throws NamingException;
  73. /**
  74. * Retrieves the context at which to continue the method using
  75. * environment properties and no controls.
  76. * The referral context is created using <tt>env</tt> as its environment
  77. * properties and no controls.
  78. *<p>
  79. * This method is equivalent to
  80. *<blockquote><pre>
  81. * getReferralContext(env, null);
  82. *</pre></blockquote>
  83. *<p>
  84. * It is overridden in this class for documentation purposes only.
  85. * See <tt>ReferralException</tt> for how to use this method.
  86. *
  87. * @param env The possibly null environment to use when retrieving the
  88. * referral context. If null, no environment properties will be used.
  89. *
  90. * @return The non-null context at which to continue the method.
  91. * @exception NamingException If a naming exception was encountered.
  92. * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
  93. * to continue processing referrals.
  94. */
  95. public abstract Context getReferralContext(Hashtable env) throws NamingException;
  96. /**
  97. * Retrieves the context at which to continue the method using
  98. * request controls and environment properties.
  99. * Regardless of whether a referral is encountered directly during a
  100. * context operation, or indirectly, for example, during a search
  101. * enumeration, the referral exception should provide a context
  102. * at which to continue the operation.
  103. * To continue the operation, the client program should re-invoke
  104. * the method using the same arguments as the original invocation.
  105. *<p>
  106. * <tt>reqCtls</tt> is used when creating the connection to the referred
  107. * server. These controls will be used as the connection request controls for
  108. * the context and context instances
  109. * derived from the context.
  110. * <tt>reqCtls</tt> will also be the context's request controls for
  111. * subsequent context operations. See the <tt>LdapContext</tt> class
  112. * description for details.
  113. *<p>
  114. * This method should be used instead of the other two overloaded forms
  115. * when the caller needs to supply request controls for creating
  116. * the referral context. It might need to do this, for example, when
  117. * it needs to supply special controls relating to authentication.
  118. *<p>
  119. * Service provider implementors should read the "Service Provider" section
  120. * in the <tt>LdapContext</tt> class description for implementation details.
  121. *
  122. * @param reqCtls The possibly null request controls to use for the new context.
  123. * If null or the empty array means use no request controls.
  124. * @param env The possibly null environment properties to use when
  125. * for the new context. If null, the context is initialized with no environment
  126. * properties.
  127. * @return The non-null context at which to continue the method.
  128. * @exception NamingException If a naming exception was encountered.
  129. * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
  130. * to continue processing referrals.
  131. */
  132. public abstract Context getReferralContext(
  133. Hashtable env, Control[] reqCtls) throws NamingException;
  134. private static final long serialVersionUID = -1668992791764950804L;
  135. }