1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.rundeck.api.domain;
17
18 import java.io.Serializable;
19 import java.util.Date;
20 import org.apache.commons.lang.time.DurationFormatUtils;
21
22
23
24
25
26
27 public class RundeckSystemInfo implements Serializable {
28
29 private static final long serialVersionUID = 1L;
30
31 private Date date;
32
33 private String version;
34
35 private String build;
36
37 private String node;
38
39 private String baseDir;
40
41 private String osArch;
42
43 private String osName;
44
45 private String osVersion;
46
47 private String jvmName;
48
49 private String jvmVendor;
50
51 private String jvmVersion;
52
53 private Date startDate;
54
55 private Long uptimeInMillis;
56
57 private String cpuLoadAverage;
58
59 private Long maxMemoryInBytes;
60
61 private Long freeMemoryInBytes;
62
63 private Long totalMemoryInBytes;
64
65 private Integer runningJobs;
66
67 private Integer activeThreads;
68
69
70
71
72 public String getUptime() {
73 return uptimeInMillis != null ? DurationFormatUtils.formatDurationWords(uptimeInMillis, true, true) : null;
74 }
75
76 public Date getDate() {
77 return (date != null) ? new Date(date.getTime()) : null;
78 }
79
80 public void setDate(Date date) {
81 this.date = ((date != null) ? new Date(date.getTime()) : null);
82 }
83
84 public String getVersion() {
85 return version;
86 }
87
88 public void setVersion(String version) {
89 this.version = version;
90 }
91
92 public String getBuild() {
93 return build;
94 }
95
96 public void setBuild(String build) {
97 this.build = build;
98 }
99
100 public String getNode() {
101 return node;
102 }
103
104 public void setNode(String node) {
105 this.node = node;
106 }
107
108 public String getBaseDir() {
109 return baseDir;
110 }
111
112 public void setBaseDir(String baseDir) {
113 this.baseDir = baseDir;
114 }
115
116 public String getOsArch() {
117 return osArch;
118 }
119
120 public void setOsArch(String osArch) {
121 this.osArch = osArch;
122 }
123
124 public String getOsName() {
125 return osName;
126 }
127
128 public void setOsName(String osName) {
129 this.osName = osName;
130 }
131
132 public String getOsVersion() {
133 return osVersion;
134 }
135
136 public void setOsVersion(String osVersion) {
137 this.osVersion = osVersion;
138 }
139
140 public String getJvmName() {
141 return jvmName;
142 }
143
144 public void setJvmName(String jvmName) {
145 this.jvmName = jvmName;
146 }
147
148 public String getJvmVendor() {
149 return jvmVendor;
150 }
151
152 public void setJvmVendor(String jvmVendor) {
153 this.jvmVendor = jvmVendor;
154 }
155
156 public String getJvmVersion() {
157 return jvmVersion;
158 }
159
160 public void setJvmVersion(String jvmVersion) {
161 this.jvmVersion = jvmVersion;
162 }
163
164 public Date getStartDate() {
165 return (startDate != null) ? new Date(startDate.getTime()) : null;
166 }
167
168 public void setStartDate(Date startDate) {
169 this.startDate = ((startDate != null) ? new Date(startDate.getTime()) : null);
170 }
171
172 public Long getUptimeInMillis() {
173 return uptimeInMillis;
174 }
175
176 public void setUptimeInMillis(Long uptimeInMillis) {
177 this.uptimeInMillis = uptimeInMillis;
178 }
179
180 public String getCpuLoadAverage() {
181 return cpuLoadAverage;
182 }
183
184 public void setCpuLoadAverage(String cpuLoadAverage) {
185 this.cpuLoadAverage = cpuLoadAverage;
186 }
187
188 public Long getMaxMemoryInBytes() {
189 return maxMemoryInBytes;
190 }
191
192 public void setMaxMemoryInBytes(Long maxMemoryInBytes) {
193 this.maxMemoryInBytes = maxMemoryInBytes;
194 }
195
196 public Long getFreeMemoryInBytes() {
197 return freeMemoryInBytes;
198 }
199
200 public void setFreeMemoryInBytes(Long freeMemoryInBytes) {
201 this.freeMemoryInBytes = freeMemoryInBytes;
202 }
203
204 public Long getTotalMemoryInBytes() {
205 return totalMemoryInBytes;
206 }
207
208 public void setTotalMemoryInBytes(Long totalMemoryInBytes) {
209 this.totalMemoryInBytes = totalMemoryInBytes;
210 }
211
212 public Integer getRunningJobs() {
213 return runningJobs;
214 }
215
216 public void setRunningJobs(Integer runningJobs) {
217 this.runningJobs = runningJobs;
218 }
219
220 public Integer getActiveThreads() {
221 return activeThreads;
222 }
223
224 public void setActiveThreads(Integer activeThreads) {
225 this.activeThreads = activeThreads;
226 }
227
228 @Override
229 public String toString() {
230 return "RundeckSystemInfo [activeThreads=" + activeThreads + ", baseDir=" + baseDir + ", build=" + build
231 + ", cpuLoadAverage=" + cpuLoadAverage + ", date=" + date + ", freeMemoryInBytes=" + freeMemoryInBytes
232 + ", jvmName=" + jvmName + ", jvmVendor=" + jvmVendor + ", jvmVersion=" + jvmVersion
233 + ", maxMemoryInBytes=" + maxMemoryInBytes + ", node=" + node + ", osArch=" + osArch + ", osName="
234 + osName + ", osVersion=" + osVersion + ", runningJobs=" + runningJobs + ", startDate=" + startDate
235 + ", totalMemoryInBytes=" + totalMemoryInBytes + ", uptimeInMillis=" + uptimeInMillis + ", version="
236 + version + "]";
237 }
238
239 @Override
240 public int hashCode() {
241 final int prime = 31;
242 int result = 1;
243 result = prime * result + ((activeThreads == null) ? 0 : activeThreads.hashCode());
244 result = prime * result + ((baseDir == null) ? 0 : baseDir.hashCode());
245 result = prime * result + ((build == null) ? 0 : build.hashCode());
246 result = prime * result + ((cpuLoadAverage == null) ? 0 : cpuLoadAverage.hashCode());
247 result = prime * result + ((date == null) ? 0 : date.hashCode());
248 result = prime * result + ((freeMemoryInBytes == null) ? 0 : freeMemoryInBytes.hashCode());
249 result = prime * result + ((jvmName == null) ? 0 : jvmName.hashCode());
250 result = prime * result + ((jvmVendor == null) ? 0 : jvmVendor.hashCode());
251 result = prime * result + ((jvmVersion == null) ? 0 : jvmVersion.hashCode());
252 result = prime * result + ((maxMemoryInBytes == null) ? 0 : maxMemoryInBytes.hashCode());
253 result = prime * result + ((node == null) ? 0 : node.hashCode());
254 result = prime * result + ((osArch == null) ? 0 : osArch.hashCode());
255 result = prime * result + ((osName == null) ? 0 : osName.hashCode());
256 result = prime * result + ((osVersion == null) ? 0 : osVersion.hashCode());
257 result = prime * result + ((runningJobs == null) ? 0 : runningJobs.hashCode());
258 result = prime * result + ((startDate == null) ? 0 : startDate.hashCode());
259 result = prime * result + ((totalMemoryInBytes == null) ? 0 : totalMemoryInBytes.hashCode());
260 result = prime * result + ((uptimeInMillis == null) ? 0 : uptimeInMillis.hashCode());
261 result = prime * result + ((version == null) ? 0 : version.hashCode());
262 return result;
263 }
264
265 @Override
266 public boolean equals(Object obj) {
267 if (this == obj)
268 return true;
269 if (obj == null)
270 return false;
271 if (getClass() != obj.getClass())
272 return false;
273 RundeckSystemInfo other = (RundeckSystemInfo) obj;
274 if (activeThreads == null) {
275 if (other.activeThreads != null)
276 return false;
277 } else if (!activeThreads.equals(other.activeThreads))
278 return false;
279 if (baseDir == null) {
280 if (other.baseDir != null)
281 return false;
282 } else if (!baseDir.equals(other.baseDir))
283 return false;
284 if (build == null) {
285 if (other.build != null)
286 return false;
287 } else if (!build.equals(other.build))
288 return false;
289 if (cpuLoadAverage == null) {
290 if (other.cpuLoadAverage != null)
291 return false;
292 } else if (!cpuLoadAverage.equals(other.cpuLoadAverage))
293 return false;
294 if (date == null) {
295 if (other.date != null)
296 return false;
297 } else if (!date.equals(other.date))
298 return false;
299 if (freeMemoryInBytes == null) {
300 if (other.freeMemoryInBytes != null)
301 return false;
302 } else if (!freeMemoryInBytes.equals(other.freeMemoryInBytes))
303 return false;
304 if (jvmName == null) {
305 if (other.jvmName != null)
306 return false;
307 } else if (!jvmName.equals(other.jvmName))
308 return false;
309 if (jvmVendor == null) {
310 if (other.jvmVendor != null)
311 return false;
312 } else if (!jvmVendor.equals(other.jvmVendor))
313 return false;
314 if (jvmVersion == null) {
315 if (other.jvmVersion != null)
316 return false;
317 } else if (!jvmVersion.equals(other.jvmVersion))
318 return false;
319 if (maxMemoryInBytes == null) {
320 if (other.maxMemoryInBytes != null)
321 return false;
322 } else if (!maxMemoryInBytes.equals(other.maxMemoryInBytes))
323 return false;
324 if (node == null) {
325 if (other.node != null)
326 return false;
327 } else if (!node.equals(other.node))
328 return false;
329 if (osArch == null) {
330 if (other.osArch != null)
331 return false;
332 } else if (!osArch.equals(other.osArch))
333 return false;
334 if (osName == null) {
335 if (other.osName != null)
336 return false;
337 } else if (!osName.equals(other.osName))
338 return false;
339 if (osVersion == null) {
340 if (other.osVersion != null)
341 return false;
342 } else if (!osVersion.equals(other.osVersion))
343 return false;
344 if (runningJobs == null) {
345 if (other.runningJobs != null)
346 return false;
347 } else if (!runningJobs.equals(other.runningJobs))
348 return false;
349 if (startDate == null) {
350 if (other.startDate != null)
351 return false;
352 } else if (!startDate.equals(other.startDate))
353 return false;
354 if (totalMemoryInBytes == null) {
355 if (other.totalMemoryInBytes != null)
356 return false;
357 } else if (!totalMemoryInBytes.equals(other.totalMemoryInBytes))
358 return false;
359 if (uptimeInMillis == null) {
360 if (other.uptimeInMillis != null)
361 return false;
362 } else if (!uptimeInMillis.equals(other.uptimeInMillis))
363 return false;
364 if (version == null) {
365 if (other.version != null)
366 return false;
367 } else if (!version.equals(other.version))
368 return false;
369 return true;
370 }
371
372 }