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 appropriate
ConnectionProvider.- Author:
- Gavin King, Steve Ebersole, Brett Meyer
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe strategy for agroal connection poolingstatic final StringThe strategy for c3p0 connection poolingstatic final StringThe strategy for hikari connection poolingstatic final StringNo idea.static final ConnectionProviderInitiatorSingleton accessstatic final StringThe strategy for proxool connection poolingstatic final StringThe strategy for oracle ucp connection poolingstatic final StringThe strategy for vibur connection pooling -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconsumeSetting(Map<String, Object> settings, ConnectionProviderInitiator.SettingConsumer consumer, String... names) static IntegerextractIsolation(Map<String, ?> settings) static StringextractSetting(Map<String, Object> settings, String... names) static PropertiesgetConnectionProperties(Map<String, Object> properties) Build the connection properties capable of being passed toDriverManager.getConnection(String, Properties)forms takingPropertiesargument.Obtains the service role initiated by this initiator.initiateService(Map<String, Object> configurationValues, ServiceRegistryImplementor registry) Initiates the managed service.static IntegerinterpretIsolation(Object setting) static StringtoIsolationConnectionConstantName(Integer isolation) Gets theConnectionconstant name corresponding to the given isolation.static StringtoIsolationNiceName(Integer isolation) Get the name of a JDBC transaction isolation level
-
Field Details
-
INSTANCE
Singleton access -
C3P0_STRATEGY
The strategy for c3p0 connection pooling- See Also:
-
PROXOOL_STRATEGY
The strategy for proxool connection pooling- See Also:
-
HIKARI_STRATEGY
The strategy for hikari connection pooling- See Also:
-
VIBUR_STRATEGY
The strategy for vibur connection pooling- See Also:
-
UCP_STRATEGY
The strategy for oracle ucp connection pooling- See Also:
-
AGROAL_STRATEGY
The strategy for agroal connection pooling- See Also:
-
INJECTION_DATA
No idea. Is this even still used?- See Also:
-
-
Constructor Details
-
ConnectionProviderInitiator
public ConnectionProviderInitiator()
-
-
Method Details
-
getServiceInitiated
Description copied from interface:ServiceInitiatorObtains the service role initiated by this initiator. Should be unique within a registry- Specified by:
getServiceInitiatedin interfaceServiceInitiator<ConnectionProvider>- Returns:
- The service role.
-
initiateService
public ConnectionProvider initiateService(Map<String, Object> configurationValues, ServiceRegistryImplementor registry) Description copied from interface:StandardServiceInitiatorInitiates the managed service.- Specified by:
initiateServicein 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
Build the connection properties capable of being passed toDriverManager.getConnection(String, Properties)forms takingPropertiesargument. We seek out all keys in the passed map which start withhibernate.connection., using them to create a newPropertiesinstance. The keys in this newPropertieshave thehibernate.connection.prefix trimmed.- Parameters:
properties- The map from which to build the connection specific properties.- Returns:
- The connection properties.
-
extractIsolation
-
interpretIsolation
-
toIsolationConnectionConstantName
Gets theConnectionconstant 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
Get the name of a JDBC transaction isolation level- Parameters:
isolation- The transaction isolation numeric value.- Returns:
- a nice human-readable name
- See Also:
-
extractSetting
-
consumeSetting
public static void consumeSetting(Map<String, Object> settings, ConnectionProviderInitiator.SettingConsumer consumer, String... names)
-