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 AgroalConnectionFactoryConfigurationSupplieraddSecurityProvider(AgroalSecurityProvider provider)Allows setting additionalAgroalSecurityProviderto deal with custom principal/credential types.AgroalConnectionFactoryConfigurationSupplierautoCommit(boolean autoCommitEnabled)Sets the value of auto-commit for connections on the pool.AgroalConnectionFactoryConfigurationSupplierconnectionProviderClass(Class<?> connectionProvider)Sets a class from the JDBC driver to be used as a supplier of connections.AgroalConnectionFactoryConfigurationSupplierconnectionProviderClassName(String connectionProviderName)Attempts to load a JDBC driver class using its fully qualified name.AgroalConnectionFactoryConfigurationSuppliercredential(Object credential)Sets credentials to use in order to authenticate to the database.AgroalConnectionFactoryConfigurationget()AgroalConnectionFactoryConfigurationSupplierinitialSql(String initialSqlString)Sets the SQL command to be executed when a connection is created.AgroalConnectionFactoryConfigurationSupplierjdbcProperty(String key, String value)Allows setting other, unspecified, properties to be passed to the JDBC driver when creating new connections.AgroalConnectionFactoryConfigurationSupplierjdbcTransactionIsolation(int customValue)Allows setting a custom transaction isolation level.AgroalConnectionFactoryConfigurationSupplierjdbcTransactionIsolation(AgroalConnectionFactoryConfiguration.TransactionIsolation transactionIsolationLevel)Sets the transaction isolation level.AgroalConnectionFactoryConfigurationSupplierjdbcUrl(String jdbcUrlString)Sets the database URL to connect to.AgroalConnectionFactoryConfigurationSupplierprincipal(Principal loginPrincipal)Sets the principal to be authenticated in the database.AgroalConnectionFactoryConfigurationSupplierrecoveryCredential(Object credential)Allows providing a different set of credentials for recovery connections.AgroalConnectionFactoryConfigurationSupplierrecoveryPrincipal(Principal loginPrincipal)Allows setting a different principal for recovery connections.AgroalConnectionFactoryConfigurationSuppliertrackJdbcResources(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.
-
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 additionalAgroalSecurityProviderto deal with custom principal/credential types. Default is to haveAgroalDefaultSecurityProviderandAgroalKerberosSecurityProvideravailable 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:
getin interfaceSupplier<AgroalConnectionFactoryConfiguration>
-
-