public class PgConnectOptions extends SqlConnectOptions
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DATABASE |
static String |
DEFAULT_HOST |
static String |
DEFAULT_PASSWORD |
static int |
DEFAULT_PIPELINING_LIMIT |
static int |
DEFAULT_PORT |
static Map<String,String> |
DEFAULT_PROPERTIES |
static SslMode |
DEFAULT_SSLMODE |
static String |
DEFAULT_USER |
DEFAULT_CACHE_PREPARED_STATEMENTS, DEFAULT_PREPARED_STATEMENT_CACHE_FILTER, DEFAULT_PREPARED_STATEMENT_CACHE_MAX_SIZE, DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT
DEFAULT_HOSTNAME_VERIFICATION_ALGORITHM, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_RECONNECT_INTERVAL
DEFAULT_CONNECT_TIMEOUT, DEFAULT_METRICS_NAME, DEFAULT_TRUST_ALL
DEFAULT_ENABLED_SECURE_TRANSPORT_PROTOCOLS, DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_SO_LINGER, DEFAULT_SSL, DEFAULT_SSL_ENGINE, DEFAULT_SSL_HANDSHAKE_TIMEOUT, DEFAULT_SSL_HANDSHAKE_TIMEOUT_TIME_UNIT, DEFAULT_TCP_CORK, DEFAULT_TCP_FAST_OPEN, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_USE_ALPN, DEFAULT_USE_POOLED_BUFFERS
DEFAULT_LOG_ENABLED, DEFAULT_RECEIVE_BUFFER_SIZE, DEFAULT_REUSE_ADDRESS, DEFAULT_REUSE_PORT, DEFAULT_SEND_BUFFER_SIZE, DEFAULT_TRAFFIC_CLASS
Constructor and Description |
---|
PgConnectOptions() |
PgConnectOptions(JsonObject json) |
PgConnectOptions(PgConnectOptions other) |
PgConnectOptions(SqlConnectOptions other) |
Modifier and Type | Method and Description |
---|---|
PgConnectOptions |
addCrlPath(String crlPath)
Add a CRL path
|
PgConnectOptions |
addCrlValue(Buffer crlValue)
Add a CRL value
|
PgConnectOptions |
addEnabledCipherSuite(String suite)
Add an enabled cipher suite, appended to the ordered suites.
|
PgConnectOptions |
addEnabledSecureTransportProtocol(String protocol)
Add an enabled SSL/TLS protocols, appended to the ordered protocols.
|
PgConnectOptions |
addProperty(String key,
String value)
Add a property for this client, which will be sent to server at the connection start.
|
boolean |
equals(Object o) |
static PgConnectOptions |
fromEnv()
Provide a
PgConnectOptions configured with environment variables, if the environment variable
is not set, then a default value will take precedence over this. |
static PgConnectOptions |
fromUri(String connectionUri)
Provide a
PgConnectOptions configured from a connection URI. |
int |
getPipeliningLimit() |
SslMode |
getSslMode() |
int |
hashCode() |
protected void |
init()
Initialize with the default options.
|
boolean |
isUsingDomainSocket() |
PgConnectOptions |
setCachePreparedStatements(boolean cachePreparedStatements)
Set whether prepared statements cache should be enabled.
|
PgConnectOptions |
setConnectTimeout(int connectTimeout)
Set the connect timeout
|
PgConnectOptions |
setDatabase(String database)
Specify the default database for the connection.
|
PgConnectOptions |
setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols)
Sets the list of enabled SSL/TLS protocols.
|
PgConnectOptions |
setHost(String host)
Specify the host for connecting to the server.
|
PgConnectOptions |
setHostnameVerificationAlgorithm(String hostnameVerificationAlgorithm)
Set the hostname verification algorithm interval
To disable hostname verification, set hostnameVerificationAlgorithm to an empty String
|
PgConnectOptions |
setIdleTimeout(int idleTimeout)
Set the idle timeout, default time unit is seconds.
|
PgConnectOptions |
setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
Set the idle timeout unit.
|
PgConnectOptions |
setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) |
PgConnectOptions |
setKeyCertOptions(KeyCertOptions options)
Set the key/cert options.
|
PgConnectOptions |
setKeyStoreOptions(JksOptions options)
Set the key/cert options in jks format, aka Java keystore.
|
PgConnectOptions |
setLocalAddress(String localAddress)
Set the local interface to bind for network connections.
|
PgConnectOptions |
setLogActivity(boolean logEnabled)
Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.
|
PgConnectOptions |
setMetricsName(String metricsName)
Set the metrics name identifying the reported metrics, useful for grouping metrics
with the same name.
|
PgConnectOptions |
setOpenSslEngineOptions(OpenSSLEngineOptions sslEngineOptions) |
PgConnectOptions |
setPassword(String password)
Specify the user password to be used for the authentication.
|
PgConnectOptions |
setPemKeyCertOptions(PemKeyCertOptions options)
Set the key/cert store options in pem format.
|
PgConnectOptions |
setPemTrustOptions(PemTrustOptions options)
Set the trust options in pem format
|
PgConnectOptions |
setPfxKeyCertOptions(PfxOptions options)
Set the key/cert options in pfx format.
|
PgConnectOptions |
setPfxTrustOptions(PfxOptions options)
Set the trust options in pfx format
|
PgConnectOptions |
setPipeliningLimit(int pipeliningLimit) |
PgConnectOptions |
setPort(int port)
Specify the port for connecting to the server.
|
PgConnectOptions |
setPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)
Set the maximum number of prepared statements that the connection will cache.
|
PgConnectOptions |
setPreparedStatementCacheSqlFilter(java.util.function.Predicate<String> predicate)
Set a predicate filtering prepared statements that the connection will cache.
|
PgConnectOptions |
setPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)
Set the maximum length of prepared statement SQL string that the connection will cache.
|
PgConnectOptions |
setProperties(Map<String,String> properties)
Set properties for this client, which will be sent to server at the connection start.
|
PgConnectOptions |
setProxyOptions(ProxyOptions proxyOptions)
Set proxy options for connections via CONNECT proxy (e.g.
|
PgConnectOptions |
setReceiveBufferSize(int receiveBufferSize)
Set the TCP receive buffer size
|
PgConnectOptions |
setReconnectAttempts(int attempts)
Set the value of reconnect attempts
|
PgConnectOptions |
setReconnectInterval(long interval)
Set the reconnect interval
|
PgConnectOptions |
setReuseAddress(boolean reuseAddress)
Set the value of reuse address
|
PgConnectOptions |
setReusePort(boolean reusePort)
Set the value of reuse port.
|
PgConnectOptions |
setSendBufferSize(int sendBufferSize)
Set the TCP send buffer size
|
PgConnectOptions |
setSoLinger(int soLinger)
Set whether SO_linger keep alive is enabled
|
PgConnectOptions |
setSsl(boolean ssl)
Set whether SSL/TLS is enabled
|
PgConnectOptions |
setSslEngineOptions(SSLEngineOptions sslEngineOptions)
Set to use SSL engine implementation to use.
|
PgConnectOptions |
setSslHandshakeTimeout(long sslHandshakeTimeout)
Set the SSL handshake timeout, default time unit is seconds.
|
PgConnectOptions |
setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit)
Set the SSL handshake timeout unit.
|
PgConnectOptions |
setSslMode(SslMode sslmode)
Set
SslMode for the client, this option can be used to provide different levels of secure protection. |
PgConnectOptions |
setTcpCork(boolean tcpCork)
Enable the
TCP_CORK option - only with linux native transport. |
PgConnectOptions |
setTcpFastOpen(boolean tcpFastOpen)
Enable the
TCP_FASTOPEN option - only with linux native transport. |
PgConnectOptions |
setTcpKeepAlive(boolean tcpKeepAlive)
Set whether TCP keep alive is enabled
|
PgConnectOptions |
setTcpNoDelay(boolean tcpNoDelay)
Set whether TCP no delay is enabled
|
PgConnectOptions |
setTcpQuickAck(boolean tcpQuickAck)
Enable the
TCP_QUICKACK option - only with linux native transport. |
PgConnectOptions |
setTrafficClass(int trafficClass)
Set the value of traffic class
|
PgConnectOptions |
setTrustAll(boolean trustAll)
Set whether all server certificates should be trusted
|
PgConnectOptions |
setTrustOptions(TrustOptions options)
Set the trust options.
|
PgConnectOptions |
setTrustStoreOptions(JksOptions options)
Set the trust options in jks format, aka Java truststore
|
PgConnectOptions |
setUseAlpn(boolean useAlpn)
Set the ALPN usage.
|
PgConnectOptions |
setUser(String user)
Specify the user account to be used for the authentication.
|
JsonObject |
toJson()
Convert to JSON
|
getCachePreparedStatements, getDatabase, getHost, getPassword, getPort, getPreparedStatementCacheMaxSize, getPreparedStatementCacheSqlFilter, getProperties, getUser
getHostnameVerificationAlgorithm, getReconnectAttempts, getReconnectInterval, removeEnabledSecureTransportProtocol, setUsePooledBuffers
getConnectTimeout, getLocalAddress, getMetricsName, getProxyOptions, isTrustAll, setTcpUserTimeout
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getJdkSslEngineOptions, getKeyCertOptions, getKeyStoreOptions, getOpenSslEngineOptions, getPemKeyCertOptions, getPemTrustOptions, getPfxKeyCertOptions, getPfxTrustOptions, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getTcpUserTimeout, getTrustOptions, getTrustStoreOptions, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn, isUsePooledBuffers
getLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePort
public static final String DEFAULT_HOST
public static int DEFAULT_PORT
public static final String DEFAULT_DATABASE
public static final String DEFAULT_USER
public static final String DEFAULT_PASSWORD
public static final int DEFAULT_PIPELINING_LIMIT
public static final SslMode DEFAULT_SSLMODE
public PgConnectOptions()
public PgConnectOptions(JsonObject json)
public PgConnectOptions(SqlConnectOptions other)
public PgConnectOptions(PgConnectOptions other)
public static PgConnectOptions fromUri(String connectionUri) throws IllegalArgumentException
PgConnectOptions
configured from a connection URI.connectionUri
- the connection URI to configure fromPgConnectOptions
parsed from the connection URIIllegalArgumentException
- when the connectionUri
is in an invalid formatpublic static PgConnectOptions fromEnv()
PgConnectOptions
configured with environment variables, if the environment variable
is not set, then a default value will take precedence over this.public PgConnectOptions setHost(String host)
SqlConnectOptions
setHost
in class SqlConnectOptions
host
- the host to specifypublic PgConnectOptions setPort(int port)
SqlConnectOptions
setPort
in class SqlConnectOptions
port
- the port to specifypublic PgConnectOptions setUser(String user)
SqlConnectOptions
setUser
in class SqlConnectOptions
user
- the user to specifypublic PgConnectOptions setPassword(String password)
SqlConnectOptions
setPassword
in class SqlConnectOptions
password
- the password to specifypublic PgConnectOptions setDatabase(String database)
SqlConnectOptions
setDatabase
in class SqlConnectOptions
database
- the database name to specifypublic int getPipeliningLimit()
public PgConnectOptions setPipeliningLimit(int pipeliningLimit)
public PgConnectOptions setCachePreparedStatements(boolean cachePreparedStatements)
SqlConnectOptions
setCachePreparedStatements
in class SqlConnectOptions
cachePreparedStatements
- true if cache should be enabledpublic PgConnectOptions setPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)
SqlConnectOptions
setPreparedStatementCacheMaxSize
in class SqlConnectOptions
preparedStatementCacheMaxSize
- the size to setpublic PgConnectOptions setPreparedStatementCacheSqlFilter(java.util.function.Predicate<String> predicate)
SqlConnectOptions
The default predicate accepts predicate having query length < SqlConnectOptions.DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT
setPreparedStatementCacheSqlFilter
in class SqlConnectOptions
predicate
- the filterpublic PgConnectOptions setPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)
SqlConnectOptions
This is an helper setting the SqlConnectOptions.setPreparedStatementCacheSqlFilter(Predicate)
.
setPreparedStatementCacheSqlLimit
in class SqlConnectOptions
preparedStatementCacheSqlLimit
- the maximum length limit of SQL string to setpublic PgConnectOptions setProperties(Map<String,String> properties)
SqlConnectOptions
setProperties
in class SqlConnectOptions
properties
- the value of properties to specifypublic PgConnectOptions addProperty(String key, String value)
SqlConnectOptions
addProperty
in class SqlConnectOptions
key
- the value of property keyvalue
- the value of property valuepublic SslMode getSslMode()
public PgConnectOptions setSslMode(SslMode sslmode)
SslMode
for the client, this option can be used to provide different levels of secure protection.sslmode
- the value of sslmodepublic PgConnectOptions setSendBufferSize(int sendBufferSize)
NetworkOptions
setSendBufferSize
in class NetClientOptions
sendBufferSize
- the buffers size, in bytespublic PgConnectOptions setReceiveBufferSize(int receiveBufferSize)
NetworkOptions
setReceiveBufferSize
in class NetClientOptions
receiveBufferSize
- the buffers size, in bytespublic PgConnectOptions setReuseAddress(boolean reuseAddress)
NetworkOptions
setReuseAddress
in class NetClientOptions
reuseAddress
- the value of reuse addresspublic PgConnectOptions setTrafficClass(int trafficClass)
NetworkOptions
setTrafficClass
in class NetClientOptions
trafficClass
- the value of traffic classpublic PgConnectOptions setTcpNoDelay(boolean tcpNoDelay)
TCPSSLOptions
setTcpNoDelay
in class NetClientOptions
tcpNoDelay
- true if TCP no delay is enabled (Nagle disabled)public PgConnectOptions setTcpKeepAlive(boolean tcpKeepAlive)
TCPSSLOptions
setTcpKeepAlive
in class NetClientOptions
tcpKeepAlive
- true if TCP keep alive is enabledpublic PgConnectOptions setSoLinger(int soLinger)
TCPSSLOptions
setSoLinger
in class NetClientOptions
soLinger
- true if SO_linger is enabledpublic PgConnectOptions setIdleTimeout(int idleTimeout)
TCPSSLOptions
TCPSSLOptions.setIdleTimeoutUnit(TimeUnit)
setIdleTimeout
in class NetClientOptions
idleTimeout
- the timeout, in secondspublic PgConnectOptions setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
TCPSSLOptions
setIdleTimeoutUnit
in class NetClientOptions
idleTimeoutUnit
- specify time unit.public PgConnectOptions setSsl(boolean ssl)
TCPSSLOptions
setSsl
in class NetClientOptions
ssl
- true if enabledpublic PgConnectOptions setKeyCertOptions(KeyCertOptions options)
TCPSSLOptions
setKeyCertOptions
in class NetClientOptions
options
- the key store optionspublic PgConnectOptions setKeyStoreOptions(JksOptions options)
TCPSSLOptions
setKeyStoreOptions
in class NetClientOptions
options
- the key store in jks formatpublic PgConnectOptions setPfxKeyCertOptions(PfxOptions options)
TCPSSLOptions
setPfxKeyCertOptions
in class NetClientOptions
options
- the key cert options in pfx formatpublic PgConnectOptions setPemKeyCertOptions(PemKeyCertOptions options)
TCPSSLOptions
setPemKeyCertOptions
in class NetClientOptions
options
- the options in pem formatpublic PgConnectOptions setTrustOptions(TrustOptions options)
TCPSSLOptions
setTrustOptions
in class NetClientOptions
options
- the trust optionspublic PgConnectOptions setTrustStoreOptions(JksOptions options)
TCPSSLOptions
setTrustStoreOptions
in class NetClientOptions
options
- the trust options in jks formatpublic PgConnectOptions setPemTrustOptions(PemTrustOptions options)
TCPSSLOptions
setPemTrustOptions
in class NetClientOptions
options
- the trust options in pem formatpublic PgConnectOptions setPfxTrustOptions(PfxOptions options)
TCPSSLOptions
setPfxTrustOptions
in class NetClientOptions
options
- the trust options in pfx formatpublic PgConnectOptions addEnabledCipherSuite(String suite)
TCPSSLOptions
addEnabledCipherSuite
in class NetClientOptions
suite
- the suitepublic PgConnectOptions addEnabledSecureTransportProtocol(String protocol)
TCPSSLOptions
addEnabledSecureTransportProtocol
in class NetClientOptions
protocol
- the SSL/TLS protocol to enablepublic PgConnectOptions addCrlPath(String crlPath) throws NullPointerException
TCPSSLOptions
addCrlPath
in class NetClientOptions
crlPath
- the pathNullPointerException
public PgConnectOptions addCrlValue(Buffer crlValue) throws NullPointerException
TCPSSLOptions
addCrlValue
in class NetClientOptions
crlValue
- the valueNullPointerException
public PgConnectOptions setTrustAll(boolean trustAll)
ClientOptionsBase
setTrustAll
in class NetClientOptions
trustAll
- true if all should be trustedpublic PgConnectOptions setConnectTimeout(int connectTimeout)
ClientOptionsBase
setConnectTimeout
in class NetClientOptions
connectTimeout
- connect timeout, in mspublic PgConnectOptions setMetricsName(String metricsName)
ClientOptionsBase
setMetricsName
in class NetClientOptions
metricsName
- the metrics namepublic PgConnectOptions setReconnectAttempts(int attempts)
NetClientOptions
setReconnectAttempts
in class NetClientOptions
attempts
- the maximum number of reconnect attemptspublic PgConnectOptions setHostnameVerificationAlgorithm(String hostnameVerificationAlgorithm)
NetClientOptions
setHostnameVerificationAlgorithm
in class NetClientOptions
hostnameVerificationAlgorithm
- should be HTTPS, LDAPS or an empty Stringpublic PgConnectOptions setLogActivity(boolean logEnabled)
NetworkOptions
setLogActivity
in class NetClientOptions
logEnabled
- true for logging the network activitypublic PgConnectOptions setReconnectInterval(long interval)
NetClientOptions
setReconnectInterval
in class NetClientOptions
interval
- the reconnect interval in mspublic PgConnectOptions setProxyOptions(ProxyOptions proxyOptions)
ClientOptionsBase
setProxyOptions
in class NetClientOptions
proxyOptions
- proxy options objectpublic PgConnectOptions setLocalAddress(String localAddress)
ClientOptionsBase
setLocalAddress
in class NetClientOptions
localAddress
- the local addresspublic PgConnectOptions setUseAlpn(boolean useAlpn)
TCPSSLOptions
setUseAlpn
in class NetClientOptions
useAlpn
- true when Application-Layer Protocol Negotiation should be usedpublic PgConnectOptions setSslEngineOptions(SSLEngineOptions sslEngineOptions)
TCPSSLOptions
setSslEngineOptions
in class NetClientOptions
sslEngineOptions
- the ssl engine to usepublic PgConnectOptions setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions)
setJdkSslEngineOptions
in class NetClientOptions
public PgConnectOptions setOpenSslEngineOptions(OpenSSLEngineOptions sslEngineOptions)
setOpenSslEngineOptions
in class NetClientOptions
public PgConnectOptions setReusePort(boolean reusePort)
NetworkOptions
setReusePort
in class NetClientOptions
reusePort
- the value of reuse portpublic PgConnectOptions setTcpFastOpen(boolean tcpFastOpen)
TCPSSLOptions
TCP_FASTOPEN
option - only with linux native transport.setTcpFastOpen
in class NetClientOptions
tcpFastOpen
- the fast open valuepublic PgConnectOptions setTcpCork(boolean tcpCork)
TCPSSLOptions
TCP_CORK
option - only with linux native transport.setTcpCork
in class NetClientOptions
tcpCork
- the cork valuepublic PgConnectOptions setTcpQuickAck(boolean tcpQuickAck)
TCPSSLOptions
TCP_QUICKACK
option - only with linux native transport.setTcpQuickAck
in class NetClientOptions
tcpQuickAck
- the quick ack valuepublic PgConnectOptions setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols)
TCPSSLOptions
setEnabledSecureTransportProtocols
in class NetClientOptions
enabledSecureTransportProtocols
- the SSL/TLS protocols to enablepublic PgConnectOptions setSslHandshakeTimeout(long sslHandshakeTimeout)
TCPSSLOptions
setSslHandshakeTimeout
in class NetClientOptions
sslHandshakeTimeout
- the SSL handshake timeout to set, in millisecondspublic PgConnectOptions setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit)
TCPSSLOptions
setSslHandshakeTimeoutUnit
in class NetClientOptions
sslHandshakeTimeoutUnit
- specify time unit.protected void init()
init
in class SqlConnectOptions
public JsonObject toJson()
ClientOptionsBase
toJson
in class SqlConnectOptions
public boolean equals(Object o)
equals
in class NetClientOptions
public int hashCode()
hashCode
in class NetClientOptions
public boolean isUsingDomainSocket()
Copyright © 2023 Eclipse. All rights reserved.