Class FHIRDbTenantDatasourceConnectionStrategy
- java.lang.Object
 - 
- com.ibm.fhir.persistence.jdbc.connection.FHIRDbConnectionStrategyBase
 - 
- com.ibm.fhir.persistence.jdbc.connection.FHIRDbTenantDatasourceConnectionStrategy
 
 
 
- 
- All Implemented Interfaces:
 FHIRDbConnectionStrategy,QueryHints
public class FHIRDbTenantDatasourceConnectionStrategy extends FHIRDbConnectionStrategyBase
Hides the logic behind obtaining a JDBCConnectionfrom the DAO code. Uses datasource and tenant ids configured in the fhir-server-config to map directly to a managed datasource. All managed datasources must be available when the server starts. This differs from the proxy datasource strategyFHIRDbPropsConnectionStrategywhich supports dynamic (programmatic) definition of managed datasources. 
- 
- 
Constructor Summary
Constructors Constructor Description FHIRDbTenantDatasourceConnectionStrategy(TransactionSynchronizationRegistry trxSyncRegistry, Action newConnectionAction, boolean enableReadOnlyReplicas)Public constructor. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectiongetConnection()Get a connection to the desired data source identified by the currentFHIRRequestContextFHIRDbFlavorgetFlavor()Get the flavor of the database we are working with to reveal its capabilitiesstatic StringmakeTenantDatasourceJNDIName(String jndiBase, String tenantId, String dsId, boolean readOnly)- 
Methods inherited from class com.ibm.fhir.persistence.jdbc.connection.FHIRDbConnectionStrategyBase
applySearchOptimizerOptions, configure, getConnection, getHintValue, getQueryHints 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
FHIRDbTenantDatasourceConnectionStrategy
public FHIRDbTenantDatasourceConnectionStrategy(TransactionSynchronizationRegistry trxSyncRegistry, Action newConnectionAction, boolean enableReadOnlyReplicas) throws FHIRException
Public constructor. The proxy datasource must be present (registered in JNDI) at server startup.- Throws:
 FHIRPersistenceDBConnectException- if the proxy datasource is not configuredFHIRException
 
 - 
 
- 
Method Detail
- 
makeTenantDatasourceJNDIName
public static String makeTenantDatasourceJNDIName(String jndiBase, String tenantId, String dsId, boolean readOnly)
 
- 
getConnection
public Connection getConnection() throws FHIRPersistenceDBConnectException
Description copied from interface:FHIRDbConnectionStrategyGet a connection to the desired data source identified by the currentFHIRRequestContext- Returns:
 - a 
Connection. Never null. - Throws:
 FHIRPersistenceDBConnectException
 
- 
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- Overrides:
 getFlavorin classFHIRDbConnectionStrategyBase- Returns:
 - the datastore/source flavor from the FHIR configuration
 - Throws:
 FHIRPersistenceDataAccessException- if there is an issue with the configuration
 
 - 
 
 -