Class HttpDataSourceConnector
java.lang.Object
com.darkcollective.relix.connectors.std.internal.HttpDataSourceConnector
- All Implemented Interfaces:
DataSourceConnector,AutoCloseable
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 aDocumentRow 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 anyIN-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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe result of an HTTP exchange: the status code and the response body.static final recordThe fully-resolved request the connector wants to send.static interfaceThe I/O boundary — sends a request and returns the response. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a connector backed by a realHttpClient.HttpDataSourceConnector(SemanticModel model, HttpDataSourceConnector.HttpTransport transport) Creates a connector with an injected transport (for testing). -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.darkcollective.relix.processor.internal.DataSourceConnector
close, openQuery, openQuery
-
Constructor Details
-
HttpDataSourceConnector
Creates a connector backed by a realHttpClient.- 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 nulltransport- the transport seam; must not be null
-
-
Method Details
-
open
Description copied from interface:DataSourceConnectorOpens a stream of rows for the named relation.- Specified by:
openin interfaceDataSourceConnector- Parameters:
relationName- the canonical (lower-cased) relation nameschema- 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
-