Generate datasource file to put in configOverrides from schema tool input
Now that issue #1694 makes liberty datasources the default, it would be good to have a way to generate the datasource file based on the input to the schema tool and write that file to a specified path (e.g. the configOverrides/defaults directory).
Describe the solution you'd like Update schema tool with new parameter of where to write the generated datasource file.
Describe alternatives you've considered None yet.
Acceptance Criteria At least one acceptance criteria is included.
GIVEN input to schema tool includes option to output datasource file WHEN schema tool run (w/ onboard, or possibly new option) THEN datasource file written to desired file location
Additional context None yet.
Notes on a possible implementation.
Input needed: -DB_TYPE (db2 or postgresql): From "db.type" of ibm-fhir-schematool properties file -TENANT: From "tenant.name" of ibm-fhir-schematool properties file -DSID: (default to default??? Or add new property???) -SERVER_NAME: From "db.host" of ibm-fhir-schematool properties file -PORT_NUMBER: From "db.port" of ibm-fhir-schematool properties file -DATABASE_NAME: From "db.database" of ibm-fhir-schematool properties file -USER: From "user" of ibm-fhir-schematool properties file -PASSWORD: From "password" of ibm-fhir-schematool properties file -CURRENT_SCHEMA: From "schema.name.fhir" of ibm-fhir-schematool properties file (defaults to FHIRDATA) -statementCacheSize??? (default to 200) -syncQueryTimeoutWithTransactionTimeout??? (default to true) -maxPoolSize??? (default to 200; 50 for derby???) -minPoolSize??? (default to 40; 10 for derby???)
Generate a file like this and write it to a specified file path (i.e. <liberty_root>/servers/fhir-server/configDropins/defaults/datasource.xml):
<server>
<library id="fhirSharedLib">
<fileset dir="${shared.resource.dir}/lib/db2" includes="*.jar"/>
</library>
<!-- ============================================================== -->
<!-- TENANT: <TENANT>; DSID: <DSID>; TYPE: read-write -->
<!-- ============================================================== -->
<dataSource id="fhir<TENANT><DSID>" jndiName="jdbc/fhir_<TENANT>_<DSID>" type="javax.sql.XADataSource" statementCacheSize="200" syncQueryTimeoutWithTransactionTimeout="true">
<jdbcDriver javax.sql.XADataSource="<com.ibm.db2.jcc.DB2XADataSource or org.postgresql.xa.PGXADataSource based on DB_TYPE>" libraryRef="fhirSharedLib"/>
<properties.<db2.jcc or postgresql based on DB_TYPE>
serverName="<SERVER_NAME>"
portNumber="<PORT_NUMBER>"
user="<USER>"
password="<PASSWORD>"
databaseName="<DATABASE_NAME>"
currentSchema="<CURRENT_SCHEMA>"
/>
<connectionManager maxPoolSize="200" minPoolSize="40"/>
</dataSource>
</server>