public String process(String message) {
InputMessage input = InputMessage.create(message);
String commandName = input.getString();
TestServerCommand command = nameToCommand.get(commandName);
OutputMessage output = null;
if (command == null) {
//TODO
} else {
try {
output = command.execute(input);
} catch (Throwable t) {
LOGGER.log(Level.SEVERE, "error in command", t);
}
}
// if the command returns a result
String result = MessageProcessor.NO_RESPONSE;
if (output != null) {
result = output.toMessage();
}
return result;
}
});