1 /*** 2 * 3 * Copyright 2004 Protique Ltd 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * 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 19 package org.codehaus.activemq.message; 20 21 import java.util.Properties; 22 23 /*** 24 * Describes a Connection 25 * 26 * @version $Revision: 1.8 $ 27 */ 28 29 public class ConnectionInfo extends AbstractPacket { 30 String clientId; 31 String userName; 32 String password; 33 String hostName; 34 String clientVersion; 35 int wireFormatVersion; 36 long startTime; 37 boolean started; 38 boolean closed; 39 Properties properties; 40 41 42 /*** 43 * Return the type of Packet 44 * 45 * @return integer representation of the type of Packet 46 */ 47 48 public int getPacketType() { 49 return ACTIVEMQ_CONNECTION_INFO; 50 } 51 52 /*** 53 * Test for equality 54 * 55 * @param obj object to test 56 * @return true if equivalent 57 */ 58 public boolean equals(Object obj) { 59 boolean result = false; 60 if (obj != null && obj instanceof ConnectionInfo) { 61 ConnectionInfo info = (ConnectionInfo) obj; 62 result = this.clientId == info.clientId; 63 } 64 return result; 65 } 66 67 /*** 68 * @return hash code for instance 69 */ 70 public int hashCode() { 71 return this.clientId != null ? this.clientId.hashCode() : super.hashCode(); 72 } 73 74 75 /*** 76 * @return Returns the clientId. 77 */ 78 public String getClientId() { 79 return this.clientId; 80 } 81 82 /*** 83 * @param newClientId The clientId to set. 84 */ 85 public void setClientId(String newClientId) { 86 this.clientId = newClientId; 87 } 88 89 /*** 90 * @return Returns the hostName. 91 */ 92 public String getHostName() { 93 return this.hostName; 94 } 95 96 /*** 97 * @param newHostName The hostName to set. 98 */ 99 public void setHostName(String newHostName) { 100 this.hostName = newHostName; 101 } 102 103 /*** 104 * @return Returns the password. 105 */ 106 public String getPassword() { 107 return this.password; 108 } 109 110 /*** 111 * @param newPassword The password to set. 112 */ 113 public void setPassword(String newPassword) { 114 this.password = newPassword; 115 } 116 117 /*** 118 * @return Returns the properties. 119 */ 120 public Properties getProperties() { 121 return this.properties; 122 } 123 124 /*** 125 * @param newProperties The properties to set. 126 */ 127 public void setProperties(Properties newProperties) { 128 this.properties = newProperties; 129 } 130 131 /*** 132 * @return Returns the startTime. 133 */ 134 public long getStartTime() { 135 return this.startTime; 136 } 137 138 /*** 139 * @param newStartTime The startTime to set. 140 */ 141 public void setStartTime(long newStartTime) { 142 this.startTime = newStartTime; 143 } 144 145 /*** 146 * @return Returns the userName. 147 */ 148 public String getUserName() { 149 return this.userName; 150 } 151 152 /*** 153 * @param newUserName The userName to set. 154 */ 155 public void setUserName(String newUserName) { 156 this.userName = newUserName; 157 } 158 159 /*** 160 * @return Returns the started. 161 */ 162 public boolean isStarted() { 163 return started; 164 } 165 166 /*** 167 * @param started The started to set. 168 */ 169 public void setStarted(boolean started) { 170 this.started = started; 171 } 172 173 /*** 174 * @return Returns the closed. 175 */ 176 public boolean isClosed() { 177 return closed; 178 } 179 180 /*** 181 * @param closed The closed to set. 182 */ 183 public void setClosed(boolean closed) { 184 this.closed = closed; 185 } 186 /*** 187 * @return Returns the clientVersion. 188 */ 189 public String getClientVersion() { 190 return clientVersion; 191 } 192 /*** 193 * @param clientVersion The clientVersion to set. 194 */ 195 public void setClientVersion(String clientVersion) { 196 this.clientVersion = clientVersion; 197 } 198 /*** 199 * @return Returns the wireFormatVersion. 200 */ 201 public int getWireFormatVersion() { 202 return wireFormatVersion; 203 } 204 /*** 205 * @param wireFormatVersion The wireFormatVersion to set. 206 */ 207 public void setWireFormatVersion(int wireFormatVersion) { 208 this.wireFormatVersion = wireFormatVersion; 209 } 210 }