aboutsummaryrefslogtreecommitdiffstats
path: root/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientFactory.java')
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientFactory.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientFactory.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientFactory.java
index 7e625182..f1e49bb7 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientFactory.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientFactory.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* DCAEGEN2-SERVICES-SDK
* ================================================================================
- * Copyright (C) 2019-2020 Nokia. All rights reserved.
+ * Copyright (C) 2019-2021 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,8 @@ package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api;
import org.jetbrains.annotations.NotNull;
import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.RxHttpClient;
import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.RxHttpClientFactory;
-import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl.CbsClientImpl;
+import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl.CbsClientConfigMap;
+import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl.CbsClientRest;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl.CbsLookup;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.CbsClientConfiguration;
import org.onap.dcaegen2.services.sdk.security.ssl.TrustStoreKeys;
@@ -36,7 +37,6 @@ import reactor.core.publisher.Mono;
* @since 1.1.2
*/
public class CbsClientFactory {
-
/**
* <p>Creates Mono which will emit instance of {@link CbsClient} when service discovery is complete.</p>
*
@@ -67,7 +67,13 @@ public class CbsClientFactory {
private static Mono<CbsClient> createCbsClientMono(RxHttpClient httpClient,
CbsClientConfiguration configuration) {
+ CbsClientConfigMap cbsClientConfigMap = new CbsClientConfigMap(configuration.configMapFilePath());
+ return cbsClientConfigMap.verifyConfigMapFile() ? Mono.just(cbsClientConfigMap) :
+ getConfigFromCBS(httpClient, configuration);
+ }
+
+ private static Mono<CbsClient> getConfigFromCBS(RxHttpClient httpClient, CbsClientConfiguration configuration) {
return new CbsLookup().lookup(configuration)
- .map(addr -> new CbsClientImpl(httpClient, configuration.appName(), addr, configuration.protocol()));
+ .map(addr ->new CbsClientRest(httpClient, configuration.appName(), addr, configuration.protocol()));
}
-}
+} \ No newline at end of file