Class AgroalConnectionFactoryConfigurationSupplier
- java.lang.Object
-
- io.agroal.api.configuration.supplier.AgroalConnectionFactoryConfigurationSupplier
-
- All Implemented Interfaces:
Supplier<AgroalConnectionFactoryConfiguration>
public class AgroalConnectionFactoryConfigurationSupplier extends Object implements Supplier<AgroalConnectionFactoryConfiguration>
Builder of AgroalConnectionFactoryConfiguration.- Author:
- Luis Barreiro
-
-
Constructor Summary
Constructors Constructor Description AgroalConnectionFactoryConfigurationSupplier()
AgroalConnectionFactoryConfigurationSupplier(AgroalConnectionFactoryConfiguration existingConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AgroalConnectionFactoryConfigurationSupplier
addSecurityProvider(AgroalSecurityProvider provider)
Allows setting additionalAgroalSecurityProvider
to deal with custom principal/credential types.AgroalConnectionFactoryConfigurationSupplier
autoCommit(boolean autoCommitEnabled)
Sets the value of auto-commit for connections on the pool.AgroalConnectionFactoryConfigurationSupplier
connectionProviderClass(Class<?> connectionProvider)
Sets a class from the JDBC driver to be used as a supplier of connections.AgroalConnectionFactoryConfigurationSupplier
connectionProviderClassName(String connectionProviderName)
Attempts to load a JDBC driver class using its fully qualified name.AgroalConnectionFactoryConfigurationSupplier
credential(Object credential)
Sets credentials to use in order to authenticate to the database.AgroalConnectionFactoryConfiguration
get()
AgroalConnectionFactoryConfigurationSupplier
initialSql(String initialSqlString)
Sets the SQL command to be executed when a connection is created.AgroalConnectionFactoryConfigurationSupplier
jdbcProperty(String key, String value)
Allows setting other, unspecified, properties to be passed to the JDBC driver when creating new connections.AgroalConnectionFactoryConfigurationSupplier
jdbcTransactionIsolation(int customValue)
Allows setting a custom transaction isolation level.AgroalConnectionFactoryConfigurationSupplier
jdbcTransactionIsolation(AgroalConnectionFactoryConfiguration.TransactionIsolation transactionIsolationLevel)
Sets the transaction isolation level.AgroalConnectionFactoryConfigurationSupplier
jdbcUrl(String jdbcUrlString)
Sets the database URL to connect to.AgroalConnectionFactoryConfigurationSupplier
loginTimeout(Duration timeout)
Sets the login timeout (in seconds).AgroalConnectionFactoryConfigurationSupplier
principal(Principal loginPrincipal)
Sets the principal to be authenticated in the database.AgroalConnectionFactoryConfigurationSupplier
recoveryCredential(Object credential)
Allows providing a different set of credentials for recovery connections.AgroalConnectionFactoryConfigurationSupplier
recoveryPrincipal(Principal loginPrincipal)
Allows setting a different principal for recovery connections.AgroalConnectionFactoryConfigurationSupplier
trackJdbcResources(boolean trackJdbcResourcesEnabled)
Sets if JDBC resources are tracked to be closed if leaked.
-
-
-
Constructor Detail
-
AgroalConnectionFactoryConfigurationSupplier
public AgroalConnectionFactoryConfigurationSupplier()
-
AgroalConnectionFactoryConfigurationSupplier
public AgroalConnectionFactoryConfigurationSupplier(AgroalConnectionFactoryConfiguration existingConfiguration)
-
-
Method Detail
-
autoCommit
public AgroalConnectionFactoryConfigurationSupplier autoCommit(boolean autoCommitEnabled)
Sets the value of auto-commit for connections on the pool. Default is true.
-
trackJdbcResources
public AgroalConnectionFactoryConfigurationSupplier trackJdbcResources(boolean trackJdbcResourcesEnabled)
Sets if JDBC resources are tracked to be closed if leaked. Default is true.
-
loginTimeout
public AgroalConnectionFactoryConfigurationSupplier loginTimeout(Duration timeout)
Sets the login timeout (in seconds). Default is 0 (waits indefinitely)
-
jdbcUrl
public AgroalConnectionFactoryConfigurationSupplier jdbcUrl(String jdbcUrlString)
Sets the database URL to connect to. Default is ""
-
initialSql
public AgroalConnectionFactoryConfigurationSupplier initialSql(String initialSqlString)
Sets the SQL command to be executed when a connection is created.
-
connectionProviderClass
public AgroalConnectionFactoryConfigurationSupplier connectionProviderClass(Class<?> connectionProvider)
Sets a class from the JDBC driver to be used as a supplier of connections. Default is null, meaning the driver will be obtained from the URL (using theDriverManager.getDriver(String)
mechanism).
-
connectionProviderClassName
public AgroalConnectionFactoryConfigurationSupplier connectionProviderClassName(String connectionProviderName)
Attempts to load a JDBC driver class using its fully qualified name. The classloader used is the one of this class. This method throws Exception if the class can't be loaded.
-
jdbcTransactionIsolation
public AgroalConnectionFactoryConfigurationSupplier jdbcTransactionIsolation(AgroalConnectionFactoryConfiguration.TransactionIsolation transactionIsolationLevel)
Sets the transaction isolation level. Default is UNDEFINED, meaning that the default isolation level for the JDBC driver is used.
-
jdbcTransactionIsolation
public AgroalConnectionFactoryConfigurationSupplier jdbcTransactionIsolation(int customValue)
Allows setting a custom transaction isolation level.
-
addSecurityProvider
public AgroalConnectionFactoryConfigurationSupplier addSecurityProvider(AgroalSecurityProvider provider)
Allows setting additionalAgroalSecurityProvider
to deal with custom principal/credential types. Default is to haveAgroalDefaultSecurityProvider
andAgroalKerberosSecurityProvider
available by default.
-
principal
public AgroalConnectionFactoryConfigurationSupplier principal(Principal loginPrincipal)
Sets the principal to be authenticated in the database. Default is to don't perform authentication.
-
credential
public AgroalConnectionFactoryConfigurationSupplier credential(Object credential)
Sets credentials to use in order to authenticate to the database. Default is to don't provide any credentials.
-
recoveryPrincipal
public AgroalConnectionFactoryConfigurationSupplier recoveryPrincipal(Principal loginPrincipal)
Allows setting a different principal for recovery connections.
-
recoveryCredential
public AgroalConnectionFactoryConfigurationSupplier recoveryCredential(Object credential)
Allows providing a different set of credentials for recovery connections.
-
jdbcProperty
public AgroalConnectionFactoryConfigurationSupplier jdbcProperty(String key, String value)
Allows setting other, unspecified, properties to be passed to the JDBC driver when creating new connections. NOTE: username and password properties are not allowed, these have to be set using the principal / credentials mechanism.
-
get
public AgroalConnectionFactoryConfiguration get()
- Specified by:
get
in interfaceSupplier<AgroalConnectionFactoryConfiguration>
-
-