Package io.pravega.client
Class ClientConfig.ClientConfigBuilder
- java.lang.Object
-
- io.pravega.client.ClientConfig.ClientConfigBuilder
-
- Enclosing class:
- ClientConfig
public static final class ClientConfig.ClientConfigBuilder extends java.lang.Object
This class overrides the lombok builder. It adds some custom functionality on top of the builder. The additional behaviors include: 1. Defining a default controller URI when none is declared/ 2. Extracting the credentials object from system properties/environment in following order of descending preference: a. User provides a credential object. This overrides any other settings. b. System properties: System properties are defined in the format: "pravega.client.auth.*" c. Environment variables. Environment variables are defined under the format "pravega_client_auth_*" d. In case of option 2 and 3, the caller can decide whether the class needs to be loaded dynamically by setting property `pravega.client.auth.loadDynamic` to true.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClientConfig
build()
ClientConfig.ClientConfigBuilder
controllerURI(java.net.URI controllerURI)
controllerURI The controller rpc URI.ClientConfig.ClientConfigBuilder
credentials(io.pravega.shared.security.auth.Credentials credentials)
Credentials to be passed on to the Pravega controller for authentication and authorization.ClientConfig.ClientConfigBuilder
enableTlsToController(boolean value)
ClientConfig.ClientConfigBuilder
enableTlsToSegmentStore(boolean value)
ClientConfig.ClientConfigBuilder
isDefaultMaxConnections(boolean isDefaultMaxConnections)
An internal property that determines if the client config.ClientConfig.ClientConfigBuilder
maxConnectionsPerSegmentStore(int maxConnectionsPerSegmentStore)
ClientConfig.ClientConfigBuilder
metricListener(io.pravega.shared.metrics.MetricListener metricListener)
An optional listener which can be used to get performance metrics from the client.java.lang.String
toString()
ClientConfig.ClientConfigBuilder
trustStore(java.lang.String trustStore)
Path to an optional truststore.ClientConfig.ClientConfigBuilder
validateHostName(boolean validateHostName)
If the flagClientConfig.isEnableTls()
is set, this flag decides whether to enable host name validation or not.
-
-
-
Method Detail
-
maxConnectionsPerSegmentStore
public ClientConfig.ClientConfigBuilder maxConnectionsPerSegmentStore(int maxConnectionsPerSegmentStore)
-
enableTlsToController
public ClientConfig.ClientConfigBuilder enableTlsToController(boolean value)
-
enableTlsToSegmentStore
public ClientConfig.ClientConfigBuilder enableTlsToSegmentStore(boolean value)
-
build
public ClientConfig build()
-
controllerURI
public ClientConfig.ClientConfigBuilder controllerURI(java.net.URI controllerURI)
controllerURI The controller rpc URI. This can be of 2 types 1. tcp://ip1:port1,ip2:port2,... This is used if the controller endpoints are static and can be directly accessed. 2. pravega://ip1:port1,ip2:port2,... This is used to autodiscovery the controller endpoints from an initial controller list.- Parameters:
controllerURI
- The controller RPC URI.- Returns:
this
.
-
credentials
public ClientConfig.ClientConfigBuilder credentials(io.pravega.shared.security.auth.Credentials credentials)
Credentials to be passed on to the Pravega controller for authentication and authorization.- Parameters:
credentials
- Pravega controller credentials for authentication and authorization.- Returns:
this
.
-
trustStore
public ClientConfig.ClientConfigBuilder trustStore(java.lang.String trustStore)
Path to an optional truststore. If this is null or empty, the default JVM trust store is used. This is currently expected to be a signing certificate for the certification authority.- Parameters:
trustStore
- Path to an optional truststore.- Returns:
this
.
-
validateHostName
public ClientConfig.ClientConfigBuilder validateHostName(boolean validateHostName)
If the flagClientConfig.isEnableTls()
is set, this flag decides whether to enable host name validation or not.- Parameters:
validateHostName
- Flag to decide whether to enable host name validation or not.- Returns:
this
.
-
isDefaultMaxConnections
public ClientConfig.ClientConfigBuilder isDefaultMaxConnections(boolean isDefaultMaxConnections)
An internal property that determines if the client config.- Returns:
this
.
-
metricListener
public ClientConfig.ClientConfigBuilder metricListener(io.pravega.shared.metrics.MetricListener metricListener)
An optional listener which can be used to get performance metrics from the client. The user can implement this interface to obtain performance metrics of the client.- Parameters:
metricListener
- Listener to collect client performance metrics.- Returns:
this
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-