Class ConnectorPluginLoader
java.lang.Object
com.darkcollective.relix.processor.connector.internal.ConnectorPluginLoader
Loads external
RelixConnector plugins from JAR files in a connector
directory — ~/.relix/connectors/ by default, overridable via
RELIX_CONNECTORS.
This is the RelixConnector analogue of RelixDriverLoader: a
connector that does not ship with relix (MongoDB, Redis, …) is dropped in as a
JAR and discovered via ServiceLoader with no rebuild. Unlike the driver
loader, the URLClassLoader's parent is this class's loader (not the
platform loader), because a plugin must see the RelixConnector API and
the Row/Schema types it references.
Loaders are retained for the JVM lifetime so the plugins keep working.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringEnvironment variable overriding the default connector directory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PathResolves the default connector directory:$RELIX_CONNECTORSif set and non-blank, otherwise~/.relix/connectors.load()Scans the directory and instantiates everyRelixConnectorservice found in its JARs.
-
Field Details
-
CONNECTORS_ENV
Environment variable overriding the default connector directory.- See Also:
-
-
Constructor Details
-
ConnectorPluginLoader
- Parameters:
directory- the directory to scan for connector JARs (need not exist)
-
-
Method Details
-
defaultDirectory
Resolves the default connector directory:$RELIX_CONNECTORSif set and non-blank, otherwise~/.relix/connectors.- Returns:
- the resolved directory path (which may not exist yet)
-
load
Scans the directory and instantiates everyRelixConnectorservice found in its JARs. A missing/non-directory path, or one with no connector JARs, yields an empty list; a JAR with no connector service is skipped.- Returns:
- the loaded connector instances, in JAR-name order
-