Close old UEB/DMaaP consumer
[policy/drools-pdp.git] / policy-endpoints / src / main / java / org / onap / policy / drools / event / comm / bus / internal / BusTopicBase.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * policy-endpoints
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.onap.policy.drools.event.comm.bus.internal;
22
23 import java.util.List;
24
25 import org.onap.policy.drools.event.comm.bus.ApiKeyEnabled;
26
27 /**
28  * Bus Topic Base
29  */
30 public abstract class BusTopicBase extends TopicBase implements ApiKeyEnabled {
31         
32         /**
33          * API Key
34          */
35         protected String apiKey;
36         
37         /**
38          * API Secret
39          */
40         protected String apiSecret;
41         
42         /**
43          * Use https
44          */
45         protected boolean useHttps;
46         
47         /**
48          * allow self signed certificates
49          */
50         protected boolean allowSelfSignedCerts;
51         
52         /**
53          * Instantiates a new Bus Topic Base
54          * 
55          * @param servers list of servers
56          * @param topic topic name
57          * @param apiKey API Key
58          * @param apiSecret API Secret
59          * @param useHttps does connection use HTTPS?
60          * @param allowSelfSignedCerts are self-signed certificates allow
61          *  
62          * @return a Bus Topic Base
63          * @throws IllegalArgumentException if invalid parameters are present
64          */
65         public BusTopicBase(List<String> servers, 
66                                                   String topic, 
67                                                   String apiKey, 
68                                                   String apiSecret,
69                                                   boolean useHttps,
70                                                   boolean allowSelfSignedCerts) 
71         throws IllegalArgumentException {
72                 
73                 super(servers, topic);
74                 
75                 this.apiKey = apiKey;
76                 this.apiSecret = apiSecret;
77                 this.useHttps = useHttps;
78                 this.allowSelfSignedCerts = allowSelfSignedCerts;
79         }
80         
81         @Override
82         public String getApiKey() {
83                 return apiKey;
84         }
85
86         @Override
87         public String getApiSecret() {
88                 return apiSecret;
89         }
90         
91         /**
92          * @return if using https
93          */
94         public boolean isUseHttps(){
95                 return useHttps;
96         }
97
98         /**
99          * @return if self signed certificates are allowed
100          */
101         public boolean isAllowSelfSignedCerts(){
102                 return allowSelfSignedCerts;
103         }
104
105
106         @Override
107         public String toString() {
108                 return "BusTopicBase [apiKey=" + apiKey + ", apiSecret=" + apiSecret + ", useHttps=" + useHttps
109                                 + ", allowSelfSignedCerts=" + allowSelfSignedCerts + ", toString()=" + super.toString() + "]";
110         }
111
112 }