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;
51 protected boolean allowTracing;
54 * allow self signed certificates.
56 protected boolean allowSelfSignedCerts;
59 * Instantiates a new Bus Topic Base.
61 * <p>servers list of servers
64 * apiSecret API Secret
65 * useHttps does connection use HTTPS?
66 * allowTracing Is tracing allowed?
67 * allowSelfSignedCerts are self-signed certificates allow
68 * @param busTopicParams holds all our parameters
69 * @throws IllegalArgumentException if invalid parameters are present
71 protected BusTopicBase(BusTopicParams busTopicParams) {
72 super(busTopicParams.getServers(), busTopicParams.getTopic(), busTopicParams.getEffectiveTopic());
73 this.apiKey = busTopicParams.getApiKey();
74 this.apiSecret = busTopicParams.getApiSecret();
75 this.useHttps = busTopicParams.isUseHttps();
76 this.allowTracing = busTopicParams.isAllowTracing();
77 this.allowSelfSignedCerts = busTopicParams.isAllowSelfSignedCerts();
80 protected boolean anyNullOrEmpty(String... args) {
81 for (String arg : args) {
82 if (arg == null || arg.isEmpty()) {
90 protected boolean allNullOrEmpty(String... args) {
91 for (String arg : args) {
92 if (!(arg == null || arg.isEmpty())) {
102 public String toString() {
103 return "BusTopicBase [apiKey=" + apiKey + ", apiSecret=" + apiSecret + ", useHttps=" + useHttps
104 + ", allowSelfSignedCerts=" + allowSelfSignedCerts + ", toString()=" + super.toString() + "]";