Class Parameters.Builder<T extends Parameters.Builder<T>>

  • Type Parameters:
    T - the concrete builder type.
    Direct Known Subclasses:
    ClientParameters.Builder, ServerParameters.Builder
    Enclosing class:
    Parameters

    public abstract static class Parameters.Builder<T extends Parameters.Builder<T>>
    extends Object
    Base builder for configuring common KDC communication parameters. Protocol-specific parameter builders extend this class to provide additional configuration and create the corresponding parameter object.
    • Method Detail

      • build

        public abstract Parameters build()
        Builds the parameters using the configuration specified by this builder.
        Returns:
        the configured parameters
      • withAutoStart

        public T withAutoStart​(boolean autoStart)
        Sets whether the communication entity starts automatically.
        Parameters:
        autoStart - true to enable automatic startup; false otherwise.
        Returns:
        this builder.
      • withBindAddress

        public T withBindAddress​(InetSocketAddress bindAddress)
        Sets the local network address to which the communication entity binds.
        Parameters:
        bindAddress - the local bind address.
        Returns:
        this builder.
      • withBindAddress

        public T withBindAddress​(String host,
                                 int port)
        Sets the local host and port to which the communication entity binds.
        Parameters:
        host - the local host name or IP address.
        port - the local port.
        Returns:
        this builder.
      • withBindAddress

        public T withBindAddress​(int port)
        Sets the local port to which the communication entity binds, using the local loopback address as the bind address. A port of 0 allows the system to automatically assign an available port.
        Parameters:
        port - the local port, from 0 through 65535.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if the port is outside the range 0 through 65535.
      • withMaxReceivedBufferSize

        public T withMaxReceivedBufferSize​(int size)
        Sets the maximum size of the receive buffer, in bytes.
        Parameters:
        size - the maximum receive buffer size, in bytes; must be greater than 0.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if size is less than or equal to 0.
      • withMaxSendBufferSize

        public T withMaxSendBufferSize​(int size)
        Sets the maximum size of the send buffer, in bytes.
        Parameters:
        size - the maximum send buffer size, in bytes; must be greater than 0.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if size is less than or equal to 0.
      • withCompressed

        public T withCompressed​(boolean compressed)
        Sets whether compression is enabled for serialized agent data.
        Parameters:
        compressed - true to enable compression; false otherwise.
        Returns:
        this builder.
      • withEncryptionKey

        public T withEncryptionKey​(com.kristensoft.ko.EncryptionKey key)
        Sets the encryption key used to encrypt and decrypt serialized agent data. A value of null disables encryption.
        Parameters:
        key - the encryption key, or null to disable encryption.
        Returns:
        this builder.
      • withCrc

        public T withCrc​(boolean crc)
        Sets whether CRC integrity checking is enabled for serialized agent data.
        Parameters:
        crc - true to enable CRC integrity checking; false otherwise.
        Returns:
        this builder.
      • withConnectionQueuePoolSize

        public T withConnectionQueuePoolSize​(int connectionQueuePoolSize)
        Sets the number of worker threads in the connection queue thread pool.
        Parameters:
        connectionQueuePoolSize - the number of worker threads; must be greater than 0.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if connectionQueuePoolSize is less than or equal to 0.
        See Also:
        Parameters.Defaults.DEFAULT_CONNECTION_QUEUE_POOL_SIZE
      • withWhiteList

        public T withWhiteList​(List<String> whiteList)
        Sets additional class and package entries permitted during deserialization. An entry containing a fully qualified class name permits that class. An entry ending with a period, such as "com.mycompany.", permits classes whose fully qualified names begin with that package prefix. A wildcard entry ("*") permits all classes.
        Parameters:
        whiteList - the class and package whitelist; must not be null and must not contain null or blank entries.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if whiteList is null, or contains a null or blank entry.
      • registerApis

        public T registerApis​(Map<String,​API> apiMap)
        Registers multiple API implementations with this builder. The supplied registrations are added to any APIs already registered with the builder.
        Parameters:
        apiMap - the API registrations to add; must not be null and must not contain null API values.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if apiMap is null or contains a null API value.
      • registerApi

        public <A extends API> T registerApi​(Class<A> apiClazz,
                                             API api)
        Registers an API implementation for the specified API class.
        Type Parameters:
        A - the API type.
        Parameters:
        apiClazz - the API class to register; must not be null.
        api - the API implementation; must not be null.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if apiClazz or api is null.
      • registerApi

        public T registerApi​(String apiClazzName,
                             API api)
        Registers an API implementation using the fully qualified name of the API class.
        Parameters:
        apiClazzName - the fully qualified API class name; must not be null or blank.
        api - the API implementation; must not be null.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if apiClazzName is null or blank, or if api is null.
      • addWhiteListEntry

        public T addWhiteListEntry​(String whitelistEntry)
        Adds a class or package entry to the deserialization whitelist. An entry containing a fully qualified class name permits that class. An entry ending with a period, such as "com.mycompany.", permits classes whose fully qualified names begin with that package prefix. A wildcard entry ("*") permits all classes. Adding a specific entry removes an existing wildcard entry.
        Parameters:
        whitelistEntry - the class or package whitelist entry to add; must not be null or blank.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if whitelistEntry is null or blank.
      • withLatencyMode

        public T withLatencyMode​(boolean on)
        Sets whether latency metrics collection is enabled.
        Parameters:
        on - true to enable latency metrics collection; false otherwise.
        Returns:
        this builder.
      • withLatencyReportingInterval

        public T withLatencyReportingInterval​(long interval)
        Sets the interval at which latency metrics are reported.
        Parameters:
        interval - the latency reporting interval, in milliseconds; must be greater than 0.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if interval is less than or equal to 0.
      • withSerializationFormat

        public T withSerializationFormat​(com.kristensoft.ko.KristenObjectsSerializer.SerializationFormat serializationFormat)
        Sets the serialization format used to serialize agent data.
        Parameters:
        serializationFormat - the serialization format; must not be null.
        Returns:
        this builder.
        Throws:
        IllegalArgumentException - if serializationFormat is null.
        See Also:
        Parameters.Defaults.DEFAULT_SERIALIZATION_MODE