3 * * ============LICENSE_START=======================================================
5 * * ================================================================================
6 * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
7 * * Copyright (c) 2021 Nokia. All rights reserved.
8 * * ================================================================================
9 * * Licensed under the Apache License, Version 2.0 (the "License");
10 * * you may not use this file except in compliance with the License.
11 * * You may obtain a copy of the License at
13 * * http://www.apache.org/licenses/LICENSE-2.0
15 * * Unless required by applicable law or agreed to in writing, software
16 * * distributed under the License is distributed on an "AS IS" BASIS,
17 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * * See the License for the specific language governing permissions and
19 * * limitations under the License.
20 * * ============LICENSE_END=========================================================
25 package org.onap.blueprintgenerator.service.dmaap;
27 import org.onap.blueprintgenerator.model.common.GetInput;
28 import org.onap.blueprintgenerator.model.dmaap.Streams;
29 import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
30 import org.springframework.beans.factory.annotation.Autowired;
31 import org.springframework.stereotype.Service;
33 import java.util.HashMap;
34 import java.util.LinkedHashMap;
38 * @author : Ravi Mantena
39 * @date 10/16/2020 Application: ONAP - Blueprint Generator Service to create Streams
42 public class StreamsService {
45 private BlueprintHelperService blueprintHelperService;
48 * Creates streams for Dmaap Blueprint
50 * @param inputs Inputs
55 * @param o For Data Router Type s
58 public Map<String, Object> createStreams(
59 Map<String, Map<String, Object>> inputs,
65 Map<String, Object> response = new HashMap<>();
66 Streams streams = new Streams();
68 Map<String, Object> stringType = new LinkedHashMap();
69 stringType.put("type", "string");
71 streams.setName(name);
72 streams.setType(type);
74 GetInput location = new GetInput();
75 location.setBpInputName(key + "_" + name + "_location");
76 inputs.put(key + "_" + name + "_location", stringType);
77 streams.setLocation(location);
79 if (blueprintHelperService.isDataRouterType(type)) {
81 GetInput username = new GetInput();
82 username.setBpInputName(key + "_" + name + "_username");
83 streams.setUsername(username);
84 inputs.put(key + "_" + name + "_username", stringType);
86 GetInput password = new GetInput();
87 password.setBpInputName(key + "_" + name + "_password");
88 streams.setPassword(password);
89 inputs.put(key + "_" + name + "_password", stringType);
91 GetInput priviliged = new GetInput();
92 priviliged.setBpInputName(key + "_" + name + "_priviliged");
93 streams.setPrivileged(priviliged);
94 inputs.put(key + "_" + name + "_priviliged", stringType);
96 GetInput decompress = new GetInput();
97 decompress.setBpInputName(key + "_" + name + "_decompress");
98 streams.setDecompress(decompress);
99 inputs.put(key + "_" + name + "_decompress", stringType);
101 streams.setRoute(route);
102 streams.setScheme("https");
106 GetInput client = new GetInput();
107 client.setBpInputName(key + "_" + name + "_client_role");
108 streams.setClient_role(client);
109 inputs.put(key + "_" + name + "_client_role", stringType);
111 response.put("streams", streams);
112 response.put("inputs", inputs);