[KAFKA] Allow kafka params to be passed as config
[sdc.git] / common-app-api / src / main / java / org / openecomp / sdc / be / config / DistributionEngineConfiguration.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.sdc.be.config;
21
22 import java.util.ArrayList;
23 import java.util.HashSet;
24 import java.util.List;
25 import java.util.Map;
26 import java.util.Set;
27 import org.openecomp.sdc.common.api.BasicConfiguration;
28 import org.openecomp.sdc.common.http.config.ExternalServiceConfig;
29
30 public class DistributionEngineConfiguration extends BasicConfiguration {
31
32     private List<String> uebServers;
33     private String distributionNotifTopicName;
34     private String distributionStatusTopicName;
35     private String kafkaBootStrapServers;
36     private Integer initRetryIntervalSec;
37     private Integer initMaxIntervalSec;
38     private ComponentArtifactTypesConfig distribNotifServiceArtifactTypes;
39     private ComponentArtifactTypesConfig distribNotifResourceArtifactTypes;
40     private String uebPublicKey;
41     private String uebSecretKey;
42     private List<String> environments;
43     private DistributionStatusTopicConfig distributionStatusTopic;
44     private CreateTopicConfig createTopic;
45     private boolean startDistributionEngine;
46     private DistributionNotificationTopicConfig distributionNotificationTopic;
47     private Integer defaultArtifactInstallationTimeout = 60;
48     private Integer currentArtifactInstallationTimeout = 120;
49     private boolean useHttpsWithDmaap;
50     private ExternalServiceConfig aaiConfig;
51     private ExternalServiceConfig msoConfig;
52     private Integer opEnvRecoveryIntervalSec;
53     private Integer allowedTimeBeforeStaleSec;
54
55     public List<String> getUebServers() {
56         return uebServers;
57     }
58
59     public void setUebServers(List<String> uebServers) {
60         this.uebServers = uebServers;
61     }
62
63     public String getDistributionNotifTopicName() {
64         return distributionNotifTopicName;
65     }
66
67     public void setDistributionNotifTopicName(String distributionNotifTopicName) {
68         this.distributionNotifTopicName = distributionNotifTopicName;
69     }
70
71     public String getDistributionStatusTopicName() {
72         return distributionStatusTopicName;
73     }
74
75     public void setDistributionStatusTopicName(String distributionStatusTopicName) {
76         this.distributionStatusTopicName = distributionStatusTopicName;
77     }
78
79     public String getKafkaBootStrapServers() {
80         return kafkaBootStrapServers;
81     }
82
83     public void setKafkaBootStrapServers(String kafkaBootStrapServers) {
84         this.kafkaBootStrapServers = kafkaBootStrapServers;
85     }
86
87     public Integer getInitRetryIntervalSec() {
88         return initRetryIntervalSec;
89     }
90
91     public void setInitRetryIntervalSec(Integer initRetryIntervalSec) {
92         this.initRetryIntervalSec = initRetryIntervalSec;
93     }
94
95     public ComponentArtifactTypesConfig getDistribNotifServiceArtifactTypes() {
96         return distribNotifServiceArtifactTypes;
97     }
98
99     public void setDistribNotifServiceArtifactTypes(ComponentArtifactTypesConfig distribNotifServiceArtifactTypes) {
100         this.distribNotifServiceArtifactTypes = distribNotifServiceArtifactTypes;
101     }
102
103     public ComponentArtifactTypesConfig getDistribNotifResourceArtifactTypes() {
104         return distribNotifResourceArtifactTypes;
105     }
106
107     public void setDistribNotifResourceArtifactTypes(ComponentArtifactTypesConfig distribNotifResourceArtifactTypes) {
108         this.distribNotifResourceArtifactTypes = distribNotifResourceArtifactTypes;
109     }
110
111     public String getUebPublicKey() {
112         return uebPublicKey;
113     }
114
115     public void setUebPublicKey(String uebPublicKey) {
116         this.uebPublicKey = uebPublicKey;
117     }
118
119     public String getUebSecretKey() {
120         return uebSecretKey;
121     }
122
123     public void setUebSecretKey(String uebSecretKey) {
124         this.uebSecretKey = uebSecretKey;
125     }
126
127     public List<String> getEnvironments() {
128         return environments;
129     }
130
131     public void setEnvironments(List<String> environments) {
132         Set<String> set = new HashSet<>();
133         if (environments != null) {
134             set.addAll(environments);
135             this.environments = new ArrayList<>(set);
136         } else {
137             this.environments = null;
138         }
139     }
140
141     public DistributionStatusTopicConfig getDistributionStatusTopic() {
142         return distributionStatusTopic;
143     }
144
145     public void setDistributionStatusTopic(DistributionStatusTopicConfig distributionStatusTopic) {
146         this.distributionStatusTopic = distributionStatusTopic;
147     }
148
149     public Integer getInitMaxIntervalSec() {
150         return initMaxIntervalSec;
151     }
152
153     public void setInitMaxIntervalSec(Integer initMaxIntervalSec) {
154         this.initMaxIntervalSec = initMaxIntervalSec;
155     }
156
157     public CreateTopicConfig getCreateTopic() {
158         return createTopic;
159     }
160
161     public void setCreateTopic(CreateTopicConfig createTopic) {
162         this.createTopic = createTopic;
163     }
164
165     public boolean isStartDistributionEngine() {
166         return startDistributionEngine;
167     }
168
169     public void setStartDistributionEngine(boolean startDistributionEngine) {
170         this.startDistributionEngine = startDistributionEngine;
171     }
172
173     public DistributionNotificationTopicConfig getDistributionNotificationTopic() {
174         return distributionNotificationTopic;
175     }
176
177     public void setDistributionNotificationTopic(DistributionNotificationTopicConfig distributionNotificationTopic) {
178         this.distributionNotificationTopic = distributionNotificationTopic;
179     }
180
181     public int getDefaultArtifactInstallationTimeout() {
182         return defaultArtifactInstallationTimeout;
183     }
184
185     public void setDefaultArtifactInstallationTimeout(int defaultArtifactInstallationTimeout) {
186         this.defaultArtifactInstallationTimeout = defaultArtifactInstallationTimeout;
187     }
188
189     public int getCurrentArtifactInstallationTimeout() {
190         return currentArtifactInstallationTimeout;
191     }
192
193     public void setCurrentArtifactInstallationTimeout(int currentArtifactInstallationTimeout) {
194         this.currentArtifactInstallationTimeout = currentArtifactInstallationTimeout;
195     }
196
197     public boolean isUseHttpsWithDmaap() {
198         return useHttpsWithDmaap;
199     }
200
201     public void setUseHttpsWithDmaap(boolean useHttpsWithDmaap) {
202         this.useHttpsWithDmaap = useHttpsWithDmaap;
203     }
204
205     public Integer getOpEnvRecoveryIntervalSec() {
206         return opEnvRecoveryIntervalSec;
207     }
208
209     public void setOpEnvRecoveryIntervalSec(Integer opEnvRecoveryIntervalSec) {
210         this.opEnvRecoveryIntervalSec = opEnvRecoveryIntervalSec;
211     }
212
213     public Integer getAllowedTimeBeforeStaleSec() {
214         return allowedTimeBeforeStaleSec;
215     }
216
217     public void setAllowedTimeBeforeStaleSec(Integer allowedTimeBeforeStaleSec) {
218         this.allowedTimeBeforeStaleSec = allowedTimeBeforeStaleSec;
219     }
220
221     public ExternalServiceConfig getAaiConfig() {
222         return aaiConfig;
223     }
224
225     public void setAaiConfig(ExternalServiceConfig aaiConfig) {
226         this.aaiConfig = aaiConfig;
227     }
228
229     public ExternalServiceConfig getMsoConfig() {
230         return msoConfig;
231     }
232
233     public void setMsoConfig(ExternalServiceConfig msoConfig) {
234         this.msoConfig = msoConfig;
235     }
236
237     public enum ArtifcatTypeEnum {
238         MURANO_PKG("MURANO-PKG"), HEAT("HEAT"), DG_XML("DG_XML");
239         String value;
240
241         private ArtifcatTypeEnum(String value) {
242             this.value = value;
243         }
244
245         public String getValue() {
246             return value;
247         }
248     }
249
250     public static class DistribNotifServiceArtifacts {
251
252         Map<String, Object> service;
253         Map<String, Object> resource;
254
255         public Map<String, Object> getService() {
256             return service;
257         }
258
259         public void setService(Map<String, Object> service) {
260             this.service = service;
261         }
262
263         public Map<String, Object> getResource() {
264             return resource;
265         }
266
267         public void setResource(Map<String, Object> resource) {
268             this.resource = resource;
269         }
270     }
271
272     public static class NotifArtifactTypes {
273
274         List<String> info;
275         List<String> lifecycle;
276
277         public List<String> getInfo() {
278             return info;
279         }
280
281         public void setInfo(List<String> info) {
282             this.info = info;
283         }
284
285         public List<String> getLifecycle() {
286             return lifecycle;
287         }
288
289         public void setLifecycle(List<String> lifecycle) {
290             this.lifecycle = lifecycle;
291         }
292     }
293
294     public static class NotifArtifactTypesResource {
295
296         List<ArtifcatTypeEnum> lifecycle;
297     }
298
299     public static class CreateTopicConfig {
300
301         private Integer partitionCount;
302         private Integer replicationCount;
303
304         public Integer getPartitionCount() {
305             return partitionCount;
306         }
307
308         public void setPartitionCount(Integer partitionCount) {
309             this.partitionCount = partitionCount;
310         }
311
312         public Integer getReplicationCount() {
313             return replicationCount;
314         }
315
316         public void setReplicationCount(Integer replicationCount) {
317             this.replicationCount = replicationCount;
318         }
319
320         @Override
321         public String toString() {
322             return "CreateTopicConfig [partitionCount=" + partitionCount + ", replicationCount=" + replicationCount + "]";
323         }
324     }
325
326     public static class EnvironmentConfig {
327
328         private String name;
329         private List<String> uebServers;
330
331         public String getName() {
332             return name;
333         }
334
335         public void setName(String name) {
336             this.name = name;
337         }
338
339         public List<String> getUebServers() {
340             return uebServers;
341         }
342
343         public void setUebServers(List<String> uebServers) {
344             this.uebServers = uebServers;
345         }
346
347         @Override
348         public String toString() {
349             return "EnvironmentConfig [name=" + name + ", uebServers=" + uebServers + "]";
350         }
351     }
352
353     public static class DistributionStatusTopicConfig {
354
355         private Integer pollingIntervalSec;
356         private Integer fetchTimeSec;
357         private String consumerGroup;
358         private String consumerId;
359
360         public Integer getPollingIntervalSec() {
361             return pollingIntervalSec;
362         }
363
364         public void setPollingIntervalSec(Integer pollingIntervalSec) {
365             this.pollingIntervalSec = pollingIntervalSec;
366         }
367
368         public Integer getFetchTimeSec() {
369             return fetchTimeSec;
370         }
371
372         public void setFetchTimeSec(Integer fetchTimeSec) {
373             this.fetchTimeSec = fetchTimeSec;
374         }
375
376         public String getConsumerGroup() {
377             return consumerGroup;
378         }
379
380         public void setConsumerGroup(String consumerGroup) {
381             this.consumerGroup = consumerGroup;
382         }
383
384         public String getConsumerId() {
385             return consumerId;
386         }
387
388         public void setConsumerId(String consumerId) {
389             this.consumerId = consumerId;
390         }
391
392         @Override
393         public String toString() {
394             return "DistributionStatusTopicConfig [pollingIntervalSec=" + pollingIntervalSec + ", fetchTimeSec=" + fetchTimeSec + ", consumerGroup="
395                 + consumerGroup + ", consumerId=" + consumerId + "]";
396         }
397     }
398
399     public static class DistributionNotificationTopicConfig {
400
401         private Integer maxWaitingAfterSendingSeconds;
402         private Integer maxThreadPoolSize;
403         private Integer minThreadPoolSize;
404
405         public Integer getMaxWaitingAfterSendingSeconds() {
406             return maxWaitingAfterSendingSeconds;
407         }
408
409         public void setMaxWaitingAfterSendingSeconds(Integer maxWaitingAfterSendingSeconds) {
410             this.maxWaitingAfterSendingSeconds = maxWaitingAfterSendingSeconds;
411         }
412
413         public Integer getMaxThreadPoolSize() {
414             return maxThreadPoolSize;
415         }
416
417         public void setMaxThreadPoolSize(Integer maxThreadPoolSize) {
418             this.maxThreadPoolSize = maxThreadPoolSize;
419         }
420
421         public Integer getMinThreadPoolSize() {
422             return minThreadPoolSize;
423         }
424
425         public void setMinThreadPoolSize(Integer minThreadPoolSize) {
426             this.minThreadPoolSize = minThreadPoolSize;
427         }
428
429         @Override
430         public String toString() {
431             return "DistributionNotificationTopicConfig [maxWaitingAfterSendingSeconds=" + maxWaitingAfterSendingSeconds + ", maxThreadPoolSize="
432                 + maxThreadPoolSize + ", minThreadPoolSize=" + minThreadPoolSize + "]";
433         }
434     }
435
436     public static class ComponentArtifactTypesConfig {
437
438         private List<String> info;
439         private List<String> lifecycle;
440
441         public List<String> getInfo() {
442             return info;
443         }
444
445         public void setInfo(List<String> info) {
446             this.info = info;
447         }
448
449         public List<String> getLifecycle() {
450             return lifecycle;
451         }
452
453         public void setLifecycle(List<String> lifecycle) {
454             this.lifecycle = lifecycle;
455         }
456
457         @Override
458         public String toString() {
459             return "ArtifactTypesConfig [info=" + info + ", lifecycle=" + lifecycle + "]";
460         }
461     }
462 }