public class DefaultConfiguration extends Object implements Configuration
DSLContext
, if no
custom configuration was supplied to DSL.using(Configuration)
.
The DefaultConfiguration
Constructor and Description |
---|
DefaultConfiguration()
Create a new "empty" configuration object.
|
Modifier and Type | Method and Description |
---|---|
ConnectionProvider |
connectionProvider()
Get this configuration's underlying connection provider.
|
ConverterProvider |
converterProvider()
Get the configured
ConverterProvider from this
configuration. |
ConcurrentHashMap<Object,Object> |
data()
Get all custom data from this
Configuration . |
Object |
data(Object key)
Get some custom data from this
Configuration . |
Object |
data(Object key,
Object value)
Set some custom data to this
Configuration . |
Configuration |
derive()
Create a derived configuration from this one, without changing any
properties.
|
Configuration |
derive(Connection newConnection)
Create a derived configuration from this one, with a new connection
wrapped in a
DefaultConnectionProvider . |
Configuration |
derive(ConnectionProvider newConnectionProvider)
Create a derived configuration from this one, with a new connection
provider.
|
Configuration |
derive(ConverterProvider newConverterProvider)
Create a derived configuration from this one, with new converter
provider.
|
Configuration |
derive(DataSource newDataSource)
Create a derived configuration from this one, with a new data source
wrapped in a
DataSourceConnectionProvider . |
Configuration |
derive(ExecuteListener... newExecuteListeners)
Create a derived configuration from this one, with new execute listeners.
|
Configuration |
derive(ExecuteListenerProvider... newExecuteListenerProviders)
Create a derived configuration from this one, with new execute listener
providers.
|
Configuration |
derive(Executor newExecutor)
Create a derived configuration from this one, with a new executor.
|
Configuration |
derive(ExecutorProvider newExecutorProvider)
Create a derived configuration from this one, with a new executor
provider.
|
Configuration |
derive(RecordListener... newRecordListeners)
Create a derived configuration from this one, with new record listeners.
|
Configuration |
derive(RecordListenerProvider... newRecordListenerProviders)
Create a derived configuration from this one, with new record listener
providers.
|
Configuration |
derive(RecordMapper<?,?> newRecordMapper)
Create a derived configuration from this one, with a new record mapper.
|
Configuration |
derive(RecordMapperProvider newRecordMapperProvider)
Create a derived configuration from this one, with a new record mapper
provider.
|
Configuration |
derive(Settings newSettings)
Create a derived configuration from this one, with new settings.
|
Configuration |
derive(SQLDialect newDialect)
Create a derived configuration from this one, with a new dialect.
|
Configuration |
derive(TransactionListener... newTransactionListeners)
Create a derived configuration from this one, with new transaction
listeners.
|
Configuration |
derive(TransactionListenerProvider... newTransactionListenerProviders)
Create a derived configuration from this one, with new transaction
listener providers.
|
Configuration |
derive(TransactionProvider newTransactionProvider)
Create a derived configuration from this one, with a new transaction
provider.
|
Configuration |
derive(VisitListener... newVisitListeners)
Create a derived configuration from this one, with new visit listeners.
|
Configuration |
derive(VisitListenerProvider... newVisitListenerProviders)
Create a derived configuration from this one, with new visit listener
providers.
|
SQLDialect |
dialect()
Retrieve the configured dialect.
|
ExecuteListenerProvider[] |
executeListenerProviders()
Get the configured
ExecuteListenerProvider s from this
configuration. |
ExecutorProvider |
executorProvider()
Get this configuration's underlying executor provider.
|
SQLDialect |
family()
Retrieve the family of the configured dialect.
|
RecordListenerProvider[] |
recordListenerProviders()
Get the configured
RecordListenerProvider s from this
configuration. |
RecordMapperProvider |
recordMapperProvider()
Get this configuration's underlying record mapper provider.
|
SchemaMapping |
schemaMapping()
Deprecated.
|
Configuration |
set(Connection newConnection)
Change this configuration to hold a new connection wrapped in a
DefaultConnectionProvider . |
Configuration |
set(ConnectionProvider newConnectionProvider)
Change this configuration to hold a new connection provider.
|
Configuration |
set(ConverterProvider newConverterProvider)
Change this configuration to hold a new converter provider.
|
Configuration |
set(DataSource newDataSource)
Change this configuration to hold a new data source wrapped in a
DataSourceConnectionProvider . |
Configuration |
set(ExecuteListener... newExecuteListeners)
Change this configuration to hold a new execute listeners.
|
Configuration |
set(ExecuteListenerProvider... newExecuteListenerProviders)
Change this configuration to hold a new execute listener providers.
|
Configuration |
set(Executor newExecutor)
Change this configuration to hold a new executor.
|
Configuration |
set(ExecutorProvider newExecutorProvider)
Change this configuration to hold a new executor provider.
|
Configuration |
set(RecordListener... newRecordListeners)
Change this configuration to hold a new record listeners.
|
Configuration |
set(RecordListenerProvider... newRecordListenerProviders)
Change this configuration to hold a new record listener providers.
|
Configuration |
set(RecordMapper<?,?> newRecordMapper)
Change this configuration to hold a new record mapper.
|
Configuration |
set(RecordMapperProvider newRecordMapperProvider)
Change this configuration to hold a new record mapper provider.
|
Configuration |
set(Settings newSettings)
Change this configuration to hold a new settings.
|
Configuration |
set(SQLDialect newDialect)
Change this configuration to hold a new dialect.
|
Configuration |
set(TransactionListener... newTransactionListeners)
Change this configuration to hold a new transaction listeners.
|
Configuration |
set(TransactionListenerProvider... newTransactionListenerProviders)
Change this configuration to hold a new transaction listener providers.
|
Configuration |
set(TransactionProvider newTransactionProvider)
Change this configuration to hold a new transaction provider.
|
Configuration |
set(VisitListener... newVisitListeners)
Change this configuration to hold a new visit listeners.
|
Configuration |
set(VisitListenerProvider... newVisitListenerProviders)
Change this configuration to hold a new visit listener providers.
|
void |
setConnection(Connection newConnection) |
void |
setConnectionProvider(ConnectionProvider newConnectionProvider) |
void |
setDataSource(DataSource newDataSource) |
void |
setExecuteListenerProvider(ExecuteListenerProvider... newExecuteListenerProviders) |
void |
setExecutorProvider(ExecutorProvider newExecutorProvider) |
void |
setRecordListenerProvider(RecordListenerProvider... newRecordListenerProviders) |
void |
setRecordMapperProvider(RecordMapperProvider newRecordMapperProvider) |
void |
setSettings(Settings newSettings) |
void |
setSQLDialect(SQLDialect newDialect) |
Settings |
settings()
Retrieve the runtime configuration settings.
|
void |
setTransactionListenerProvider(TransactionListenerProvider... newTransactionListenerProviders) |
void |
setTransactionProvider(TransactionProvider newTransactionProvider) |
void |
setVisitListenerProvider(VisitListenerProvider... newVisitListenerProviders) |
String |
toString() |
TransactionListenerProvider[] |
transactionListenerProviders()
Get the configured
TransactionListenerProvider s from this
configuration. |
TransactionProvider |
transactionProvider()
Get this configuration's underlying transaction provider.
|
VisitListenerProvider[] |
visitListenerProviders()
TODO [#2667]
|
public DefaultConfiguration()
This can be used as is, as a "dummy" configuration object, or as a base
implementation for creating more sophisticated "derived" configurations
through the various derive()
or set()
methods.
public final Configuration derive()
Configuration
derive
in interface Configuration
public final Configuration derive(Connection newConnection)
Configuration
DefaultConnectionProvider
.derive
in interface Configuration
newConnection
- The new connection to be contained in the derived
configuration.public final Configuration derive(DataSource newDataSource)
Configuration
DataSourceConnectionProvider
.derive
in interface Configuration
newDataSource
- The new data source to be contained in the derived
configuration.public final Configuration derive(ConnectionProvider newConnectionProvider)
Configuration
derive
in interface Configuration
newConnectionProvider
- The new connection provider to be contained
in the derived configuration.public final Configuration derive(Executor newExecutor)
Configuration
This will wrap the argument Executor
in a
DefaultExecutorProvider
for convenience.
derive
in interface Configuration
newExecutor
- The new executor to be contained in the derived
configuration.public final Configuration derive(ExecutorProvider newExecutorProvider)
Configuration
derive
in interface Configuration
newExecutorProvider
- The new executor provider to be contained in
the derived configuration.public final Configuration derive(TransactionProvider newTransactionProvider)
Configuration
derive
in interface Configuration
newTransactionProvider
- The new transaction provider to be
contained in the derived configuration.public final Configuration derive(RecordMapper<?,?> newRecordMapper)
Configuration
This will wrap the argument RecordMapper
in a
DefaultRecordMapperProvider
for convenience.
derive
in interface Configuration
newRecordMapper
- The new record mapper to be contained in the
derived configuration.public final Configuration derive(RecordMapperProvider newRecordMapperProvider)
Configuration
derive
in interface Configuration
newRecordMapperProvider
- The new record mapper provider to be
contained in the derived configuration.public final Configuration derive(RecordListener... newRecordListeners)
Configuration
This will wrap the argument RecordListener
in a
DefaultRecordListenerProvider
for convenience.
derive
in interface Configuration
newRecordListeners
- The new record listeners to be contained in the
derived configuration.public final Configuration derive(RecordListenerProvider... newRecordListenerProviders)
Configuration
derive
in interface Configuration
newRecordListenerProviders
- The new record listener providers to
be contained in the derived configuration.public final Configuration derive(ExecuteListener... newExecuteListeners)
Configuration
This will wrap the argument ExecuteListener
in a
DefaultExecuteListenerProvider
for convenience.
derive
in interface Configuration
newExecuteListeners
- The new execute listener to be contained in
the derived configuration.public final Configuration derive(ExecuteListenerProvider... newExecuteListenerProviders)
Configuration
derive
in interface Configuration
newExecuteListenerProviders
- The new execute listener providers to
be contained in the derived configuration.public final Configuration derive(VisitListener... newVisitListeners)
Configuration
This will wrap the argument VisitListener
in a
DefaultVisitListenerProvider
for convenience.
derive
in interface Configuration
newVisitListeners
- The new visit listeners to be contained in the
derived configuration.public final Configuration derive(VisitListenerProvider... newVisitListenerProviders)
Configuration
derive
in interface Configuration
newVisitListenerProviders
- The new visit listener providers to
be contained in the derived configuration.public final Configuration derive(TransactionListener... newTransactionListeners)
Configuration
This will wrap the argument TransactionListener
in a
DefaultTransactionListenerProvider
for convenience.
derive
in interface Configuration
newTransactionListeners
- The new transaction listeners to be
contained in the derived configuration.public final Configuration derive(TransactionListenerProvider... newTransactionListenerProviders)
Configuration
derive
in interface Configuration
newTransactionListenerProviders
- The new transaction listener
providers to be contained in the derived configuration.public final Configuration derive(ConverterProvider newConverterProvider)
Configuration
derive
in interface Configuration
newConverterProvider
- The new converter provider to be contained in
the derived configuration.public final Configuration derive(SQLDialect newDialect)
Configuration
derive
in interface Configuration
newDialect
- The new dialect to be contained in the derived
configuration.public final Configuration derive(Settings newSettings)
Configuration
derive
in interface Configuration
newSettings
- The new settings to be contained in the derived
configuration.public final Configuration set(Connection newConnection)
Configuration
DefaultConnectionProvider
.
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newConnection
- The new connection to be contained in the changed
configuration.public final Configuration set(DataSource newDataSource)
Configuration
DataSourceConnectionProvider
.
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
public final Configuration set(ConnectionProvider newConnectionProvider)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newConnectionProvider
- The new connection provider to be contained
in the changed configuration.public final Configuration set(Executor newExecutor)
Configuration
This will wrap the argument Executor
in a
DefaultExecutorProvider
for convenience.
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
public final Configuration set(ExecutorProvider newExecutorProvider)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newExecutorProvider
- The new executor provider to be contained in
the changed configuration.public final Configuration set(TransactionProvider newTransactionProvider)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newTransactionProvider
- The new transaction provider to be
contained in the changed configuration.public Configuration set(RecordMapper<?,?> newRecordMapper)
Configuration
This will wrap the argument RecordMapper
in a
DefaultRecordMapperProvider
for convenience.
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
public final Configuration set(RecordMapperProvider newRecordMapperProvider)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newRecordMapperProvider
- The new record mapper provider to be
contained in the changed configuration.public final Configuration set(RecordListener... newRecordListeners)
Configuration
This will wrap the argument RecordListener
in a
DefaultRecordListenerProvider
for convenience.
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newRecordListeners
- The new record listener to be contained
in the changed configuration.public final Configuration set(RecordListenerProvider... newRecordListenerProviders)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newRecordListenerProviders
- The new record listener providers to
be contained in the changed configuration.public final Configuration set(ExecuteListener... newExecuteListeners)
Configuration
This will wrap the argument ExecuteListener
in a
DefaultExecuteListenerProvider
for convenience.
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newExecuteListeners
- The new execute listeners to be contained in
the changed configuration.public final Configuration set(ExecuteListenerProvider... newExecuteListenerProviders)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newExecuteListenerProviders
- The new execute listener providers to
be contained in the changed configuration.public final Configuration set(VisitListener... newVisitListeners)
Configuration
This will wrap the argument VisitListener
in a
DefaultVisitListenerProvider
for convenience.
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newVisitListeners
- The new visit listeners to be contained
in the changed configuration.public final Configuration set(VisitListenerProvider... newVisitListenerProviders)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newVisitListenerProviders
- The new visit listener providers to
be contained in the changed configuration.public final Configuration set(TransactionListener... newTransactionListeners)
Configuration
This will wrap the argument TransactionListener
in a
DefaultTransactionListenerProvider
for convenience.
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newTransactionListeners
- The new transaction listeners to be
contained in the changed configuration.public final Configuration set(TransactionListenerProvider... newTransactionListenerProviders)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newTransactionListenerProviders
- The new transaction listener
providers to be contained in the changed configuration.public final Configuration set(ConverterProvider newConverterProvider)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newConverterProvider
- The new converter provider to be contained in
the changed configuration.public final Configuration set(SQLDialect newDialect)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newDialect
- The new dialect to be contained in the changed
configuration.public final Configuration set(Settings newSettings)
Configuration
This method is not thread-safe and should not be used in globally
available Configuration
objects.
set
in interface Configuration
newSettings
- The new settings to be contained in the changed
configuration.public final void setConnection(Connection newConnection)
set(Connection)
public final void setDataSource(DataSource newDataSource)
set(DataSource)
public final void setConnectionProvider(ConnectionProvider newConnectionProvider)
set(ConnectionProvider)
public final void setExecutorProvider(ExecutorProvider newExecutorProvider)
set(ExecutorProvider)
public final void setTransactionProvider(TransactionProvider newTransactionProvider)
set(TransactionProvider)
public final void setRecordMapperProvider(RecordMapperProvider newRecordMapperProvider)
set(RecordMapperProvider)
public final void setRecordListenerProvider(RecordListenerProvider... newRecordListenerProviders)
set(RecordListenerProvider[])
public final void setExecuteListenerProvider(ExecuteListenerProvider... newExecuteListenerProviders)
set(ExecuteListenerProvider[])
public final void setVisitListenerProvider(VisitListenerProvider... newVisitListenerProviders)
set(VisitListenerProvider[])
public final void setTransactionListenerProvider(TransactionListenerProvider... newTransactionListenerProviders)
set(TransactionListenerProvider[])
public final void setSQLDialect(SQLDialect newDialect)
set(SQLDialect)
public final void setSettings(Settings newSettings)
set(Settings)
public final ConnectionProvider connectionProvider()
Configuration
connectionProvider
in interface Configuration
public final ExecutorProvider executorProvider()
Configuration
Asynchronous operations will call back to this SPI to obtain an executor.
This applies, for example, to ResultQuery.fetchAsync()
.
The following logic is applied when resolving the appropriate
executor
:
Configuration.executorProvider()
does not return
null
, then ExecutorProvider.provide()
is called to
obtain an Executor
for the asynchronous task.ForkJoinPool.commonPool()
is
used if ForkJoinPool.getCommonPoolParallelism()
> 1
Executor
is used in any
other case.
The SPI will not be called if an asynchronous operation explicitly
overrides the Executor
, e.g. as is the case for
ResultQuery.fetchAsync(Executor)
.
executorProvider
in interface Configuration
public final TransactionProvider transactionProvider()
Configuration
If no explicit transaction provider was specified, and if
Configuration.connectionProvider()
is a DefaultConnectionProvider
,
then this will return a DefaultTransactionProvider
.
transactionProvider
in interface Configuration
public final RecordMapperProvider recordMapperProvider()
Configuration
recordMapperProvider
in interface Configuration
public final RecordListenerProvider[] recordListenerProviders()
Configuration
RecordListenerProvider
s from this
configuration.
This method allows for retrieving the configured
RecordListenerProvider
from this configuration. The
providers will provide jOOQ with RecordListener
instances. These
instances receive record manipulation notification events every time jOOQ
executes queries. jOOQ makes no assumptions about the internal state of
these listeners, i.e. listener instances may
Configuration
's lifecycle (i.e. that of a
JDBC Connection
, or that of a transaction)RecordContext
(i.e. that of a
single record manipulation)recordListenerProviders
in interface Configuration
RecordListenerProvider
,
RecordListener
,
RecordContext
public final ExecuteListenerProvider[] executeListenerProviders()
Configuration
ExecuteListenerProvider
s from this
configuration.
This method allows for retrieving the configured
ExecuteListenerProvider
from this configuration. The
providers will provide jOOQ with ExecuteListener
instances. These
instances receive execution lifecycle notification events every time jOOQ
executes queries. jOOQ makes no assumptions about the internal state of
these listeners, i.e. listener instances may
Configuration
's lifecycle (i.e. that of a
JDBC Connection
, or that of a transaction)ExecuteContext
(i.e. that of a
single query execution)
Note, depending on your Settings.isExecuteLogging()
, some
additional listeners may be prepended to this list, internally. Those
listeners will never be exposed through this method, though.
executeListenerProviders
in interface Configuration
ExecuteListenerProvider
,
ExecuteListener
,
ExecuteContext
public final VisitListenerProvider[] visitListenerProviders()
Configuration
visitListenerProviders
in interface Configuration
public final TransactionListenerProvider[] transactionListenerProviders()
Configuration
TransactionListenerProvider
s from this
configuration.transactionListenerProviders
in interface Configuration
public final ConverterProvider converterProvider()
Configuration
ConverterProvider
from this
configuration.converterProvider
in interface Configuration
public final SQLDialect dialect()
Configuration
dialect
in interface Configuration
public final SQLDialect family()
Configuration
family
in interface Configuration
public final Settings settings()
Configuration
settings
in interface Configuration
public final ConcurrentHashMap<Object,Object> data()
Configuration
Configuration
.
This is custom data that was previously set to the configuration using
Configuration.data(Object, Object)
. Use custom data if you want to pass data
to your custom QueryPart
or ExecuteListener
objects to be
made available at render, bind, execution, fetch time.
See ExecuteListener
for more details.
data
in interface Configuration
null
ExecuteListener
public final Object data(Object key)
Configuration
Configuration
.
This is custom data that was previously set to the configuration using
Configuration.data(Object, Object)
. Use custom data if you want to pass data
to your custom QueryPart
or ExecuteListener
objects to be
made available at render, bind, execution, fetch time.
See ExecuteListener
for more details.
data
in interface Configuration
key
- A key to identify the custom datanull
if no such data is contained
in this Configuration
ExecuteListener
public final Object data(Object key, Object value)
Configuration
Configuration
.
Use custom data if you want to pass data to your custom QueryPart
or ExecuteListener
objects to be made available at render, bind,
execution, fetch time.
Be sure that your custom data implements Serializable
if you want
to serialise this Configuration
or objects referencing this
Configuration
, e.g. your Record
types.
See ExecuteListener
for more details.
data
in interface Configuration
key
- A key to identify the custom datavalue
- The custom datanull
if no data
was previously set for the given keyExecuteListener
@Deprecated public final SchemaMapping schemaMapping()
Configuration
schemaMapping
in interface Configuration
Copyright © 2017. All Rights Reserved.