834d7cb57927261ce5e89d2a535f131d85115306
[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 Integer initRetryIntervalSec;
36     private Integer initMaxIntervalSec;
37     private ComponentArtifactTypesConfig distribNotifServiceArtifactTypes;
38     private ComponentArtifactTypesConfig distribNotifResourceArtifactTypes;
39     private String uebPublicKey;
40     private String uebSecretKey;
41     private List<String> environments;
42     private DistributionStatusTopicConfig distributionStatusTopic;
43     private CreateTopicConfig createTopic;
44     private boolean startDistributionEngine;
45     private DistributionNotificationTopicConfig distributionNotificationTopic;
46     private Integer defaultArtifactInstallationTimeout = 60;
47     private Integer currentArtifactInstallationTimeout = 120;
48     private boolean useHttpsWithDmaap;
49     private ExternalServiceConfig aaiConfig;
50     private ExternalServiceConfig msoConfig;
51     private Integer opEnvRecoveryIntervalSec;
52     private Integer allowedTimeBeforeStaleSec;
53
54     public List<String> getUebServers() {
55         return uebServers;
56     }
57
58     public void setUebServers(List<String> uebServers) {
59         this.uebServers = uebServers;
60     }
61
62     public String getDistributionNotifTopicName() {
63         return distributionNotifTopicName;
64     }
65
66     public void setDistributionNotifTopicName(String distributionNotifTopicName) {
67         this.distributionNotifTopicName = distributionNotifTopicName;
68     }
69
70     public String getDistributionStatusTopicName() {
71         return distributionStatusTopicName;
72     }
73
74     public void setDistributionStatusTopicName(String distributionStatusTopicName) {
75         this.distributionStatusTopicName = distributionStatusTopicName;
76     }
77
78     public Integer getInitRetryIntervalSec() {
79         return initRetryIntervalSec;
80     }
81
82     public void setInitRetryIntervalSec(Integer initRetryIntervalSec) {
83         this.initRetryIntervalSec = initRetryIntervalSec;
84     }
85
86     public ComponentArtifactTypesConfig getDistribNotifServiceArtifactTypes() {
87         return distribNotifServiceArtifactTypes;
88     }
89
90     public void setDistribNotifServiceArtifactTypes(ComponentArtifactTypesConfig distribNotifServiceArtifactTypes) {
91         this.distribNotifServiceArtifactTypes = distribNotifServiceArtifactTypes;
92     }
93
94     public ComponentArtifactTypesConfig getDistribNotifResourceArtifactTypes() {
95         return distribNotifResourceArtifactTypes;
96     }
97
98     public void setDistribNotifResourceArtifactTypes(ComponentArtifactTypesConfig distribNotifResourceArtifactTypes) {
99         this.distribNotifResourceArtifactTypes = distribNotifResourceArtifactTypes;
100     }
101
102     public String getUebPublicKey() {
103         return uebPublicKey;
104     }
105
106     public void setUebPublicKey(String uebPublicKey) {
107         this.uebPublicKey = uebPublicKey;
108     }
109
110     public String getUebSecretKey() {
111         return uebSecretKey;
112     }
113
114     public void setUebSecretKey(String uebSecretKey) {
115         this.uebSecretKey = uebSecretKey;
116     }
117
118     public List<String> getEnvironments() {
119         return environments;
120     }
121
122     public void setEnvironments(List<String> environments) {
123         Set<String> set = new HashSet<>();
124         if (environments != null) {
125             set.addAll(environments);
126             this.environments = new ArrayList<>(set);
127         } else {
128             this.environments = null;
129         }
130     }
131
132     public DistributionStatusTopicConfig getDistributionStatusTopic() {
133         return distributionStatusTopic;
134     }
135
136     public void setDistributionStatusTopic(DistributionStatusTopicConfig distributionStatusTopic) {
137         this.distributionStatusTopic = distributionStatusTopic;
138     }
139
140     public Integer getInitMaxIntervalSec() {
141         return initMaxIntervalSec;
142     }
143
144     public void setInitMaxIntervalSec(Integer initMaxIntervalSec) {
145         this.initMaxIntervalSec = initMaxIntervalSec;
146     }
147
148     public CreateTopicConfig getCreateTopic() {
149         return createTopic;
150     }
151
152     public void setCreateTopic(CreateTopicConfig createTopic) {
153         this.createTopic = createTopic;
154     }
155
156     public boolean isStartDistributionEngine() {
157         return startDistributionEngine;
158     }
159
160     public void setStartDistributionEngine(boolean startDistributionEngine) {
161         this.startDistributionEngine = startDistributionEngine;
162     }
163
164     public DistributionNotificationTopicConfig getDistributionNotificationTopic() {
165         return distributionNotificationTopic;
166     }
167
168     public void setDistributionNotificationTopic(DistributionNotificationTopicConfig distributionNotificationTopic) {
169         this.distributionNotificationTopic = distributionNotificationTopic;
170     }
171
172     public int getDefaultArtifactInstallationTimeout() {
173         return defaultArtifactInstallationTimeout;
174     }
175
176     public void setDefaultArtifactInstallationTimeout(int defaultArtifactInstallationTimeout) {
177         this.defaultArtifactInstallationTimeout = defaultArtifactInstallationTimeout;
178     }
179
180     public int getCurrentArtifactInstallationTimeout() {
181         return currentArtifactInstallationTimeout;
182     }
183
184     public void setCurrentArtifactInstallationTimeout(int currentArtifactInstallationTimeout) {
185         this.currentArtifactInstallationTimeout = currentArtifactInstallationTimeout;
186     }
187
188     public boolean isUseHttpsWithDmaap() {
189         return useHttpsWithDmaap;
190     }
191
192     public void setUseHttpsWithDmaap(boolean useHttpsWithDmaap) {
193         this.useHttpsWithDmaap = useHttpsWithDmaap;
194     }
195
196     public Integer getOpEnvRecoveryIntervalSec() {
197         return opEnvRecoveryIntervalSec;
198     }
199
200     public void setOpEnvRecoveryIntervalSec(Integer opEnvRecoveryIntervalSec) {
201         this.opEnvRecoveryIntervalSec = opEnvRecoveryIntervalSec;
202     }
203
204     public Integer getAllowedTimeBeforeStaleSec() {
205         return allowedTimeBeforeStaleSec;
206     }
207
208     public void setAllowedTimeBeforeStaleSec(Integer allowedTimeBeforeStaleSec) {
209         this.allowedTimeBeforeStaleSec = allowedTimeBeforeStaleSec;
210     }
211
212     public ExternalServiceConfig getAaiConfig() {
213         return aaiConfig;
214     }
215
216     public void setAaiConfig(ExternalServiceConfig aaiConfig) {
217         this.aaiConfig = aaiConfig;
218     }
219
220     public ExternalServiceConfig getMsoConfig() {
221         return msoConfig;
222     }
223
224     public void setMsoConfig(ExternalServiceConfig msoConfig) {
225         this.msoConfig = msoConfig;
226     }
227
228     public enum ArtifcatTypeEnum {
229         MURANO_PKG("MURANO-PKG"), HEAT("HEAT"), DG_XML("DG_XML");
230         String value;
231
232         private ArtifcatTypeEnum(String value) {
233             this.value = value;
234         }
235
236         public String getValue() {
237             return value;
238         }
239     }
240
241     public static class DistribNotifServiceArtifacts {
242
243         Map<String, Object> service;
244         Map<String, Object> resource;
245
246         public Map<String, Object> getService() {
247             return service;
248         }
249
250         public void setService(Map<String, Object> service) {
251             this.service = service;
252         }
253
254         public Map<String, Object> getResource() {
255             return resource;
256         }
257
258         public void setResource(Map<String, Object> resource) {
259             this.resource = resource;
260         }
261     }
262
263     public static class NotifArtifactTypes {
264
265         List<String> info;
266         List<String> lifecycle;
267
268         public List<String> getInfo() {
269             return info;
270         }
271
272         public void setInfo(List<String> info) {
273             this.info = info;
274         }
275
276         public List<String> getLifecycle() {
277             return lifecycle;
278         }
279
280         public void setLifecycle(List<String> lifecycle) {
281             this.lifecycle = lifecycle;
282         }
283     }
284
285     public static class NotifArtifactTypesResource {
286
287         List<ArtifcatTypeEnum> lifecycle;
288     }
289
290     public static class CreateTopicConfig {
291
292         private Integer partitionCount;
293         private Integer replicationCount;
294
295         public Integer getPartitionCount() {
296             return partitionCount;
297         }
298
299         public void setPartitionCount(Integer partitionCount) {
300             this.partitionCount = partitionCount;
301         }
302
303         public Integer getReplicationCount() {
304             return replicationCount;
305         }
306
307         public void setReplicationCount(Integer replicationCount) {
308             this.replicationCount = replicationCount;
309         }
310
311         @Override
312         public String toString() {
313             return "CreateTopicConfig [partitionCount=" + partitionCount + ", replicationCount=" + replicationCount + "]";
314         }
315     }
316
317     public static class EnvironmentConfig {
318
319         private String name;
320         private List<String> uebServers;
321
322         public String getName() {
323             return name;
324         }
325
326         public void setName(String name) {
327             this.name = name;
328         }
329
330         public List<String> getUebServers() {
331             return uebServers;
332         }
333
334         public void setUebServers(List<String> uebServers) {
335             this.uebServers = uebServers;
336         }
337
338         @Override
339         public String toString() {
340             return "EnvironmentConfig [name=" + name + ", uebServers=" + uebServers + "]";
341         }
342     }
343
344     public static class DistributionStatusTopicConfig {
345
346         private Integer pollingIntervalSec;
347         private Integer fetchTimeSec;
348         private String consumerGroup;
349         private String consumerId;
350
351         public Integer getPollingIntervalSec() {
352             return pollingIntervalSec;
353         }
354
355         public void setPollingIntervalSec(Integer pollingIntervalSec) {
356             this.pollingIntervalSec = pollingIntervalSec;
357         }
358
359         public Integer getFetchTimeSec() {
360             return fetchTimeSec;
361         }
362
363         public void setFetchTimeSec(Integer fetchTimeSec) {
364             this.fetchTimeSec = fetchTimeSec;
365         }
366
367         public String getConsumerGroup() {
368             return consumerGroup;
369         }
370
371         public void setConsumerGroup(String consumerGroup) {
372             this.consumerGroup = consumerGroup;
373         }
374
375         public String getConsumerId() {
376             return consumerId;
377         }
378
379         public void setConsumerId(String consumerId) {
380             this.consumerId = consumerId;
381         }
382
383         @Override
384         public String toString() {
385             return "DistributionStatusTopicConfig [pollingIntervalSec=" + pollingIntervalSec + ", fetchTimeSec=" + fetchTimeSec + ", consumerGroup="
386                 + consumerGroup + ", consumerId=" + consumerId + "]";
387         }
388     }
389
390     public static class DistributionNotificationTopicConfig {
391
392         private Integer maxWaitingAfterSendingSeconds;
393         private Integer maxThreadPoolSize;
394         private Integer minThreadPoolSize;
395
396         public Integer getMaxWaitingAfterSendingSeconds() {
397             return maxWaitingAfterSendingSeconds;
398         }
399
400         public void setMaxWaitingAfterSendingSeconds(Integer maxWaitingAfterSendingSeconds) {
401             this.maxWaitingAfterSendingSeconds = maxWaitingAfterSendingSeconds;
402         }
403
404         public Integer getMaxThreadPoolSize() {
405             return maxThreadPoolSize;
406         }
407
408         public void setMaxThreadPoolSize(Integer maxThreadPoolSize) {
409             this.maxThreadPoolSize = maxThreadPoolSize;
410         }
411
412         public Integer getMinThreadPoolSize() {
413             return minThreadPoolSize;
414         }
415
416         public void setMinThreadPoolSize(Integer minThreadPoolSize) {
417             this.minThreadPoolSize = minThreadPoolSize;
418         }
419
420         @Override
421         public String toString() {
422             return "DistributionNotificationTopicConfig [maxWaitingAfterSendingSeconds=" + maxWaitingAfterSendingSeconds + ", maxThreadPoolSize="
423                 + maxThreadPoolSize + ", minThreadPoolSize=" + minThreadPoolSize + "]";
424         }
425     }
426
427     public static class ComponentArtifactTypesConfig {
428
429         private List<String> info;
430         private List<String> lifecycle;
431
432         public List<String> getInfo() {
433             return info;
434         }
435
436         public void setInfo(List<String> info) {
437             this.info = info;
438         }
439
440         public List<String> getLifecycle() {
441             return lifecycle;
442         }
443
444         public void setLifecycle(List<String> lifecycle) {
445             this.lifecycle = lifecycle;
446         }
447
448         @Override
449         public String toString() {
450             return "ArtifactTypesConfig [info=" + info + ", lifecycle=" + lifecycle + "]";
451         }
452     }
453 }