Package org.ldaptive

Class ConnectionConfig


  • public class ConnectionConfig
    extends AbstractConfig
    Contains all the configuration data needed to control connections.
    Author:
    Middleware Services
    • Field Detail

      • ONE_RECONNECT_ATTEMPT

        public static final java.util.function.Predicate<RetryMetadata> ONE_RECONNECT_ATTEMPT
        Predicate that attempts a single reconnect.
      • INFINITE_RECONNECT_ATTEMPTS

        public static final java.util.function.Predicate<RetryMetadata> INFINITE_RECONNECT_ATTEMPTS
        Predicate that attempts to reconnect forever, waiting for 5 seconds after the first attempt.
      • INFINITE_RECONNECT_ATTEMPTS_WITH_BACKOFF

        public static final java.util.function.Predicate<RetryMetadata> INFINITE_RECONNECT_ATTEMPTS_WITH_BACKOFF
        Predicate that attempts to reconnect forever, backing off in 5 second intervals after the first attempt.
    • Constructor Detail

      • ConnectionConfig

        public ConnectionConfig()
        Default constructor.
      • ConnectionConfig

        public ConnectionConfig​(java.lang.String url)
        Creates a new connection config.
        Parameters:
        url - to connect to
    • Method Detail

      • getLdapUrl

        public java.lang.String getLdapUrl()
        Returns the ldap url.
        Returns:
        ldap url
      • setLdapUrl

        public void setLdapUrl​(java.lang.String url)
        Sets the ldap url.
        Parameters:
        url - of the ldap
      • getConnectTimeout

        public java.time.Duration getConnectTimeout()
        Returns the connect timeout.
        Returns:
        timeout
      • setConnectTimeout

        public void setConnectTimeout​(java.time.Duration time)
        Sets the maximum amount of time that connects will block.
        Parameters:
        time - timeout for connects
      • getResponseTimeout

        public java.time.Duration getResponseTimeout()
        Returns the response timeout.
        Returns:
        timeout
      • setResponseTimeout

        public void setResponseTimeout​(java.time.Duration time)
        Sets the maximum amount of time that operations will wait for a response.
        Parameters:
        time - timeout for responses
      • getReconnectTimeout

        public java.time.Duration getReconnectTimeout()
        Returns the reconnect timeout.
        Returns:
        timeout
      • setReconnectTimeout

        public void setReconnectTimeout​(java.time.Duration time)
        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

        public java.util.function.Predicate<RetryMetadata> getAutoReconnectCondition()
        Returns the auto reconnect condition.
        Returns:
        auto reconnect condition
      • setAutoReconnectCondition

        public void setAutoReconnectCondition​(java.util.function.Predicate<RetryMetadata> predicate)
        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
      • getSslConfig

        public SslConfig getSslConfig()
        Returns the ssl config.
        Returns:
        ssl config
      • setSslConfig

        public void setSslConfig​(SslConfig config)
        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

        public ConnectionInitializer[] getConnectionInitializers()
        Returns the connection initializers.
        Returns:
        connection initializers
      • setConnectionInitializers

        public void setConnectionInitializers​(ConnectionInitializer... initializers)
        Sets the connection initializers.
        Parameters:
        initializers - connection initializers
      • getConnectionStrategy

        public ConnectionStrategy getConnectionStrategy()
        Returns the connection strategy.
        Returns:
        strategy for making connections
      • setConnectionStrategy

        public void setConnectionStrategy​(ConnectionStrategy strategy)
        Sets the connection strategy.
        Parameters:
        strategy - for making new connections
      • getConnectionValidator

        public ConnectionValidator getConnectionValidator()
        Returns the connection validator.
        Returns:
        connection validator
      • setConnectionValidator

        public void setConnectionValidator​(ConnectionValidator validator)
        Sets the connection validator.
        Parameters:
        validator - for validating connections
      • getTransportOptions

        public java.util.Map<java.lang.String,​?> getTransportOptions()
        Returns transport options.
        Returns:
        transport options
      • setTransportOptions

        public void setTransportOptions​(java.util.Map<java.lang.String,​?> options)
        Sets transport options.
        Parameters:
        options - to set
      • getTransportOption

        public java.lang.Object getTransportOption​(java.lang.String id)
        Returns a transport option.
        Parameters:
        id - transport option id
        Returns:
        transport option
      • setTransportOption

        public void setTransportOption​(java.lang.String id,
                                       java.lang.Object value)
        Sets a transport option.
        Parameters:
        id - of the transport option
        value - of the transport option
      • copy

        public static ConnectionConfig copy​(ConnectionConfig config)
        Returns a new connection config initialized with the supplied config.
        Parameters:
        config - connection config to read properties from
        Returns:
        connection config
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object