Package org.ldaptive
Interface ConnectionStrategy
-
- All Known Implementing Classes:
AbstractConnectionStrategy
,AbstractPassiveConnectionStrategy
,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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
failure(LdapURL url)
Indicates the supplied URL could not be connected to.Predicate<LdapURL>
getActivateCondition()
Returns the condition used to activate connections.Predicate<LdapURL>
getRetryCondition()
Returns the condition used to determine whether to attempt to activate a connection.void
initialize(String urls, Predicate<LdapURL> activateCondition)
Prepare this strategy for use.boolean
isInitialized()
Whether this strategy is ready for use.ConnectionStrategy
newInstance()
Create a deep copy of this strategy.void
populate(String urls, LdapURLSet urlSet)
Populates aLdapURLSet
from the URL string provided at configuration time.void
success(LdapURL url)
Indicates the supplied URL was successfully connected to.-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
populate
void populate(String urls, LdapURLSet urlSet)
Populates aLdapURLSet
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 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 forDnsSrvConnectionStrategy
that use URLs with the schemedns:
.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 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
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
-
-