Skip to content

Commit

Permalink
fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Jan 13, 2025
1 parent a2d36df commit 810eee2
Showing 1 changed file with 24 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@
import org.eclipse.edc.api.auth.spi.AuthenticationService;
import org.eclipse.edc.api.auth.spi.registry.ApiAuthenticationRegistry;
import org.eclipse.edc.connector.dataplane.spi.pipeline.PipelineService;
import org.eclipse.edc.runtime.metamodel.annotation.Configuration;
import org.eclipse.edc.runtime.metamodel.annotation.Extension;
import org.eclipse.edc.runtime.metamodel.annotation.Inject;
import org.eclipse.edc.runtime.metamodel.annotation.Setting;
import org.eclipse.edc.runtime.metamodel.annotation.Settings;
import org.eclipse.edc.spi.monitor.Monitor;
import org.eclipse.edc.spi.security.Vault;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.web.spi.WebServer;
import org.eclipse.edc.web.spi.WebService;
import org.eclipse.edc.web.spi.configuration.WebServiceConfigurer;
import org.eclipse.edc.web.spi.configuration.WebServiceSettings;
import org.eclipse.edc.web.spi.configuration.PortMapping;
import org.eclipse.edc.web.spi.configuration.PortMappingRegistry;
import org.eclipse.tractusx.edc.dataplane.proxy.consumer.api.asset.ClientErrorExceptionMapper;
import org.eclipse.tractusx.edc.dataplane.proxy.consumer.api.asset.ConsumerAssetRequestController;
import org.eclipse.tractusx.edc.edr.spi.service.EdrService;
Expand All @@ -58,7 +59,8 @@ public class DataPlaneProxyConsumerApiExtension implements ServiceExtension {
static final String NAME = "Data Plane Proxy Consumer API";
private static final int DEFAULT_PROXY_PORT = 8186;
private static final String CONSUMER_API_ALIAS = "consumer.api";
private static final String CONSUMER_CONTEXT_PATH = "/proxy";
private static final String DEFAULT_PROXY_PATH = "/proxy";
private static final String PROXY = "proxy";
private static final String CONSUMER_CONFIG_KEY = "web.http.proxy";
@Setting(value = "Data plane proxy API consumer port", type = "int")
private static final String CONSUMER_PORT = "tx.edc.dpf.consumer.proxy.port";
Expand All @@ -72,29 +74,25 @@ public class DataPlaneProxyConsumerApiExtension implements ServiceExtension {
private static final String AUTH_SETTING_APIKEY_ALIAS_DEPRECATED = "edc.api.auth.key.alias";
@Deprecated(since = "0.7.1")
private static final String AUTH_SETTING_APIKEY_DEPRECATED = "edc.api.auth.key";
@Inject
private WebService webService;

@Inject
private WebServer webServer;
@Configuration
private DataPlaneProxyConsumerApiConfiguration apiConfiguration;

@Inject
private WebService webService;
@Inject
private PipelineService pipelineService;

@Inject
private EdrService edrService;

@Inject
private WebServiceConfigurer configurer;

@Inject
private Vault vault;

@Inject
private ApiAuthenticationRegistry apiAuthenticationRegistry;

@Inject
private Monitor monitor;
@Inject
private PortMappingRegistry portMappingRegistry;


private ExecutorService executorService;

Expand All @@ -105,10 +103,10 @@ public String name() {

@Override
public void initialize(ServiceExtensionContext context) {
// when deprecated port will be purged, just assign `apiConfiguration.port()` to `port`
var port = propertyCompatibility(context, CONSUMER_PORT, CONSUMER_PORT_DEPRECATED, DEFAULT_PROXY_PORT);
var config = context.getConfig(CONSUMER_CONFIG_KEY);

configurer.configure(config, webServer, createApiContext(port));
var portMapping = new PortMapping(PROXY, port, apiConfiguration.path());
portMappingRegistry.register(portMapping);

var poolSize = propertyCompatibility(context, THREAD_POOL_SIZE, THREAD_POOL_SIZE_DEPRECATED, DEFAULT_THREAD_POOL);
executorService = newFixedThreadPool(poolSize);
Expand Down Expand Up @@ -138,14 +136,14 @@ private AuthenticationService createAuthenticationService(ServiceExtensionContex
return new TokenBasedAuthenticationService(context.getMonitor().withPrefix("ConsumerProxyAPI"), apiKey);
}

private WebServiceSettings createApiContext(int port) {
return WebServiceSettings.Builder.newInstance()
.apiConfigKey(CONSUMER_CONFIG_KEY)
.contextAlias(CONSUMER_API_ALIAS)
.defaultPath(CONSUMER_CONTEXT_PATH)
.defaultPort(port)
.name(NAME)
.build();
@Settings
record DataPlaneProxyConsumerApiConfiguration(
@Setting(key = "web.http." + PROXY + ".port", description = "Port for " + PROXY + " api context", defaultValue = DEFAULT_PROXY_PORT + "")
int port,
@Setting(key = "web.http." + PROXY + ".path", description = "Path for " + PROXY + " api context", defaultValue = DEFAULT_PROXY_PATH)
String path
) {

}

}

0 comments on commit 810eee2

Please sign in to comment.