Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/message/ConnectionInfo.java


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