Class FHIRDbConnectionStrategyBase
- java.lang.Object
-
- com.ibm.fhir.persistence.jdbc.connection.FHIRDbConnectionStrategyBase
-
- All Implemented Interfaces:
FHIRDbConnectionStrategy
,QueryHints
- Direct Known Subclasses:
FHIRDbTenantDatasourceConnectionStrategy
public abstract class FHIRDbConnectionStrategyBase extends java.lang.Object implements FHIRDbConnectionStrategy, QueryHints
Common base for multi-tenant connection strategy implementations
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FHIRDbConnectionStrategyBase(javax.transaction.TransactionSynchronizationRegistry trxSyncRegistry, Action newConnectionAction)
Protected constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applySearchOptimizerOptions(java.sql.Connection c, boolean isCompartment)
Apply any optimizer options configured to improve search query performance See issue-1911 for details.protected void
configure(java.sql.Connection connection, java.lang.String tenantId, java.lang.String dsId)
Check with the transaction sync registry to see if this is the first time we've worked with this connection in the current transaction.protected java.sql.Connection
getConnection(javax.sql.DataSource datasource, java.lang.String tenantId, java.lang.String dsId)
Get a connection configured for the given tenant and datasourceIdFHIRDbFlavor
getFlavor()
Get the flavor of the database we are working with to reveal its capabilitiesjava.lang.String
getHintValue(java.lang.String hintProperty)
Get the hint value from the configurationQueryHints
getQueryHints()
Append the given hint to FHIR search queries-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ibm.fhir.persistence.jdbc.connection.FHIRDbConnectionStrategy
getConnection
-
-
-
-
Constructor Detail
-
FHIRDbConnectionStrategyBase
protected FHIRDbConnectionStrategyBase(javax.transaction.TransactionSynchronizationRegistry trxSyncRegistry, Action newConnectionAction) throws FHIRPersistenceDataAccessException
Protected constructor- Parameters:
trxSyncRegistry
- the transaction sync registrynewConnectionAction
- actions to apply when a connection is created- Throws:
FHIRPersistenceDataAccessException
-
-
Method Detail
-
configure
protected void configure(java.sql.Connection connection, java.lang.String tenantId, java.lang.String dsId) throws FHIRPersistenceException
Check with the transaction sync registry to see if this is the first time we've worked with this connection in the current transaction.- Parameters:
connection
- the new connectiontenantId
- the tenant to which the connection belongsdsId
- the datasource in the tenant to which the connection belongs- Throws:
FHIRPersistenceException
-
getConnection
protected java.sql.Connection getConnection(javax.sql.DataSource datasource, java.lang.String tenantId, java.lang.String dsId) throws java.sql.SQLException, FHIRPersistenceException
Get a connection configured for the given tenant and datasourceId- Parameters:
datasource
-tenantId
-dsId
-- Returns:
- Throws:
java.sql.SQLException
FHIRPersistenceException
-
getFlavor
public FHIRDbFlavor getFlavor() throws FHIRPersistenceDataAccessException
Description copied from interface:FHIRDbConnectionStrategy
Get the flavor of the database we are working with to reveal its capabilities- Specified by:
getFlavor
in interfaceFHIRDbConnectionStrategy
- Returns:
- the datastore/source flavor from the FHIR configuration
- Throws:
FHIRPersistenceDataAccessException
- if there is an issue with the configuration
-
getHintValue
public java.lang.String getHintValue(java.lang.String hintProperty)
Description copied from interface:QueryHints
Get the hint value from the configuration- Specified by:
getHintValue
in interfaceQueryHints
- Returns:
-
getQueryHints
public QueryHints getQueryHints()
Description copied from interface:FHIRDbConnectionStrategy
Append the given hint to FHIR search queries- Specified by:
getQueryHints
in interfaceFHIRDbConnectionStrategy
- Returns:
-
applySearchOptimizerOptions
public void applySearchOptimizerOptions(java.sql.Connection c, boolean isCompartment)
Description copied from interface:FHIRDbConnectionStrategy
Apply any optimizer options configured to improve search query performance See issue-1911 for details.- Specified by:
applySearchOptimizerOptions
in interfaceFHIRDbConnectionStrategy
- Parameters:
c
- the connection to be configuredisCompartment
- true if the query is a compartment-based search
-
-