Package org.ldaptive
Interface ConnectionStrategy
- All Known Implementing Classes:
AbstractConnectionStrategy,AbstractPassiveConnectionStrategy,ActivePassiveConnectionStrategy,DnsResolverConnectionStrategy,DnsSrvConnectionStrategy,RandomConnectionStrategy,RoundRobinConnectionStrategy
Interface to describe various connection strategies. Each strategy returns an ordered list of LDAP URLs to attempt
when opening a connection.
-
Method Summary
Modifier and TypeMethodDescriptionvoidIndicates the supplied URL could not be connected to.Returns the condition used to activate connections.Returns the condition used to determine whether to attempt to activate a connection.voidinitialize(String urls, Predicate<LdapURL> activateCondition) Prepare this strategy for use.booleanWhether this strategy is ready for use.Create a deep copy of this strategy.voidpopulate(String urls, LdapURLSet urlSet) Populates aLdapURLSetfrom the URL string provided at configuration time.voidIndicates the supplied URL was successfully connected to.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
populate
Populates aLdapURLSetfrom 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 commonlyldap://orldaps://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 forDnsSrvConnectionStrategythat use URLs with the schemedns:.urlSet- LDAP URL set to populate.
-
initialize
Prepare this strategy for use.- Parameters:
urls- LDAP URLs for this strategyactivateCondition- 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
Returns the condition used to activate connections.- Returns:
- activate condition
-
getRetryCondition
Returns the condition used to determine whether to attempt to activate a connection.- Returns:
- retry condition
-
success
Indicates the supplied URL was successfully connected to.- Parameters:
url- which was successfully connected to
-
failure
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
-