1
2
3
4
5
6
7
8
9
10
11 package psiprobe.model;
12
13 import java.io.File;
14 import java.io.Serializable;
15 import java.util.Date;
16 import java.util.Map;
17 import java.util.Set;
18
19 import org.apache.catalina.util.ServerInfo;
20
21
22
23
24 public class SystemInformation implements Serializable {
25
26
27 private static final long serialVersionUID = 1L;
28
29
30 private String appBase;
31
32
33 private String configBase;
34
35
36 private Map<String, String> systemProperties;
37
38
39
40
41
42
43 public long getMaxMemory() {
44 return Runtime.getRuntime().maxMemory();
45 }
46
47
48
49
50
51
52 public long getFreeMemory() {
53 return Runtime.getRuntime().freeMemory();
54 }
55
56
57
58
59
60
61 public long getTotalMemory() {
62 return Runtime.getRuntime().totalMemory();
63 }
64
65
66
67
68
69
70 public int getCpuCount() {
71 return Runtime.getRuntime().availableProcessors();
72 }
73
74
75
76
77
78
79 public Date getDate() {
80 return new Date();
81 }
82
83
84
85
86
87
88 public String getServerInfo() {
89 return ServerInfo.getServerInfo();
90 }
91
92
93
94
95
96
97 public String getWorkingDir() {
98 return new File("").getAbsolutePath();
99 }
100
101
102
103
104
105
106 public String getAppBase() {
107 return appBase;
108 }
109
110
111
112
113
114
115 public void setAppBase(String appBase) {
116 this.appBase = appBase;
117 }
118
119
120
121
122
123
124 public String getConfigBase() {
125 return configBase;
126 }
127
128
129
130
131
132
133 public void setConfigBase(String configBase) {
134 this.configBase = configBase;
135 }
136
137
138
139
140
141
142 public Map<String, String> getSystemProperties() {
143 return systemProperties;
144 }
145
146
147
148
149
150
151 public void setSystemProperties(Map<String, String> systemProperties) {
152 this.systemProperties = systemProperties;
153 }
154
155
156
157
158
159
160 public Set<Map.Entry<String, String>> getSystemPropertySet() {
161 return systemProperties.entrySet();
162 }
163
164 }