From 5e173b931bdc12cb9ba444a764a8c1e83ae59c19 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Tue, 11 Jun 2013 20:31:29 +0000 Subject: [PATCH] - fix compile issues --- .../org/bigbluebutton/conference/Meeting.java | 2 - .../presentation/PresentationApplication.java | 1 - .../PresentationMessageListener.java | 61 ++++++++----------- .../core/messages/AbstractMessage.java | 16 ----- .../core/messages/CreateMeeting.java | 8 --- .../bigbluebutton/core/messages/Message.java | 6 -- .../core/BigBlueButtonActor.scala | 6 +- .../org/bigbluebutton/core/Meeting.scala | 4 +- .../core/apps/poll/PollApp.scala | 19 ++++-- .../apps/poll/messages/PollMessages.scala | 8 +-- .../core/messages/Messages.scala | 6 +- 11 files changed, 53 insertions(+), 84 deletions(-) delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/AbstractMessage.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/CreateMeeting.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/Message.java diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/Meeting.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/Meeting.java index 957125f6d5..e08e9fa43f 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/Meeting.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/Meeting.java @@ -26,8 +26,6 @@ import org.bigbluebutton.conference.service.participants.messaging.messages.Assi import org.bigbluebutton.conference.service.participants.messaging.messages.UserJoinedMessage; import org.bigbluebutton.conference.service.participants.messaging.messages.UserLeftMessage; import org.bigbluebutton.conference.service.participants.messaging.messages.UserStatusChangeMessage; -import org.bigbluebutton.conference.service.participants.messaging.redis.UsersMessagePublisher; -import org.bigbluebutton.conference.service.participants.red5.UsersClientMessageSender; import org.red5.logging.Red5LoggerFactory; import java.util.concurrent.ConcurrentHashMap; import java.util.ArrayList; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationApplication.java index 8722179b41..25111ec6b2 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationApplication.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationApplication.java @@ -20,7 +20,6 @@ package org.bigbluebutton.conference.service.presentation; import org.slf4j.Logger; import org.bigbluebutton.conference.meeting.messaging.red5.BroadcastClientMessage; -import org.bigbluebutton.conference.meeting.messaging.red5.ClientMessage; import org.bigbluebutton.conference.meeting.messaging.red5.ConnectionInvokerService; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import java.util.ArrayList; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java index a90f083920..7f72e6b10f 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java @@ -21,12 +21,12 @@ public class PresentationMessageListener implements MessageHandler { public static final String GENERATED_THUMBNAIL_KEY = "GENERATED_THUMBNAIL"; public static final String CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED"; - private ConversionUpdatesMessageListener listener; + private ConversionUpdatesProcessor conversionUpdatesProcessor; - public void setPresentationListener(ConversionUpdatesMessageListener listener) { - this.listener = listener; - } + public void setConversionUpdatesProcessor(ConversionUpdatesProcessor p) { + conversionUpdatesProcessor = p; + } @Override @@ -41,14 +41,13 @@ public class PresentationMessageListener implements MessageHandler { String conference = (String) map.get("conference"); String messageKey = (String) map.get("messageKey"); - Map message = new HashMap(); - message.put("conference", conference); - message.put("room", room); - message.put("code", code); - message.put("presentationName", presentationName); - message.put("messageKey", messageKey); + Map msg = new HashMap(); + msg.put("conference", conference); + msg.put("room", room); + msg.put("code", code); + msg.put("presentationName", presentationName); + msg.put("messageKey", messageKey); - log.debug("Message: " + messageKey + "[ " + presentationName + "]"); if(messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_SUCCESS_KEY)|| messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_FAILED_KEY)|| @@ -58,30 +57,24 @@ public class PresentationMessageListener implements MessageHandler { messageKey.equalsIgnoreCase(GENERATED_THUMBNAIL_KEY)|| messageKey.equalsIgnoreCase(PAGE_COUNT_FAILED_KEY)){ - conversionUpdatesProcessor.process(message); - } - else if(messageKey.equalsIgnoreCase(PAGE_COUNT_EXCEEDED_KEY)){ - Integer numberOfPages = new Integer((String) mapMessage.get("numberOfPages")); - Integer maxNumberPages = new Integer((String) mapMessage.get("maxNumberPages")); - message.put("numberOfPages", numberOfPages); - message.put("maxNumberPages", maxNumberPages); - conversionUpdatesProcessor.process(message); - } - else if(messageKey.equalsIgnoreCase(GENERATED_SLIDE_KEY)){ - Integer numberOfPages = new Integer((String)mapMessage.get("numberOfPages")); - Integer pagesCompleted = new Integer((String)mapMessage.get("pagesCompleted")); - message.put("numberOfPages", numberOfPages); - message.put("pagesCompleted", pagesCompleted); + conversionUpdatesProcessor.process(msg); + } else if(messageKey.equalsIgnoreCase(PAGE_COUNT_EXCEEDED_KEY)){ + Integer numberOfPages = new Integer((String) map.get("numberOfPages")); + Integer maxNumberPages = new Integer((String) map.get("maxNumberPages")); + msg.put("numberOfPages", numberOfPages); + msg.put("maxNumberPages", maxNumberPages); + conversionUpdatesProcessor.process(msg); + } else if(messageKey.equalsIgnoreCase(GENERATED_SLIDE_KEY)){ + Integer numberOfPages = new Integer((String) map.get("numberOfPages")); + Integer pagesCompleted = new Integer((String) map.get("pagesCompleted")); + msg.put("numberOfPages", numberOfPages); + msg.put("pagesCompleted", pagesCompleted); - conversionUpdatesProcessor.process(message); - } - else if(messageKey.equalsIgnoreCase(CONVERSION_COMPLETED_KEY)){ - String slidesInfo = (String) mapMessage.get("slidesInfo"); - message.put("slidesInfo", StringEscapeUtils.unescapeXml(slidesInfo)); - conversionUpdatesProcessor.process(message); - } - else{ - log.error("Cannot handle recieved message."); + conversionUpdatesProcessor.process(msg); + } else if(messageKey.equalsIgnoreCase(CONVERSION_COMPLETED_KEY)){ + String slidesInfo = (String) map.get("slidesInfo"); + msg.put("slidesInfo", StringEscapeUtils.unescapeXml(slidesInfo)); + conversionUpdatesProcessor.process(msg); } } } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/AbstractMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/AbstractMessage.java deleted file mode 100755 index fd25d61292..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/AbstractMessage.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.bigbluebutton.core.messages; - -public class AbstractMessage implements Message { - - private final String messageID; - - public AbstractMessage(String messageID) { - this.messageID = messageID; - } - - @Override - public String getMeetingID() { - return messageID; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/CreateMeeting.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/CreateMeeting.java deleted file mode 100755 index 42270b3278..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/CreateMeeting.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.bigbluebutton.core.messages; - -public class CreateMeeting extends AbstractMessage { - - public CreateMeeting(String meetingID) { - super(meetingID); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/Message.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/Message.java deleted file mode 100755 index c1aad7c994..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/messages/Message.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.bigbluebutton.core.messages; - -public interface Message { - - public String getMeetingID(); -} diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala index d9a1714632..d2827d99f4 100755 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala @@ -19,10 +19,10 @@ class BigBlueButtonActor(outGW: BigBlueButtonOutGateway) extends Actor { } } - private def handleCreateMeeting(message: CreateMeeting):Unit = { - meetings.get(message.id) match { + private def handleCreateMeeting(msg: CreateMeeting):Unit = { + meetings.get(msg.id) match { case None => { - var m = new Meeting() + var m = new Meeting(msg.id, msg.recorded, outGW) } } } diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/Meeting.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/Meeting.scala index f88d75f3b6..1c3c722ab5 100755 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/Meeting.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/Meeting.scala @@ -13,7 +13,7 @@ class Meeting(id: String, recorded: Boolean, outGW: BigBlueButtonOutGateway) ext import org.bigbluebutton.core.apps.poll.messages._ val users = new HashMap[String, User] - val polls = new PollApp() + val polls = new PollApp(outGW) def act() = { loop { @@ -22,7 +22,7 @@ class Meeting(id: String, recorded: Boolean, outGW: BigBlueButtonOutGateway) ext handleUserJoin(userJoin) } case createPoll: CreatePoll => { - polls.createPoll(createPoll) + polls.handleMessage(createPoll) } } } diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala index 6adeea6e55..7513e1d34d 100755 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala @@ -2,15 +2,22 @@ package org.bigbluebutton.core.apps.poll import scala.collection.mutable.HashMap import org.bigbluebutton.core.User +import org.bigbluebutton.core.BigBlueButtonOutGateway -class PollApp { +class PollApp(outGW: BigBlueButtonOutGateway) { import org.bigbluebutton.core.messages._ import org.bigbluebutton.core.apps.poll.messages._ - private val polls = new HashMap[String, Poll]() + private val polls = new HashMap[String, Poll]() - def createPoll(msg: CreatePoll) { - var poll = new Poll(msg.poll.id, msg.poll.title) - polls += poll.id -> poll - } + def handleMessage(msg: InMessage):Unit = { + msg match { + case create: CreatePoll => createPoll(create) + } + } + + private def createPoll(msg: CreatePoll) { + var poll = new Poll(msg.poll.id, msg.poll.title) + polls += poll.id -> poll + } } \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/messages/PollMessages.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/messages/PollMessages.scala index cf9a03c9a9..3bebc95008 100755 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/messages/PollMessages.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/messages/PollMessages.scala @@ -1,12 +1,12 @@ package org.bigbluebutton.core.apps.poll.messages -import org.bigbluebutton.core.messages.Message +import org.bigbluebutton.core.messages.InMessage import org.bigbluebutton.core.apps.poll.QuestionType._ // Poll Messages -case class CreatePoll(poll: PollVO) extends Message -case class StopPoll(id: String) extends Message -case class StartPoll(id: String) extends Message +case class CreatePoll(poll: PollVO) extends InMessage +case class StopPoll(id: String) extends InMessage +case class StartPoll(id: String) extends InMessage case class AddQuestion(pollID: String, question: QuestionVO) case class DeleteQuestion(pollID: String, questionID: Int) case class AddResponse(pollID: String, questionID: Int, responseVO: ResponseVO) diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/messages/Messages.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/messages/Messages.scala index 67936a1d4f..40533972c6 100755 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/messages/Messages.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/messages/Messages.scala @@ -2,14 +2,16 @@ package org.bigbluebutton.core.messages abstract class InMessage -case class CreateMeeting(id: String) extends InMessage +case class CreateMeeting(id: String, recorded: Boolean) extends InMessage case class DestroyMeeting(id: String) extends InMessage case class StartMeeting(id: String) extends InMessage case class EndMeeting(id: String) extends InMessage case class UserJoin(id: String, name: String) extends InMessage case class UserLeft(id: String) extends InMessage - +abstract class OutMessage +case class MeetingStarted() extends OutMessage +case class MeetingEnded() extends OutMessage // Value Objects case class MeetingVO(id: String, recorded: Boolean)