Package org.ldaptive

Interface ConnectionStrategy

All Superinterfaces:
Iterable<LdapURL>
All Known Implementing Classes:
AbstractConnectionStrategy, ActivePassiveConnectionStrategy, DnsResolverConnectionStrategy, DnsSrvConnectionStrategy, RandomConnectionStrategy, RoundRobinConnectionStrategy

public interface ConnectionStrategy extends Iterable<LdapURL>
Interface to describe various connection strategies. Each strategy returns an ordered list of LDAP URLs to attempt when opening a connection.
  • Method Details

    • populate

      void populate(String urls, LdapURLSet urlSet)
      Populates a LdapURLSet from the URL string provided at configuration time.
      Parameters:
      urls - Space-delimited string of URLs describing the LDAP hosts to connect to. The URLs in the string are commonly ldap:// or ldaps:// URLs that directly describe the hosts to connect to, but may also describe a resource from which to obtain LDAP connection URLs as is the case for DnsSrvConnectionStrategy that use URLs with the scheme dns:.
      urlSet - LDAP URL set to populate.
    • initialize

      void initialize(String urls, Predicate<LdapURL> activateCondition)
      Prepare this strategy for use.
      Parameters:
      urls - LDAP URLs for this strategy
      activateCondition - predicate to determine whether a connection is active
    • isInitialized

      boolean isInitialized()
      Whether this strategy is ready for use.
      Returns:
      whether this strategy is ready for use
    • getActivateCondition

      Predicate<LdapURL> getActivateCondition()
      Returns the condition used to activate connections.
      Returns:
      activate condition
    • getRetryCondition

      Predicate<LdapURL> getRetryCondition()
      Returns the condition used to determine whether to attempt to activate a connection.
      Returns:
      retry condition
    • success

      void success(LdapURL url)
      Indicates the supplied URL was successfully connected to.
      Parameters:
      url - which was successfully connected to
    • failure

      void failure(LdapURL url)
      Indicates the supplied URL could not be connected to.
      Parameters:
      url - which was could not be connected to
    • newInstance

      ConnectionStrategy newInstance()
      Create a deep copy of this strategy.
      Returns:
      new instance of this connection strategy