KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > proxool > admin > Snapshot


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.admin;
7
8 import org.apache.commons.logging.Log;
9 import org.apache.commons.logging.LogFactory;
10 import org.logicalcobwebs.proxool.ConnectionInfoIF;
11
12 import java.util.Collection JavaDoc;
13 import java.util.Date JavaDoc;
14
15 /**
16  * Implementation of SnapshotIF
17  *
18  * @version $Revision: 1.5 $, $Date: 2006/01/18 14:39:57 $
19  * @author bill
20  * @author $Author: billhorsman $ (current maintainer)
21  * @since Proxool 0.7
22  */

23 class Snapshot implements SnapshotIF {
24
25     private static final Log LOG = LogFactory.getLog(Snapshot.class);
26
27     private Date JavaDoc dateStarted;
28
29     private long servedCount;
30
31     private long refusedCount;
32
33     private int activeConnectionCount;
34
35     private int availableConnectionCount;
36
37     private int offlineConnectionCount;
38
39     private int maximumConnectionCount;
40
41     private Date JavaDoc snapshotDate;
42
43     private Collection JavaDoc connectionInfos;
44
45     private long connectionCount;
46
47     /**
48      * @param snapshotDate see {@link org.logicalcobwebs.proxool.admin.SnapshotIF#getSnapshotDate}
49      */

50     public Snapshot(Date JavaDoc snapshotDate) {
51         this.snapshotDate = snapshotDate;
52     }
53
54     /**
55      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getDateStarted
56      */

57     public Date JavaDoc getDateStarted() {
58         return dateStarted;
59     }
60
61     /**
62      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getDateStarted
63      */

64     public void setDateStarted(Date JavaDoc dateStarted) {
65         this.dateStarted = dateStarted;
66     }
67
68     /**
69      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getServedCount
70      */

71     public long getServedCount() {
72         return servedCount;
73     }
74
75     /**
76      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getServedCount
77      */

78     public void setServedCount(long servedCount) {
79         this.servedCount = servedCount;
80     }
81
82     /**
83      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getRefusedCount
84      */

85     public long getRefusedCount() {
86         return refusedCount;
87     }
88
89     /**
90      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getRefusedCount
91      */

92     public void setRefusedCount(long refusedCount) {
93         this.refusedCount = refusedCount;
94     }
95
96     /**
97      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getActiveConnectionCount
98      */

99     public int getActiveConnectionCount() {
100         return activeConnectionCount;
101     }
102
103     /**
104      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getActiveConnectionCount
105      */

106     public void setActiveConnectionCount(int activeConnectionCount) {
107         this.activeConnectionCount = activeConnectionCount;
108     }
109
110     /**
111      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getAvailableConnectionCount
112      */

113     public int getAvailableConnectionCount() {
114         return availableConnectionCount;
115     }
116
117     /**
118      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getAvailableConnectionCount
119      */

120     public void setAvailableConnectionCount(int availableConnectionCount) {
121         this.availableConnectionCount = availableConnectionCount;
122     }
123
124     /**
125      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getOfflineConnectionCount
126      */

127     public int getOfflineConnectionCount() {
128         return offlineConnectionCount;
129     }
130
131     /**
132      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getOfflineConnectionCount
133      */

134     public void setOfflineConnectionCount(int offlineConnectionCount) {
135         this.offlineConnectionCount = offlineConnectionCount;
136     }
137
138     /**
139      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getMaximumConnectionCount
140      */

141     public int getMaximumConnectionCount() {
142         return maximumConnectionCount;
143     }
144
145     /**
146      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getMaximumConnectionCount
147      */

148     public void setMaximumConnectionCount(int maximumConnectionCount) {
149         this.maximumConnectionCount = maximumConnectionCount;
150     }
151
152     /**
153      * @see org.logicalcobwebs.proxool.admin.SnapshotIF#getSnapshotDate
154      */

155     public Date JavaDoc getSnapshotDate() {
156         return snapshotDate;
157     }
158
159     /**
160      * @see SnapshotIF#getConnectionInfos
161      */

162     public ConnectionInfoIF[] getConnectionInfos() {
163         return (ConnectionInfoIF[]) connectionInfos.toArray(new ConnectionInfoIF[connectionInfos.size()]);
164     }
165
166     /**
167      * @see SnapshotIF#getConnectionInfos
168      */

169     public void setConnectionInfos(Collection JavaDoc connectionInfos) {
170         this.connectionInfos = connectionInfos;
171     }
172
173     /**
174      * @see SnapshotIF#getConnectionInfo
175      */

176     public ConnectionInfoIF getConnectionInfo(long id) {
177         ConnectionInfoIF connectionInfo = null;
178         ConnectionInfoIF[] connectionInfos = getConnectionInfos();
179         for (int i = 0; i < connectionInfos.length; i++) {
180             if (connectionInfos[i].getId() == id) {
181                 connectionInfo = connectionInfos[i];
182             }
183         }
184         return connectionInfo;
185     }
186
187     /**
188      * @see SnapshotIF#isDetail
189      */

190     public boolean isDetail() {
191         return connectionInfos != null;
192     }
193
194     public long getConnectionCount() {
195         return connectionCount;
196     }
197
198     public void setConnectionCount(long connectionCount) {
199         this.connectionCount = connectionCount;
200     }
201 }
202
203
204 /*
205  Revision history:
206  $Log: Snapshot.java,v $
207  Revision 1.5 2006/01/18 14:39:57 billhorsman
208  Unbundled Jakarta's Commons Logging.
209
210  Revision 1.4 2005/10/02 12:32:01 billhorsman
211  Make connectionCount available to statistics
212
213  Revision 1.3 2003/03/10 15:26:51 billhorsman
214  refactoringn of concurrency stuff (and some import
215  optimisation)
216
217  Revision 1.2 2003/03/03 11:11:59 billhorsman
218  fixed licence
219
220  Revision 1.1 2003/02/19 23:36:51 billhorsman
221  renamed monitor package to admin
222
223  Revision 1.4 2003/02/12 12:28:28 billhorsman
224  added url, proxyHashcode and delegateHashcode to
225  ConnectionInfoIF
226
227  Revision 1.3 2003/02/06 17:41:06 billhorsman
228  now uses imported logging
229
230  Revision 1.2 2003/01/31 16:38:53 billhorsman
231  doc (and removing public modifier for classes where possible)
232
233  Revision 1.1 2003/01/31 11:35:57 billhorsman
234  improvements to servlet (including connection details)
235
236  Revision 1.1 2003/01/30 17:20:09 billhorsman
237  fixes, improvements and doc
238
239  */
Popular Tags