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
39 * Application: ONAP - Blueprint Generator
40 * Service to create Streams
45 public class StreamsService {
48 private BlueprintHelperService blueprintHelperService;
50 //Methos to create streams for Dmaap Blueprint
51 public Map<String, Object> createStreams(Map<String, LinkedHashMap<String, Object>> inputs, String name, String type, String key, String route, char o){
52 Map<String,Object> response = new HashMap<>();
53 Streams streams = new Streams();
55 LinkedHashMap<String, Object> stringType = new LinkedHashMap();
56 stringType.put("type", "string");
58 streams.setName(name);
59 streams.setType(type);
61 GetInput location = new GetInput();
62 location.setBpInputName(key + "_" + name + "_location");
63 inputs.put(key + "_" + name + "_location", stringType);
64 streams.setLocation(location);
66 if(blueprintHelperService.isDataRouterType(type)) {
68 GetInput username = new GetInput();
69 username.setBpInputName(key + "_" + name + "_username");
70 streams.setUsername(username);
71 inputs.put(key + "_" + name + "_username", stringType);
73 GetInput password = new GetInput();
74 password.setBpInputName(key + "_" + name + "_password");
75 streams.setPassword(password);
76 inputs.put(key + "_" + name + "_password", stringType);
78 GetInput priviliged = new GetInput();
79 priviliged.setBpInputName(key + "_" + name + "_priviliged");
80 streams.setPrivileged(priviliged);
81 inputs.put(key + "_" + name + "_priviliged", stringType);
83 GetInput decompress = new GetInput();
84 decompress.setBpInputName(key + "_" + name + "_decompress");
85 streams.setDecompress(decompress);
86 inputs.put(key + "_" + name + "_decompress", stringType);
88 streams.setRoute(route);
89 streams.setScheme("https");
94 GetInput client = new GetInput();
95 client.setBpInputName(key + "_" + name + "_client_role");
96 streams.setClient_role(client);
97 inputs.put(key + "_" + name + "_client_role", stringType);
99 response.put("streams", streams);
100 response.put("inputs", inputs);