public abstract class HikariCPServiceConfigurationProvider extends ServiceConfigurationProvider
ServiceConfigurationProvider implementation
that provides HikariCPServiceConfiguration instances.buildFor(Set, Properties),
HikariCPServiceConfiguration| Modifier | Constructor and Description |
|---|---|
protected |
HikariCPServiceConfigurationProvider()
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
appliesTo(Properties properties,
System system,
Properties coordinates)
Returns
true if this HikariCPServiceConfigurationProvider is relevant in the
configuration space described by the supplied properties, System and coordinates. |
ServiceConfiguration |
buildFor(Set<? extends System> systems,
Properties coordinates)
Overrides the
ServiceConfigurationProvider.buildFor(Set,
Properties) method to ensure that there is an authoritative System and then, if so,
calls the appliesTo(Properties, System, Properties)
method, and, if that returns true, then calls the create(Properties, System, Properties) method and returns its
result. |
protected HikariCPServiceConfiguration |
create(Properties properties,
System system,
Properties coordinates)
Creates and returns a new
HikariCPServiceConfiguration. |
protected String |
getDataSourceProperty(Properties properties,
System system,
Properties coordinates,
String dataSourceName,
String unprefixedPropertyName)
Returns the value of a property found in the
properties
parameter value, or, failing that, in the supplied System's properties, or,
failing that, in the supplied coordinates parameter
value, that applies to the data source identified by the supplied
dataSourceName parameter, taking into account the
prefix. |
String |
getPrefix()
Returns the prefix with which relevant property names will start.
|
protected void |
installDataSourceProperties(Properties target,
System system,
Properties coordinates,
String dataSourceName)
Installs any discoverable properties that might exist that
pertain to the data source identified by the supplied
dataSourceName into the supplied target Properties object, optionally using the supplied system
and coordinates objects in the process. |
getAuthoritativeSystem, getServiceIdentifierprotected HikariCPServiceConfigurationProvider()
public String getPrefix()
This method never returns null.
Overrides of this method must not return null.
The default implementation of this method returns javax.sql.DataSource.
Undefined behavior will result if the return value of an override of this method is empty.
null prefix with which relevant
property names will startprotected HikariCPServiceConfiguration create(Properties properties, System system, Properties coordinates)
HikariCPServiceConfiguration.
Normally this method is invoked as a result of an invocation
of the buildFor(Set, Properties) method. In these
cases, the appliesTo(Properties, System, Properties)
method will have already been invoked and will have returned
true.
Overrides of this method must not call the buildFor(Set, Properties) method, as an infinite loop may
result.
properties - a Properties instance that can be used
as the basis of a HikariCPServiceConfiguration
implementation; must not be nullsystem - a System determined to be in effect; may,
strictly speaking, be null but ordinarily is non-null and enabledcoordinates - a Properties instance representing the
meta-properties in effect; may be nullnull HikariCPServiceConfigurationNullPointerException - if properties is nullHikariCPServiceConfiguration(Properties,
System, Properties),
buildFor(Set, Properties),
appliesTo(Properties, System, Properties)public final ServiceConfiguration buildFor(Set<? extends System> systems, Properties coordinates)
ServiceConfigurationProvider.buildFor(Set,
Properties) method to ensure that there is an authoritative System and then, if so,
calls the appliesTo(Properties, System, Properties)
method, and, if that returns true, then calls the create(Properties, System, Properties) method and returns its
result.
This method may—and often does—return null.
buildFor in class ServiceConfigurationProvidersystems - a Set of Systems that will help
determine whether a ServiceConfiguration is in effect or
not; may be nullcoordinates - a Properties instance representing the
meta-properties in effect; may be nullServiceConfiguration instance suitable for
the configuration space implied by the supplied Set of
Systems and coordinates, or nullappliesTo(Properties, System, Properties),
create(Properties, System, Properties)protected boolean appliesTo(Properties properties, System system, Properties coordinates)
true if this HikariCPServiceConfigurationProvider is relevant in the
configuration space described by the supplied properties, System and coordinates.
The default implementation of this method:
hikaricp.dataSourceNames.
The value of this property is a comma-separated String
whose components are names of data sources that will ultimately
have Hikari connection pools set up for them.properties, system and coordinates are scanned for those starting with javax.sql.DataSource., and for all names in that subset, the
next period-separated component of the name is taken to be a data
source name. For example, a property named javax.sql.DataSource.test.dataSourceClassName will yield a data
source name of test.installDataSourceProperties(Properties, System, Properties,
String) method is called with the parameters supplied to this
method and the data source name.javax.sql.DataSource.dataSourceName.dataSourceClassName.true
is returned.javax.sql.DataSource.dataSourceName.jdbcUrl.null String then it is
passed to the DriverManager.getDriver(String) method. If
that method invocation results in a non-null return
value, then true is returned.false is returned.properties - a Properties instance that may be used
later by the create(Properties, System, Properties)
method as the basis of a HikariCPServiceConfiguration
implementation; must not be nullsystem - a System determined to be in effect; may,
strictly speaking, be null but ordinarily is non-null and enabledcoordinates - a Properties instance representing the
meta-properties in effect; may be nulltrue if this HikariCPServiceConfigurationProvider applies to the
configuration space implied by the supplied parameters; false otherwiseNullPointerException - if properties is nullprotected void installDataSourceProperties(Properties target, System system, Properties coordinates, String dataSourceName)
dataSourceName into the supplied target Properties object, optionally using the supplied system
and coordinates objects in the process.
The default implementation of this method:
hikaricp.dataSourceName.propertiesPath. If it is found,
then it will be converted to a Path via the Paths.get(String, String...) method.Path identifies a readable file,
then the file is read into a temporary Properties object
via the Properties.load(Reader) method.target will now contain a property named javax.sql.DataSource.dataSourceName.explicitlyConfigured with a String value of true.Properties object
contains as a result of reading the file will be added to target, prefixed with javax.sql.DataSource.dataSourceName..If the supplied dataSourceName is null or
empty, or if the property being
read out of the temporary Properties object already
starts with javax.sql.DataSource., then it is copied into
target without any prefix or modification.
target - the Properties into which data source
properties will be installed; must not be nullsystem - a System determined to be in effect; may,
strictly speaking, be null but ordinarily is non-null and enabledcoordinates - a Properties instance representing the
meta-properties in effect; may be nulldataSourceName - the name of the data source for which
properties should be installed; may be nullNullPointerException - if target is nullprotected final String getDataSourceProperty(Properties properties, System system, Properties coordinates, String dataSourceName, String unprefixedPropertyName)
properties
parameter value, or, failing that, in the supplied System's properties, or,
failing that, in the supplied coordinates parameter
value, that applies to the data source identified by the supplied
dataSourceName parameter, taking into account the
prefix.
This method may return null.
properties - the Properties to check first; must not
be nullsystem - a System determined to be in effect; may,
strictly speaking, be null but ordinarily is non-null and enabledcoordinates - a Properties instance representing the
meta-properties in effect; may be nulldataSourceName - the name of a data source; may be nullunprefixedPropertyName - the "simple" property name being
sought; must not be nullnull if no such
property existsNullPointerException - if properties or unprefixedPropertyName is nullCopyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.