1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright © 2021 Orange.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * 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=========================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 *******************************************************************************/
25 package org.onap.dmaap.mr.tools;
27 import com.att.nsa.apiClient.http.HttpClient;
28 import com.att.nsa.apiClient.http.HttpTracer;
29 import com.att.nsa.cmdtool.CommandContext;
30 import java.util.Collection;
31 import java.util.LinkedList;
32 import org.onap.dmaap.mr.client.MRClient;
34 public class MRCommandContext implements CommandContext {
35 public MRCommandContext() {
39 fCluster = new LinkedList<>();
40 fCluster.add("localhost");
44 public void requestShutdown() {
49 public boolean shouldContinue() {
53 public void setAuth(String key, String pwd) {
58 public void clearAuth() {
62 public boolean checkClusterReady() {
63 return (fCluster.isEmpty());
66 public Collection<String> getCluster() {
67 return new LinkedList<>(fCluster);
70 public void clearCluster() {
74 public void addClusterHost(String host) {
78 public String getApiKey() {
82 public String getApiPwd() {
86 public void useTracer(HttpTracer t) {
90 public void noTracer() {
94 public void applyTracer(MRClient cc) {
95 if (cc instanceof HttpClient && fTracer != null) {
96 ((HttpClient) cc).installTracer(fTracer);
100 private boolean fShutdown;
101 private String fApiKey;
102 private String fApiPwd;
103 private final LinkedList<String> fCluster;
104 private HttpTracer fTracer = null;