Merge pull request #4845 from capilkey/fix-presentationpod-reconnect

Change presentation pod reconnect to get all pods
This commit is contained in:
Chad Pilkey 2017-12-18 20:30:54 -05:00 committed by GitHub
commit 911c2b84fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 25 additions and 197 deletions

View File

@ -1,54 +0,0 @@
package org.bigbluebutton.core.apps.presentationpod
import org.bigbluebutton.common2.domain.PresentationVO
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.apps.{ PermissionCheck, RightsManagementTrait }
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.running.LiveMeeting
trait GetPresentationInfoReqMsgHdlr extends RightsManagementTrait {
this: PresentationPodHdlrs =>
def handle(msg: GetPresentationInfoReqMsg, state: MeetingState2x,
liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
if (permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
val meetingId = liveMeeting.props.meetingProp.intId
val reason = "No permission get presentation info from meeting."
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
state
} else {
def buildGetPresentationInfoRespMsg(presentations: Vector[PresentationVO], podId: String,
requesterId: String): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, requesterId)
val envelope = BbbCoreEnvelope(GetPresentationInfoRespMsg.NAME, routing)
val header = BbbClientMsgHeader(GetPresentationInfoRespMsg.NAME, liveMeeting.props.meetingProp.intId, requesterId)
val body = GetPresentationInfoRespMsgBody(podId, presentations)
val event = GetPresentationInfoRespMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val requesterId = msg.header.userId
val podId = msg.body.podId
for {
pod <- PresentationPodsApp.getPresentationPod(state, podId)
} yield {
val presInPod = pod.presentations
val presVOs = presInPod.values.map { p =>
PresentationVO(p.id, p.name, p.current, p.pages.values.toVector, p.downloadable)
}.toVector
val event = buildGetPresentationInfoRespMsg(presVOs, podId, requesterId)
bus.outGW.send(event)
}
state
}
}
}

View File

@ -5,7 +5,6 @@ import akka.event.Logging
class PresentationPodHdlrs(implicit val context: ActorContext)
extends CreateNewPresentationPodPubMsgHdlr
with GetPresentationInfoReqMsgHdlr
with GetAllPresentationPodsReqMsgHdlr
with SetCurrentPresentationPubMsgHdlr
with PresentationConversionCompletedSysPubMsgHdlr

View File

@ -186,8 +186,6 @@ class ReceivedJsonMsgHandlerActor(
// Presentation
case SetCurrentPresentationPubMsg.NAME =>
routeGenericMsg[SetCurrentPresentationPubMsg](envelope, jsonNode)
case GetPresentationInfoReqMsg.NAME =>
routeGenericMsg[GetPresentationInfoReqMsg](envelope, jsonNode)
case SetCurrentPagePubMsg.NAME =>
routeGenericMsg[SetCurrentPagePubMsg](envelope, jsonNode)
case ResizeAndMovePagePubMsg.NAME =>

View File

@ -279,7 +279,6 @@ class MeetingActor(
// Presentation Pods
case m: CreateNewPresentationPodPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
case m: RemovePresentationPodPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
case m: GetPresentationInfoReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
case m: GetAllPresentationPodsReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
case m: SetCurrentPresentationPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
case m: PresentationConversionCompletedSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)

View File

@ -12,10 +12,6 @@ object RemovePresentationPodPubMsg { val NAME = "RemovePresentationPodPubMsg"}
case class RemovePresentationPodPubMsg(header: BbbClientMsgHeader, body: RemovePresentationPodPubMsgBody) extends StandardMsg
case class RemovePresentationPodPubMsgBody(podId: String)
object GetPresentationInfoReqMsg { val NAME = "GetPresentationInfoReqMsg"}
case class GetPresentationInfoReqMsg(header: BbbClientMsgHeader, body: GetPresentationInfoReqMsgBody) extends StandardMsg
case class GetPresentationInfoReqMsgBody(podId: String)
object PresentationUploadTokenReqMsg { val NAME = "PresentationUploadTokenReqMsg"}
case class PresentationUploadTokenReqMsg(header: BbbClientMsgHeader, body: PresentationUploadTokenReqMsgBody) extends StandardMsg
case class PresentationUploadTokenReqMsgBody(podId: String, filename: String)
@ -91,10 +87,6 @@ object RemovePresentationPodEvtMsg { val NAME = "RemovePresentationPodEvtMsg"}
case class RemovePresentationPodEvtMsg(header: BbbClientMsgHeader, body: RemovePresentationPodEvtMsgBody) extends StandardMsg
case class RemovePresentationPodEvtMsgBody(podId: String)
object GetPresentationInfoRespMsg { val NAME = "GetPresentationInfoRespMsg"}
case class GetPresentationInfoRespMsg(header: BbbClientMsgHeader, body: GetPresentationInfoRespMsgBody) extends BbbCoreMsg
case class GetPresentationInfoRespMsgBody(podId: String, presentations: Vector[PresentationVO])
object PresentationUploadTokenPassRespMsg { val NAME = "PresentationUploadTokenPassRespMsg"}
case class PresentationUploadTokenPassRespMsg(header: BbbClientMsgHeader, body: PresentationUploadTokenPassRespMsgBody) extends StandardMsg
case class PresentationUploadTokenPassRespMsgBody(podId: String, authzToken: String, filename: String)

View File

@ -25,8 +25,8 @@ package org.bigbluebutton.main.model.users.events
public class RequestPresenterGroupEvent extends Event {
public static const REQUEST_PRESENTER_GROUP:String = "REQUEST_PRESENTER_GROUP";
public function RequestPresenterGroupEvent(type:String) {
super(type, true, false);
public function RequestPresenterGroupEvent(type:String, bubbles:Boolean, cancelable:Boolean) {
super(type, bubbles, cancelable);
}
}
}

View File

@ -40,10 +40,8 @@ package org.bigbluebutton.modules.present.business
import org.bigbluebutton.modules.present.events.PresentationUploadTokenPass;
import org.bigbluebutton.modules.present.events.PresenterCommands;
import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
import org.bigbluebutton.modules.present.events.RequestAllPodsEvent;
import org.bigbluebutton.modules.present.events.RequestClosePresentationPodEvent;
import org.bigbluebutton.modules.present.events.RequestNewPresentationPodEvent;
import org.bigbluebutton.modules.present.events.RequestPresentationInfoPodEvent;
import org.bigbluebutton.modules.present.events.SetPresentationDownloadableEvent;
import org.bigbluebutton.modules.present.events.SetPresenterInPodReqEvent;
import org.bigbluebutton.modules.present.events.UploadEvent;
@ -61,7 +59,6 @@ package org.bigbluebutton.modules.present.business
private var host:String;
private var conference:String;
private var room:String;
private var userid:Number;
private var uploadService:FileUploadService;
private var sender:MessageSender;
@ -77,25 +74,18 @@ package org.bigbluebutton.modules.present.business
service = new PresentationService();
}
public function getCurrentPresentationInfo():void {
podManager.requestAllPodsPresentationInfo();
}
public function handleRequestAllPodsEvent(e: RequestAllPodsEvent):void {
public function getPresentationPodsInfo():void {
sender.requestAllPodsEvent();
}
public function connect(e:PresentModuleEvent):void {
extractAttributes(e.data);
podManager.requestAllPodsPresentationInfo();
}
private function extractAttributes(a:Object):void{
host = a.host as String;
conference = a.conference as String;
room = a.room as String;
userid = a.userid as Number;
}
public function handleGetListOfPresentationsRequest(event: GetListOfPresentationsRequest):void {
@ -114,10 +104,6 @@ package org.bigbluebutton.modules.present.business
dispatcher.dispatchEvent(new GetListOfPresentationsReply(idAndName));
}
public function handleRequestPresentationInfoPodEvent(e: RequestPresentationInfoPodEvent): void {
sender.getPresentationInfo(e.podId);
}
public function handleChangePresentationCommand(cmd:ChangePresentationCommand):void {
var presModel: PresentationModel = podManager.getPod(cmd.podId);
var pres:Presentation = presModel.getPresentation(cmd.presId);

View File

@ -1,34 +0,0 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2017 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 <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.modules.present.events
{
import flash.events.Event;
import flash.net.FileReference;
public class RequestAllPodsEvent extends Event {
public static const REQUEST_ALL_PODS:String = "REQUEST_ALL_PODS";
public function RequestAllPodsEvent(type:String) {
super(type, true, false);
}
}
}

View File

@ -1,36 +0,0 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2017 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 <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.modules.present.events
{
import flash.events.Event;
import flash.net.FileReference;
public class RequestPresentationInfoPodEvent extends Event {
public static const REQUEST_PRES_INFO:String = "REQUEST_PRES_INFO";
public var podId: String;
public function RequestPresentationInfoPodEvent(type:String) {
super(type, true, false);
}
}
}

View File

@ -37,7 +37,6 @@ package org.bigbluebutton.modules.present.managers
import org.bigbluebutton.modules.present.events.NewPresentationPodCreated;
import org.bigbluebutton.modules.present.events.PresentModuleEvent;
import org.bigbluebutton.modules.present.events.PresentationPodRemoved;
import org.bigbluebutton.modules.present.events.RequestAllPodsEvent;
import org.bigbluebutton.modules.present.events.UploadEvent;
import org.bigbluebutton.modules.present.model.PresentOptions;
import org.bigbluebutton.modules.present.model.PresentationPodManager;
@ -68,12 +67,6 @@ package org.bigbluebutton.modules.present.managers
presentOptions = Options.getOptions(PresentOptions) as PresentOptions;
winManager.initCollection(presentOptions.maxNumWindows);
var requestAllPodsEvent:RequestAllPodsEvent = new RequestAllPodsEvent(RequestAllPodsEvent.REQUEST_ALL_PODS);
globalDispatcher.dispatchEvent(requestAllPodsEvent);
var requestPresenterGroupEvent:RequestPresenterGroupEvent = new RequestPresenterGroupEvent(RequestPresenterGroupEvent.REQUEST_PRESENTER_GROUP);
globalDispatcher.dispatchEvent(requestPresenterGroupEvent);
}
public function handleAddPresentationPod(e: NewPresentationPodCreated): void {
@ -122,6 +115,15 @@ package org.bigbluebutton.modules.present.managers
public function handleGetAllPodsRespEvent(e: GetAllPodsRespEvent): void {
var podsAC:ArrayCollection = e.pods as ArrayCollection;
// For now the best option for cleaning up old pods is to just delete everything we
// know about. In the future we'll want to update existing pods to a new state
// rather than recreating.
var activePodIds:Array = podsManager.getAllPodIds();
for (var i:int=0; i<activePodIds.length; i++) {
handlePresentationPodRemovedHelper(activePodIds[i]);
}
podsManager.handleGetAllPodsResp(podsAC);
}

View File

@ -25,6 +25,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import mx.events.FlexEvent;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.model.users.events.RequestPresenterGroupEvent;
import org.bigbluebutton.modules.present.business.PresentProxy;
import org.bigbluebutton.modules.present.commands.ChangePageCommand;
import org.bigbluebutton.modules.present.commands.ChangePresentationCommand;
@ -43,10 +44,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.present.events.PresentationUploadTokenPass;
import org.bigbluebutton.modules.present.events.PresenterCommands;
import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
import org.bigbluebutton.modules.present.events.RequestAllPodsEvent;
import org.bigbluebutton.modules.present.events.RequestClosePresentationPodEvent;
import org.bigbluebutton.modules.present.events.RequestNewPresentationPodEvent;
import org.bigbluebutton.modules.present.events.RequestPresentationInfoPodEvent;
import org.bigbluebutton.modules.present.events.SetPresentationDownloadableEvent;
import org.bigbluebutton.modules.present.events.SetPresenterInPodReqEvent;
import org.bigbluebutton.modules.present.events.UploadEvent;
@ -63,7 +62,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<EventHandlers type="{PresentModuleEvent.START_MODULE}" >
<MethodInvoker generator="{PresentManager}" method="handleStartModuleEvent" arguments="{event}"/>
<MethodInvoker generator="{PresentProxy}" method="getCurrentPresentationInfo" />
<MethodInvoker generator="{PresentProxy}" method="getPresentationPodsInfo" />
<EventAnnouncer generator="{RequestPresenterGroupEvent}" type="{RequestPresenterGroupEvent.REQUEST_PRESENTER_GROUP}" />
<MethodInvoker generator="{PresentProxy}" method="connect" arguments="{event}" />
</EventHandlers>
@ -84,7 +84,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</EventHandlers>
<EventHandlers type="{BBBEvent.RECONNECT_BIGBLUEBUTTON_SUCCEEDED_EVENT}" >
<MethodInvoker generator="{PresentProxy}" method="getCurrentPresentationInfo" />
<MethodInvoker generator="{PresentProxy}" method="getPresentationPodsInfo" />
</EventHandlers>
<EventHandlers type="{UploadEvent.OPEN_UPLOAD_WINDOW}" >
@ -180,14 +180,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<MethodInvoker generator="{PresentManager}" method="handlePresentationPodRemoved" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{RequestPresentationInfoPodEvent.REQUEST_PRES_INFO}" >
<MethodInvoker generator="{PresentProxy}" method="handleRequestPresentationInfoPodEvent" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{RequestAllPodsEvent.REQUEST_ALL_PODS}" >
<MethodInvoker generator="{PresentProxy}" method="handleRequestAllPodsEvent" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{GetAllPodsRespEvent.GET_ALL_PODS_RESP}" >
<MethodInvoker generator="{PresentManager}" method="handleGetAllPodsRespEvent" arguments="{event}" />
</EventHandlers>

View File

@ -9,7 +9,6 @@ package org.bigbluebutton.modules.present.model {
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.core.EventConstants;
import org.bigbluebutton.modules.present.events.NewPresentationPodCreated;
import org.bigbluebutton.modules.present.events.RequestPresentationInfoPodEvent;
import org.bigbluebutton.modules.present.services.PresentationService;
import org.bigbluebutton.modules.present.services.messages.PresentationPodVO;
@ -82,6 +81,15 @@ package org.bigbluebutton.modules.present.model {
return pod;
}
public function getAllPodIds():Array {
var podIds:Array = [];
for (var i:int = 0; i < _presentationPods.length; i++) {
var pod: PresentationModel = _presentationPods.getItemAt(i) as PresentationModel;
podIds.push(pod.getPodId())
}
return podIds;
}
public function handleAddPresentationPod(podId: String): void {
for (var i:int = 0; i < _presentationPods.length; i++) {
var pod: PresentationModel = _presentationPods.getItemAt(i) as PresentationModel;
@ -107,16 +115,6 @@ package org.bigbluebutton.modules.present.model {
}
}
public function requestAllPodsPresentationInfo(): void {
for (var i:int = 0; i < _presentationPods.length; i++) {
var pod: PresentationModel = _presentationPods.getItemAt(i) as PresentationModel;
var event:RequestPresentationInfoPodEvent = new RequestPresentationInfoPodEvent(RequestPresentationInfoPodEvent.REQUEST_PRES_INFO);
event.podId = pod.getPodId();
globalDispatcher.dispatchEvent(event);
}
}
public function handleGetAllPodsResp(podsAC: ArrayCollection): void {
for (var j:int = 0; j < podsAC.length; j++) {
var podVO: PresentationPodVO = podsAC.getItemAt(j) as PresentationPodVO;

View File

@ -74,20 +74,6 @@ package org.bigbluebutton.modules.present.services.messaging
);
}
public function getPresentationInfo(podId: String):void {
var message:Object = {
header: {name: "GetPresentationInfoReqMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()},
body: {podId: podId}
};
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage2x(
function(result:String):void { },
function(status:String):void { LOGGER.error(status); },
JSON.stringify(message)
);
}
public function requestAllPodsEvent():void {
var message:Object = {
header: {name: "GetAllPresentationPodsReqMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()},