Class ConnectorProvisioner
connectorType for which no RelixConnector is registered, this
looks the plugin up in the ConnectorCatalog, downloads its artifacts
(the connector JAR + its driver/runtime JARs, each checksum-verified) into the
connector directory, and reports the outcome — the caller then rebuilds its
ConnectorRegistry to pick up the new plugin. It is the SPI-side
analogue of DriverProvisioner.
The catalog is hosted and decoupled from the relix release: it
is fetched from DEFAULT_CATALOG_URL (overridable via
$RELIX_CONNECTOR_CATALOG, which may be an https:// URL or a local
file path) so a connector plugin can be published — and the catalog updated —
without rebuilding relix. It is served as an asset of the latest release, which is
what keeps a pre-release's catalog out of everybody's hands. The catalog is loaded
lazily and only when downloading is actually needed, so no network call
happens at startup or when downloads are off.
Downloading is opt-in: a provisioner created with
enabled == false never reaches the network and reports ConnectorProvisioner.Outcome.DISABLED.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe result of a provisioning attempt (the caller checks the registry for "already present").static final recordA provisioning outcome plus a human-readable explanation. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe hosted catalog, served as an asset of the engine repository's latest release. -
Constructor Summary
ConstructorsConstructorDescriptionConnectorProvisioner(ConnectorCatalog catalog, Path connectorDirectory, Fetcher fetcher, boolean enabled) Creates a provisioner with a fixed, already-loaded catalog. -
Method Summary
Modifier and TypeMethodDescriptionThe connector type tokens available to download from the catalog (e.g.static ConnectorProvisionerBuilds a provisioner that fetches the hosted catalog on demand (the location is$RELIX_CONNECTOR_CATALOGif set, elseDEFAULT_CATALOG_URL) and downloads into the default connector directory.static PathWhere connector plugins are installed and looked for:~/.relix/connectors.The connector type tokens usable now: those shipped with the engine, and those of every plugin installed indefaultDirectory().booleanDownloads the plugin for a connector type, if cataloged and permitted.
-
Field Details
-
DEFAULT_CATALOG_URL
The hosted catalog, served as an asset of the engine repository's latest release.A release asset rather than a file on a branch, and the difference is what the URL means.
/releases/latest/download/resolves to the newest release that is not a pre-release — so a release candidate's catalog is published under its own tag and served to nobody, which is the property this needs: the file is fetched at run time by every user who asks to download a connector, and a candidate that is later dropped must never have been what they got. Reading a branch could only approximate that with a rule someone has to remember.It also means a release writes nothing back. The catalog committed in the repository is the base — which connectors exist — and each release publishes it merged with that build's own entry, so the per-release part (a version in a URL, a hash of the artifact just built) is never a commit at all.
Overridable via
$RELIX_CONNECTOR_CATALOG, anhttps://URL or a local file path. A catalog that 404s is not a failure here: provisioning is opt-in, and a caller who has not asked to download never fetches it.- See Also:
-
-
Constructor Details
-
ConnectorProvisioner
public ConnectorProvisioner(ConnectorCatalog catalog, Path connectorDirectory, Fetcher fetcher, boolean enabled) Creates a provisioner with a fixed, already-loaded catalog.- Parameters:
catalog- the catalog of downloadable connector pluginsconnectorDirectory- the directory plugins are downloaded into and loaded fromfetcher- the network seamenabled- whether downloading is permitted (user consent)
-
-
Method Details
-
create
Builds a provisioner that fetches the hosted catalog on demand (the location is$RELIX_CONNECTOR_CATALOGif set, elseDEFAULT_CATALOG_URL) and downloads into the default connector directory.The
Fetcheris a parameter rather than a default because this class lives in the engine and the engine owns no HTTP client: the caller that wants downloads supplies the thing that performs them. Front-ends pass the reporting fetcher that prints progress to the terminal.- Parameters:
enabled- whether downloading is permittedfetcher- the fetcher used for the catalog fetch and downloads- Returns:
- a production provisioner
-
defaultDirectory
Where connector plugins are installed and looked for:~/.relix/connectors.- Returns:
- the directory; it may not exist yet
- Since:
- 1.0
-
installedTypes
The connector type tokens usable now: those shipped with the engine, and those of every plugin installed indefaultDirectory().- Returns:
- the type tokens, such as
csvorjdbc; never null - Since:
- 1.0
-
catalogTypes
The connector type tokens available to download from the catalog (e.g. for arelix connectors list). Loads the catalog (which may fetch the hosted URL); returns an empty set if the catalog can't be loaded.- Returns:
- the cataloged connector types, sorted
-
isEnabled
public boolean isEnabled()- Returns:
- whether this provisioner is permitted to download
-
provision
Downloads the plugin for a connector type, if cataloged and permitted. The catalog is fetched only here (lazily) and only when downloading is enabled.- Parameters:
connectorType- the connection's connector type token (e.g."mongodb")- Returns:
- the outcome of the attempt
-