Package org.ldaptive.referral
Class AbstractFollowReferralHandler<Q extends Request,S extends Result>
- java.lang.Object
-
- 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
- All Implemented Interfaces:
java.util.function.Function<S,S>
- Direct Known Subclasses:
FollowSearchReferralHandler,FollowSearchResultReferenceHandler
public abstract class AbstractFollowReferralHandler<Q extends Request,S extends Result> extends MessageFunctional.Function<Q,S,S,S>
Common implementation of referral handling.- Author:
- Middleware Services
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_REFERRAL_LIMITDefault referral limit.protected org.slf4j.LoggerloggerLogger for this class.protected intreferralDepthReferral depth.protected intreferralLimitReferral limit.
-
Constructor Summary
Constructors Constructor Description AbstractFollowReferralHandler(int limit, int depth, ReferralConnectionFactory factory)Creates a new abstract referral handler.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Sapply(S result)protected abstract Operation<Q,S>createReferralOperation(ConnectionFactory factory)Creates an operation for this type of referral.protected abstract QcreateReferralRequest(LdapURL url)Creates a new request for this type of referral.protected SfollowReferral(java.lang.String[] referralUrls)Follows the supplied referral URLs in order until a SUCCESS or REFERRAL_LIMIT_EXCEEDED occurs.ReferralConnectionFactorygetReferralConnectionFactory()Returns the referral connection factory.intgetReferralDepth()Returns the referral depth of this handler.intgetReferralLimit()Returns the maximum number of referrals to follow.-
Methods inherited from class org.ldaptive.transport.MessageFunctional
getConnection, getHandle, getRequest, setConnection, setHandle, setRequest
-
-
-
-
Field Detail
-
DEFAULT_REFERRAL_LIMIT
protected static final int DEFAULT_REFERRAL_LIMIT
Default referral limit. Value is 10.- See Also:
- Constant Field Values
-
logger
protected final org.slf4j.Logger logger
Logger for this class.
-
referralLimit
protected final int referralLimit
Referral limit.
-
referralDepth
protected final int referralDepth
Referral depth.
-
-
Constructor Detail
-
AbstractFollowReferralHandler
public AbstractFollowReferralHandler(int limit, int depth, ReferralConnectionFactory factory)Creates a new abstract referral handler.- Parameters:
limit- number of referrals to followdepth- number of referrals followedfactory- referral connection factory
-
-
Method Detail
-
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
public ReferralConnectionFactory getReferralConnectionFactory()
Returns the referral connection factory.- Returns:
- referral connection factory
-
createReferralRequest
protected abstract Q createReferralRequest(LdapURL url)
Creates a new request for this type of referral.- Parameters:
url- of the referral- Returns:
- new request
-
createReferralOperation
protected abstract Operation<Q,S> createReferralOperation(ConnectionFactory factory)
Creates an operation for this type of referral.- Parameters:
factory- to get a connection with- Returns:
- new operation
-
followReferral
protected S followReferral(java.lang.String[] referralUrls)
Follows the supplied referral URLs in 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
-
-