Class DriverProvisioner
java.lang.Object
com.darkcollective.relix.connectors.std.DriverProvisioner
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe result of a provisioning attempt.static final recordA provisioning outcome plus a human-readable explanation. -
Constructor Summary
ConstructorsConstructorDescriptionDriverProvisioner(DriverCatalog catalog, Path driverDirectory, Fetcher fetcher, boolean enabled) -
Method Summary
Modifier and TypeMethodDescriptionstatic DriverProvisionercreate(boolean enabled) Builds a provisioner from the active catalog, the default driver directory, and an HTTPS fetcher.static DriverProvisionerBuilds a provisioner using a suppliedFetcher— e.g.booleanRegisters every JDBC driver installed in~/.relix/drivers, so a connection can use a driver downloaded by an earlier run.Ensures a driver is available for the given JDBC URL, downloading it if necessary and permitted.
-
Constructor Details
-
DriverProvisioner
public DriverProvisioner(DriverCatalog catalog, Path driverDirectory, Fetcher fetcher, boolean enabled) - Parameters:
catalog- the catalog of downloadable driversdriverDirectory- the directory drivers are downloaded into and loaded fromfetcher- the network seamenabled- whether downloading is permitted (user consent)
-
-
Method Details
-
create
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
Builds a provisioner using a suppliedFetcher— e.g. one that reports download progress to the terminal.- Parameters:
enabled- whether downloading is permittedfetcher- the fetcher used for downloads- Returns:
- a production provisioner
-
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
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
-