Class FhirCacheTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.fhirfrog.frog.ant.FhirCacheTask
All Implemented Interfaces:
Cloneable

public class FhirCacheTask extends org.apache.tools.ant.Task
Ant task that saves and restores HAPI bootstrap artifacts (committed HAPI Docker image and pg_dump SQL file) to/from a container registry.

Both artifacts are bundled into a single OCI image stored in the registry under registry/cacheImageName:cacheKey, where cacheKey is a 16-character SHA-256 prefix of the concatenated bytes of all keyFiles. The packages.sql dump is baked in as an extra layer (/packages.sql) so that a single pull/push operation handles both artifacts.

Operations:

  • restore — pulls the cache image, extracts packages.sql, and tags the image with imageTag. Logs "cache miss" and exits cleanly if the image is not found in the registry (non-zero docker pull exit code).
  • save — layers packages.sql into the local imageTag Docker image via an ephemeral Dockerfile, then pushes the result to the registry. Skips silently if either artifact is absent (bootstrap did not complete).

When registry is blank the task is a no-op, enabling local development without a registry.

Example


 <fhircache operation="restore"
            registry="ghcr.io/my-org"
            cacheImageName="hapi-erequesting-bootstrap-cache"
            imageTag="hapi-erequesting:0.2.0"
            pgDumpFile=".fhir-frog/packages.sql"
            keyFiles="../sushi-config.yaml,build.properties"/>
 
  • Field Summary

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
     
    void
    setImageTag(String imageTag)
     
    void
    setKeyFiles(String keyFiles)
     
    void
    setOperation(String operation)
     
    void
    setPgDumpFile(String pgDumpFile)
     
    void
    setRegistry(String registry)
     

    Methods inherited from class org.apache.tools.ant.Task

    bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FhirCacheTask

      public FhirCacheTask()
  • Method Details

    • setOperation

      public void setOperation(String operation)
    • setRegistry

      public void setRegistry(String registry)
    • setCacheImageName

      public void setCacheImageName(String n)
    • setImageTag

      public void setImageTag(String imageTag)
    • setPgDumpFile

      public void setPgDumpFile(String pgDumpFile)
    • setKeyFiles

      public void setKeyFiles(String keyFiles)
    • execute

      public void execute() throws org.apache.tools.ant.BuildException
      Overrides:
      execute in class org.apache.tools.ant.Task
      Throws:
      org.apache.tools.ant.BuildException