java.lang.Object
com.darkcollective.relix.connectors.std.DriverProvisioner

public final class DriverProvisioner extends Object
Provisions a JDBC driver on demand: when a connection references a database for which no driver is registered, this looks the driver up in the DriverCatalog, downloads it (with checksum verification) into the driver directory, and registers it — so a database relix has never seen before just works.

Downloading is opt-in: a provisioner created with enabled == false never reaches the network and reports DriverProvisioner.Outcome.DISABLED — network egress is a deliberate user choice (the CLI --download-drivers flag), not a silent default.

  • Constructor Details

    • DriverProvisioner

      public DriverProvisioner(DriverCatalog catalog, Path driverDirectory, Fetcher fetcher, boolean enabled)
      Parameters:
      catalog - the catalog of downloadable drivers
      driverDirectory - the directory drivers are downloaded into and loaded from
      fetcher - the network seam
      enabled - whether downloading is permitted (user consent)
  • Method Details

    • create

      public static DriverProvisioner create(boolean enabled)
      Builds a provisioner from the active catalog, the default driver directory, and an HTTPS fetcher.
      Parameters:
      enabled - whether downloading is permitted
      Returns:
      a production provisioner
    • create

      public static DriverProvisioner create(boolean enabled, Fetcher fetcher)
      Builds a provisioner using a supplied Fetcher — e.g. one that reports download progress to the terminal.
      Parameters:
      enabled - whether downloading is permitted
      fetcher - the fetcher used for downloads
      Returns:
      a production provisioner
    • loadInstalled

      public static List<String> loadInstalled()
      Registers every JDBC driver installed in ~/.relix/drivers, so a connection can use a driver downloaded by an earlier run.

      A host calls this once at startup. A missing directory, or one with no driver JARs, registers nothing.

      Returns:
      one description per driver registered (its class and the JAR it came from), in load order; never null
      Since:
      1.0
    • isEnabled

      public boolean isEnabled()
      Returns:
      whether this provisioner is permitted to download
    • provision

      public DriverProvisioner.Result provision(String jdbcUrl)
      Ensures a driver is available for the given JDBC URL, downloading it if necessary and permitted.
      Parameters:
      jdbcUrl - the connection URL
      Returns:
      the outcome of the attempt