KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jrobin > mrtg > client > ServerInfo


1 /* ============================================================
2  * JRobin : Pure java implementation of RRDTool's functionality
3  * ============================================================
4  *
5  * Project Info: http://www.jrobin.org
6  * Project Lead: Sasa Markovic (saxon@jrobin.org);
7  *
8  * (C) Copyright 2003, by Sasa Markovic.
9  *
10  * Developers: Sasa Markovic (saxon@jrobin.org)
11  * Arne Vandamme (cobralord@jrobin.org)
12  *
13  * This library is free software; you can redistribute it and/or modify it under the terms
14  * of the GNU Lesser General Public License as published by the Free Software Foundation;
15  * either version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
18  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  * See the GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License along with this
22  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
23  * Boston, MA 02111-1307, USA.
24  */

25 package org.jrobin.mrtg.client;
26
27 import java.util.Date JavaDoc;
28
29 class ServerInfo implements TreeElementInfo {
30     private String JavaDoc serverHost;
31     private int sampleCount, savesCount, goodSavesCount, badSavesCount;
32     private double poolEfficency;
33     private Date JavaDoc startDate;
34
35     public String JavaDoc getServerHost() {
36         return serverHost;
37     }
38
39     public void setServerHost(String JavaDoc serverHost) {
40         this.serverHost = serverHost;
41     }
42
43     int getSampleCount() {
44         return sampleCount;
45     }
46
47     void setSampleCount(int sampleCount) {
48         this.sampleCount = sampleCount;
49     }
50
51     int getSavesCount() {
52         return savesCount;
53     }
54
55     void setSavesCount(int savesCount) {
56         this.savesCount = savesCount;
57     }
58
59     int getGoodSavesCount() {
60         return goodSavesCount;
61     }
62
63     void setGoodSavesCount(int goodSavesCount) {
64         this.goodSavesCount = goodSavesCount;
65     }
66
67     int getBadSavesCount() {
68         return badSavesCount;
69     }
70
71     void setBadSavesCount(int badSavesCount) {
72         this.badSavesCount = badSavesCount;
73     }
74
75     Date JavaDoc getStartDate() {
76         return startDate;
77     }
78
79     void setStartDate(Date JavaDoc startDate) {
80         this.startDate = startDate;
81     }
82
83     public String JavaDoc toString() {
84         return getServerHost() + " [right click to reload]";
85     }
86
87     public String JavaDoc getInfo() {
88         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
89         buffer.append("Server host: " + getServerHost() + "\n");
90         buffer.append("Server started on: " + getStartDate() + "\n");
91         buffer.append("Samples created: " + getSampleCount() + "\n");
92         buffer.append("Total samples processed: " + getSavesCount() + "\n");
93         buffer.append("Samples stored OK: " + getGoodSavesCount() + "\n");
94         buffer.append("Samples not stored: " + getBadSavesCount() + "\n");
95         buffer.append("Pool efficency: " + getPoolEfficency() + "\n");
96         return buffer.toString();
97     }
98
99     public boolean equals(Object JavaDoc obj) {
100         return obj instanceof ServerInfo;
101     }
102
103     double getPoolEfficency() {
104         return poolEfficency;
105     }
106
107     void setPoolEfficency(double poolEfficency) {
108         this.poolEfficency = poolEfficency;
109     }
110
111 }
112
Popular Tags