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