Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: annotate properly settings and refer to autodoc from the README files #4084

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ maven/mavencentral/commons-logging/commons-logging/1.2, Apache-2.0, approved, CQ
maven/mavencentral/dev.failsafe/failsafe-okhttp/3.3.2, Apache-2.0, approved, #9178
maven/mavencentral/dev.failsafe/failsafe/3.3.2, Apache-2.0, approved, #9268
maven/mavencentral/info.picocli/picocli/4.7.5, Apache-2.0, approved, #4365
maven/mavencentral/io.cloudevents/cloudevents-api/3.0.0, , restricted, clearlydefined
maven/mavencentral/io.cloudevents/cloudevents-core/3.0.0, , restricted, clearlydefined
maven/mavencentral/io.cloudevents/cloudevents-http-basic/3.0.0, , restricted, clearlydefined
maven/mavencentral/io.cloudevents/cloudevents-api/3.0.0, Apache-2.0, approved, #14228
maven/mavencentral/io.cloudevents/cloudevents-core/3.0.0, Apache-2.0, approved, #14227
maven/mavencentral/io.cloudevents/cloudevents-http-basic/3.0.0, Apache-2.0, approved, #14229
maven/mavencentral/io.github.classgraph/classgraph/4.8.154, MIT, approved, CQ22530
maven/mavencentral/io.micrometer/micrometer-commons/1.12.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11679
maven/mavencentral/io.micrometer/micrometer-core/1.12.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11678
Expand Down Expand Up @@ -348,7 +348,7 @@ maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915
maven/mavencentral/org.testcontainers/database-commons/1.19.7, Apache-2.0, approved, #10345
maven/mavencentral/org.testcontainers/jdbc/1.19.7, Apache-2.0, approved, #10348
maven/mavencentral/org.testcontainers/junit-jupiter/1.19.7, MIT, approved, #10344
maven/mavencentral/org.testcontainers/kafka/1.19.7, None, restricted, #14177
maven/mavencentral/org.testcontainers/kafka/1.19.7, MIT, approved, #14177
maven/mavencentral/org.testcontainers/postgresql/1.19.7, MIT, approved, #10350
maven/mavencentral/org.testcontainers/testcontainers/1.19.7, Apache-2.0 AND MIT, approved, #10347
maven/mavencentral/org.testcontainers/vault/1.19.7, MIT, approved, #10852
Expand Down
13 changes: 1 addition & 12 deletions core/common/connector-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,4 @@ Extension that registers default and core services as default implementations, h

## Configuration settings
ndr-brt marked this conversation as resolved.
Show resolved Hide resolved

| Parameter name | Description | Mandatory | Default value |
|------------------------------------------|----------------------------------------------------------------------|-----------|---------------|
| `edc.hostname` | Connector hostname, which e.g. is used in referer urls | false | localhost |
| `edc.http.enforce-https` | If true, enable HTTPS call enforcement. | false | false |
| `edc.core.retry.retries.max` | Maximum retries for the retry policy before a failure is propagated. | false | 5 |
| `edc.core.retry.backoff.min` | Minimum number of milliseconds for exponential backoff. | false | 500 |
| `edc.core.retry.backoff.max` | Maximum number of milliseconds for exponential backoff. | false | 10000 |
| `edc.core.retry.log.on.retry` | Log Failsafe onRetry events. | false | false |
| `edc.core.retry.log.on.retry.scheduled` | Log Failsafe onRetryScheduled events. | false | false |
| `edc.core.retry.log.on.retries.exceeded` | Log Failsafe onRetriesExceeded events. | false | false |
| `edc.core.retry.log.on.failed.attempt` | Log Failsafe onFailedAttempt events. | false | false |
| `edc.core.retry.log.on.abort` | Log Failsafe onAbort events. | false | false |
See [here](https://eclipse-edc.github.io/Connector/autodoc/#connector-core) the latest documentation for the available configuration parameters.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@

import java.util.concurrent.Executors;

import static java.lang.Integer.parseInt;

/**
* Provides default service implementations for fallback
* Omitted {@link Extension} since this module contains the extension {@link CoreServicesExtension}
Expand All @@ -49,39 +47,46 @@ public class CoreDefaultServicesExtension implements ServiceExtension {

public static final String NAME = "Core Default Services";

private static final String RETRY_POLICY_DEFAULT_RETRIES = "5";
private static final String RETRY_POLICY_DEFAULT_MIN_BACKOFF = "500";
private static final String RETRY_POLICY_DEFAULT_MAX_BACKOFF = "10000";
private static final String RETRY_POLICY_DEFAULT_LOG = "false";
@Setting(value = "RetryPolicy: Maximum retries before a failure is propagated", defaultValue = RETRY_POLICY_DEFAULT_RETRIES)
private static final int DEFAULT_RETRY_POLICY_MAX_RETRIES = 5;
private static final int DEFAULT_RETRY_POLICY_BACKOFF_MIN_MILLIS = 500;
private static final int DEFAULT_RETRY_POLICY_BACKOFF_MAX_MILLIS = 10000;
private static final boolean DEFAULT_RETRY_POLICY_LOG_ON_RETRY = false;
private static final boolean DEFAULT_RETRY_POLICY_LOG_ON_RETRY_SCHEDULED = false;
private static final boolean DEFAULT_RETRY_POLICY_LOG_ON_RETRIES_EXCEEDED = false;
private static final boolean DEFAULT_RETRY_POLICY_LOG_ON_FAILED_ATTEMPT = false;
private static final boolean DEFAULT_RETRY_POLICY_LOG_ON_ABORT = false;
private static final int DEFAULT_OK_HTTP_CLIENT_TIMEOUT_CONNECT = 30;
private static final int DEFAULT_OK_HTTP_CLIENT_TIMEOUT_READ = 30;
private static final boolean DEFAULT_OK_HTTP_CLIENT_HTTPS_ENFORCE = false;
private static final int DEFAULT_OK_HTTP_CLIENT_SEND_BUFFER_SIZE = 0;
private static final int DEFAULT_OK_HTTP_CLIENT_RECEIVE_BUFFER_SIZE = 0;

@Setting(value = "RetryPolicy: Maximum retries before a failure is propagated", defaultValue = DEFAULT_RETRY_POLICY_MAX_RETRIES + "", type = "int")
private static final String RETRY_POLICY_MAX_RETRIES = "edc.core.retry.retries.max";
@Setting(value = "RetryPolicy: Minimum number of milliseconds for exponential backoff", defaultValue = RETRY_POLICY_DEFAULT_MIN_BACKOFF)
@Setting(value = "RetryPolicy: Minimum number of milliseconds for exponential backoff", defaultValue = DEFAULT_RETRY_POLICY_BACKOFF_MIN_MILLIS + "", type = "int")
private static final String RETRY_POLICY_BACKOFF_MIN_MILLIS = "edc.core.retry.backoff.min";
@Setting(value = "RetryPolicy: Maximum number of milliseconds for exponential backoff.", defaultValue = RETRY_POLICY_DEFAULT_MAX_BACKOFF)
@Setting(value = "RetryPolicy: Maximum number of milliseconds for exponential backoff", defaultValue = DEFAULT_RETRY_POLICY_BACKOFF_MAX_MILLIS + "", type = "int")
private static final String RETRY_POLICY_BACKOFF_MAX_MILLIS = "edc.core.retry.backoff.max";
@Setting(value = "RetryPolicy: Log onRetry events", defaultValue = RETRY_POLICY_DEFAULT_LOG)
static final String RETRY_POLICY_LOG_ON_RETRY = "edc.core.retry.log.on.retry";
@Setting(value = "RetryPolicy: Log onRetryScheduled events", defaultValue = RETRY_POLICY_DEFAULT_LOG)
static final String RETRY_POLICY_LOG_ON_RETRY_SCHEDULED = "edc.core.retry.log.on.retry.scheduled";
@Setting(value = "RetryPolicy: Log onRetriesExceeded events", defaultValue = RETRY_POLICY_DEFAULT_LOG)
static final String RETRY_POLICY_LOG_ON_RETRIES_EXCEEDED = "edc.core.retry.log.on.retries.exceeded";
@Setting(value = "RetryPolicy: Log onFailedAttempt events", defaultValue = RETRY_POLICY_DEFAULT_LOG)
static final String RETRY_POLICY_LOG_ON_FAILED_ATTEMPT = "edc.core.retry.log.on.failed.attempt";
@Setting(value = "RetryPolicy: Log onAbort events", defaultValue = RETRY_POLICY_DEFAULT_LOG)
static final String RETRY_POLICY_LOG_ON_ABORT = "edc.core.retry.log.on.abort";

private static final String OK_HTTP_CLIENT_DEFAULT_TIMEOUT = "30";
private static final String OK_HTTP_CLIENT_DEFAULT_HTTPS_ENFORCE = "false";
@Setting(value = "OkHttpClient: If true, enable HTTPS call enforcement.", defaultValue = OK_HTTP_CLIENT_DEFAULT_HTTPS_ENFORCE, type = "boolean")
public static final String OK_HTTP_CLIENT_HTTPS_ENFORCE = "edc.http.client.https.enforce";
@Setting(value = "OkHttpClient: connect timeout, in seconds", defaultValue = OK_HTTP_CLIENT_DEFAULT_TIMEOUT, type = "int")
public static final String OK_HTTP_CLIENT_TIMEOUT_CONNECT = "edc.http.client.timeout.connect";
@Setting(value = "OkHttpClient: read timeout, in seconds", defaultValue = OK_HTTP_CLIENT_DEFAULT_TIMEOUT, type = "int")
public static final String OK_HTTP_CLIENT_TIMEOUT_READ = "edc.http.client.timeout.read";
@Setting(value = "OkHttpClient: send buffer size, in bytes", type = "int", min = 1)
public static final String OK_HTTP_CLIENT_SEND_BUFFER_SIZE = "edc.http.client.send.buffer.size";
@Setting(value = "OkHttpClient: receive buffer size, in bytes", type = "int", min = 1)
public static final String OK_HTTP_CLIENT_RECEIVE_BUFFER_SIZE = "edc.http.client.receive.buffer.size";
@Setting(value = "RetryPolicy: Log onRetry events", defaultValue = DEFAULT_RETRY_POLICY_LOG_ON_RETRY + "", type = "boolean")
private static final String RETRY_POLICY_LOG_ON_RETRY = "edc.core.retry.log.on.retry";
@Setting(value = "RetryPolicy: Log onRetryScheduled events", defaultValue = DEFAULT_RETRY_POLICY_LOG_ON_RETRY_SCHEDULED + "", type = "boolean")
private static final String RETRY_POLICY_LOG_ON_RETRY_SCHEDULED = "edc.core.retry.log.on.retry.scheduled";
@Setting(value = "RetryPolicy: Log onRetriesExceeded events", defaultValue = DEFAULT_RETRY_POLICY_LOG_ON_RETRIES_EXCEEDED + "", type = "boolean")
private static final String RETRY_POLICY_LOG_ON_RETRIES_EXCEEDED = "edc.core.retry.log.on.retries.exceeded";
@Setting(value = "RetryPolicy: Log onFailedAttempt events", defaultValue = DEFAULT_RETRY_POLICY_LOG_ON_FAILED_ATTEMPT + "", type = "boolean")
private static final String RETRY_POLICY_LOG_ON_FAILED_ATTEMPT = "edc.core.retry.log.on.failed.attempt";
@Setting(value = "RetryPolicy: Log onAbort events", defaultValue = DEFAULT_RETRY_POLICY_LOG_ON_ABORT + "", type = "boolean")
private static final String RETRY_POLICY_LOG_ON_ABORT = "edc.core.retry.log.on.abort";
@Setting(value = "OkHttpClient: If true, enable HTTPS call enforcement", defaultValue = DEFAULT_OK_HTTP_CLIENT_HTTPS_ENFORCE + "", type = "boolean")
private static final String OK_HTTP_CLIENT_HTTPS_ENFORCE = "edc.http.client.https.enforce";
@Setting(value = "OkHttpClient: connect timeout, in seconds", defaultValue = DEFAULT_OK_HTTP_CLIENT_TIMEOUT_CONNECT + "", type = "int")
private static final String OK_HTTP_CLIENT_TIMEOUT_CONNECT = "edc.http.client.timeout.connect";
@Setting(value = "OkHttpClient: read timeout, in seconds", defaultValue = DEFAULT_OK_HTTP_CLIENT_TIMEOUT_READ + "", type = "int")
private static final String OK_HTTP_CLIENT_TIMEOUT_READ = "edc.http.client.timeout.read";
@Setting(value = "OkHttpClient: send buffer size, in bytes", defaultValue = DEFAULT_OK_HTTP_CLIENT_SEND_BUFFER_SIZE + "", type = "int", min = 1)
private static final String OK_HTTP_CLIENT_SEND_BUFFER_SIZE = "edc.http.client.send.buffer.size";
@Setting(value = "OkHttpClient: receive buffer size, in bytes", defaultValue = DEFAULT_OK_HTTP_CLIENT_RECEIVE_BUFFER_SIZE + "", type = "int", min = 1)
private static final String OK_HTTP_CLIENT_RECEIVE_BUFFER_SIZE = "edc.http.client.receive.buffer.size";

/**
* An optional OkHttp {@link EventListener} that can be used to instrument OkHttp client for collecting metrics.
Expand Down Expand Up @@ -123,11 +128,11 @@ public EdcHttpClient edcHttpClient(ServiceExtensionContext context) {
@Provider
public OkHttpClient okHttpClient(ServiceExtensionContext context) {
var configuration = OkHttpClientConfiguration.Builder.newInstance()
.enforceHttps(context.getSetting(OK_HTTP_CLIENT_HTTPS_ENFORCE, Boolean.parseBoolean(OK_HTTP_CLIENT_DEFAULT_HTTPS_ENFORCE)))
.connectTimeout(context.getSetting(OK_HTTP_CLIENT_TIMEOUT_CONNECT, parseInt(OK_HTTP_CLIENT_DEFAULT_TIMEOUT)))
.readTimeout(context.getSetting(OK_HTTP_CLIENT_TIMEOUT_READ, parseInt(OK_HTTP_CLIENT_DEFAULT_TIMEOUT)))
.sendBufferSize(context.getSetting(OK_HTTP_CLIENT_SEND_BUFFER_SIZE, 0))
.receiveBufferSize(context.getSetting(OK_HTTP_CLIENT_RECEIVE_BUFFER_SIZE, 0))
.enforceHttps(context.getSetting(OK_HTTP_CLIENT_HTTPS_ENFORCE, DEFAULT_OK_HTTP_CLIENT_HTTPS_ENFORCE))
.connectTimeout(context.getSetting(OK_HTTP_CLIENT_TIMEOUT_CONNECT, DEFAULT_OK_HTTP_CLIENT_TIMEOUT_CONNECT))
.readTimeout(context.getSetting(OK_HTTP_CLIENT_TIMEOUT_READ, DEFAULT_OK_HTTP_CLIENT_TIMEOUT_READ))
.sendBufferSize(context.getSetting(OK_HTTP_CLIENT_SEND_BUFFER_SIZE, DEFAULT_OK_HTTP_CLIENT_SEND_BUFFER_SIZE))
.receiveBufferSize(context.getSetting(OK_HTTP_CLIENT_RECEIVE_BUFFER_SIZE, DEFAULT_OK_HTTP_CLIENT_RECEIVE_BUFFER_SIZE))
.build();

return OkHttpClientFactory.create(configuration, okHttpEventListener, context.getMonitor());
Expand All @@ -136,14 +141,14 @@ public OkHttpClient okHttpClient(ServiceExtensionContext context) {
@Provider
public <T> RetryPolicy<T> retryPolicy(ServiceExtensionContext context) {
var configuration = RetryPolicyConfiguration.Builder.newInstance()
.maxRetries(context.getSetting(RETRY_POLICY_MAX_RETRIES, parseInt(RETRY_POLICY_DEFAULT_RETRIES)))
.minBackoff(context.getSetting(RETRY_POLICY_BACKOFF_MIN_MILLIS, parseInt(RETRY_POLICY_DEFAULT_MIN_BACKOFF)))
.maxBackoff(context.getSetting(RETRY_POLICY_BACKOFF_MAX_MILLIS, parseInt(RETRY_POLICY_DEFAULT_MAX_BACKOFF)))
.logOnRetry(context.getSetting(RETRY_POLICY_LOG_ON_RETRY, false))
.logOnRetryScheduled(context.getSetting(RETRY_POLICY_LOG_ON_RETRY_SCHEDULED, false))
.logOnRetriesExceeded(context.getSetting(RETRY_POLICY_LOG_ON_RETRIES_EXCEEDED, false))
.logOnFailedAttempt(context.getSetting(RETRY_POLICY_LOG_ON_FAILED_ATTEMPT, false))
.logOnAbort(context.getSetting(RETRY_POLICY_LOG_ON_ABORT, false))
.maxRetries(context.getSetting(RETRY_POLICY_MAX_RETRIES, DEFAULT_RETRY_POLICY_MAX_RETRIES))
.minBackoff(context.getSetting(RETRY_POLICY_BACKOFF_MIN_MILLIS, DEFAULT_RETRY_POLICY_BACKOFF_MIN_MILLIS))
.maxBackoff(context.getSetting(RETRY_POLICY_BACKOFF_MAX_MILLIS, DEFAULT_RETRY_POLICY_BACKOFF_MAX_MILLIS))
.logOnRetry(context.getSetting(RETRY_POLICY_LOG_ON_RETRY, DEFAULT_RETRY_POLICY_LOG_ON_RETRY))
.logOnRetryScheduled(context.getSetting(RETRY_POLICY_LOG_ON_RETRY_SCHEDULED, DEFAULT_RETRY_POLICY_LOG_ON_RETRY_SCHEDULED))
.logOnRetriesExceeded(context.getSetting(RETRY_POLICY_LOG_ON_RETRIES_EXCEEDED, DEFAULT_RETRY_POLICY_LOG_ON_RETRIES_EXCEEDED))
.logOnFailedAttempt(context.getSetting(RETRY_POLICY_LOG_ON_FAILED_ATTEMPT, DEFAULT_RETRY_POLICY_LOG_ON_FAILED_ATTEMPT))
.logOnAbort(context.getSetting(RETRY_POLICY_LOG_ON_ABORT, DEFAULT_RETRY_POLICY_LOG_ON_ABORT))
.build();

return RetryPolicyFactory.create(configuration, context.getMonitor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,14 @@
@Extension(value = CoreServicesExtension.NAME)
public class CoreServicesExtension implements ServiceExtension {

@Setting
public static final String HOSTNAME_SETTING = "edc.hostname";
public static final String NAME = "Core Services";

/**
* The name of the claim key used to determine the participant identity.
*/
@Setting
public static final String IDENTITY_KEY = "edc.agent.identity.key";
private static final String DEFAULT_EDC_HOSTNAME = "localhost";

public static final String NAME = "Core Services";
private static final String DEFAULT_HOSTNAME = "localhost";
@Setting(value = "Connector hostname, which e.g. is used in referer urls", defaultValue = DEFAULT_EDC_HOSTNAME)
public static final String EDC_HOSTNAME = "edc.hostname";
@Setting(value = "The name of the claim key used to determine the participant identity", defaultValue = DEFAULT_IDENTITY_CLAIM_KEY)
public static final String EDC_AGENT_IDENTITY_KEY = "edc.agent.identity.key";

@Inject
private EventExecutorServiceContainer eventExecutorServiceContainer;
Expand Down Expand Up @@ -103,9 +100,9 @@ public TypeManager typeManager() {

@Provider
public Hostname hostname(ServiceExtensionContext context) {
var hostname = context.getSetting(HOSTNAME_SETTING, DEFAULT_HOSTNAME);
if (DEFAULT_HOSTNAME.equals(hostname)) {
context.getMonitor().warning(String.format("Settings: No setting found for key '%s'. Using default value '%s'", HOSTNAME_SETTING, DEFAULT_HOSTNAME));
var hostname = context.getSetting(EDC_HOSTNAME, DEFAULT_EDC_HOSTNAME);
if (DEFAULT_EDC_HOSTNAME.equals(hostname)) {
context.getMonitor().warning(String.format("Settings: No setting found for key '%s'. Using default value '%s'", EDC_HOSTNAME, DEFAULT_EDC_HOSTNAME));
}
return () -> hostname;
}
Expand All @@ -122,7 +119,7 @@ public CommandHandlerRegistry commandHandlerRegistry() {

@Provider
public ParticipantAgentService participantAgentService(ServiceExtensionContext context) {
var identityKey = context.getSetting(IDENTITY_KEY, DEFAULT_IDENTITY_CLAIM_KEY);
var identityKey = context.getSetting(EDC_AGENT_IDENTITY_KEY, DEFAULT_IDENTITY_CLAIM_KEY);
return new ParticipantAgentServiceImpl(identityKey);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import java.util.Map;

import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.edc.connector.core.CoreServicesExtension.HOSTNAME_SETTING;
import static org.eclipse.edc.connector.core.CoreServicesExtension.EDC_HOSTNAME;

@ExtendWith(EdcExtension.class)
class CoreServicesExtensionIntegrationTest {

@BeforeEach
void setUp(EdcExtension extension) {
extension.setConfiguration(Map.of(HOSTNAME_SETTING, "hostname"));
extension.setConfiguration(Map.of(EDC_HOSTNAME, "hostname"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,4 @@ of its public API. OpenApi documentation can be found [here](../../../../resourc

### Configurations
ndr-brt marked this conversation as resolved.
Show resolved Hide resolved

| Parameter name | Description | Mandatory | Default value |
|:----------------------------------------------------|:-----------------------------------------------------------------------------------------------|:----------|:----------------------|
| `edc.transfer.proxy.token.validity.seconds` | Validity (in seconds) of tokens generated by the extension for accessing Data Plane public API | false | 600 |
| `edc.transfer.client.selector.strategy` | Strategy for Data Plane instance selection | false | random |
| `edc.transfer.proxy.token.signer.privatekey.alias` | Alias of private key used for signing tokens | false | Random EC public key |
| `edc.transfer.proxy.token.verifier.publickey.alias` | Alias of public key used for verifying the tokens | false | Random EC private key |
See [here](https://eclipse-edc.github.io/Connector/autodoc/#transfer-data-plane) the latest documentation for the available configuration parameters.