Class ConnectionProviderInitiator
- java.lang.Object
-
- org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator
-
- All Implemented Interfaces:
StandardServiceInitiator<ConnectionProvider>
,ServiceInitiator<ConnectionProvider>
public class ConnectionProviderInitiator extends Object implements StandardServiceInitiator<ConnectionProvider>
Instantiates and configures an appropriateConnectionProvider
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ConnectionProviderInitiator.SettingConsumer
-
Field Summary
Fields Modifier and Type Field Description static String
AGROAL_STRATEGY
The strategy for agroal connection poolingstatic String
C3P0_STRATEGY
The strategy for c3p0 connection poolingstatic String
HIKARI_STRATEGY
The strategy for hikari connection poolingstatic String
INJECTION_DATA
No idea.static ConnectionProviderInitiator
INSTANCE
Singleton accessstatic String
PROXOOL_STRATEGY
The strategy for proxool connection poolingstatic String
VIBUR_STRATEGY
The strategy for vibur connection pooling
-
Constructor Summary
Constructors Constructor Description ConnectionProviderInitiator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
consumeSetting(Map<String,Object> settings, ConnectionProviderInitiator.SettingConsumer consumer, String... names)
static Integer
extractIsolation(Map<String,?> settings)
static String
extractSetting(Map<String,Object> settings, String... names)
static Properties
getConnectionProperties(Map<String,Object> properties)
Build the connection properties capable of being passed toDriverManager.getConnection(String, Properties)
forms takingProperties
argument.Class<ConnectionProvider>
getServiceInitiated()
Obtains the service role initiated by this initiator.ConnectionProvider
initiateService(Map<String,Object> configurationValues, ServiceRegistryImplementor registry)
Initiates the managed service.static Integer
interpretIsolation(Object setting)
static String
toIsolationConnectionConstantName(Integer isolation)
Gets theConnection
constant name corresponding to the given isolation.static String
toIsolationNiceName(Integer isolation)
Get the name of a JDBC transaction isolation level
-
-
-
Field Detail
-
INSTANCE
public static final ConnectionProviderInitiator INSTANCE
Singleton access
-
C3P0_STRATEGY
public static final String C3P0_STRATEGY
The strategy for c3p0 connection pooling- See Also:
- Constant Field Values
-
PROXOOL_STRATEGY
public static final String PROXOOL_STRATEGY
The strategy for proxool connection pooling- See Also:
- Constant Field Values
-
HIKARI_STRATEGY
public static final String HIKARI_STRATEGY
The strategy for hikari connection pooling- See Also:
- Constant Field Values
-
VIBUR_STRATEGY
public static final String VIBUR_STRATEGY
The strategy for vibur connection pooling- See Also:
- Constant Field Values
-
AGROAL_STRATEGY
public static final String AGROAL_STRATEGY
The strategy for agroal connection pooling- See Also:
- Constant Field Values
-
INJECTION_DATA
public static final String INJECTION_DATA
No idea. Is this even still used?- See Also:
- Constant Field Values
-
-
Method Detail
-
getServiceInitiated
public Class<ConnectionProvider> getServiceInitiated()
Description copied from interface:ServiceInitiator
Obtains the service role initiated by this initiator. Should be unique within a registry- Specified by:
getServiceInitiated
in interfaceServiceInitiator<ConnectionProvider>
- Returns:
- The service role.
-
initiateService
public ConnectionProvider initiateService(Map<String,Object> configurationValues, ServiceRegistryImplementor registry)
Description copied from interface:StandardServiceInitiator
Initiates the managed service.- Specified by:
initiateService
in interfaceStandardServiceInitiator<ConnectionProvider>
- Parameters:
configurationValues
- The configuration values in effectregistry
- The service registry. Can be used to locate services needed to fulfill initiation.- Returns:
- The initiated service.
-
getConnectionProperties
public static Properties getConnectionProperties(Map<String,Object> properties)
Build the connection properties capable of being passed toDriverManager.getConnection(String, Properties)
forms takingProperties
argument. We seek out all keys in the passed map which start withhibernate.connection.
, using them to create a newProperties
instance. The keys in this newProperties
have thehibernate.connection.
prefix trimmed.- Parameters:
properties
- The map from which to build the connection specific properties.- Returns:
- The connection properties.
-
toIsolationConnectionConstantName
public static String toIsolationConnectionConstantName(Integer isolation)
Gets theConnection
constant name corresponding to the given isolation.- Parameters:
isolation
- The transaction isolation numeric value.- Returns:
- The corresponding Connection constant name.
- Throws:
HibernateException
- If the given isolation does not map to JDBC standard isolation- See Also:
toIsolationNiceName(java.lang.Integer)
-
toIsolationNiceName
public static String toIsolationNiceName(Integer isolation)
Get the name of a JDBC transaction isolation level- Parameters:
isolation
- The transaction isolation numeric value.- Returns:
- a nice human-readable name
- See Also:
toIsolationConnectionConstantName(java.lang.Integer)
-
consumeSetting
public static void consumeSetting(Map<String,Object> settings, ConnectionProviderInitiator.SettingConsumer consumer, String... names)
-
-