Package com.ibm.fhir.schema.derby
Class DerbyFhirDatabase
- java.lang.Object
-
- com.ibm.fhir.schema.derby.DerbyFhirDatabase
-
- All Implemented Interfaces:
IConnectionProvider,AutoCloseable
public class DerbyFhirDatabase extends Object implements AutoCloseable, IConnectionProvider
An Apache Derby implementation of the IBM FHIR Server database (useful for supporting unit tests).
-
-
Constructor Summary
Constructors Constructor Description DerbyFhirDatabase()The default constructor will initialize the database at "derby/fhirDB".DerbyFhirDatabase(String dbPath)Construct a Derby database at the specified path and deploy the IBM FHIR Server schema.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcommitTransaction()Commit the current transaction if there's an actual connection associated with this thread (i.e.VersionHistoryServicecreateVersionHistoryService()Create the version history table and a simple service which is used to access information from it.voiddescribe(String arg0, StringBuilder arg1, String arg2)Describe self, for writing configuration information to log file for test record purposesConnectiongetConnection()Obtain a new connection to a data-source which this provider has been configured for.IDatabaseTranslatorgetTranslator()Get the translator associated with this connection provider.voidpopulateResourceTypeAndParameterNameTableEntries()prepopulates the bootstrapped derby database with static lookup data.voidrollbackTransaction()Roll back the transaction for the connection associated with this thread, if one exists-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ibm.fhir.database.utils.api.IConnectionProvider
getPoolSize
-
-
-
-
Constructor Detail
-
DerbyFhirDatabase
public DerbyFhirDatabase() throws SQLExceptionThe default constructor will initialize the database at "derby/fhirDB".- Throws:
SQLException
-
DerbyFhirDatabase
public DerbyFhirDatabase(String dbPath) throws SQLException
Construct a Derby database at the specified path and deploy the IBM FHIR Server schema.- Throws:
SQLException
-
-
Method Detail
-
populateResourceTypeAndParameterNameTableEntries
public void populateResourceTypeAndParameterNameTableEntries() throws SQLExceptionprepopulates the bootstrapped derby database with static lookup data.- Throws:
SQLException
-
createVersionHistoryService
public VersionHistoryService createVersionHistoryService() throws SQLException
Create the version history table and a simple service which is used to access information from it.- Throws:
SQLException
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
commitTransaction
public void commitTransaction() throws SQLExceptionDescription copied from interface:IConnectionProviderCommit the current transaction if there's an actual connection associated with this thread (i.e. if getConnection() has been called at least once), otherwise do nothing.- Specified by:
commitTransactionin interfaceIConnectionProvider- Throws:
SQLException
-
describe
public void describe(String arg0, StringBuilder arg1, String arg2)
Description copied from interface:IConnectionProviderDescribe self, for writing configuration information to log file for test record purposes- Specified by:
describein interfaceIConnectionProvider
-
getConnection
public Connection getConnection() throws SQLException
Description copied from interface:IConnectionProviderObtain a new connection to a data-source which this provider has been configured for.- Specified by:
getConnectionin interfaceIConnectionProvider- Returns:
- Throws:
SQLException
-
getTranslator
public IDatabaseTranslator getTranslator()
Description copied from interface:IConnectionProviderGet the translator associated with this connection provider. Supports interpretation of SQLExceptions and the ability to tweak SQL statements to handle differences between DB2 and Derby- Specified by:
getTranslatorin interfaceIConnectionProvider- Returns:
-
rollbackTransaction
public void rollbackTransaction() throws SQLExceptionDescription copied from interface:IConnectionProviderRoll back the transaction for the connection associated with this thread, if one exists- Specified by:
rollbackTransactionin interfaceIConnectionProvider- Throws:
SQLException
-
-