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

public final class DriverCatalog extends Object
A catalog of downloadable JDBC drivers — the manifest that lets relix fetch a driver it does not have locally, complementing the external driver directory.

Each DriverCatalog.Entry maps a JDBC URL scheme prefix (e.g. "jdbc:postgresql:") to one or more downloadable Artifacts (a URL plus a SHA-256 checksum). forUrl(String) resolves the entry whose scheme prefixes a connection URL, so a DriverProvisioner knows what to fetch for jdbc:postgresql://host/db.

A default catalog ships as the relix-drivers.json resource; it can be overridden by a file named in $RELIX_DRIVER_CATALOG. The manifest format is a JSON array of entries:


 [
   { "name": "PostgreSQL", "scheme": "jdbc:postgresql:",
     "artifacts": [ { "url": "https://.../postgresql-42.7.4.jar", "sha256": "…" } ] }
 ]
 
  • Field Details

    • CATALOG_ENV

      public static final String CATALOG_ENV
      Environment variable naming a manifest file that overrides the bundled default.
      See Also:
  • Constructor Details

  • Method Details

    • entries

      public List<DriverCatalog.Entry> entries()
      Returns:
      all catalog entries, in manifest order
    • forUrl

      public Optional<DriverCatalog.Entry> forUrl(String jdbcUrl)
      Finds the catalog entry whose scheme prefixes the given JDBC URL (case-insensitive). When several match, the longest (most specific) scheme wins.
      Parameters:
      jdbcUrl - the connection URL, e.g. "jdbc:postgresql://host/db"
      Returns:
      the matching entry, or empty when no catalog entry covers the URL
    • load

      public static DriverCatalog load()
      Loads the active catalog: the file named by $RELIX_DRIVER_CATALOG if set and present, otherwise the bundled default.
      Returns:
      the resolved catalog
    • bundledDefault

      public static DriverCatalog bundledDefault()
      Returns:
      the catalog bundled as the relix-drivers.json resource
    • parse

      public static DriverCatalog parse(String json)
      Parses a manifest from JSON text.
      Parameters:
      json - the manifest JSON (a top-level array of entries)
      Returns:
      the parsed catalog
      Throws:
      IllegalArgumentException - if the manifest is malformed