use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class CaptionMessageReceiver method handleMessage.
@Override
public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.TO_CAPTION_CHANNEL)) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (SendCaptionHistoryRequestMessage.SEND_CAPTION_HISTORY_REQUEST.equals(messageName)) {
SendCaptionHistoryRequestMessage msg = SendCaptionHistoryRequestMessage.fromJson(message);
bbbGW.sendCaptionHistory(msg.meetingID, msg.requesterID);
} else if (UpdateCaptionOwnerMessage.UPDATE_CAPTION_OWNER.equals(messageName)) {
UpdateCaptionOwnerMessage msg = UpdateCaptionOwnerMessage.fromJson(message);
bbbGW.updateCaptionOwner(msg.meetingID, msg.locale, msg.localeCode, msg.ownerID);
} else if (EditCaptionHistoryMessage.EDIT_CAPTION_HISTORY.equals(messageName)) {
EditCaptionHistoryMessage msg = EditCaptionHistoryMessage.fromJson(message);
bbbGW.editCaptionHistory(msg.meetingID, msg.userID, msg.startIndex, msg.endIndex, msg.locale, msg.localeCode, msg.text);
}
}
}
}
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class DeskShareMessageReceiver method handleMessage.
@Override
public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.FROM_VOICE_CONF_SYSTEM_CHAN)) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (DeskShareStartedEventMessage.DESKSHARE_STARTED_MESSAGE.equals(messageName)) {
DeskShareStartedEventMessage msg = DeskShareStartedEventMessage.fromJson(message);
log.info("^^^^^^^DESKSHARE STARTED^^^^^^");
bbbGW.deskShareStarted(msg.conferenceName, msg.callerId, msg.callerIdName);
} else if (DeskShareStoppedEventMessage.DESK_SHARE_STOPPED_MESSAGE.equals(messageName)) {
DeskShareStoppedEventMessage msg = DeskShareStoppedEventMessage.fromJson(message);
log.info("^^^^^^^DESKSHARE STOPPED^^^^^^");
bbbGW.deskShareStopped(msg.conferenceName, msg.callerId, msg.callerIdName);
} else if (DeskShareRTMPBroadcastStartedEventMessage.DESKSHARE_RTMP_BROADCAST_STARTED_MESSAGE.equals(messageName)) {
log.info("^^^^^^^DESKSHARE_RTMP_BROADCAST_STARTED_MESSAGE^^^^^^");
DeskShareRTMPBroadcastStartedEventMessage msg = DeskShareRTMPBroadcastStartedEventMessage.fromJson(message);
bbbGW.deskShareRTMPBroadcastStarted(msg.conferenceName, msg.streamname, msg.vw, msg.vh, msg.timestamp);
} else if (DeskShareRTMPBroadcastStoppedEventMessage.DESKSHARE_RTMP_BROADCAST_STOPPED_MESSAGE.equals(messageName)) {
log.info("^^^^^^^DESKSHARE_RTMP_BROADCAST_STOPPED_MESSAGE^^^^^^");
DeskShareRTMPBroadcastStoppedEventMessage msg = DeskShareRTMPBroadcastStoppedEventMessage.fromJson(message);
bbbGW.deskShareRTMPBroadcastStopped(msg.conferenceName, msg.streamname, msg.vw, msg.vh, msg.timestamp);
} else if (DeskShareGetInfoRequestMessage.GET_DESKTOP_SHARE_GET_INFO_REQUEST.equals(messageName)) {
log.info("^^^^^^^GET_DESKTOP_SHARE_INFO_REQUEST^^^^^^");
DeskShareGetInfoRequestMessage msg = DeskShareGetInfoRequestMessage.fromJson(message);
bbbGW.deskShareGetInfoRequest(msg.meetingId, msg.requesterId, msg.replyTo);
}
}
}
}
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class LockMessageReceiver method handleMessage.
@Override
public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (GetLockSettingsMessage.GET_LOCK_SETTINGS.equals(messageName)) {
GetLockSettingsMessage msg = GetLockSettingsMessage.fromJson(message);
bbbGW.getLockSettings(msg.meetingId, msg.userId);
} else if (LockUserMessage.LOCK_USER.equals(messageName)) {
LockUserMessage msg = LockUserMessage.fromJson(message);
bbbGW.lockUser(msg.meetingId, msg.requesterId, msg.lock, msg.internalUserId);
} else if (SendLockSettingsMessage.SEND_LOCK_SETTINGS.equals(messageName)) {
SendLockSettingsMessage msg = SendLockSettingsMessage.fromJson(message);
bbbGW.sendLockSettings(msg.meetingId, msg.userId, msg.newSettings);
}
}
}
}
}
use of com.google.gson.JsonParser in project bigbluebutton by bigbluebutton.
the class PollingMessageReceiver method handleMessage.
@Override
public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.TO_POLLING_CHANNEL)) {
log.debug("Polling message: " + channel + " " + message);
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (VotePollUserRequestMessage.VOTE_POLL_REQUEST.equals(messageName)) {
VotePollUserRequestMessage msg = VotePollUserRequestMessage.fromJson(message);
bbbGW.votePoll(msg.meetingId, msg.userId, msg.pollId, msg.questionId, msg.answerId);
} else if (StartPollRequestMessage.START_POLL_REQUEST.equals(messageName)) {
log.debug("Received StartPollRequest message");
StartPollRequestMessage msg = StartPollRequestMessage.fromJson(message);
bbbGW.startPoll(msg.meetingId, msg.requesterId, msg.pollId, msg.pollType);
} else if (StopPollRequestMessage.STOP_POLL_REQUEST.equals(messageName)) {
StopPollRequestMessage msg = StopPollRequestMessage.fromJson(message);
bbbGW.stopPoll(msg.meetingId, msg.requesterId, msg.pollId);
} else if (ShowPollResultRequestMessage.SHOW_POLL_RESULT_REQUEST.equals(messageName)) {
ShowPollResultRequestMessage msg = ShowPollResultRequestMessage.fromJson(message);
bbbGW.showPollResult(msg.meetingId, msg.requesterId, msg.pollId, msg.show);
} else if (StartCustomPollRequestMessage.START_CUSTOM_POLL_REQUEST.equals(messageName)) {
Gson gson = new Gson();
StartCustomPollRequestMessage msg = gson.fromJson(message, StartCustomPollRequestMessage.class);
bbbGW.handleBigBlueButtonMessage(msg);
}
}
}
}
}
use of com.google.gson.JsonParser in project Presentation by feelinglucky.
the class PstRequest method getPinsFromResponse.
private int getPinsFromResponse(String response) {
JsonObject jsonObject = (JsonObject) new JsonParser().parse(response);
JsonArray jsonArrayPins = jsonObject.getAsJsonArray("pins");
mAffectedRows = 0;
for (int i = 0; i < jsonArrayPins.size(); i++) {
JsonObject tmp = (JsonObject) jsonArrayPins.get(i);
Pin pin = mGson.fromJson(tmp, Pin.class);
Pin.File file = mGson.fromJson(tmp.getAsJsonObject("file"), Pin.File.class);
pin.setKey(file.key);
pin.setWidth(file.width);
pin.setHeight(file.height);
// ignore gif and some 'bad' images.
if (file.frames == 1 && (file.width / (float) file.height < .38f)) {
try {
Dao.CreateOrUpdateStatus status = mDatabaseHelper.getPinsDAO().createOrUpdate(pin);
mAffectedRows += status.getNumLinesChanged();
} catch (SQLException e) {
Logger.e(e.getMessage());
}
}
}
mListener.onSaved(mAffectedRows);
return mAffectedRows;
}
Aggregations