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 / BaseDMaaPMRPluginConfig.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 import org.openecomp.dcae.apod.analytics.cdap.common.settings.CDAPBasePluginConfig;
27
28 import javax.annotation.Nullable;
29
30 /**
31  * Base class for all DMaaP MR Configs
32  * <p>
33  * @author Rajiv Singla . Creation Date: 1/17/2017.
34  */
35 public abstract class BaseDMaaPMRPluginConfig extends CDAPBasePluginConfig {
36
37     @Description("DMaaP Message Router HostName")
38     @Macro
39     protected String hostName;
40
41     @Description("DMaaP Message Router Host Port number. Defaults to Port 80")
42     @Nullable
43     @Macro
44     protected Integer portNumber;
45
46     @Description("DMaaP Message Router Topic Name")
47     @Macro
48     protected String topicName;
49
50     @Description("DMaaP Message Router HTTP Protocol e.g. HTTP or HTTPS. Defaults to HTTPS")
51     @Nullable
52     @Macro
53     protected String protocol;
54
55     @Description("DMaaP Message Router User Name used for AAF Authentication. Defaults to no authentication")
56     @Nullable
57     @Macro
58     protected String userName;
59
60     @Description("DMaaP Message Router User Password used for AAF Authentication. Defaults to no authentication")
61     @Nullable
62     @Macro
63     protected String userPassword;
64
65     @Description("DMaaP Message Router Content Type. Defaults to 'application/json'")
66     @Nullable
67     @Macro
68     protected String contentType;
69
70
71     public BaseDMaaPMRPluginConfig(final String referenceName, final String hostName, final String topicName) {
72         this.referenceName = referenceName;
73         this.hostName = hostName;
74         this.topicName = topicName;
75     }
76
77     /**
78      * Host Name for DMaaP MR Publisher or Subscriber
79      *
80      * @return host name
81      */
82     public String getHostName() {
83         return hostName;
84     }
85
86     /**
87      * Port Number for DMaaP MR Publisher or Subscriber
88      *
89      * @return port number
90      */
91     @Nullable
92     public Integer getPortNumber() {
93         return portNumber;
94     }
95
96     /**
97      * DMaaP MR Topic Name for Subscriber or Publisher
98      *
99      * @return topic name
100      */
101     public String getTopicName() {
102         return topicName;
103     }
104
105
106     /**
107      * DMaaP MR HTTP or HTTPS protocol
108      *
109      * @return http or https protocol
110      */
111     @Nullable
112     public String getProtocol() {
113         return protocol;
114     }
115
116     /**
117      * User name used for DMaaP MR AAF Authentication
118      *
119      * @return User name for DMaaP MR AAF Authentication
120      */
121     @Nullable
122     public String getUserName() {
123         return userName;
124     }
125
126     /**
127      * User password used for DMaaP MR AAF Authentication
128      *
129      * @return User password used for DMaaP MR AAF Authentication
130      */
131     @Nullable
132     public String getUserPassword() {
133         return userPassword;
134     }
135
136     /**
137      * Content type used for DMaaP MR Topic e.g. 'application/json'
138      *
139      * @return content type for DMaaP MR Topic
140      */
141     @Nullable
142     public String getContentType() {
143         return contentType;
144     }
145
146     @Override
147     public String toString() {
148         return Objects.toStringHelper(this)
149                 .add("referenceName", referenceName)
150                 .add("hostName", hostName)
151                 .add("portNumber", portNumber)
152                 .add("topicName", topicName)
153                 .add("protocol", protocol)
154                 .add("userName", userName)
155                 .add("userPassword", "xxxx")
156                 .add("contentType", contentType)
157                 .toString();
158     }
159 }