Class FHIRDbTenantDatasourceConnectionStrategy
- java.lang.Object
-
- org.linuxforhealth.fhir.persistence.jdbc.connection.FHIRDbConnectionStrategyBase
-
- org.linuxforhealth.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(javax.transaction.TransactionSynchronizationRegistry trxSyncRegistry, Action newConnectionAction, boolean enableReadOnlyReplicas)Public constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.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 java.lang.StringmakeTenantDatasourceJNDIName(java.lang.String jndiBase, java.lang.String tenantId, java.lang.String dsId, boolean readOnly)-
Methods inherited from class org.linuxforhealth.fhir.persistence.jdbc.connection.FHIRDbConnectionStrategyBase
applySearchOptimizerOptions, configure, getConnection, getHintValue, getQueryHints
-
-
-
-
Constructor Detail
-
FHIRDbTenantDatasourceConnectionStrategy
public FHIRDbTenantDatasourceConnectionStrategy(javax.transaction.TransactionSynchronizationRegistry trxSyncRegistry, Action newConnectionAction, boolean enableReadOnlyReplicas) throws FHIRExceptionPublic 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 java.lang.String makeTenantDatasourceJNDIName(java.lang.String jndiBase, java.lang.String tenantId, java.lang.String dsId, boolean readOnly)
-
getConnection
public java.sql.Connection getConnection() throws FHIRPersistenceDBConnectExceptionDescription 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
-
-