Package org.ldaptive.referral
Class AbstractFollowReferralHandler<Q extends Request,S extends Result>
java.lang.Object
org.ldaptive.AbstractFreezable
org.ldaptive.transport.MessageFunctional<Q,S>
org.ldaptive.transport.MessageFunctional.Function<Q,S,S,S>
org.ldaptive.referral.AbstractFollowReferralHandler<Q,S>
- Type Parameters:
Q- type of requestS- type of result
- Direct Known Subclasses:
AbstractFollowSearchReferralHandler,FollowAddReferralHandler,FollowCompareReferralHandler,FollowDeleteReferralHandler,FollowModifyDnReferralHandler,FollowModifyReferralHandler
public abstract class AbstractFollowReferralHandler<Q extends Request,S extends Result>
extends MessageFunctional.Function<Q,S,S,S>
Common implementation of referral handling.
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ReferralConnectionFactoryReferral connection factory.protected static final intDefault referral limit.protected final LoggerLogger for this class.protected final intReferral depth.protected final intReferral limit.private final booleanWhether to throw an exception if a referral cannot be chased. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFollowReferralHandler(int limit, int depth, ReferralConnectionFactory factory, boolean tf) Creates a new abstract referral handler. -
Method Summary
Modifier and TypeMethodDescriptioncreateReferralOperation(ConnectionFactory factory) Creates an operation for this type of referral.protected abstract QCreates a new request for this type of referral.protected SfollowReferral(String[] referralUrls) Follows the supplied referral URLs in random order until a SUCCESS or REFERRAL_LIMIT_EXCEEDED occurs.Returns the referral connection factory.intReturns the referral depth of this handler.intReturns the maximum number of referrals to follow.protected Set<ResultCode>Returns the result codes that indicate a successful referral was followed.booleanReturns whether to throw on failure to chase referrals.Methods inherited from class org.ldaptive.transport.MessageFunctional
getConnection, getHandle, getRequest, newInstance, setConnection, setHandle, setRequestMethods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, freeze, isFrozen
-
Field Details
-
DEFAULT_REFERRAL_LIMIT
protected static final int DEFAULT_REFERRAL_LIMITDefault referral limit. Value is 10.- See Also:
-
logger
Logger for this class. -
referralLimit
protected final int referralLimitReferral limit. -
referralDepth
protected final int referralDepthReferral depth. -
connectionFactory
Referral connection factory. -
throwOnFailure
private final boolean throwOnFailureWhether to throw an exception if a referral cannot be chased.
-
-
Constructor Details
-
AbstractFollowReferralHandler
public AbstractFollowReferralHandler(int limit, int depth, ReferralConnectionFactory factory, boolean tf) Creates a new abstract referral handler.- Parameters:
limit- number of referrals to followdepth- number of referrals followedfactory- referral connection factorytf- whether to throw on failure to chase referral
-
-
Method Details
-
getReferralLimit
public int getReferralLimit()Returns the maximum number of referrals to follow.- Returns:
- referral limit
-
getReferralDepth
public int getReferralDepth()Returns the referral depth of this handler.- Returns:
- referral depth
-
getReferralConnectionFactory
Returns the referral connection factory.- Returns:
- referral connection factory
-
getThrowOnFailure
public boolean getThrowOnFailure()Returns whether to throw on failure to chase referrals.- Returns:
- whether to throw on failure to chase referrals
-
createReferralRequest
Creates a new request for this type of referral.- Parameters:
url- of the referral- Returns:
- new request
-
createReferralOperation
Creates an operation for this type of referral.- Parameters:
factory- to get a connection with- Returns:
- new operation
-
getSuccessResultCodes
Returns the result codes that indicate a successful referral was followed.- Returns:
- success result codes
-
followReferral
Follows the supplied referral URLs in random order until a SUCCESS or REFERRAL_LIMIT_EXCEEDED occurs. If neither of those conditions occurs this method returns null.- Parameters:
referralUrls- produced by the request- Returns:
- referral response
- Throws:
LdapException- if the referral limit is exceeded
-
apply
-