View Javadoc

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  /***
22   * Denotes an object that can be serialized/deserailized using a Packet Reader/Writer
23   */
24  
25  public class SessionInfo extends AbstractPacket {
26  
27      private String clientId;
28      private String sessionId;
29      private long startTime;
30      private boolean started;
31  
32      /***
33       * Return the type of Packet
34       *
35       * @return integer representation of the type of Packet
36       */
37  
38      public int getPacketType() {
39          return SESSION_INFO;
40      }
41  
42  
43      /***
44       * Test for equality
45       *
46       * @param obj object to test
47       * @return true if equivalent
48       */
49      public boolean equals(Object obj) {
50          boolean result = false;
51          if (obj != null && obj instanceof SessionInfo) {
52              SessionInfo info = (SessionInfo) obj;
53              result = this.sessionId == info.sessionId;
54          }
55          return result;
56      }
57  
58      /***
59       * @return hash code for instance
60       */
61      public int hashCode() {
62          return this.sessionId != null ? this.sessionId.hashCode() : super.hashCode();
63      }
64  
65  
66      /***
67       * @return Returns the sessionId.
68       */
69      public String getSessionId() {
70          return sessionId;
71      }
72  
73      /***
74       * @param sessionId The sessionId to set.
75       */
76      public void setSessionId(String sessionId) {
77          this.sessionId = sessionId;
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      /***
97       * @return Returns the started.
98       */
99      public boolean isStarted() {
100         return this.started;
101     }
102 
103     /***
104      * @param flag to indicate if started
105      */
106     public void setStarted(boolean flag) {
107         this.started = flag;
108     }
109 
110     /***
111      * @return Returns the startTime.
112      */
113     public long getStartTime() {
114         return this.startTime;
115     }
116 
117     /***
118      * @param newStartTime The startTime to set.
119      */
120     public void setStartTime(long newStartTime) {
121         this.startTime = newStartTime;
122     }
123 
124 
125 }