Package org.ldaptive

Class AbstractConnectionStrategy

java.lang.Object
org.ldaptive.AbstractConnectionStrategy
All Implemented Interfaces:
Iterable<LdapURL>, ConnectionStrategy
Direct Known Subclasses:
ActivePassiveConnectionStrategy, DnsResolverConnectionStrategy, DnsSrvConnectionStrategy, RandomConnectionStrategy, RoundRobinConnectionStrategy

public abstract class AbstractConnectionStrategy extends Object implements ConnectionStrategy
Base class for connection strategy implementations.
  • Field Details

    • logger

      protected final org.slf4j.Logger logger
      Logger for this class.
    • ldapURLSet

      protected LdapURLSet ldapURLSet
      Set of LDAP URLs to attempt connections to.
    • initialized

      private boolean initialized
      Whether this strategy has been successfully initialized.
    • activateCondition

      private Predicate<LdapURL> activateCondition
      Condition used to determine whether to activate a URL.
    • retryCondition

      private Predicate<LdapURL> retryCondition
      Condition used to determine whether to test an inactive URL.
  • Constructor Details

    • AbstractConnectionStrategy

      public AbstractConnectionStrategy()
  • Method Details

    • isInitialized

      public boolean isInitialized()
      Description copied from interface: ConnectionStrategy
      Whether this strategy is ready for use.
      Specified by:
      isInitialized in interface ConnectionStrategy
      Returns:
      whether this strategy is ready for use
    • initialize

      public void initialize(String urls, Predicate<LdapURL> condition)
      Description copied from interface: ConnectionStrategy
      Prepare this strategy for use.
      Specified by:
      initialize in interface ConnectionStrategy
      Parameters:
      urls - LDAP URLs for this strategy
      condition - predicate to determine whether a connection is active
    • populate

      public void populate(String urls, LdapURLSet urlSet)
      Description copied from interface: ConnectionStrategy
      Populates a LdapURLSet from the URL string provided at configuration time.
      Specified by:
      populate in interface ConnectionStrategy
      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.
    • getActivateCondition

      public Predicate<LdapURL> getActivateCondition()
      Description copied from interface: ConnectionStrategy
      Returns the condition used to activate connections.
      Specified by:
      getActivateCondition in interface ConnectionStrategy
      Returns:
      activate condition
    • getRetryCondition

      public Predicate<LdapURL> getRetryCondition()
      Description copied from interface: ConnectionStrategy
      Returns the condition used to determine whether to attempt to activate a connection.
      Specified by:
      getRetryCondition in interface ConnectionStrategy
      Returns:
      retry condition
    • setRetryCondition

      public void setRetryCondition(Predicate<LdapURL> condition)
      Sets the retry condition which determines whether an attempt should be made to activate a URL.
      Parameters:
      condition - that determines whether to test an inactive URL
    • success

      public void success(LdapURL url)
      Description copied from interface: ConnectionStrategy
      Indicates the supplied URL was successfully connected to.
      Specified by:
      success in interface ConnectionStrategy
      Parameters:
      url - which was successfully connected to
    • failure

      public void failure(LdapURL url)
      Description copied from interface: ConnectionStrategy
      Indicates the supplied URL could not be connected to.
      Specified by:
      failure in interface ConnectionStrategy
      Parameters:
      url - which was could not be connected to
    • toString

      public String toString()
      Overrides:
      toString in class Object