admin = false;
msg = "You are not admin. You can safely play with the settings as"
+ " you can not change anything.";
if (packet.getStrCommand() != null
&& packet.getStrCommand().endsWith(DEF_SM_NAME)) {
Packet result = packet.commandResult("result");
Command.addFieldValue(result, "Note", msg, "fixed");
Command.addFieldValue(result, "Note",
"Restricted area, only admin can see these settings.", "fixed");
results.offer(result);
return;
}
} else {
try {
results.offer(Authorization.NOT_AUTHORIZED.getResponseMessage(packet,
"You are not authorized for this action.", true));
} catch (PacketErrorTypeException e) {
log.warning("Packet processing exception: " + e);
}
return;
}
}
log.finest("Command received: " + packet.getStringData());
Command.Action action = Command.getAction(packet);
if (action == Command.Action.cancel) {
Packet result = packet.commandResult(null);
results.offer(result);
return;
}
switch (packet.getCommand()) {
case OTHER:
if (packet.getStrCommand() != null) {
if (packet.getStrCommand().startsWith("config/list/")) {
String[] spl = packet.getStrCommand().split("/");
Packet result = packet.commandResult("result");
Command.addFieldValue(result, "Note", msg, "fixed");
Map<String, Object> allprop = getAllProperties(spl[2]);
for (Map.Entry<String, Object> entry: allprop.entrySet()) {
Command.addFieldValue(result, XMLUtils.escape(entry.getKey()),
XMLUtils.escape(objectToString(entry.getValue())));
} // end of for (Map.Entry entry: prop.entrySet())
results.offer(result);
}
if (packet.getStrCommand().startsWith("config/set/")) {
String[] spl = packet.getStrCommand().split("/");
Packet result = packet.commandResult("result");
Command.addFieldValue(result, "Note", msg, "fixed");
if (Command.getData(packet) == null) {
prepareConfigData(result, spl[2]);
results.offer(result);
} else {