<properties>
<java.version>11</java.version>
<springfox.version>3.0.0</springfox.version>
- <immutable.version>2.8.2</immutable.version>
+ <immutable.version>2.9.0</immutable.version>
<swagger.version>2.1.6</swagger.version>
<json.version>20211205</json.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<artifactId>swagger-jaxrs2-servlet-initializer</artifactId>
<version>${swagger.version}</version>
</dependency>
- <dependency>
- <groupId>org.immutables</groupId>
- <artifactId>value</artifactId>
- <version>${immutable.version}</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.immutables</groupId>
<artifactId>gson</artifactId>
}
private boolean isHttpProxyConfigured() {
- return httpProxyConfig != null && httpProxyConfig.httpProxyPort() > 0
- && !httpProxyConfig.httpProxyHost().isEmpty();
+ return httpProxyConfig != null && httpProxyConfig.getHttpProxyPort() > 0
+ && !httpProxyConfig.getHttpProxyHost().isEmpty();
}
private HttpClient buildHttpClient() {
if (isHttpProxyConfigured()) {
httpClient = httpClient.proxy(proxy -> proxy.type(ProxyProvider.Proxy.HTTP)
- .host(httpProxyConfig.httpProxyHost()).port(httpProxyConfig.httpProxyPort()));
+ .host(httpProxyConfig.getHttpProxyHost()).port(httpProxyConfig.getHttpProxyPort()));
}
return httpClient;
}
public AsyncRestClientFactory(WebClientConfig clientConfig, SecurityContext securityContext) {
if (clientConfig != null) {
this.sslContextFactory = new CachingSslContextFactory(clientConfig);
- this.httpProxyConfig = clientConfig.httpProxyConfig();
+ this.httpProxyConfig = clientConfig.getHttpProxyConfig();
} else {
logger.warn("No configuration for web client defined, HTTPS will not work");
this.sslContextFactory = null;
private SslContext createSslContext(KeyManagerFactory keyManager)
throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException {
if (this.clientConfig.isTrustStoreUsed()) {
- return createSslContextRejectingUntrustedPeers(this.clientConfig.trustStore(),
- this.clientConfig.trustStorePassword(), keyManager);
+ return createSslContextRejectingUntrustedPeers(this.clientConfig.getTrustStore(),
+ this.clientConfig.getTrustStorePassword(), keyManager);
} else {
// Trust anyone
return SslContextBuilder.forClient() //
private KeyManagerFactory createKeyManager() throws NoSuchAlgorithmException, CertificateException, IOException,
UnrecoverableKeyException, KeyStoreException {
final KeyManagerFactory keyManager = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
- final KeyStore keyStore = KeyStore.getInstance(this.clientConfig.keyStoreType());
- final String keyStoreFile = this.clientConfig.keyStore();
- final String keyStorePassword = this.clientConfig.keyStorePassword();
- final String keyPassword = this.clientConfig.keyPassword();
+ final KeyStore keyStore = KeyStore.getInstance(this.clientConfig.getKeyStoreType());
+ final String keyStoreFile = this.clientConfig.getKeyStore();
+ final String keyStorePassword = this.clientConfig.getKeyStorePassword();
+ final String keyPassword = this.clientConfig.getKeyPassword();
try (final InputStream inputStream = new FileInputStream(keyStoreFile)) {
keyStore.load(inputStream, keyStorePassword.toCharArray());
}
public WebClientConfig getWebClientConfig() {
if (this.webClientConfig == null) {
- HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
+ HttpProxyConfig httpProxyConfig = HttpProxyConfig.builder() //
.httpProxyHost(this.httpProxyHost) //
.httpProxyPort(this.httpProxyPort) //
.build();
- this.webClientConfig = ImmutableWebClientConfig.builder() //
+ this.webClientConfig = WebClientConfig.builder() //
.keyStoreType(this.sslKeyStoreType) //
.keyStorePassword(this.sslKeyStorePassword) //
.keyStore(this.sslKeyStore) //
package org.oran.dmaapadapter.configuration;
-import org.immutables.value.Value;
+import lombok.Builder;
+import lombok.Getter;
+import reactor.netty.transport.ProxyProvider;
-@Value.Immutable
-@Value.Style(redactedMask = "####")
-public interface WebClientConfig {
- public String keyStoreType();
+@Builder
+@Getter
+public class WebClientConfig {
+ private String keyStoreType;
- @Value.Redacted
- public String keyStorePassword();
+ private String keyStorePassword;
- public String keyStore();
+ private String keyStore;
- @Value.Redacted
- public String keyPassword();
+ private String keyPassword;
- public boolean isTrustStoreUsed();
+ private boolean isTrustStoreUsed;
- @Value.Redacted
- public String trustStorePassword();
+ private String trustStorePassword;
- public String trustStore();
+ private String trustStore;
- @Value.Immutable
- public interface HttpProxyConfig {
- public String httpProxyHost();
+ @Builder
+ @Getter
+ public static class HttpProxyConfig {
+ private String httpProxyHost;
- public int httpProxyPort();
- }
+ private int httpProxyPort;
- public HttpProxyConfig httpProxyConfig();
+ private ProxyProvider.Proxy httpProxyType;
+ }
+ private HttpProxyConfig httpProxyConfig;
}
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "void", description = "Void/empty")
public class VoidResponse {
private VoidResponse() {}
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "consumer_job", description = "Information for an Information Job")
public class ConsumerJobInfo {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "producer_info_type_info", description = "Information for an Information Type")
public class ProducerInfoTypeInfo {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "producer_info_job_request",
description = "The body of the Information Producer callbacks for Information Job creation and deletion")
public class ProducerJobInfo {
import lombok.Builder;
-import org.immutables.gson.Gson;
-
@Builder
-@Gson.TypeAdapters
@Schema(name = "producer_registration_info", description = "Information for an Information Producer")
public class ProducerRegistrationInfo {
import lombok.Getter;
import lombok.Setter;
-import org.immutables.gson.Gson;
import org.oran.dmaapadapter.clients.AsyncRestClient;
import org.oran.dmaapadapter.repository.filters.Filter;
import org.oran.dmaapadapter.repository.filters.JsltFilter;
private static com.google.gson.Gson gson = new GsonBuilder().create();
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- @Gson.TypeAdapters
public static class Parameters {
public static final String REGEXP_TYPE = "regexp";
public static final String PM_FILTER_TYPE = "pmdata";
}
}
- @Gson.TypeAdapters
public static class BufferTimeout {
public BufferTimeout(int maxSize, long maxTimeMiliseconds) {
this.maxSize = maxSize;
package org.oran.dmaapadapter.repository.filters;
+
import java.util.ArrayList;
import java.util.Collection;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
class PmReport {
Event event = new Event();
- @Gson.TypeAdapters
public static class CommonEventHeader {
String domain;
String eventId;
String timeZoneOffset;
}
- @Gson.TypeAdapters
public static class MeasInfoId {
String sMeasInfoId;
}
- @Gson.TypeAdapters
public static class MeasTypes {
public String getMeasType(int pValue) {
if (pValue > sMeasTypesList.size()) {
protected ArrayList<String> sMeasTypesList = new ArrayList<>();
}
- @Gson.TypeAdapters
public static class MeasResult {
int p;
String sValue;
}
- @Gson.TypeAdapters
public static class MeasValuesList {
String measObjInstId;
String suspectFlag;
}
}
- @Gson.TypeAdapters
public static class MeasInfoList {
MeasInfoId measInfoId;
MeasTypes measTypes;
}
}
- @Gson.TypeAdapters
public static class MeasDataCollection {
int granularityPeriod;
String measuredEntityUserName;
Collection<MeasInfoList> measInfoList = new ArrayList<>();
}
- @Gson.TypeAdapters
public static class Perf3gppFields {
String perf3gppFieldsVersion;
MeasDataCollection measDataCollection;
}
- @Gson.TypeAdapters
public static class Event {
CommonEventHeader commonEventHeader;
Perf3gppFields perf3gppFields;
package org.oran.dmaapadapter.repository.filters;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import lombok.Getter;
-import org.immutables.gson.Gson;
import org.thymeleaf.util.StringUtils;
public class PmReportFilter implements Filter {
private static com.google.gson.Gson gson = new com.google.gson.GsonBuilder().create();
private final FilterData filterData;
- @Gson.TypeAdapters
@Getter
public static class FilterData {
Collection<String> sourceNames = new ArrayList<>();
private Disposable topicReceiverTask;
public DmaapTopicListener(ApplicationConfig applicationConfig, InfoType type, SecurityContext securityContext) {
- AsyncRestClientFactory restclientFactory = new AsyncRestClientFactory(applicationConfig.getWebClientConfig(),
- securityContext);
+ AsyncRestClientFactory restclientFactory =
+ new AsyncRestClientFactory(applicationConfig.getWebClientConfig(), securityContext);
this.dmaapRestClient = restclientFactory.createRestClientNoHttpProxy("");
this.applicationConfig = applicationConfig;
this.type = type;
import org.oran.dmaapadapter.clients.AsyncRestClientFactory;
import org.oran.dmaapadapter.clients.SecurityContext;
import org.oran.dmaapadapter.configuration.ApplicationConfig;
-import org.oran.dmaapadapter.configuration.ImmutableHttpProxyConfig;
-import org.oran.dmaapadapter.configuration.ImmutableWebClientConfig;
import org.oran.dmaapadapter.configuration.WebClientConfig;
import org.oran.dmaapadapter.configuration.WebClientConfig.HttpProxyConfig;
import org.oran.dmaapadapter.controllers.ProducerCallbacksController;
private AsyncRestClient restClient(boolean useTrustValidation) {
WebClientConfig config = this.applicationConfig.getWebClientConfig();
- HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
+ HttpProxyConfig httpProxyConfig = HttpProxyConfig.builder() //
.httpProxyHost("") //
.httpProxyPort(0) //
.build();
- config = ImmutableWebClientConfig.builder() //
- .keyStoreType(config.keyStoreType()) //
- .keyStorePassword(config.keyStorePassword()) //
- .keyStore(config.keyStore()) //
- .keyPassword(config.keyPassword()) //
+ config = WebClientConfig.builder() //
+ .keyStoreType(config.getKeyStoreType()) //
+ .keyStorePassword(config.getKeyStorePassword()) //
+ .keyStore(config.getKeyStore()) //
+ .keyPassword(config.getKeyPassword()) //
.isTrustStoreUsed(useTrustValidation) //
- .trustStore(config.trustStore()) //
- .trustStorePassword(config.trustStorePassword()) //
+ .trustStore(config.getTrustStore()) //
+ .trustStorePassword(config.getTrustStorePassword()) //
.httpProxyConfig(httpProxyConfig).build();
AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(config, securityContext);
import org.oran.dmaapadapter.clients.AsyncRestClientFactory;
import org.oran.dmaapadapter.clients.SecurityContext;
import org.oran.dmaapadapter.configuration.ApplicationConfig;
-import org.oran.dmaapadapter.configuration.ImmutableHttpProxyConfig;
-import org.oran.dmaapadapter.configuration.ImmutableWebClientConfig;
import org.oran.dmaapadapter.configuration.WebClientConfig;
import org.oran.dmaapadapter.configuration.WebClientConfig.HttpProxyConfig;
import org.oran.dmaapadapter.r1.ConsumerJobInfo;
private AsyncRestClient restClient(boolean useTrustValidation) {
WebClientConfig config = this.applicationConfig.getWebClientConfig();
- HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
+ HttpProxyConfig httpProxyConfig = HttpProxyConfig.builder() //
.httpProxyHost("") //
.httpProxyPort(0) //
.build();
- config = ImmutableWebClientConfig.builder() //
- .keyStoreType(config.keyStoreType()) //
- .keyStorePassword(config.keyStorePassword()) //
- .keyStore(config.keyStore()) //
- .keyPassword(config.keyPassword()) //
+ config = WebClientConfig.builder() //
+ .keyStoreType(config.getKeyStoreType()) //
+ .keyStorePassword(config.getKeyStorePassword()) //
+ .keyStore(config.getKeyStore()) //
+ .keyPassword(config.getKeyPassword()) //
.isTrustStoreUsed(useTrustValidation) //
- .trustStore(config.trustStore()) //
- .trustStorePassword(config.trustStorePassword()) //
+ .trustStore(config.getTrustStore()) //
+ .trustStorePassword(config.getTrustStorePassword()) //
.httpProxyConfig(httpProxyConfig).build();
AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(config, securityContext);
import org.oran.dmaapadapter.clients.AsyncRestClientFactory;
import org.oran.dmaapadapter.clients.SecurityContext;
import org.oran.dmaapadapter.configuration.ApplicationConfig;
-import org.oran.dmaapadapter.configuration.ImmutableHttpProxyConfig;
-import org.oran.dmaapadapter.configuration.ImmutableWebClientConfig;
import org.oran.dmaapadapter.configuration.WebClientConfig;
import org.oran.dmaapadapter.configuration.WebClientConfig.HttpProxyConfig;
import org.oran.dmaapadapter.r1.ConsumerJobInfo;
private AsyncRestClient restClient(boolean useTrustValidation) {
WebClientConfig config = this.applicationConfig.getWebClientConfig();
- HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
+ HttpProxyConfig httpProxyConfig = HttpProxyConfig.builder() //
.httpProxyHost("") //
.httpProxyPort(0) //
.build();
- config = ImmutableWebClientConfig.builder() //
- .keyStoreType(config.keyStoreType()) //
- .keyStorePassword(config.keyStorePassword()) //
- .keyStore(config.keyStore()) //
- .keyPassword(config.keyPassword()) //
+ config = WebClientConfig.builder() //
+ .keyStoreType(config.getKeyStoreType()) //
+ .keyStorePassword(config.getKeyStorePassword()) //
+ .keyStore(config.getKeyStore()) //
+ .keyPassword(config.getKeyPassword()) //
.isTrustStoreUsed(useTrustValidation) //
- .trustStore(config.trustStore()) //
- .trustStorePassword(config.trustStorePassword()) //
+ .trustStore(config.getTrustStore()) //
+ .trustStorePassword(config.getTrustStorePassword()) //
.httpProxyConfig(httpProxyConfig).build();
AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(config, securityContext);