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
ConstructorsConstructorDescriptionAgroalConnectionFactoryConfigurationSupplier(AgroalConnectionFactoryConfiguration existingConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionaddSecurityProvider(AgroalSecurityProvider provider) Allows setting additionalAgroalSecurityProviderto deal with custom principal/credential types.autoCommit(boolean autoCommitEnabled) Sets the value of auto-commit for connections on the pool.connectionProviderClass(Class<?> connectionProvider) Sets a class from the JDBC driver to be used as a supplier of connections.connectionProviderClassName(String connectionProviderName) Attempts to load a JDBC driver class using its fully qualified name.credential(Object credential) Sets credentials to use in order to authenticate to the database.get()initialSql(String initialSqlString) Sets the SQL command to be executed when a connection is created.jdbcProperty(String key, String value) Allows setting other, unspecified, properties to be passed to the JDBC driver when creating new connections.jdbcTransactionIsolation(int customValue) Allows setting a custom transaction isolation level.jdbcTransactionIsolation(AgroalConnectionFactoryConfiguration.TransactionIsolation transactionIsolationLevel) Sets the transaction isolation level.Sets the database URL to connect to.loginTimeout(Duration timeout) Sets the login timeout (in seconds).poolRecovery(boolean poolRecoveryEnabled) Sets the value of pool recovery connections.Sets the principal to be authenticated in the database.readOnly()Sets the value of read-only for connections on the pool.readOnly(boolean readOnlyEnabled) Sets the value of read-only for connections on the pool.recoveryCredential(Object credential) Allows providing a different set of credentials for recovery connections.recoveryPrincipal(Principal loginPrincipal) Allows setting a different principal for recovery connections.trackJdbcResources(boolean trackJdbcResourcesEnabled) Sets if JDBC resources are tracked to be closed if leaked.xaProperty(String key, String value) Allows setting other, unspecified, properties to be passed to the XA Datasource that override JDBC properties.
-
Constructor Details
-
AgroalConnectionFactoryConfigurationSupplier
public AgroalConnectionFactoryConfigurationSupplier() -
AgroalConnectionFactoryConfigurationSupplier
public AgroalConnectionFactoryConfigurationSupplier(AgroalConnectionFactoryConfiguration existingConfiguration)
-
-
Method Details
-
autoCommit
Sets the value of auto-commit for connections on the pool. Default is true. -
readOnly
Sets the value of read-only for connections on the pool. -
readOnly
Sets the value of read-only for connections on the pool. Default is false. -
trackJdbcResources
public AgroalConnectionFactoryConfigurationSupplier trackJdbcResources(boolean trackJdbcResourcesEnabled) Sets if JDBC resources are tracked to be closed if leaked. Default is true. -
loginTimeout
Sets the login timeout (in seconds). Default is 0 (waits indefinitely) -
jdbcUrl
Sets the database URL to connect to. Default is "" -
initialSql
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
Allows setting a custom transaction isolation level. -
addSecurityProvider
public AgroalConnectionFactoryConfigurationSupplier addSecurityProvider(AgroalSecurityProvider provider) Allows setting additionalAgroalSecurityProviderto deal with custom principal/credential types. Default is to haveAgroalDefaultSecurityProviderandAgroalKerberosSecurityProvideravailable by default. -
principal
Sets the principal to be authenticated in the database. Default is to don't perform authentication. -
credential
Sets credentials to use in order to authenticate to the database. Default is to don't provide any credentials. -
poolRecovery
Sets the value of pool recovery connections. Default is true. -
recoveryPrincipal
Allows setting a different principal for recovery connections. -
recoveryCredential
Allows providing a different set of credentials for recovery connections. -
jdbcProperty
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. -
xaProperty
Allows setting other, unspecified, properties to be passed to the XA Datasource that override JDBC properties. NOTE: username and password properties are not allowed, these have to be set using the principal / credentials mechanism. -
get
- Specified by:
getin interfaceSupplier<AgroalConnectionFactoryConfiguration>
-