String cmdData = command.getData();
getLogger().info("onContentCommand: ({}, {})", cmdType, cmdData);
if (COMMAND_GET_PARTICIPANTS.equalsIgnoreCase(cmdType)) {
String json = gson.toJson(participants.values());
return new ContentCommandResult(json);
} else if (COMMAND_SELECT.equalsIgnoreCase(cmdType)) {
return new ContentCommandResult(Boolean.toString(selectParticipant(
session, cmdData)));
} else if (COMMAND_CONNECT.equalsIgnoreCase(cmdType)) {
Type listType = new TypeToken<List<String>>() {
}.getType();
List<String> idList = gson.fromJson(cmdData, listType);
if (idList.size() != 2) {
return new ContentCommandResult(Boolean.FALSE.toString());
}
return new ContentCommandResult(
Boolean.toString(connectParticipant(idList.get(0),
idList.get(1))));
}
return super.onContentCommand(session, command);
}