Class HapiConfigGenerator

java.lang.Object
org.fhirfrog.frog.ant.ig.HapiConfigGenerator

public class HapiConfigGenerator extends Object
Generates HAPI FHIR application.yaml and application-test.yaml from a PackageClassifier.ClassificationResult.

The generated files configure:

  • Spring datasource pointing to the Docker Compose postgres service
  • hapi.fhir.implementationguides with one entry per R4-compatible package
  • dependencyExcludes on each guide entry listing R5 packages to skip
  • hapi.fhir.logical_urls with standard Australian terminology server patterns
  • hapi.fhir.expunge_enabled: true for server-reset between tests

The bootstrap file (application.yaml) includes packageUrl: entries for any package whose container URL is provided in the packageUrls map, pointing HAPI to local tgz files instead of the registry. The test file (application-test.yaml) is generated without those entries — HAPI v8 fetches packageUrl before checking reloadExisting, so the test container (which has no packages volume) would crash if the entries were present.

  • Constructor Details

    • HapiConfigGenerator

      public HapiConfigGenerator()
  • Method Details

    • generate

      public void generate(PackageClassifier.ClassificationResult result, Map<String,String> packageUrls, Map<String,String> resolvedVersions, Path outputDir) throws IOException
      Writes application.yaml and application-test.yaml to outputDir.

      Both files are generated directly from result and packageUrls — no post-processing or file patching is performed.

      The bootstrap file uses the declared package versions and includes packageUrl: entries so HAPI loads local tgz files instead of the registry. The test file omits packageUrl: entries (HAPI v8 fetches them before checking reloadExisting, which would crash the test container) and substitutes resolvedVersions for any dev/current packages so HAPI finds them in the restored postgres dump without hitting the network.

      Parameters:
      result - the classification result from PackageClassifier
      packageUrls - map from package name to container-local file URL; entries only emitted when present
      resolvedVersions - map from package name to the actual installed version (e.g. "fhir.ph.core" → "current"); used in the test config to replace pseudo-versions like dev
      outputDir - directory to write files into (created if absent)
      Throws:
      IOException