57 |
|
|
58 |
|
// check to config to see if we want extra data or not |
59 |
|
if(Configuration.getInstance().getProperty("displayExtraData").equals("1")) { |
60 |
< |
extraData = true; |
60 |
> |
_extraData = true; |
61 |
|
} |
62 |
|
try { |
63 |
|
_heartbeatTimer = new PacketTimer(Integer.parseInt(Configuration.getInstance().getProperty("Host.TCPUpdateTime"))); |
194 |
|
_center.add(_services); |
195 |
|
|
196 |
|
// everything else we get is "extra", but we may still want to display it |
197 |
< |
if (extraData) { |
197 |
> |
if (_extraData) { |
198 |
|
_center.add(new javax.swing.JLabel("--- Extra Data ---")); |
199 |
|
_center.add(_extra); |
200 |
|
} |
227 |
|
_heartbeatTimerThread = new Thread(_heartbeatTimer); |
228 |
|
_heartbeatTimerThread.start(); |
229 |
|
} |
230 |
< |
displaySucessful = processPacket(packet, _services, true); |
230 |
> |
displaySucessful = processPacket(packet); |
231 |
|
|
232 |
|
// must be a normal data packet, update the display |
233 |
|
} else if((packet.getParam("packet.attributes.type")).equals("data")) { |
234 |
< |
displaySucessful = processPacket(packet, _extra, extraData); |
234 |
> |
displaySucessful = processPacket(packet); |
235 |
|
_dataTimer.reset(); |
236 |
|
if(_dataTimerThread == null){ |
237 |
|
_dataTimerThread = new Thread(_dataTimer); |
249 |
|
* create a new StringDataComponent to display the data. |
250 |
|
* |
251 |
|
* @param packet the packet to process |
252 |
– |
* @param extraDataJPanel a panel to place any data that is found to be extra |
253 |
– |
* @param processUnknownData whether to process data that is not currently being handled |
252 |
|
* |
253 |
|
* @return if the proceesing was successful |
254 |
|
*/ |
255 |
< |
private boolean processPacket(XMLPacket packet, JPanel extraDataJPanel, boolean processUnknownData) { |
255 |
> |
private boolean processPacket(XMLPacket packet) { |
256 |
|
// iterate over the packets data |
257 |
|
boolean displaySucessful = true; |
258 |
|
Set packetSet = packet.getSet(); |
268 |
|
createDiskPanel(dataKey); |
269 |
|
|
270 |
|
// !check for services here! to display |
271 |
+ |
} else if(dataKey.startsWith("packet.services.")) { |
272 |
+ |
createServicesPanel(dataKey); |
273 |
|
|
274 |
< |
} else if (processUnknownData) { |
275 |
< |
addVisibleDataComponent(extraDataJPanel, new StringDataComponent(dataKey, dataKey)); |
274 |
> |
} else if (_extraData) { |
275 |
> |
addVisibleDataComponent(_extra, new StringDataComponent(dataKey, dataKey)); |
276 |
|
} |
277 |
|
} |
278 |
|
|
355 |
|
// but we add it so that it is forgotten about |
356 |
|
addDataComponent(new StringDataComponent("packet.disk.p" + diskNumber + ".used", "packet.disk.p" + diskNumber + ".attributes.used")); |
357 |
|
} |
358 |
+ |
|
359 |
+ |
/** |
360 |
+ |
* Creates the disk components and adds them |
361 |
+ |
* do the list of components. It also displays |
362 |
+ |
* any relavant component. |
363 |
+ |
* |
364 |
+ |
* When a packet attribute is new to the system |
365 |
+ |
* and when it starts "packet.disk.p" then this |
366 |
+ |
* method is called. Thus it then accounts for |
367 |
+ |
* all attributes relating to that new disk. |
368 |
+ |
* |
369 |
+ |
* @param attribute the name of the attrivbute first encountered |
370 |
+ |
*/ |
371 |
+ |
private void createServicesPanel(String attribute) { |
372 |
+ |
String serviceType = ""; |
373 |
+ |
|
374 |
+ |
// pos is after "packet.services." |
375 |
+ |
int pos = 16; |
376 |
+ |
while (attribute.charAt(pos) != '.') { |
377 |
+ |
serviceType = serviceType + attribute.charAt(pos); |
378 |
+ |
pos++; |
379 |
+ |
} |
380 |
+ |
StringDataComponent serviceStatus = new StringDataComponent(serviceType + " service status", "packet.services." + serviceType + ".attributes.status"); |
381 |
+ |
addDataComponent(serviceStatus); |
382 |
+ |
|
383 |
+ |
ServiceDataComponent service = new ServiceDataComponent(serviceType, "packet.services." + serviceType + ".attributes.message", serviceStatus); |
384 |
+ |
addVisibleDataComponent(_services, service); |
385 |
+ |
} |
386 |
|
|
387 |
|
//---ACCESSOR/MUTATOR METHODS--- |
388 |
|
|
473 |
|
* by default we don't, but we look in the configuration |
474 |
|
* in the constructor. |
475 |
|
*/ |
476 |
< |
private boolean extraData = false; |
476 |
> |
private boolean _extraData = false; |
477 |
|
|
478 |
|
//---STATIC ATTRIBUTES--- |
479 |
|
|