java.lang.Object
com.darkcollective.relix.connectors.std.internal.HttpDataSourceConnector
All Implemented Interfaces:
DataSourceConnector, AutoCloseable

public final class HttpDataSourceConnector extends Object implements DataSourceConnector
Executes source … from http { … } relations: it issues the configured HTTP request, parses the JSON response, and yields one Row per record.

Read-only by design. Only GET, QUERY and POST are possible (the grammar rejects the mutating methods). QUERY is the RFC 10008 read whose query is the request body; POST is used solely to carry a read query in the request body for APIs that do not accept QUERY (e.g. GraphQL/search APIs).

A request that carries a body is sent with Content-Type: application/json unless the declaration names a Content-Type of its own.

Schema

A source with no declared columns is open (schema-on-read): each JSON record becomes a DocumentRow navigated by path at query time. A declared schema { col: TYPE at "$.path" } makes the source closed and typed: each column is extracted from the record by its at path (or the column name) and coerced to the declared scalar type.

Authentication

auth: bearer/basic/apikey(…) is translated to the appropriate header (or query parameter for apikey(query(…))); a raw Authorization header works too. A ${NAME} placeholder reaches this connector already resolved: the session resolves the declaration before handing it over.

Request determinism (v1)

The request is fully determined by the declaration: static URL/headers/auth/body plus pagination defaults and any IN-column [default: …]. Pushing a query predicate (σ city = "X") into a request parameter is a planned follow-on; a [required] IN column with no default is therefore a clear error today.
  • Constructor Details

    • HttpDataSourceConnector

      public HttpDataSourceConnector(SemanticModel model)
      Creates a connector backed by a real HttpClient.
      Parameters:
      model - the semantic model holding the source declarations; must not be null
    • HttpDataSourceConnector

      public HttpDataSourceConnector(SemanticModel model, HttpDataSourceConnector.HttpTransport transport)
      Creates a connector with an injected transport (for testing).
      Parameters:
      model - the semantic model; must not be null
      transport - the transport seam; must not be null
  • Method Details

    • open

      public Stream<Row> open(String relationName, Schema schema)
      Description copied from interface: DataSourceConnector
      Opens a stream of rows for the named relation.
      Specified by:
      open in interface DataSourceConnector
      Parameters:
      relationName - the canonical (lower-cased) relation name
      schema - the expected schema; may be used to map source columns to the correct positions and types
      Returns:
      a stream of rows; the caller is responsible for closing it