Class AbstractFollowReferralHandler<Q extends Request,​S extends Result>

    • 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 Logger logger
        Logger for this class.
      • referralLimit

        protected final int referralLimit
        Referral limit.
      • referralDepth

        protected final int referralDepth
        Referral depth.
      • throwOnFailure

        private final boolean throwOnFailure
        Whether to throw an exception if a referral cannot be chased.
    • Constructor Detail

      • AbstractFollowReferralHandler

        public AbstractFollowReferralHandler​(int limit,
                                             int depth,
                                             ReferralConnectionFactory factory,
                                             boolean tf)
        Creates a new abstract referral handler.
        Parameters:
        limit - number of referrals to follow
        depth - number of referrals followed
        factory - referral connection factory
        tf - whether to throw on failure to chase referral
    • 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
      • getThrowOnFailure

        public boolean getThrowOnFailure()
        Returns whether to throw on failure to chase referrals.
        Returns:
        whether to throw on failure to chase referrals
      • 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
      • getSuccessResultCodes

        protected Set<ResultCode> getSuccessResultCodes()
        Returns the result codes that indicate a successful referral was followed.
        Returns:
        success result codes
      • followReferral

        protected S followReferral​(String[] referralUrls)
                            throws LdapException
        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

        public S apply​(S result)