KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > proxool > ConnectionInfo


1 /*
2  * This software is released under a licence similar to the Apache Software Licence.
3  * See org.logicalcobwebs.proxool.package.html for details.
4  * The latest version is available at http://proxool.sourceforge.net
5  */

6 package org.logicalcobwebs.proxool;
7
8 import org.logicalcobwebs.proxool.util.FastArrayList;
9
10 import java.util.Date JavaDoc;
11 import java.util.List JavaDoc;
12
13 /**
14  * Implementation of ConnectionInfoIF. Unlike ConnectionPool it is
15  * frozen and will not change. Used with a {@link org.logicalcobwebs.proxool.admin.SnapshotIF snapshot}
16  *
17  * @version $Revision: 1.8 $, $Date: 2005/10/07 08:18:23 $
18  * @author bill
19  * @author $Author: billhorsman $ (current maintainer)
20  * @since Proxool 0.7
21  */

22 class ConnectionInfo implements ConnectionInfoIF {
23
24     private Date JavaDoc birthDate;
25
26     private long age;
27
28     private long id;
29
30     private int mark;
31
32     private int status;
33
34     private long timeLastStartActive;
35
36     private long timeLastStopActive;
37
38     private String JavaDoc requester;
39
40     private String JavaDoc delegateDriver;
41
42     private String JavaDoc delegateUrl;
43
44     private String JavaDoc proxyHashcode;
45
46     private String JavaDoc delegateHashcode;
47
48     private List sqlCalls = new FastArrayList();
49
50     public Date JavaDoc getBirthDate() {
51         return birthDate;
52     }
53
54     public long getBirthTime() {
55         return birthDate.getTime();
56     }
57
58     public void setBirthDate(Date JavaDoc birthDate) {
59         this.birthDate = birthDate;
60     }
61
62     public long getAge() {
63         return age;
64     }
65
66     public void setAge(long age) {
67         this.age = age;
68     }
69
70     public long getId() {
71         return id;
72     }
73
74     public void setId(long id) {
75         this.id = id;
76     }
77
78     public int getMark() {
79         return mark;
80     }
81
82     public void setMark(int mark) {
83         this.mark = mark;
84     }
85
86     public int getStatus() {
87         return status;
88     }
89
90     public void setStatus(int status) {
91         this.status = status;
92     }
93
94     public long getTimeLastStartActive() {
95         return timeLastStartActive;
96     }
97
98     public void setTimeLastStartActive(long timeLastStartActive) {
99         this.timeLastStartActive = timeLastStartActive;
100     }
101
102     public long getTimeLastStopActive() {
103         return timeLastStopActive;
104     }
105
106     public void setTimeLastStopActive(long timeLastStopActive) {
107         this.timeLastStopActive = timeLastStopActive;
108     }
109
110     public String JavaDoc getRequester() {
111         return requester;
112     }
113
114     public void setRequester(String JavaDoc requester) {
115         this.requester = requester;
116     }
117
118     public String JavaDoc getDelegateDriver() {
119         return delegateDriver;
120     }
121
122     public void setDelegateDriver(String JavaDoc delegateDriver) {
123         this.delegateDriver = delegateDriver;
124     }
125
126     public String JavaDoc getDelegateUrl() {
127         return delegateUrl;
128     }
129
130     public void setDelegateUrl(String JavaDoc delegateUrl) {
131         this.delegateUrl = delegateUrl;
132     }
133
134     public String JavaDoc getProxyHashcode() {
135         return proxyHashcode;
136     }
137
138     public void setProxyHashcode(String JavaDoc proxyHashcode) {
139         this.proxyHashcode = proxyHashcode;
140     }
141
142     public String JavaDoc getDelegateHashcode() {
143         return delegateHashcode;
144     }
145
146     public void setDelegateHashcode(String JavaDoc delegateHashcode) {
147         this.delegateHashcode = delegateHashcode;
148     }
149
150     /**
151      * Compares using {@link #getId()}
152      * @param o must be another {@link ConnectionInfoIF} implementation
153      * @return the comparison
154      * @see Comparable#compareTo(Object)
155      */

156     public int compareTo(Object JavaDoc o) {
157         return new Long JavaDoc(((ConnectionInfoIF) o).getId()).compareTo(new Long JavaDoc(getId()));
158     }
159
160     public String JavaDoc[] getSqlCalls() {
161         return (String JavaDoc[]) sqlCalls.toArray(new String JavaDoc[0]);
162     }
163
164     public void addSqlCall(String JavaDoc sqlCall) {
165         this.sqlCalls.add(sqlCall);
166     }
167 }
168
169
170 /*
171  Revision history:
172  $Log: ConnectionInfo.java,v $
173  Revision 1.8 2005/10/07 08:18:23 billhorsman
174  New sqlCalls gives list of SQL calls rather than just he most recent (for when a connection makes more than one call before being returned to the pool)
175
176  Revision 1.7 2005/09/26 10:01:31 billhorsman
177  Added lastSqlCall when trace is on.
178
179  Revision 1.6 2003/10/30 00:05:50 billhorsman
180  now implements Comparable (using ID)
181
182  Revision 1.5 2003/03/03 11:11:56 billhorsman
183  fixed licence
184
185  Revision 1.4 2003/02/19 23:46:09 billhorsman
186  renamed monitor package to admin
187
188  Revision 1.3 2003/02/12 12:28:27 billhorsman
189  added url, proxyHashcode and delegateHashcode to
190  ConnectionInfoIF
191
192  Revision 1.2 2003/01/31 16:53:15 billhorsman
193  checkstyle
194
195  Revision 1.1 2003/01/31 11:47:14 billhorsman
196  new snapshot of connection info
197
198  */
Popular Tags