2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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;
24 import org.onap.policy.common.endpoints.event.comm.bus.ApiKeyEnabled;
29 public abstract class BusTopicBase extends TopicBase implements ApiKeyEnabled {
34 protected String apiKey;
39 protected String apiSecret;
44 protected boolean useHttps;
47 * allow self signed certificates.
49 protected boolean allowSelfSignedCerts;
52 * Instantiates a new Bus Topic Base.
54 * <p>servers list of servers
57 * apiSecret API Secret
58 * useHttps does connection use HTTPS?
59 * allowSelfSignedCerts are self-signed certificates allow
60 * @param busTopicParams holds all our parameters
61 * @throws IllegalArgumentException if invalid parameters are present
63 protected BusTopicBase(BusTopicParams busTopicParams) {
64 super(busTopicParams.getServers(), busTopicParams.getTopic(), busTopicParams.getEffectiveTopic());
65 this.apiKey = busTopicParams.getApiKey();
66 this.apiSecret = busTopicParams.getApiSecret();
67 this.useHttps = busTopicParams.isUseHttps();
68 this.allowSelfSignedCerts = busTopicParams.isAllowSelfSignedCerts();
72 public String getApiKey() {
77 public String getApiSecret() {
84 * @return if using https
86 public boolean isUseHttps() {
91 * Is self signed certificates allowed.
93 * @return if self signed certificates are allowed
95 public boolean isAllowSelfSignedCerts() {
96 return allowSelfSignedCerts;
99 protected boolean anyNullOrEmpty(String... args) {
100 for (String arg : args) {
101 if (arg == null || arg.isEmpty()) {
109 protected boolean allNullOrEmpty(String... args) {
110 for (String arg : args) {
111 if (!(arg == null || arg.isEmpty())) {
121 public String toString() {
122 return "BusTopicBase [apiKey=" + apiKey + ", apiSecret=" + apiSecret + ", useHttps=" + useHttps
123 + ", allowSelfSignedCerts=" + allowSelfSignedCerts + ", toString()=" + super.toString() + "]";