Class FHIRDbTestConnectionStrategy
- java.lang.Object
- 
- com.ibm.fhir.persistence.jdbc.connection.FHIRDbTestConnectionStrategy
 
- 
- All Implemented Interfaces:
- FHIRDbConnectionStrategy
 
 public class FHIRDbTestConnectionStrategy extends Object implements FHIRDbConnectionStrategy Hides the logic behind obtaining a JDBCConnectionfrom the DAO code. This strategy object is local to a thread, and because we use the same underlying connection to our test database within a transaction, we only need to configure the connection once. We can track this initialization with nothing more complicated than a Boolean flag. Use by unit tests or other scenarios where connections are obtained using an IConnectionProvider implementation, outside the scope of a JEE container. For example, this is used when connecting to in-memory instances of Derby when running persistence layer unit-tests.
- 
- 
Constructor SummaryConstructors Constructor Description FHIRDbTestConnectionStrategy(IConnectionProvider cp, Action action)Public constructor
 - 
Method SummaryAll 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.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 capabilitiesQueryHintsgetQueryHints()Append the given hint to FHIR search queries
 
- 
- 
- 
Constructor Detail- 
FHIRDbTestConnectionStrategypublic FHIRDbTestConnectionStrategy(IConnectionProvider cp, Action action) Public constructor- Parameters:
- cp-
- action-
 
 
- 
 - 
Method Detail- 
getConnectionpublic Connection getConnection() throws FHIRPersistenceDBConnectException Description copied from interface:FHIRDbConnectionStrategyGet a connection to the desired data source identified by the currentFHIRRequestContext- Specified by:
- getConnectionin interface- FHIRDbConnectionStrategy
- Returns:
- a Connection. Never null.
- Throws:
- FHIRPersistenceDBConnectException
 
 - 
getFlavorpublic 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 interface- FHIRDbConnectionStrategy
- Returns:
- the datastore/source flavor from the FHIR configuration
- Throws:
- FHIRPersistenceDataAccessException- if there is an issue with the configuration
 
 - 
getQueryHintspublic QueryHints getQueryHints() Description copied from interface:FHIRDbConnectionStrategyAppend the given hint to FHIR search queries- Specified by:
- getQueryHintsin interface- FHIRDbConnectionStrategy
- Returns:
 
 - 
applySearchOptimizerOptionspublic 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 interface- FHIRDbConnectionStrategy
- Parameters:
- c- the connection to be configured
 
 
- 
 
-