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 Object implements FHIRDbConnectionStrategy, QueryHints
Common base for multi-tenant connection strategy implementations
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFHIRDbConnectionStrategyBase(TransactionSynchronizationRegistry trxSyncRegistry, Action newConnectionAction)Protected constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplySearchOptimizerOptions(Connection c)Apply any optimizer options configured to improve search query performance See issue-1911 for details.protected voidconfigure(Connection connection, String tenantId, 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 ConnectiongetConnection(DataSource datasource, String tenantId, String dsId)Get a connection configured for the given tenant and datasourceIdFHIRDbFlavorgetFlavor()Get the flavor of the database we are working with to reveal its capabilitiesStringgetHintValue(String hintProperty)Get the hint value from the configurationQueryHintsgetQueryHints()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(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(Connection connection, String tenantId, 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 Connection getConnection(DataSource datasource, String tenantId, String dsId) throws SQLException, FHIRPersistenceException
Get a connection configured for the given tenant and datasourceId- Parameters:
datasource-tenantId-dsId-- Returns:
- Throws:
SQLExceptionFHIRPersistenceException
-
getFlavor
public FHIRDbFlavor getFlavor() throws FHIRPersistenceDataAccessException
Description copied from interface:FHIRDbConnectionStrategyGet the flavor of the database we are working with to reveal its capabilities- Specified by:
getFlavorin interfaceFHIRDbConnectionStrategy- Returns:
- the datastore/source flavor from the FHIR configuration
- Throws:
FHIRPersistenceDataAccessException- if there is an issue with the configuration
-
getHintValue
public String getHintValue(String hintProperty)
Description copied from interface:QueryHintsGet the hint value from the configuration- Specified by:
getHintValuein interfaceQueryHints- Returns:
-
getQueryHints
public QueryHints getQueryHints()
Description copied from interface:FHIRDbConnectionStrategyAppend the given hint to FHIR search queries- Specified by:
getQueryHintsin interfaceFHIRDbConnectionStrategy- Returns:
-
applySearchOptimizerOptions
public void applySearchOptimizerOptions(Connection c)
Description copied from interface:FHIRDbConnectionStrategyApply any optimizer options configured to improve search query performance See issue-1911 for details.- Specified by:
applySearchOptimizerOptionsin interfaceFHIRDbConnectionStrategy- Parameters:
c- the connection to be configured
-
-