Initial TCA commit into DCAEGEN2
[dcaegen2/analytics/tca.git] / dcae-analytics-cdap-plugins / src / main / java / org / openecomp / dcae / apod / analytics / cdap / plugins / domain / config / dmaap / DMaaPMRSourcePluginConfig.java
1 /*
2  * ===============================LICENSE_START======================================
3  *  dcae-analytics
4  * ================================================================================
5  *    Copyright © 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.dcae.apod.analytics.cdap.plugins.domain.config.dmaap;
22
23 import co.cask.cdap.api.annotation.Description;
24 import co.cask.cdap.api.annotation.Macro;
25 import com.google.common.base.Objects;
26
27 import javax.annotation.Nullable;
28
29 /**
30  * DMaaP MR Subscriber Config
31  * <p>
32  * @author Rajiv Singla . Creation Date: 1/17/2017.
33  */
34 public class DMaaPMRSourcePluginConfig extends BaseDMaaPMRPluginConfig {
35
36     private static final long serialVersionUID = 1L;
37
38     @Description("DMaaP MR Polling Interval in MS")
39     @Macro
40     protected Integer pollingInterval;
41
42     @Description("DMaaP Message Router Subscriber Consumer ID. Defaults to some randomly created userID")
43     @Nullable
44     @Macro
45     protected String consumerId;
46
47     @Description("DMaaP Message Router Subscriber Consumer Group. Defaults to some randomly created user Group")
48     @Nullable
49     @Macro
50     protected String consumerGroup;
51
52     @Description("DMaaP Message Router Subscriber Timeout in MS. Defaults to no timeout")
53     @Nullable
54     @Macro
55     protected Integer timeoutMS;
56
57     @Description("DMaaP Message Router Subscriber Message Limit. Defaults to no message limit")
58     @Nullable
59     @Macro
60     protected Integer messageLimit;
61
62     // Required No Arg constructor
63     public DMaaPMRSourcePluginConfig() {
64         this(null, null, null, 0);
65     }
66
67     public DMaaPMRSourcePluginConfig(String referenceName, String hostName, String topicName, Integer pollingInterval) {
68         super(referenceName, hostName, topicName);
69         this.pollingInterval = pollingInterval;
70     }
71
72     /**
73      * DMaaP MR Subscriber Polling interval
74      *
75      * @return DMaaP MR Subscriber Polling interval
76      */
77     public Integer getPollingInterval() {
78         return pollingInterval;
79     }
80
81     /**
82      * DMaaP MR Subscriber Consumer ID
83      *
84      * @return DMaaP MR Subscriber Consumer ID
85      */
86     @Nullable
87     public String getConsumerId() {
88         return consumerId;
89     }
90
91     /**
92      * DMaaP MR Subscriber Consumer Group
93      *
94      * @return DMaaP MR Subscriber Consumer Group
95      */
96     @Nullable
97     public String getConsumerGroup() {
98         return consumerGroup;
99     }
100
101     /**
102      * DMaaP MR Subscriber Timeout in MS
103      *
104      * @return DMaaP MR Subscriber Timeout in MS
105      */
106     @Nullable
107     public Integer getTimeoutMS() {
108         return timeoutMS;
109     }
110
111     /**
112      * DMaaP MR Subscriber message limit
113      *
114      * @return DMaaP MR Subscriber Message limit
115      */
116     @Nullable
117     public Integer getMessageLimit() {
118         return messageLimit;
119     }
120
121
122     @Override
123     public String toString() {
124         return Objects.toStringHelper(this)
125                 .add("super", super.toString())
126                 .add("pollingInterval", pollingInterval)
127                 .add("consumerId", consumerId)
128                 .add("consumerGroup", consumerGroup)
129                 .add("timeoutMS", timeoutMS)
130                 .add("messageLimit", messageLimit)
131                 .toString();
132     }
133
134 }