From 52b5f5276add6116a14ba671c35ff9d87c140421 Mon Sep 17 00:00:00 2001 From: Tomasz Wrobel Date: Fri, 15 Jan 2021 14:34:18 +0100 Subject: Add Native Kafka streams support in bp-generator Issue-ID: DCAEGEN2-1179 Signed-off-by: Tomasz Wrobel Change-Id: I541dca959707a41c56205e20c9f5a56ccec5ca41 --- .../blueprintgenerator/constants/Constants.java | 3 ++ .../blueprintgenerator/model/common/Appconfig.java | 6 ++-- .../model/common/BaseStream.java | 37 ++++++++++++++++++++++ .../blueprintgenerator/model/common/Dmaap.java | 10 ++++-- .../service/base/BlueprintHelperService.java | 12 +++++++ 5 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/BaseStream.java (limited to 'mod/bpgenerator/common/src/main/java') diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java index ac654a2..fbd0527 100644 --- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java @@ -5,6 +5,8 @@ * * ================================================================================ * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. * * ================================================================================ + * * Modifications Copyright (c) 2021 Nokia + * * ================================================================================ * * 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 @@ -39,6 +41,7 @@ public class Constants { public static final String DATA_ROUTER = "data_router"; public static final String MESSAGEROUTER_VALUE = "message router"; public static final String MESSAGE_ROUTER = "message_router"; + public static final String KAFKA_TYPE = "kafka"; public static final String TOSCA_DEF_VERSION = "cloudify_dsl_1_3"; public static final String SERVICE_COMPONENT_NAME_OVERRIDE = "service_component_name_override"; public static final String EMPTY = "''"; diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java index 5b3cdc6..d0f5784 100644 --- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java @@ -5,6 +5,8 @@ * * ================================================================================ * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. * * ================================================================================ + * * Modifications Copyright (c) 2021 Nokia + * * ================================================================================ * * 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 @@ -43,9 +45,9 @@ public class Appconfig { private Calls[] services_calls; - private Map streams_publishes; + private Map streams_publishes; - private Map streams_subscribes; + private Map streams_subscribes; private Map params; diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/BaseStream.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/BaseStream.java new file mode 100644 index 0000000..310f9a0 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/BaseStream.java @@ -0,0 +1,37 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2021 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.blueprintgenerator.model.common; + +/** + * @author : Tomasz Wrobel + * @date 01/18/2021 Application: DCAE/ONAP - Blueprint Generator + * Applications Common Model: An interface with common stream field + */ + +public interface BaseStream { + + String getType(); + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java index 7ed79b3..9c37773 100644 --- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java @@ -5,6 +5,8 @@ * * ================================================================================ * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. * * ================================================================================ + * * Modifications Copyright (c) 2021 Nokia + * * ================================================================================ * * 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 @@ -29,13 +31,14 @@ import lombok.Data; /** * @author : Ravi Mantena - * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP - * and DCAE Blueprint Applications Common Model: A model class which represents Dmaap + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP and DCAE Blueprint + * Applications Common Model: A model class which represents Dmaap */ + @Data @JsonInclude(value = JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class Dmaap { +public class Dmaap implements BaseStream { private Object dmaap_info; @@ -45,4 +48,5 @@ public class Dmaap { private GetInput pass; private GetInput user; + } diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java index db15360..c9759d0 100644 --- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java @@ -5,6 +5,8 @@ * * ================================================================================ * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. * * ================================================================================ + * * Modifications Copyright (c) 2021 Nokia + * * ================================================================================ * * 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 @@ -201,6 +203,16 @@ public class BlueprintHelperService { return type.equals(Constants.MESSAGE_ROUTER) || type.equals(Constants.MESSAGEROUTER_VALUE); } + /** + * Returns if the type is Kafka or not + * + * @param type Input Type + * @return + */ + public boolean isKafkaStreamType(String type) { + return type.equals(Constants.KAFKA_TYPE); + } + /** * Returns name with underscore for empty input * -- cgit 1.2.3-korg