2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.policy.common.endpoints.event.comm.bus.internal;
23 import java.util.List;
25 import org.onap.policy.common.endpoints.event.comm.bus.ApiKeyEnabled;
30 public abstract class BusTopicBase extends TopicBase implements ApiKeyEnabled {
35 protected String apiKey;
40 protected String apiSecret;
45 protected boolean useHttps;
48 * allow self signed certificates
50 protected boolean allowSelfSignedCerts;
53 * Instantiates a new Bus Topic Base
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
62 * @return a Bus Topic Base
63 * @throws IllegalArgumentException if invalid parameters are present
65 public BusTopicBase(List<String> servers, String topic, String apiKey, String apiSecret, boolean useHttps,
66 boolean allowSelfSignedCerts) {
68 super(servers, topic);
71 this.apiSecret = apiSecret;
72 this.useHttps = useHttps;
73 this.allowSelfSignedCerts = allowSelfSignedCerts;
77 public String getApiKey() {
82 public String getApiSecret() {
87 * @return if using https
89 public boolean isUseHttps() {
94 * @return if self signed certificates are allowed
96 public boolean isAllowSelfSignedCerts() {
97 return allowSelfSignedCerts;
100 protected boolean anyNullOrEmpty(String... args) {
101 for (String arg : args) {
102 if (arg == null || arg.isEmpty()) {
110 protected boolean allNullOrEmpty(String... args) {
111 for (String arg : args) {
112 if (!(arg == null || arg.isEmpty())) {
122 public String toString() {
123 return "BusTopicBase [apiKey=" + apiKey + ", apiSecret=" + apiSecret + ", useHttps=" + useHttps
124 + ", allowSelfSignedCerts=" + allowSelfSignedCerts + ", toString()=" + super.toString() + "]";