java.lang.Object
com.darkcollective.relix.processor.connector.internal.ConnectorPluginLoader

public final class ConnectorPluginLoader extends Object
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 Details

    • CONNECTORS_ENV

      public static final String CONNECTORS_ENV
      Environment variable overriding the default connector directory.
      See Also:
  • Constructor Details

    • ConnectorPluginLoader

      public ConnectorPluginLoader(Path directory)
      Parameters:
      directory - the directory to scan for connector JARs (need not exist)
  • Method Details

    • defaultDirectory

      public static Path defaultDirectory()
      Resolves the default connector directory: $RELIX_CONNECTORS if set and non-blank, otherwise ~/.relix/connectors.
      Returns:
      the resolved directory path (which may not exist yet)
    • load

      public List<RelixConnector> load()
      Scans the directory and instantiates every RelixConnector service 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