diff options
author | 2019-05-23 14:47:19 +0200 | |
---|---|---|
committer | 2019-05-23 13:34:35 +0000 | |
commit | e6b79a67b2ad6e60e17a4f0e88a162e31a599870 (patch) | |
tree | 48669e33f996536cfe15a9919a4e7fff9f3e257d /rest-services/dmaap-client/src/main | |
parent | a952590339504e30e1f88f638cd465c4cc4ea1c7 (diff) |
Remove CloudHttpClient usages from dmaap-client module
Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Issue-ID: DCAEGEN2-1527
Change-Id: I8b5ddbf5231cb4848eb288300cf786bb549950cf
Diffstat (limited to 'rest-services/dmaap-client/src/main')
12 files changed, 0 insertions, 776 deletions
diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/config/DmaapConsumerConfiguration.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/config/DmaapConsumerConfiguration.java deleted file mode 100644 index 91e026af..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/config/DmaapConsumerConfiguration.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 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.dmaap.client.config; - -import org.immutables.gson.Gson; -import org.immutables.value.Value; - -/** - * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 3/23/18 - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Value.Immutable(prehash = true) -@Value.Style(builder = "new") -@Gson.TypeAdapters -@Deprecated -public abstract class DmaapConsumerConfiguration implements DmaapCustomConfig { - - private static final long serialVersionUID = 1L; - - public static DmaapConsumerConfiguration.Builder builder() { - return ImmutableDmaapConsumerConfiguration.builder(); - } - - @Value.Parameter - public abstract String consumerId(); - - @Value.Parameter - public abstract String consumerGroup(); - - @Value.Parameter - public abstract Integer timeoutMs(); - - @Value.Parameter - public abstract Integer messageLimit(); - - public interface Builder extends - DmaapCustomConfig.Builder<DmaapConsumerConfiguration, DmaapConsumerConfiguration.Builder> { - - Builder consumerId(String consumerId); - - Builder consumerGroup(String consumerGroup); - - Builder timeoutMs(Integer timeoutMs); - - Builder messageLimit(Integer messageLimit); - } - -}
\ No newline at end of file diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/config/DmaapCustomConfig.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/config/DmaapCustomConfig.java deleted file mode 100644 index 29c3a5e8..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/config/DmaapCustomConfig.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 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.dmaap.client.config; - -import java.io.Serializable; -import org.immutables.value.Value; - -/** - * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 3/28/18 - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Deprecated -public interface DmaapCustomConfig extends Serializable { - - @Deprecated - @Value.Parameter - String dmaapHostName(); - - @Deprecated - @Value.Parameter - Integer dmaapPortNumber(); - - @Deprecated - @Value.Parameter - String dmaapTopicName(); - - @Deprecated - @Value.Parameter - String dmaapProtocol(); - - @Value.Parameter - String dmaapUserName(); - - @Value.Parameter - String dmaapUserPassword(); - - @Value.Parameter - String dmaapContentType(); - - @Value.Parameter - String trustStorePath(); - - @Value.Parameter - String trustStorePasswordPath(); - - @Value.Parameter - String keyStorePath(); - - @Value.Parameter - String keyStorePasswordPath(); - - @Value.Parameter - Boolean enableDmaapCertAuth(); - - @Value.Parameter - String endpointUrl(); - - interface Builder<T extends DmaapCustomConfig, B extends Builder<T, B>> { - - B dmaapHostName(String dmaapHostName); - - B dmaapPortNumber(Integer dmaapPortNumber); - - B dmaapTopicName(String dmaapTopicName); - - B dmaapProtocol(String dmaapProtocol); - - B dmaapUserName(String dmaapUserName); - - B dmaapUserPassword(String dmaapUserPassword); - - B dmaapContentType(String dmaapContentType); - - B trustStorePath(String trustStorePath); - - B trustStorePasswordPath(String trustStorePasswordPath); - - B keyStorePath(String keyStore); - - B keyStorePasswordPath(String keyStorePass); - - B enableDmaapCertAuth(Boolean enableDmaapCertAuth); - - B endpointUrl(String endpointUrl); - - T build(); - } -} diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/config/DmaapPublisherConfiguration.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/config/DmaapPublisherConfiguration.java deleted file mode 100644 index df813705..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/config/DmaapPublisherConfiguration.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 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.dmaap.client.config; - -import org.immutables.gson.Gson; -import org.immutables.value.Value; - -/** - * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 3/23/18 - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Value.Immutable(prehash = true) -@Value.Style(builder = "new") -@Gson.TypeAdapters -@Deprecated -public abstract class DmaapPublisherConfiguration implements DmaapCustomConfig { - - private static final long serialVersionUID = 1L; - - public static DmaapPublisherConfiguration.Builder builder() { - return ImmutableDmaapPublisherConfiguration.builder(); - } - - interface Builder extends - DmaapCustomConfig.Builder<DmaapPublisherConfiguration, DmaapPublisherConfiguration.Builder> { - - } -} diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/DMaaPAbstractReactiveHttpClient.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/DMaaPAbstractReactiveHttpClient.java deleted file mode 100644 index aee961ef..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/DMaaPAbstractReactiveHttpClient.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 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.dmaap.client.service; - -import java.util.UUID; -import org.onap.dcaegen2.services.sdk.rest.services.model.logging.ImmutableRequestDiagnosticContext; -import org.onap.dcaegen2.services.sdk.rest.services.model.logging.RequestDiagnosticContext; - -/** - * - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Deprecated -public abstract class DMaaPAbstractReactiveHttpClient { - - protected final static String SLASH = "/"; - - protected RequestDiagnosticContext getRequestDiagnosticContext() { - return ImmutableRequestDiagnosticContext.builder() - .invocationId(UUID.randomUUID()).requestId(UUID.randomUUID()).build(); - } - - -} diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/DMaaPClientServiceUtils.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/DMaaPClientServiceUtils.java deleted file mode 100644 index 3b4f55ab..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/DMaaPClientServiceUtils.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 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.dmaap.client.service; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author <a href="mailto:marcin.wmigdal@nokia.com">Marcin Migdal</a> on 3/8/2019 - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Deprecated -public final class DMaaPClientServiceUtils { - - public final static String CONTENT_TYPE = "Content-Type"; - - private DMaaPClientServiceUtils() { - - } - - /** - * Method generates headers for HTTP requests - * @param contentType contentType to be used in HTTP header* - * @return Map of Headers - * */ - public static Map<String, String> getHeaders(String contentType) { - Map<String, String> header = new HashMap<>(); - header.put(CONTENT_TYPE, contentType); - return header; - } - - -} diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/consumer/ConsumerReactiveHttpClientFactory.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/consumer/ConsumerReactiveHttpClientFactory.java deleted file mode 100644 index 5e1a0648..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/consumer/ConsumerReactiveHttpClientFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 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.dmaap.client.service.consumer; - -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration; - -/** - * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 6/26/18 - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Deprecated -public class ConsumerReactiveHttpClientFactory { - - private final DMaaPReactiveWebClientFactory reactiveWebClientFactory; - - public ConsumerReactiveHttpClientFactory( - DMaaPReactiveWebClientFactory reactiveWebClientFactory) { - this.reactiveWebClientFactory = reactiveWebClientFactory; - } - - public DMaaPConsumerReactiveHttpClient create( - DmaapConsumerConfiguration consumerConfiguration) { - return new DMaaPConsumerReactiveHttpClient(consumerConfiguration, - reactiveWebClientFactory.build(consumerConfiguration)); - } - -} diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/consumer/DMaaPConsumerReactiveHttpClient.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/consumer/DMaaPConsumerReactiveHttpClient.java deleted file mode 100644 index 83678d26..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/consumer/DMaaPConsumerReactiveHttpClient.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 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.dmaap.client.service.consumer; - -import com.google.gson.JsonElement; -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; -import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.CloudHttpClient; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.DMaaPAbstractReactiveHttpClient; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.DMaaPClientServiceUtils; -import org.onap.dcaegen2.services.sdk.rest.services.model.logging.ImmutableRequestDiagnosticContext; -import org.onap.dcaegen2.services.sdk.rest.services.model.logging.RequestDiagnosticContext; -import org.onap.dcaegen2.services.sdk.rest.services.uri.URI.URIBuilder; -import reactor.core.publisher.Mono; - - -/** - * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 6/26/18 - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Deprecated -public class DMaaPConsumerReactiveHttpClient extends DMaaPAbstractReactiveHttpClient { - - private final DmaapConsumerConfiguration consumerConfiguration; - private final CloudHttpClient cloudHttpClient; - - /** - * Constructor of DMaaPConsumerReactiveHttpClient. - * - * @param consumerConfiguration - DMaaP consumer configuration object - */ - - public DMaaPConsumerReactiveHttpClient(DmaapConsumerConfiguration consumerConfiguration, - CloudHttpClient cloudHttpClient) { - this.consumerConfiguration = consumerConfiguration; - this.cloudHttpClient = cloudHttpClient; - } - - /** - * Function for calling DMaaP HTTP consumer - consuming messages from Kafka/DMaaP from topic. - * - * @return reactive response from DMaaP in string format - */ - public Mono<JsonElement> getDMaaPConsumerResponse( - Optional<RequestDiagnosticContext> requestDiagnosticContextOptional) { - Map<String, String> headers = DMaaPClientServiceUtils.getHeaders(consumerConfiguration.dmaapContentType()); - if (requestDiagnosticContextOptional.isPresent()) { - return cloudHttpClient - .get(getUri().toString(), requestDiagnosticContextOptional.get(), headers, JsonElement.class); - } - RequestDiagnosticContext requestDiagnosticContext = ImmutableRequestDiagnosticContext.builder() - .invocationId(UUID.randomUUID()).requestId(UUID.randomUUID()).build(); - return cloudHttpClient.get(getUri().toString(), requestDiagnosticContext, headers, JsonElement.class); - } - - URI getUri() { - return URI.create( - new URIBuilder().scheme(consumerConfiguration.dmaapProtocol()).host(consumerConfiguration.dmaapHostName()) - .port(consumerConfiguration.dmaapPortNumber()).path(createRequestPath()) - .build().toString()); - } - - private String createRequestPath() { - return new StringBuilder().append(SLASH).append(consumerConfiguration.dmaapTopicName()).append(SLASH) - .append(consumerConfiguration.consumerGroup()) - .append(SLASH).append(consumerConfiguration.consumerId()).toString(); - } -} diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/consumer/DMaaPReactiveWebClientFactory.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/consumer/DMaaPReactiveWebClientFactory.java deleted file mode 100644 index 65f0b608..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/consumer/DMaaPReactiveWebClientFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018-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.dmaap.client.service.consumer; - -import io.netty.handler.ssl.SslContext; -import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.CloudHttpClient; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.utlis.SecurityKeysUtil; -import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys; -import org.onap.dcaegen2.services.sdk.security.ssl.SslFactory; - -/** - * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 7/4/18 - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Deprecated -public class DMaaPReactiveWebClientFactory { - - private final SslFactory sslFactory; - - public DMaaPReactiveWebClientFactory() { - this(new SslFactory()); - } - - DMaaPReactiveWebClientFactory(SslFactory sslFactory) { - this.sslFactory = sslFactory; - } - - /** - * Construct CloudHttpClient with appropriate settings. - * - * @return CloudHttpClient - */ - - public CloudHttpClient build(DmaapConsumerConfiguration consumerConfiguration){ - SslContext sslContext = createSslContext(consumerConfiguration); - return new CloudHttpClient(sslContext); - } - - private SslContext createSslContext(DmaapConsumerConfiguration consumerConfiguration){ - if (consumerConfiguration.enableDmaapCertAuth()) { - final SecurityKeys securityKeys = SecurityKeysUtil.fromDmappCustomConfig(consumerConfiguration); - return sslFactory.createSecureClientContext(securityKeys); - } - return sslFactory.createInsecureClientContext(); - } -} diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DMaaPPublisherReactiveHttpClient.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DMaaPPublisherReactiveHttpClient.java deleted file mode 100644 index 7173624d..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DMaaPPublisherReactiveHttpClient.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 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.dmaap.client.service.producer; - - -import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.CloudHttpClient; -import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpResponse; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.DMaaPAbstractReactiveHttpClient; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.DMaaPClientServiceUtils; -import org.onap.dcaegen2.services.sdk.rest.services.model.DmaapModel; -import org.onap.dcaegen2.services.sdk.rest.services.model.JsonBodyBuilder; -import org.onap.dcaegen2.services.sdk.rest.services.model.logging.RequestDiagnosticContext; -import org.onap.dcaegen2.services.sdk.rest.services.uri.URI.URIBuilder; -import reactor.core.publisher.Mono; - -import java.net.URI; -import java.util.Map; -import java.util.Optional; - - -/** - * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 7/4/18 - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Deprecated -public class DMaaPPublisherReactiveHttpClient extends DMaaPAbstractReactiveHttpClient { - - private final DmaapPublisherConfiguration dmaapPublisherConfiguration; - private final JsonBodyBuilder jsonBodyBuilder; - private final CloudHttpClient cloudHttpClient; - - /** - * Constructor DMaaPPublisherReactiveHttpClient. - * - * @param dmaapPublisherConfiguration - DMaaP producer configuration object - * @param cloudHttpClient - cloudHttpClient sending http requests - */ - DMaaPPublisherReactiveHttpClient(DmaapPublisherConfiguration dmaapPublisherConfiguration, - CloudHttpClient cloudHttpClient, JsonBodyBuilder jsonBodyBuilder) { - this.dmaapPublisherConfiguration = dmaapPublisherConfiguration; - this.cloudHttpClient = cloudHttpClient; - this.jsonBodyBuilder = jsonBodyBuilder; - } - - /** - * Function for calling DMaaP HTTP producer - post request to DMaaP. - * - * @param dmaapModel - object which will be sent to DMaaP - * @return status code of operation - */ - - public Mono<HttpResponse> getDMaaPProducerResponse( - DmaapModel dmaapModel, - Optional<RequestDiagnosticContext> requestDiagnosticContextOptional) { - return Mono.defer(() -> { - Map<String, String> headers = DMaaPClientServiceUtils.getHeaders(dmaapPublisherConfiguration.dmaapContentType()); - if (requestDiagnosticContextOptional.isPresent()) { - cloudHttpClient - .post(getUri().toString(), requestDiagnosticContextOptional.get(), headers, jsonBodyBuilder, - dmaapModel); - } - return cloudHttpClient - .post(getUri().toString(), getRequestDiagnosticContext(), headers, jsonBodyBuilder, dmaapModel); - }); - } - - - URI getUri() { - return URI.create( - new URIBuilder().scheme(dmaapPublisherConfiguration.dmaapProtocol()) - .host(dmaapPublisherConfiguration.dmaapHostName()).port(dmaapPublisherConfiguration.dmaapPortNumber()) - .path(createRequestPath()) - .build().toString()); - } - - private String createRequestPath() { - return new StringBuilder().append(SLASH).append(dmaapPublisherConfiguration.dmaapTopicName()).toString(); - } - -} diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DmaaPRestTemplateFactory.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DmaaPRestTemplateFactory.java deleted file mode 100644 index 30079802..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DmaaPRestTemplateFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018-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.dmaap.client.service.producer; - -import io.netty.handler.ssl.SslContext; -import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.CloudHttpClient; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.utlis.SecurityKeysUtil; -import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys; -import org.onap.dcaegen2.services.sdk.security.ssl.SslFactory; - -/** - * - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Deprecated -public class DmaaPRestTemplateFactory { - - private SslFactory sslFactory; - - public DmaaPRestTemplateFactory() { - this(new SslFactory()); - } - - DmaaPRestTemplateFactory(SslFactory sslFactory) { - this.sslFactory = sslFactory; - } - - /** - * Function for creating RestTemplate object. - * - * @param publisherConfiguration - DMaaP publisher configuration object - * @return RestTemplate with correct ssl configuration - */ - public CloudHttpClient build(DmaapPublisherConfiguration publisherConfiguration){ - SslContext sslContext = createSslContext(publisherConfiguration); - return new CloudHttpClient(sslContext); - } - - private SslContext createSslContext(DmaapPublisherConfiguration consumerConfiguration) { - if (consumerConfiguration.enableDmaapCertAuth()) { - final SecurityKeys securityKeys = SecurityKeysUtil - .fromDmappCustomConfig(consumerConfiguration); - return sslFactory.createSecureClientContext(securityKeys); - } - return sslFactory.createInsecureClientContext(); - } -} diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/PublisherReactiveHttpClientFactory.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/PublisherReactiveHttpClientFactory.java deleted file mode 100644 index 9e6cce27..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/PublisherReactiveHttpClientFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018-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.dmaap.client.service.producer; - -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.model.JsonBodyBuilder; - -/** - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Deprecated -public class PublisherReactiveHttpClientFactory { - - private final DmaaPRestTemplateFactory restTemplateFactory; - - private final JsonBodyBuilder jsonBodyBuilder; - - public PublisherReactiveHttpClientFactory(DmaaPRestTemplateFactory restTemplateFactory, - JsonBodyBuilder jsonBodyBuilder) { - this.restTemplateFactory = restTemplateFactory; - this.jsonBodyBuilder = jsonBodyBuilder; - } - - public DMaaPPublisherReactiveHttpClient create( - DmaapPublisherConfiguration publisherConfiguration) { - return new DMaaPPublisherReactiveHttpClient(publisherConfiguration, - restTemplateFactory.build(publisherConfiguration), jsonBodyBuilder); - } -} diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/utlis/SecurityKeysUtil.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/utlis/SecurityKeysUtil.java deleted file mode 100644 index c688ab0b..00000000 --- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/utlis/SecurityKeysUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ============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.dmaap.client.utlis; - -import io.vavr.control.Try; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.jetbrains.annotations.NotNull; -import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapCustomConfig; -import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableSecurityKeys; -import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableSecurityKeysStore; -import org.onap.dcaegen2.services.sdk.security.ssl.Passwords; -import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys; - -/** - * @deprecated Use new API {@link org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory} - */ -@Deprecated -public final class SecurityKeysUtil { - - private SecurityKeysUtil(){ - - } - - public static @NotNull SecurityKeys fromDmappCustomConfig(DmaapCustomConfig configuration){ - return ImmutableSecurityKeys.builder() - .keyStore(ImmutableSecurityKeysStore.of(resource(configuration.keyStorePath()).get())) - .keyStorePassword(Passwords.fromResource(configuration.keyStorePasswordPath())) - .trustStore(ImmutableSecurityKeysStore.of(resource(configuration.trustStorePath()).get())) - .trustStorePassword(Passwords.fromResource(configuration.trustStorePasswordPath())) - .build(); - } - - private static Try<Path> resource(String resource) { - return Try.of(() -> Paths.get(Passwords.class.getResource(resource).toURI())); - }} |