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