|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.apache.kyuubi.client.api.v1.dto; |
| 19 | + |
| 20 | +import java.util.Collections; |
| 21 | +import java.util.Map; |
| 22 | +import java.util.Objects; |
| 23 | +import org.apache.commons.lang3.builder.ReflectionToStringBuilder; |
| 24 | +import org.apache.commons.lang3.builder.ToStringStyle; |
| 25 | + |
| 26 | +public class KyuubiServerEvent { |
| 27 | + private String serverName; |
| 28 | + private Long startTime; |
| 29 | + private Long eventTime; |
| 30 | + private String state; |
| 31 | + private String serverIp; |
| 32 | + private Map<String, String> serverConf; |
| 33 | + private Map<String, String> serverEnv; |
| 34 | + |
| 35 | + public KyuubiServerEvent() {} |
| 36 | + |
| 37 | + public KyuubiServerEvent( |
| 38 | + String serverName, |
| 39 | + Long startTime, |
| 40 | + Long eventTime, |
| 41 | + String state, |
| 42 | + String serverIp, |
| 43 | + Map<String, String> serverConf, |
| 44 | + Map<String, String> serverEnv) { |
| 45 | + this.serverName = serverName; |
| 46 | + this.startTime = startTime; |
| 47 | + this.eventTime = eventTime; |
| 48 | + this.state = state; |
| 49 | + this.serverIp = serverIp; |
| 50 | + this.serverConf = serverConf; |
| 51 | + this.serverEnv = serverEnv; |
| 52 | + } |
| 53 | + |
| 54 | + public String getServerName() { |
| 55 | + return serverName; |
| 56 | + } |
| 57 | + |
| 58 | + public void setServerName(String serverName) { |
| 59 | + this.serverName = serverName; |
| 60 | + } |
| 61 | + |
| 62 | + public Long getStartTime() { |
| 63 | + return startTime; |
| 64 | + } |
| 65 | + |
| 66 | + public void setStartTime(Long startTime) { |
| 67 | + this.startTime = startTime; |
| 68 | + } |
| 69 | + |
| 70 | + public Long getEventTime() { |
| 71 | + return eventTime; |
| 72 | + } |
| 73 | + |
| 74 | + public void setEventTime(Long eventTime) { |
| 75 | + this.eventTime = eventTime; |
| 76 | + } |
| 77 | + |
| 78 | + public String getState() { |
| 79 | + return state; |
| 80 | + } |
| 81 | + |
| 82 | + public void setState(String state) { |
| 83 | + this.state = state; |
| 84 | + } |
| 85 | + |
| 86 | + public String getServerIp() { |
| 87 | + return serverIp; |
| 88 | + } |
| 89 | + |
| 90 | + public void setServerIp(String serverIp) { |
| 91 | + this.serverIp = serverIp; |
| 92 | + } |
| 93 | + |
| 94 | + public Map<String, String> getServerConf() { |
| 95 | + if (null == serverConf) { |
| 96 | + return Collections.emptyMap(); |
| 97 | + } |
| 98 | + return serverConf; |
| 99 | + } |
| 100 | + |
| 101 | + public void setServerConf(Map<String, String> serverConf) { |
| 102 | + this.serverConf = serverConf; |
| 103 | + } |
| 104 | + |
| 105 | + public Map<String, String> getServerEnv() { |
| 106 | + if (null == serverEnv) { |
| 107 | + return Collections.emptyMap(); |
| 108 | + } |
| 109 | + return serverEnv; |
| 110 | + } |
| 111 | + |
| 112 | + public void setServerEnv(Map<String, String> serverEnv) { |
| 113 | + this.serverEnv = serverEnv; |
| 114 | + } |
| 115 | + |
| 116 | + @Override |
| 117 | + public boolean equals(Object o) { |
| 118 | + if (this == o) return true; |
| 119 | + if (o == null || getClass() != o.getClass()) return false; |
| 120 | + KyuubiServerEvent that = (KyuubiServerEvent) o; |
| 121 | + return Objects.equals(getServerName(), that.getServerName()) |
| 122 | + && Objects.equals(getStartTime(), that.getStartTime()) |
| 123 | + && Objects.equals(getEventTime(), that.getEventTime()) |
| 124 | + && Objects.equals(getState(), that.getState()) |
| 125 | + && Objects.equals(getServerIp(), that.getServerIp()) |
| 126 | + && Objects.equals(getServerConf(), that.getServerConf()) |
| 127 | + && Objects.equals(getServerEnv(), that.getServerEnv()); |
| 128 | + } |
| 129 | + |
| 130 | + @Override |
| 131 | + public int hashCode() { |
| 132 | + return Objects.hash( |
| 133 | + getServerName(), |
| 134 | + getStartTime(), |
| 135 | + getEventTime(), |
| 136 | + getState(), |
| 137 | + getServerIp(), |
| 138 | + getServerConf(), |
| 139 | + getServerEnv()); |
| 140 | + } |
| 141 | + |
| 142 | + @Override |
| 143 | + public String toString() { |
| 144 | + return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE); |
| 145 | + } |
| 146 | +} |
0 commit comments