From 8199113dfdb8c4542c11318c7d43464ed7b6b270 Mon Sep 17 00:00:00 2001 From: Markos Calderon Date: Tue, 2 Jul 2013 18:50:57 -0500 Subject: [PATCH] store poll created --- .../polling/AbstractPollRecordEvent.java | 29 ++++++++++ .../polling/PollCreatedRecordEvent.java | 53 +++++++++++++++++++ .../recorder/polling/PollEventRecorder.java | 47 ++++++++++++++++ .../poll/redis/PollEventRedisRecorder.scala | 40 ++++++++++++++ 4 files changed, 169 insertions(+) create mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java create mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java create mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollEventRecorder.java create mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java new file mode 100755 index 000000000000..b95e18e37a6a --- /dev/null +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java @@ -0,0 +1,29 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.polling; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractPollRecordEvent extends RecordEvent { + + public AbstractPollRecordEvent() { + setModule("POLL"); + } +} + diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java new file mode 100755 index 000000000000..5200b8dde8c5 --- /dev/null +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java @@ -0,0 +1,53 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.polling; + + +public class PollCreatedRecordEvent extends AbstractPollRecordEvent { + private static final String POLL_ID = "pollID"; + private static final String TITLE = "title"; + private static final String QUESTION = "question"; + private static final String DATETIME = "datetime"; + private static final String ANSWERS = "answers"; + + public PollCreatedRecordEvent() { + super(); + setEvent("PollCreatedEvent"); + } + + public void setPollID(String pollID) { + eventMap.put(POLL_ID, pollID); + } + + public void setTitle(String title) { + eventMap.put(TITLE, title); + } + + public void setQuestion(String question) { + eventMap.put(QUESTION, question); + } + + public void setDatetime(String datetime) { + eventMap.put(DATETIME, datetime); + } + + public void setAnswers(String answers) { + eventMap.put(ANSWERS, answers); + } +} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollEventRecorder.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollEventRecorder.java new file mode 100755 index 000000000000..e135fa933c0f --- /dev/null +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollEventRecorder.java @@ -0,0 +1,47 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ + +package org.bigbluebutton.conference.service.recorder.polling; + +import org.bigbluebutton.conference.service.poll.Poll; +import org.bigbluebutton.conference.service.poll.IPollRoomListener; +import org.bigbluebutton.conference.service.recorder.RecorderApplication; + +public class PollEventRecorder implements IPollRoomListener{ + + private final RecorderApplication recorder; + private final String session; + + String name = "RECORDER:POLL"; + + public PollEventRecorder(String session, RecorderApplication recorder){ + this.recorder = recorder; + this.session = session; + } + + @Override + public String getName(){ + return name; + } + + @Override + public void savePoll(Poll poll ){ + + } +} diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala new file mode 100755 index 000000000000..9f36208d396e --- /dev/null +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala @@ -0,0 +1,40 @@ +package org.bigbluebutton.core.apps.poll.redis + +import org.bigbluebutton.conference.service.recorder.RecorderApplication +import org.bigbluebutton.core.api.OutMessageListener2 +import org.bigbluebutton.core.api.IOutMessage +import org.bigbluebutton.core.apps.poll.messages._ +import org.bigbluebutton.conference.service.recorder.polling.PollCreatedRecordEvent + +class PollEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + /*case getPollsReplyOutMsg: GetPollsReplyOutMsg => handleGetPollsReplyOutMsg(getPollsReplyOutMsg) + case pollClearedOutMsg : PollClearedOutMsg => handlePollClearedOutMsg(pollClearedOutMsg) + case pollStartedOutMsg: PollStartedOutMsg => handlePollStartedOutMsg(pollStartedOutMsg) + case pollStoppedOutMsg: PollStoppedOutMsg => handlePollStoppedOutMsg(pollStoppedOutMsg) + case pollRemovedOutMsg: PollRemovedOutMsg => handlePollRemovedOutMsg(pollRemovedOutMsg) + case pollUpdatedOutMsg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(pollUpdatedOutMsg)*/ + case pollCreatedOutMsg: PollCreatedOutMsg => handlePollCreatedOutMsg(pollCreatedOutMsg) + case _ => // do nothing + } + } + + def handlePollCreatedOutMsg(msg: PollCreatedOutMsg):Unit = { + if (msg.recorded) { + val ev = new PollCreatedRecordEvent(); + ev.setPollID(msg.pollVO.id) + ev.setTitle(msg.pollVO.title) + ev.setQuestion(msg.pollVO.questions(0).question) + //ev.setDatetime(map.datetime) + // probably the answer will be stored as json + //ev.setAnswers("") + ev.setTimestamp(System.currentTimeMillis()) + ev.setMeetingId(msg.meetingID) + recorder.record(msg.meetingID, ev) + } + + } + +} \ No newline at end of file