Class LDAPListenerConfig

java.lang.Object
com.unboundid.ldap.listener.LDAPListenerConfig

This class provides a mechanism for defining the configuration to use for an LDAPListener instance. Note that while instances of this class are not inherently threadsafe, a private copy of the configuration will be created whenever a new LDAPListener is created so that this configuration may continue to be altered for new instances without impacting any existing listeners.
  • Constructor Summary

    Constructors
    Constructor
    Description
    LDAPListenerConfig(int listenPort, LDAPListenerRequestHandler requestHandler)
    Creates a new listener configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a copy of this configuration that may be altered without impacting this configuration, and which will not be altered by changes to this configuration.
    Retrieves the exception handler that should be notified of any exceptions caught while attempting to accept or interact with a client connection.
    int
    Retrieves the timeout in seconds that should be used if the SO_LINGER socket option is enabled.
    Retrieves the address on which to listen for client connections, if defined.
    int
    Retrieves the port number on which to listen for client connections.
    int
    Retrieves the maximum number of concurrent connections that the listener will allow.
    int
    Retrieves the maximum size in bytes for LDAP messages that will be accepted by this listener.
    int
    Retrieves the receive buffer size that should be used for sockets accepted by the listener.
    Retrieves the LDAP listener request handler that should be used to process requests read from clients.
    int
    Retrieves the send buffer size that should be used for sockets accepted by the listener.
    Retrieves the factory that will be used to create the server socket that will listen for client connections.
    boolean
    Indicates whether the listener should request that the client present its own certificate chain during TLS negotiation.
    boolean
    Indicates whether the listener should require that the client present its own certificate chain during TLS negotiation and should fail negotiation if no certificate chain was provided.
    void
    Specifies the exception handler that should be notified of any exceptions caught while attempting to accept or interact with a client connection.
    void
    setLingerTimeoutSeconds(int lingerTimeout)
    Specifies the timeout in seconds that should be used if the SO_LINGER socket option is enabled.
    void
    Specifies the address on which to listen for client connections.
    void
    setListenPort(int listenPort)
    Specifies the port number on which to listen for client connections.
    void
    setMaxConnections(int maxConnections)
    Specifies the maximum number of concurrent connections that the listener will allow.
    void
    setMaxMessageSizeBytes(int maxMessageSizeBytes)
    Specifies the maximum size in bytes for LDAP messages that will be accepted by this listener.
    void
    setReceiveBufferSize(int receiveBufferSize)
    Specifies the receive buffer size that should be used for sockets accepted by the listener.
    void
    setRequestClientCertificate(boolean requestClientCertificate)
    Specifies whether the listener should request that the client present its own certificate chain during TLS negotiation.
    void
    Specifies the LDAP listener request handler that should be used to process requests read from clients.
    void
    setRequireClientCertificate(boolean requireClientCertificate)
    Specifies whether the listener should require that the client present its own certificate chain during TLS negotiation and should fail negotiation if no certificate chain was provided.
    void
    setSendBufferSize(int sendBufferSize)
    Specifies the send buffer size that should be used for sockets accepted by the listener.
    void
    Specifies the factory that will be used to create the server socket that will listen for client connections.
    void
    setUseKeepAlive(boolean useKeepAlive)
    Specifies whether to use the SO_KEEPALIVE socket option for sockets accepted by the listener.
    void
    setUseLinger(boolean useLinger)
    Specifies whether to use the SO_LINGER socket option for sockets accepted by the listener.
    void
    setUseReuseAddress(boolean useReuseAddress)
    Specifies whether to use the SO_REUSEADDR socket option for sockets accepted by the listener.
    void
    setUseTCPNoDelay(boolean useTCPNoDelay)
    Specifies whether to use the TCP_NODELAY socket option for sockets accepted by the listener.
    Retrieves a string representation of this LDAP listener config.
    void
    Appends a string representation of this LDAP listener config to the provided buffer.
    boolean
    Indicates whether to use the SO_KEEPALIVE socket option for sockets accepted by the listener.
    boolean
    Indicates whether to use the SO_LINGER socket option for sockets accepted by the listener.
    boolean
    Indicates whether to use the SO_REUSEADDR socket option for sockets accepted by the listener.
    boolean
    Indicates whether to use the TCP_NODELAY socket option for sockets accepted by the listener.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LDAPListenerConfig

      public LDAPListenerConfig(int listenPort, @NotNull LDAPListenerRequestHandler requestHandler)
      Creates a new listener configuration.
      Parameters:
      listenPort - The port on which to listen for client connections. It must be an integer between 1 and 65535, or 0 to indicate that a free port should be chosen by the JVM.
      requestHandler - The request handler that will be used to process requests read from clients. It must not be null.
  • Method Details

    • getListenPort

      public int getListenPort()
      Retrieves the port number on which to listen for client connections. A value of zero indicates that the listener should allow the JVM to choose a free port.
      Returns:
      The port number on which to listen for client connections.
    • setListenPort

      public void setListenPort(int listenPort)
      Specifies the port number on which to listen for client connections. The provided value must be between 1 and 65535, or it may be 0 to indicate that the JVM should select a free port on the system.
      Parameters:
      listenPort - The port number on which to listen for client connections.
    • getRequestHandler

      Retrieves the LDAP listener request handler that should be used to process requests read from clients.
      Returns:
      The LDAP listener request handler that should be used to process requests read from clients.
    • setRequestHandler

      Specifies the LDAP listener request handler that should be used to process requests read from clients.
      Parameters:
      requestHandler - The LDAP listener request handler that should be used to process requests read from clients. It must not be null.
    • useKeepAlive

      public boolean useKeepAlive()
      Indicates whether to use the SO_KEEPALIVE socket option for sockets accepted by the listener.
      Returns:
      true if the SO_KEEPALIVE socket option should be used for sockets accepted by the listener, or false if not.
    • setUseKeepAlive

      public void setUseKeepAlive(boolean useKeepAlive)
      Specifies whether to use the SO_KEEPALIVE socket option for sockets accepted by the listener.
      Parameters:
      useKeepAlive - Indicates whether to use the SO_KEEPALIVE socket option for sockets accepted by the listener.
    • useLinger

      public boolean useLinger()
      Indicates whether to use the SO_LINGER socket option for sockets accepted by the listener.
      Returns:
      true if the SO_LINGER socket option should be used for sockets accepted by the listener, or false if not.
    • setUseLinger

      public void setUseLinger(boolean useLinger)
      Specifies whether to use the SO_LINGER socket option for sockets accepted by the listener.
      Parameters:
      useLinger - Indicates whether to use the SO_LINGER socket option for sockets accepted by the listener.
    • useReuseAddress

      public boolean useReuseAddress()
      Indicates whether to use the SO_REUSEADDR socket option for sockets accepted by the listener.
      Returns:
      true if the SO_REUSEADDR socket option should be used for sockets accepted by the listener, or false if not.
    • setUseReuseAddress

      public void setUseReuseAddress(boolean useReuseAddress)
      Specifies whether to use the SO_REUSEADDR socket option for sockets accepted by the listener.
      Parameters:
      useReuseAddress - Indicates whether to use the SO_REUSEADDR socket option for sockets accepted by the listener.
    • useTCPNoDelay

      public boolean useTCPNoDelay()
      Indicates whether to use the TCP_NODELAY socket option for sockets accepted by the listener.
      Returns:
      true if the TCP_NODELAY socket option should be used for sockets accepted by the listener, or false if not.
    • setUseTCPNoDelay

      public void setUseTCPNoDelay(boolean useTCPNoDelay)
      Specifies whether to use the TCP_NODELAY socket option for sockets accepted by the listener.
      Parameters:
      useTCPNoDelay - Indicates whether to use the TCP_NODELAY socket option for sockets accepted by the listener.
    • getListenAddress

      Retrieves the address on which to listen for client connections, if defined.
      Returns:
      The address on which to listen for client connections, or null if it should listen on all available addresses on all interfaces.
    • setListenAddress

      public void setListenAddress(@Nullable InetAddress listenAddress)
      Specifies the address on which to listen for client connections.
      Parameters:
      listenAddress - The address on which to listen for client connections. It may be null to indicate that it should listen on all available addresses on all interfaces.
    • getLingerTimeoutSeconds

      Retrieves the timeout in seconds that should be used if the SO_LINGER socket option is enabled.
      Returns:
      The timeout in seconds that should be used if the SO_LINGER socket option is enabled.
    • setLingerTimeoutSeconds

      public void setLingerTimeoutSeconds(int lingerTimeout)
      Specifies the timeout in seconds that should be used if the SO_LINGER socket option is enabled.
      Parameters:
      lingerTimeout - The timeout in seconds that should be used if the SO_LINGER socket option is enabled. The value must be between 0 and 65535, inclusive.
    • getMaxConnections

      public int getMaxConnections()
      Retrieves the maximum number of concurrent connections that the listener will allow. If a client tries to establish a new connection while the listener already has the maximum number of concurrent connections, then the new connection will be rejected.
      Returns:
      The maximum number of concurrent connections that the listener will allow, or zero if no limit should be enforced.
    • setMaxConnections

      public void setMaxConnections(int maxConnections)
      Specifies the maximum number of concurrent connections that the listener will allow. If a client tries to establish a new connection while the listener already has the maximum number of concurrent connections, then the new connection will be rejected.
      Parameters:
      maxConnections - The maximum number of concurrent connections that the listener will allow. A value that is less than or equal to zero indicates no limit.
    • getMaxMessageSizeBytes

      public int getMaxMessageSizeBytes()
      Retrieves the maximum size in bytes for LDAP messages that will be accepted by this listener.
      Returns:
      The maximum size in bytes for LDAP messages that will be accepted by this listener.
    • setMaxMessageSizeBytes

      public void setMaxMessageSizeBytes(int maxMessageSizeBytes)
      Specifies the maximum size in bytes for LDAP messages that will be accepted by this listener.
      Parameters:
      maxMessageSizeBytes - The maximum size in bytes for LDAP messages that will be accepted by this listener. A value that is less than or equal to zero will use the maximum allowed message size.
    • getReceiveBufferSize

      public int getReceiveBufferSize()
      Retrieves the receive buffer size that should be used for sockets accepted by the listener.
      Returns:
      The receive buffer size that should be used for sockets accepted by the listener, or 0 if the default receive buffer size should be used.
    • setReceiveBufferSize

      public void setReceiveBufferSize(int receiveBufferSize)
      Specifies the receive buffer size that should be used for sockets accepted by the listener. A value less than or equal to zero indicates that the default receive buffer size should be used.
      Parameters:
      receiveBufferSize - The receive buffer size that should be used for sockets accepted by the listener.
    • getSendBufferSize

      public int getSendBufferSize()
      Retrieves the send buffer size that should be used for sockets accepted by the listener.
      Returns:
      The send buffer size that should be used for sockets accepted by the listener, or 0 if the default send buffer size should be used.
    • setSendBufferSize

      public void setSendBufferSize(int sendBufferSize)
      Specifies the send buffer size that should be used for sockets accepted by the listener. A value less than or equal to zero indicates that the default send buffer size should be used.
      Parameters:
      sendBufferSize - The send buffer size that should be used for sockets accepted by the listener.
    • getExceptionHandler

      Retrieves the exception handler that should be notified of any exceptions caught while attempting to accept or interact with a client connection.
      Returns:
      The exception handler that should be notified of any exceptions caught while attempting to accept or interact with a client connection, or null if none is defined.
    • setExceptionHandler

      Specifies the exception handler that should be notified of any exceptions caught while attempting to accept or interact with a client connection.
      Parameters:
      exceptionHandler - The exception handler that should be notified of any exceptions encountered during processing. It may be null if no exception handler should be used.
    • getServerSocketFactory

      Retrieves the factory that will be used to create the server socket that will listen for client connections.
      Returns:
      The factory that will be used to create the server socket that will listen for client connections.
    • setServerSocketFactory

      public void setServerSocketFactory(@Nullable ServerSocketFactory serverSocketFactory)
      Specifies the factory that will be used to create the server socket that will listen for client connections.
      Parameters:
      serverSocketFactory - The factory that will be used to create the server socket that will listen for client connections. It may be null to use the JVM-default server socket factory.
    • requestClientCertificate

      public boolean requestClientCertificate()
      Indicates whether the listener should request that the client present its own certificate chain during TLS negotiation. This will be ignored for non-TLS-based connections.
      Returns:
      true if the listener should request that the client present its own certificate chain during TLS negotiation, or false if not.
    • setRequestClientCertificate

      public void setRequestClientCertificate(boolean requestClientCertificate)
      Specifies whether the listener should request that the client present its own certificate chain during TLS negotiation. This will be ignored for non-TLS-based connections.
      Parameters:
      requestClientCertificate - Indicates whether the listener should request that the client present its own certificate chain during TLS negotiation.
    • requireClientCertificate

      public boolean requireClientCertificate()
      Indicates whether the listener should require that the client present its own certificate chain during TLS negotiation and should fail negotiation if no certificate chain was provided. This will be ignored for non-TLS-based connections, and it will also be ignored if requestClientCertificate returns false.
      Returns:
      true if the listener should require that the client present its own certificate chain during TLS negotiation, or false if TLS negotiation should continue even if the client did not present a certificate chain when requested.
    • setRequireClientCertificate

      public void setRequireClientCertificate(boolean requireClientCertificate)
      Specifies whether the listener should require that the client present its own certificate chain during TLS negotiation and should fail negotiation if no certificate chain was provided. This will be ignored for non-TLS-based connections, and it will also be ignored if requestClientCertificate returns false.
      Parameters:
      requireClientCertificate - Indicates whether the listener should require that the client present its own certificate chain during TLS negotiation.
    • duplicate

      Creates a copy of this configuration that may be altered without impacting this configuration, and which will not be altered by changes to this configuration.
      Returns:
      A copy of this configuration that may be altered without impacting this configuration, and which will not be altered by changes to this configuration.
    • toString

      Retrieves a string representation of this LDAP listener config.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this LDAP listener config.
    • toString

      public void toString(@NotNull StringBuilder buffer)
      Appends a string representation of this LDAP listener config to the provided buffer.
      Parameters:
      buffer - The buffer to which the information should be appended.