Package org.ldaptive
Class AbstractConnectionStrategy
java.lang.Object
org.ldaptive.AbstractFreezable
org.ldaptive.AbstractConnectionStrategy
- All Implemented Interfaces:
Iterable<LdapURL>,ConnectionStrategy,Freezable
- Direct Known Subclasses:
AbstractPassiveConnectionStrategy,DnsSrvConnectionStrategy,RandomConnectionStrategy,RoundRobinConnectionStrategy
public abstract class AbstractConnectionStrategy
extends AbstractFreezable
implements ConnectionStrategy
Base class for connection strategy implementations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classDefault iterator implementation. -
Field Summary
FieldsModifier and TypeFieldDescriptionCondition used to determine whether to activate a URL.private booleanWhether this strategy has been successfully initialized.protected LdapURLSetSet of LDAP URLs to attempt connections to.protected final LoggerLogger for this class.Condition used to determine whether to test an inactive URL. -
Constructor Summary
Constructors -
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> condition) Prepare this strategy for use.booleanWhether this strategy is ready for use.voidpopulate(String urls, LdapURLSet urlSet) Populates aLdapURLSetfrom the URL string provided at configuration time.voidsetRetryCondition(Predicate<LdapURL> condition) Sets the retry condition which determines whether an attempt should be made to activate a URL.voidIndicates the supplied URL was successfully connected to.toString()Methods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, freeze, isFrozenMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ldaptive.ConnectionStrategy
newInstanceMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Field Details
-
logger
Logger for this class. -
ldapURLSet
Set of LDAP URLs to attempt connections to. -
initialized
private boolean initializedWhether this strategy has been successfully initialized. -
activateCondition
Condition used to determine whether to activate a URL. -
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:ConnectionStrategyWhether this strategy is ready for use.- Specified by:
isInitializedin interfaceConnectionStrategy- Returns:
- whether this strategy is ready for use
-
initialize
Description copied from interface:ConnectionStrategyPrepare this strategy for use.- Specified by:
initializein interfaceConnectionStrategy- Parameters:
urls- LDAP URLs for this strategycondition- predicate to determine whether a connection is active
-
populate
Description copied from interface:ConnectionStrategyPopulates aLdapURLSetfrom the URL string provided at configuration time.- Specified by:
populatein interfaceConnectionStrategy- 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.
-
getActivateCondition
Description copied from interface:ConnectionStrategyReturns the condition used to activate connections.- Specified by:
getActivateConditionin interfaceConnectionStrategy- Returns:
- activate condition
-
getRetryCondition
Description copied from interface:ConnectionStrategyReturns the condition used to determine whether to attempt to activate a connection.- Specified by:
getRetryConditionin interfaceConnectionStrategy- Returns:
- retry condition
-
setRetryCondition
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
Description copied from interface:ConnectionStrategyIndicates the supplied URL was successfully connected to.- Specified by:
successin interfaceConnectionStrategy- Parameters:
url- which was successfully connected to
-
failure
Description copied from interface:ConnectionStrategyIndicates the supplied URL could not be connected to.- Specified by:
failurein interfaceConnectionStrategy- Parameters:
url- which was could not be connected to
-
toString
-