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 interfaceConnectionProviderInitiator.SettingConsumer
-
Field Summary
Fields Modifier and Type Field Description static StringAGROAL_STRATEGYThe strategy for agroal connection poolingstatic StringC3P0_STRATEGYThe strategy for c3p0 connection poolingstatic StringHIKARI_STRATEGYThe strategy for hikari connection poolingstatic StringINJECTION_DATANo idea.static ConnectionProviderInitiatorINSTANCESingleton accessstatic StringPROXOOL_STRATEGYThe strategy for proxool connection poolingstatic StringUCP_STRATEGYThe strategy for oracle ucp connection poolingstatic StringVIBUR_STRATEGYThe 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 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.Class<ConnectionProvider>getServiceInitiated()Obtains the service role initiated by this initiator.ConnectionProviderinitiateService(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 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
-
UCP_STRATEGY
public static final String UCP_STRATEGY
The strategy for oracle ucp 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: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
public static Properties getConnectionProperties(Map<String,Object> properties)
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.
-
toIsolationConnectionConstantName
public static String toIsolationConnectionConstantName(Integer isolation)
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(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)
-
-