Package org.ldaptive
Class ConnectionConfig
java.lang.Object
org.ldaptive.AbstractFreezable
org.ldaptive.AbstractConfig
org.ldaptive.ConnectionConfig
- All Implemented Interfaces:
Freezable
Contains all the configuration data needed to control connections.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether data will be read from the socket as it arrives or only after each LDAP message is consumed.private booleanWhether to automatically reconnect to the server when a connection is lost.private Predicate<RetryMetadata>Condition used to determine whether another reconnect attempt should be made.private booleanWhether pending operations should be replayed after a reconnect.private ConnectionInitializer[]Connection initializers to execute onConnection.open().private ConnectionStrategyConnection strategy.private ConnectionValidatorConnection validator.private DurationDuration of time that connects will block.static final Predicate<RetryMetadata>Predicate that attempts to reconnect forever, waiting for 5 seconds after the first attempt.static final Predicate<RetryMetadata>Predicate that attempts to reconnect forever, backing off in 5 second intervals after the first attempt.private StringURL to the LDAP(s).static final Predicate<RetryMetadata>Predicate that attempts a single reconnect.private DurationDuration of time that operations will block on reconnects, should generally be longer thanconnectTimeout.private DurationDuration of time to wait for responses.private SslConfigConfiguration for SSL and startTLS connections.private DurationDuration of time to wait for startTLS responses.Transport options.private booleanConnect to LDAP using startTLS.Fields inherited from class org.ldaptive.AbstractConfig
logger -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ConnectionConfig(String url) Creates a new connection config. -
Method Summary
Modifier and TypeMethodDescriptionstatic ConnectionConfig.Builderbuilder()Creates a builder for this class.static ConnectionConfigcopy(ConnectionConfig config) Returns a new connection config initialized with the supplied config.voidfreeze()Freezes this object, making it immutable.booleanReturns whether data will be read from the socket as it arrives or only after each LDAP message is consumed.booleanReturns whether connections will attempt to reconnect.Returns the auto reconnect condition.booleanReturns whether operations should be replayed after a reconnect.Returns the connection initializers.Returns the connection strategy.Returns the connection validator.Returns the connect timeout.Returns the ldap url.Returns the reconnect timeout.Returns the response timeout.Returns the ssl config.Returns the startTLS timeout.Returns a transport option.Returns transport options.booleanReturns whether startTLS will be used for connections.voidsetAutoRead(boolean b) Sets whether data will be read from the socket as it arrives or only after each LDAP message is consumed.voidsetAutoReconnect(boolean b) Sets whether connections will attempt to reconnect when unexpectedly closed.voidsetAutoReconnectCondition(Predicate<RetryMetadata> predicate) Sets the auto reconnect condition.voidsetAutoReplay(boolean b) Sets whether operations will be replayed after a reconnect.voidsetConnectionInitializers(ConnectionInitializer... initializers) Sets the connection initializers.voidsetConnectionStrategy(ConnectionStrategy strategy) Sets the connection strategy.voidsetConnectionValidator(ConnectionValidator validator) Sets the connection validator.voidsetConnectTimeout(Duration time) Sets the maximum amount of time that connects will block.voidsetLdapUrl(String url) Sets the ldap url.voidsetReconnectTimeout(Duration time) Sets the maximum amount of time that operations will block waiting for a reconnect.voidsetResponseTimeout(Duration time) Sets the maximum amount of time that operations will wait for a response.voidsetSslConfig(SslConfig config) Sets the ssl config.voidsetStartTLSTimeout(Duration time) Sets the maximum amount of time that startTLS operations will wait for a response.voidsetTransportOption(String id, Object value) Sets a transport option.voidsetTransportOptions(Map<String, ?> options) Sets transport options.voidsetUseStartTLS(boolean b) Sets whether startTLS will be used for connections.toString()Methods inherited from class org.ldaptive.AbstractConfig
checkArrayContainsNull, checkStringInputMethods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, isFrozen
-
Field Details
-
ONE_RECONNECT_ATTEMPT
Predicate that attempts a single reconnect. -
INFINITE_RECONNECT_ATTEMPTS
Predicate that attempts to reconnect forever, waiting for 5 seconds after the first attempt. -
INFINITE_RECONNECT_ATTEMPTS_WITH_BACKOFF
Predicate that attempts to reconnect forever, backing off in 5 second intervals after the first attempt. -
ldapUrl
URL to the LDAP(s). -
connectTimeout
Duration of time that connects will block. -
startTLSTimeout
Duration of time to wait for startTLS responses. -
responseTimeout
Duration of time to wait for responses. -
reconnectTimeout
Duration of time that operations will block on reconnects, should generally be longer thanconnectTimeout. -
autoReconnect
private boolean autoReconnectWhether to automatically reconnect to the server when a connection is lost. Default is true. -
autoReconnectCondition
Condition used to determine whether another reconnect attempt should be made. Default makes a single attempt only if the connection was previously opened. -
autoReplay
private boolean autoReplayWhether pending operations should be replayed after a reconnect. Default is false. -
autoRead
private boolean autoReadWhether data will be read from the socket as it arrives or only after each LDAP message is consumed. Default is true. -
sslConfig
Configuration for SSL and startTLS connections. -
useStartTLS
private boolean useStartTLSConnect to LDAP using startTLS. -
connectionInitializers
Connection initializers to execute onConnection.open(). -
connectionStrategy
Connection strategy. -
connectionValidator
Connection validator. -
transportOptions
Transport options.
-
-
Constructor Details
-
ConnectionConfig
public ConnectionConfig()Default constructor. -
ConnectionConfig
Creates a new connection config.- Parameters:
url- to connect to
-
-
Method Details
-
freeze
public void freeze()Description copied from interface:FreezableFreezes this object, making it immutable.- Specified by:
freezein interfaceFreezable- Overrides:
freezein classAbstractFreezable
-
getLdapUrl
Returns the ldap url.- Returns:
- ldap url
-
setLdapUrl
Sets the ldap url.- Parameters:
url- of the ldap
-
getConnectTimeout
Returns the connect timeout.- Returns:
- timeout
-
setConnectTimeout
Sets the maximum amount of time that connects will block.- Parameters:
time- timeout for connects
-
getStartTLSTimeout
Returns the startTLS timeout.- Returns:
- timeout
-
setStartTLSTimeout
Sets the maximum amount of time that startTLS operations will wait for a response.- Parameters:
time- timeout for responses
-
getResponseTimeout
Returns the response timeout.- Returns:
- timeout
-
setResponseTimeout
Sets the maximum amount of time that operations will wait for a response.- Parameters:
time- timeout for responses
-
getReconnectTimeout
Returns the reconnect timeout.- Returns:
- timeout
-
setReconnectTimeout
Sets the maximum amount of time that operations will block waiting for a reconnect.- Parameters:
time- timeout for reconnects
-
getAutoReconnect
public boolean getAutoReconnect()Returns whether connections will attempt to reconnect.- Returns:
- whether to automatically reconnect when a connection is lost
-
setAutoReconnect
public void setAutoReconnect(boolean b) Sets whether connections will attempt to reconnect when unexpectedly closed.- Parameters:
b- whether to automatically reconnect when a connection is lost
-
getAutoReconnectCondition
Returns the auto reconnect condition.- Returns:
- auto reconnect condition
-
setAutoReconnectCondition
Sets the auto reconnect condition.- Parameters:
predicate- to determine whether to attempt a reconnect
-
getAutoReplay
public boolean getAutoReplay()Returns whether operations should be replayed after a reconnect.- Returns:
- whether to auto replay
-
setAutoReplay
public void setAutoReplay(boolean b) Sets whether operations will be replayed after a reconnect.- Parameters:
b- whether to replay operations
-
getAutoRead
public boolean getAutoRead()Returns whether data will be read from the socket as it arrives or only after each LDAP message is consumed.- Returns:
- whether to auto read data from the socket
-
setAutoRead
public void setAutoRead(boolean b) Sets whether data will be read from the socket as it arrives or only after each LDAP message is consumed.- Parameters:
b- whether to auto read data from the socket
-
getSslConfig
Returns the ssl config.- Returns:
- ssl config
-
setSslConfig
Sets the ssl config.- Parameters:
config- ssl config
-
getUseStartTLS
public boolean getUseStartTLS()Returns whether startTLS will be used for connections.- Returns:
- whether startTLS will be used
-
setUseStartTLS
public void setUseStartTLS(boolean b) Sets whether startTLS will be used for connections.- Parameters:
b- whether startTLS will be used
-
getConnectionInitializers
Returns the connection initializers.- Returns:
- connection initializers
-
setConnectionInitializers
Sets the connection initializers.- Parameters:
initializers- connection initializers
-
getConnectionStrategy
Returns the connection strategy.- Returns:
- strategy for making connections
-
setConnectionStrategy
Sets the connection strategy.- Parameters:
strategy- for making new connections
-
getConnectionValidator
Returns the connection validator.- Returns:
- connection validator
-
setConnectionValidator
Sets the connection validator.- Parameters:
validator- for validating connections
-
getTransportOptions
Returns transport options.- Returns:
- transport options
-
setTransportOptions
Sets transport options.- Parameters:
options- to set
-
getTransportOption
Returns a transport option.- Parameters:
id- transport option id- Returns:
- transport option
-
setTransportOption
Sets a transport option.- Parameters:
id- of the transport optionvalue- of the transport option
-
copy
Returns a new connection config initialized with the supplied config.- Parameters:
config- connection config to read properties from- Returns:
- connection config
-
toString
-
builder
Creates a builder for this class.- Returns:
- new builder
-