2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.common.endpoints.event.comm.bus.internal;
25 import org.onap.policy.common.endpoints.event.comm.bus.ApiKeyEnabled;
31 public abstract class BusTopicBase extends TopicBase implements ApiKeyEnabled {
36 protected String apiKey;
41 protected String apiSecret;
46 protected boolean useHttps;
49 * allow self signed certificates.
51 protected boolean allowSelfSignedCerts;
54 * Instantiates a new Bus Topic Base.
56 * <p>servers list of servers
59 * apiSecret API Secret
60 * useHttps does connection use HTTPS?
61 * allowSelfSignedCerts are self-signed certificates allow
62 * @param busTopicParams holds all our parameters
63 * @throws IllegalArgumentException if invalid parameters are present
65 protected BusTopicBase(BusTopicParams busTopicParams) {
66 super(busTopicParams.getServers(), busTopicParams.getTopic(), busTopicParams.getEffectiveTopic());
67 this.apiKey = busTopicParams.getApiKey();
68 this.apiSecret = busTopicParams.getApiSecret();
69 this.useHttps = busTopicParams.isUseHttps();
70 this.allowSelfSignedCerts = busTopicParams.isAllowSelfSignedCerts();
73 protected boolean anyNullOrEmpty(String... args) {
74 for (String arg : args) {
75 if (arg == null || arg.isEmpty()) {
83 protected boolean allNullOrEmpty(String... args) {
84 for (String arg : args) {
85 if (!(arg == null || arg.isEmpty())) {
95 public String toString() {
96 return "BusTopicBase [apiKey=" + apiKey + ", apiSecret=" + apiSecret + ", useHttps=" + useHttps
97 + ", allowSelfSignedCerts=" + allowSelfSignedCerts + ", toString()=" + super.toString() + "]";