aboutsummaryrefslogtreecommitdiffstats
path: root/rest-services/cbs-client/src
diff options
context:
space:
mode:
authormicdzied <michal.1.dziedzic@nokia.com>2019-02-19 10:04:21 +0100
committermicdzied <michal.1.dziedzic@nokia.com>2019-02-19 11:46:46 +0100
commit6dccfdbc73ff779019fc4736a118b7d7b86d446b (patch)
tree7858d4d4cc7e95123d7d0f49de682c4f2ed1c7f2 /rest-services/cbs-client/src
parent20ee68fa27d20ffc11decc7b8e4b7926efa5f331 (diff)
remove usage of spring
Change-Id: I7464f0235c2fb4189d3f13cd3129a9d8498c468d Issue-ID: DCAEGEN2-1245 Signed-off-by: micdzied <michal.1.dziedzic@nokia.com>
Diffstat (limited to 'rest-services/cbs-client/src')
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/CloudConfigurationClient.java2
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/ReactiveCloudConfigurationProvider.java5
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/URI.java164
3 files changed, 165 insertions, 6 deletions
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/CloudConfigurationClient.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/CloudConfigurationClient.java
index 3fb8da60..594db6d0 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/CloudConfigurationClient.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/CloudConfigurationClient.java
@@ -24,7 +24,6 @@ package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.providers;
import com.google.gson.JsonObject;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.http.configuration.EnvProperties;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.http.configuration.ImmutableEnvProperties;
-import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;
/**
@@ -34,7 +33,6 @@ import reactor.core.publisher.Mono;
* @version 1.0.0
* @since 1.0.0
*/
-@Service
public final class CloudConfigurationClient implements CloudConfigurationProvider {
private final CloudConfigurationProvider cloudConfigurationProvider;
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/ReactiveCloudConfigurationProvider.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/ReactiveCloudConfigurationProvider.java
index 16a1dc3a..a0b4a6f0 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/ReactiveCloudConfigurationProvider.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/ReactiveCloudConfigurationProvider.java
@@ -27,14 +27,11 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.http.configuratio
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.http.configuration.EnvProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-import org.springframework.web.util.DefaultUriBuilderFactory;
import reactor.core.publisher.Mono;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 11/15/18
*/
-@Service
public final class ReactiveCloudConfigurationProvider implements CloudConfigurationProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(ReactiveCloudConfigurationProvider.class);
@@ -114,7 +111,7 @@ public final class ReactiveCloudConfigurationProvider implements CloudConfigurat
}
private String getUri(String host, Integer port, String... paths) {
- return new DefaultUriBuilderFactory().builder()
+ return new URI.URIBuilder()
.scheme("http")
.host(host)
.port(port)
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/URI.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/URI.java
new file mode 100644
index 00000000..f478ff06
--- /dev/null
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/providers/URI.java
@@ -0,0 +1,164 @@
+/*
+ * ============LICENSE_START=======================================================
+ * DCAEGEN2-SERVICES-SDK
+ * ================================================================================
+ * Copyright (C) 2019 NOKIA Intellectual Property. 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.providers;
+
+final class URI {
+ private String scheme;
+ private String host;
+ private int port;
+ private String path;
+ private String fragment;
+ private String authority;
+ private String userInfo;
+ private String query;
+ private String schemeSpecificPart;
+ private String string;
+
+ private URI() {
+ }
+
+ static final class URIBuilder {
+ private String scheme;
+ private String host;
+ private int port;
+ private String path;
+ private String fragment;
+ private String authority;
+ private String userInfo;
+ private String query;
+ private String schemeSpecificPart;
+
+ URIBuilder scheme(String scheme) {
+ this.scheme = scheme;
+ return this;
+ }
+
+ URIBuilder host(String host) {
+ this.host = host;
+ return this;
+ }
+
+ URIBuilder port(int port) {
+ this.port = port;
+ return this;
+ }
+
+ URIBuilder path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ URIBuilder fragment(String fragment) {
+ this.fragment = fragment;
+ return this;
+ }
+
+ URIBuilder authority(String authority) {
+ this.authority = authority;
+ return this;
+ }
+
+ URIBuilder userInfo(String userInfo) {
+ this.userInfo = userInfo;
+ return this;
+ }
+
+ URIBuilder query(String query) {
+ this.query = query;
+ return this;
+ }
+
+ URIBuilder schemeSpecificPart(String schemeSpecificPart) {
+ this.schemeSpecificPart = schemeSpecificPart;
+ return this;
+ }
+
+ URI build() {
+ URI uri = new URI();
+ uri.scheme = this.scheme;
+ uri.host = this.host;
+ uri.port = this.port;
+ uri.path = this.path;
+ uri.fragment = this.fragment;
+ uri.authority = this.authority;
+ uri.userInfo = this.userInfo;
+ uri.query = this.query;
+ uri.schemeSpecificPart = this.schemeSpecificPart;
+ return uri;
+ }
+ }
+
+ @Override
+ public String toString() {
+ defineString();
+ return string;
+ }
+
+ private void defineString() {
+ if (string != null) return;
+
+ StringBuffer sb = new StringBuffer();
+ if (scheme != null) {
+ sb.append(scheme);
+ sb.append(':');
+ }
+ if (isOpaque()) {
+ sb.append(schemeSpecificPart);
+ } else {
+ if (host != null) {
+ sb.append("//");
+ if (userInfo != null) {
+ sb.append(userInfo);
+ sb.append('@');
+ }
+ boolean needBrackets = ((host.indexOf(':') >= 0)
+ && !host.startsWith("[")
+ && !host.endsWith("]"));
+ if (needBrackets) sb.append('[');
+ sb.append(host);
+ if (needBrackets) sb.append(']');
+ if (port != -1) {
+ sb.append(':');
+ sb.append(port);
+ }
+ } else if (authority != null) {
+ sb.append("//");
+ sb.append(authority);
+ }
+ if (path != null)
+ sb.append(path);
+ if (query != null) {
+ sb.append('?');
+ sb.append(query);
+ }
+ }
+ if (fragment != null) {
+ sb.append('#');
+ sb.append(fragment);
+ }
+ string = sb.toString();
+ }
+
+ private boolean isOpaque() {
+ return path == null;
+ }
+} \ No newline at end of file