Disable DMaaP if Kafka active
[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 lombok.AllArgsConstructor;
23 import lombok.Getter;
24 import lombok.Setter;
25 import lombok.ToString;
26 import org.openecomp.sdc.common.api.BasicConfiguration;
27 import org.openecomp.sdc.common.http.config.ExternalServiceConfig;
28
29 import java.util.ArrayList;
30 import java.util.HashSet;
31 import java.util.List;
32 import java.util.Map;
33 import java.util.Set;
34
35 @Getter
36 @Setter
37 public class DistributionEngineConfiguration extends BasicConfiguration {
38
39     private List<String> uebServers;
40     private String distributionNotifTopicName;
41     private String distributionStatusTopicName;
42     private String kafkaBootStrapServers;
43     private Integer initRetryIntervalSec;
44     private Integer initMaxIntervalSec;
45     private ComponentArtifactTypesConfig distribNotifServiceArtifactTypes;
46     private ComponentArtifactTypesConfig distribNotifResourceArtifactTypes;
47     private String uebPublicKey;
48     private String uebSecretKey;
49     private List<String> environments;
50     private DistributionStatusTopicConfig distributionStatusTopic;
51     private CreateTopicConfig createTopic;
52     private boolean startDistributionEngine;
53     private DistributionNotificationTopicConfig distributionNotificationTopic;
54     private Integer defaultArtifactInstallationTimeout = 60;
55     private Integer currentArtifactInstallationTimeout = 120;
56     private boolean useHttpsWithDmaap;
57     private ExternalServiceConfig aaiConfig;
58     private ExternalServiceConfig msoConfig;
59     private Integer opEnvRecoveryIntervalSec;
60     private Integer allowedTimeBeforeStaleSec;
61
62     public void setEnvironments(List<String> environments) {
63         Set<String> set = new HashSet<>();
64         if (environments != null) {
65             set.addAll(environments);
66             this.environments = new ArrayList<>(set);
67         } else {
68             this.environments = null;
69         }
70     }
71
72     @Getter
73     @AllArgsConstructor
74     public enum ArtifcatTypeEnum {
75         MURANO_PKG("MURANO-PKG"),
76         HEAT("HEAT"),
77         DG_XML("DG_XML");
78         private final String value;
79
80     }
81
82     @Getter
83     @Setter
84     public static class DistribNotifServiceArtifacts {
85
86         private Map<String, Object> service;
87         private Map<String, Object> resource;
88
89     }
90
91     @Getter
92     @Setter
93     public static class NotifArtifactTypes {
94
95         private List<String> info;
96         private List<String> lifecycle;
97
98     }
99
100     @Getter
101     @Setter
102     public static class NotifArtifactTypesResource {
103
104         private List<ArtifcatTypeEnum> lifecycle;
105     }
106
107     @Getter
108     @Setter
109     @ToString
110     public static class CreateTopicConfig {
111
112         private Integer partitionCount;
113         private Integer replicationCount;
114
115     }
116
117     @Getter
118     @Setter
119     @ToString
120     public static class EnvironmentConfig {
121
122         private String name;
123         private List<String> uebServers;
124
125     }
126
127     @Getter
128     @Setter
129     @ToString
130     public static class DistributionStatusTopicConfig {
131
132         private Integer pollingIntervalSec;
133         private Integer fetchTimeSec;
134         private String consumerGroup;
135         private String consumerId;
136
137     }
138
139     @Getter
140     @Setter
141     @ToString
142     public static class DistributionNotificationTopicConfig {
143
144         private Integer maxWaitingAfterSendingSeconds;
145         private Integer maxThreadPoolSize;
146         private Integer minThreadPoolSize;
147
148     }
149
150     @Getter
151     @Setter
152     @ToString
153     public static class ComponentArtifactTypesConfig {
154
155         private List<String> info;
156         private List<String> lifecycle;
157
158     }
159 }