- wire up new message path

This commit is contained in:
Richard Alam 2017-07-03 07:44:13 -07:00
parent 2e0f6d8610
commit 8ca0d6c9fe
41 changed files with 2232 additions and 1980 deletions

View File

@ -9,12 +9,25 @@ import org.bigbluebutton.common2.domain.DefaultProps
body: CreateMeetingReqMsgBody) extends BbbCoreMsg
case class CreateMeetingReqMsgBody(props: DefaultProps)
object DestroyMeetingSysCmdMsg { val NAME = "DestroyMeetingSysCmdMsg" }
case class DestroyMeetingSysCmdMsg(header: BbbCoreBaseHeader,
body: DestroyMeetingSysCmdMsgBody) extends BbbCoreMsg
case class DestroyMeetingSysCmdMsgBody(meetingId: String)
object EndMeetingSysCmdMsg { val NAME = "DestroyMeetingReqMsg" }
case class EndMeetingSysCmdMsg(header: BbbCoreBaseHeader,
body: EndMeetingSysCmdMsgBody) extends BbbCoreMsg
case class EndMeetingSysCmdMsgBody(meetingId: String)
object GetAllMeetingsReqMsg { val NAME = "GetAllMeetingsReqMsg" }
case class GetAllMeetingsReqMsg(header: BbbCoreBaseHeader,
body: GetAllMeetingsReqMsgBody) extends BbbCoreMsg
case class GetAllMeetingsReqMsgBody(requesterId: String)
object PubSubPingSysReqMsg { val NAME = "PubSubPingSysReqMsg" }
case class PubSubPingSysReqMsg(header: BbbCoreBaseHeader,
body: PubSubPingSysReqMsgBody) extends BbbCoreMsg
case class PubSubPingSysReqMsgBody(system: String, timestamp: Long)
/** Response Messages **/
object MeetingCreatedEvtMsg { val NAME = "MeetingCreatedEvtMsg"}
@ -22,12 +35,27 @@ import org.bigbluebutton.common2.domain.DefaultProps
body: MeetingCreatedEvtBody) extends BbbCoreMsg
case class MeetingCreatedEvtBody(props: DefaultProps)
object MeetingEndedEvtMsg { val NAME = "MeetingEndedEvtMsg"}
case class MeetingEndedEvtMsg(header: BbbCoreBaseHeader,
body: MeetingEndedEvtMsgBody) extends BbbCoreMsg
case class MeetingEndedEvtMsgBody(meetingId: String)
object SyncGetMeetingInfoRespMsg { val NAME = "SyncGetMeetingInfoRespMsg"}
object MeetingDestroyedEvtMsg { val NAME = "MeetingDestroyedEvtMsg"}
case class MeetingDestroyedEvtMsg(header: BbbCoreBaseHeader,
body: MeetingDestroyedEvtMsgBody) extends BbbCoreMsg
case class MeetingDestroyedEvtMsgBody(meetingId: String)
object SyncGetMeetingInfoRespMsg { val NAME = "SyncGetMeetingInfoRespMsg"}
case class SyncGetMeetingInfoRespMsg(header: BbbCoreBaseHeader,
body: SyncGetMeetingInfoRespMsgBody) extends BbbCoreMsg
case class SyncGetMeetingInfoRespMsgBody(props: DefaultProps)
object PubSubPongSysRespMsg { val NAME = "PubSubPongSysRespMsg" }
case class PubSubPongSysRespMsg(header: BbbCoreBaseHeader,
body: PubSubPongSysRespMsgBody) extends BbbCoreMsg
case class PubSubPongSysRespMsgBody(system: String, timestamp: Long)
/** System Messages **/
case class AkkaAppsCheckAliveReqBody(timestamp: Long)

View File

@ -1,5 +1,7 @@
package org.bigbluebutton.api;
import org.bigbluebutton.api.messaging.messages.IMessage;
public interface IReceivedOldMessageHandler {
void handleMessage(String pattern, String channel, String message);
void handleMessage(IMessage msg);
}

View File

@ -42,167 +42,80 @@ public class MeetingMessageHandler implements MessageHandler {
this.listeners = listeners;
}
public void handleMessage(String pattern, String channel, String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
public void handleMessage(IMessage message) {
/*
for (MessageListener listener : listeners) {
listener.handle(new MeetingStarted(meetingId));
}
for (MessageListener listener : listeners) {
listener.handle(new MeetingEnded(meetingId));
}
for (MessageListener listener : listeners) {
listener.handle(new MeetingDestroyed(meetingId));
}
for (MessageListener listener : listeners) {
listener.handle(new CreateBreakoutRoom(
msg.payload.breakoutMeetingId,
msg.payload.parentMeetingId,
msg.payload.name,
msg.payload.sequence,
msg.payload.voiceConfId,
msg.payload.viewerPassword,
msg.payload.moderatorPassword,
msg.payload.durationInMinutes,
msg.payload.sourcePresentationId,
msg.payload.sourcePresentationSlide,
msg.payload.record
)
);
}
for (MessageListener listener : listeners) {
listener.handle(new EndBreakoutRoom(msg.payload.meetingId));
}
IMessage rxMsg = null;
if (PubSubPongMessage.PUBSUB_PONG.equals(messageName)) {
IBigBlueButtonMessage msg = decoder.decodeMessage(message);
if (msg != null) {
PubSubPongMessage m = (PubSubPongMessage) msg;
rxMsg = new KeepAliveReply(m.payload.system, m.payload.timestamp);
}
}
if (rxMsg != null) {
for (MessageListener listener : listeners) {
listener.handle(rxMsg);
}
}
for (MessageListener listener : listeners) {
listener.handle(new UserJoined(meetingId, userid, externuserid, username, role, avatarURL, guest, waitingForAcceptance));
}
for (MessageListener listener : listeners) {
listener.handle(new UserStatusChanged(meetingId, userid, status, value));
}
for (MessageListener listener : listeners) {
listener.handle(new UserLeft(meetingId, userid));
}
for (MessageListener listener : listeners) {
listener.handle(new UserJoinedVoice(meetingId, userid));
}
for (MessageListener listener : listeners) {
listener.handle(new UserLeftVoice(meetingId, userid));
}
for (MessageListener listener : listeners) {
listener.handle(new UserListeningOnly(meetingId, userid, listenOnly));
}
for (MessageListener listener : listeners) {
listener.handle(new UserSharedWebcam(meetingId, userid, stream));
}
for (MessageListener listener : listeners) {
listener.handle(new UserUnsharedWebcam(meetingId, userid, stream));
}
for (MessageListener listener : listeners) {
listener.handle(new UserRoleChanged(meetingId, userid, role));
}
for (MessageListener listener : listeners) {
listener.handle(new StunTurnInfoRequested(meetingId, requesterId));
}
*/
if (channel.equalsIgnoreCase(MessagingConstants.FROM_MEETING_CHANNEL)) {
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if(MessagingConstants.MEETING_STARTED_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new MeetingStarted(meetingId));
}
} else if(MessagingConstants.MEETING_ENDED_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new MeetingEnded(meetingId));
}
} else if (MessagingConstants.MEETING_DESTROYED_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
log.info("Received a meeting destroyed message for meeting id=[{}]", meetingId);
for (MessageListener listener : listeners) {
listener.handle(new MeetingDestroyed(meetingId));
}
} else if (CreateBreakoutRoomRequest.NAME.equals(messageName)) {
CreateBreakoutRoomRequest msg = new Gson().fromJson(message, CreateBreakoutRoomRequest.class);
for (MessageListener listener : listeners) {
listener.handle(new CreateBreakoutRoom(
msg.payload.breakoutMeetingId,
msg.payload.parentMeetingId,
msg.payload.name,
msg.payload.sequence,
msg.payload.voiceConfId,
msg.payload.viewerPassword,
msg.payload.moderatorPassword,
msg.payload.durationInMinutes,
msg.payload.sourcePresentationId,
msg.payload.sourcePresentationSlide,
msg.payload.record
)
);
}
}
else if (EndBreakoutRoomRequest.NAME.equals(messageName)) {
EndBreakoutRoomRequest msg = new Gson().fromJson(message, EndBreakoutRoomRequest.class);
log.info("Received end breakout room request message for breakout meeting id=[{}]", msg.payload.meetingId);
for (MessageListener listener : listeners) {
listener.handle(new EndBreakoutRoom(msg.payload.meetingId));
}
}
}
}
} else if (channel.equalsIgnoreCase(MessagingConstants.FROM_SYSTEM_CHANNEL)) {
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
IMessage rxMsg = null;
if (PubSubPongMessage.PUBSUB_PONG.equals(messageName)) {
IBigBlueButtonMessage msg = decoder.decodeMessage(message);
if (msg != null) {
PubSubPongMessage m = (PubSubPongMessage) msg;
rxMsg = new KeepAliveReply(m.payload.system, m.payload.timestamp);
}
}
if (rxMsg != null) {
for (MessageListener listener : listeners) {
listener.handle(rxMsg);
}
}
}
}
} else if (channel.equalsIgnoreCase(MessagingConstants.FROM_USERS_CHANNEL)) {
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (MessagingConstants.USER_JOINED_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
JsonObject user = (JsonObject) payload.get("user");
String userid = user.get("userid").getAsString();
String externuserid = user.get("extern_userid").getAsString();
String username = user.get("name").getAsString();
String role = user.get("role").getAsString();
String avatarURL = user.get("avatarURL").getAsString();
Boolean guest = user.get("guest").getAsBoolean();
Boolean waitingForAcceptance = user.get("waiting_for_acceptance").getAsBoolean();
for (MessageListener listener : listeners) {
listener.handle(new UserJoined(meetingId, userid, externuserid, username, role, avatarURL, guest, waitingForAcceptance));
}
} else if(MessagingConstants.USER_STATUS_CHANGE_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
String userid = payload.get("userid").getAsString();
String status = payload.get("status").getAsString();
String value = payload.get("value").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserStatusChanged(meetingId, userid, status, value));
}
} else if (MessagingConstants.USER_LEFT_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
JsonObject user = (JsonObject) payload.get("user");
String userid = user.get("userid").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserLeft(meetingId, userid));
}
} else if (MessagingConstants.USER_JOINED_VOICE_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
JsonObject user = (JsonObject) payload.get("user");
String userid = user.get("userid").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserJoinedVoice(meetingId, userid));
}
} else if (MessagingConstants.USER_LEFT_VOICE_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
JsonObject user = (JsonObject) payload.get("user");
String userid = user.get("userid").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserLeftVoice(meetingId, userid));
}
} else if (MessagingConstants.USER_LISTEN_ONLY_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
String userid = payload.get("userid").getAsString();
Boolean listenOnly = payload.get("listen_only").getAsBoolean();
for (MessageListener listener : listeners) {
listener.handle(new UserListeningOnly(meetingId, userid, listenOnly));
}
} else if (MessagingConstants.USER_SHARE_WEBCAM_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
String userid = payload.get("userid").getAsString();
String stream = payload.get("stream").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserSharedWebcam(meetingId, userid, stream));
}
} else if (MessagingConstants.USER_UNSHARE_WEBCAM_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
String userid = payload.get("userid").getAsString();
String stream = payload.get("stream").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserUnsharedWebcam(meetingId, userid, stream));
}
} else if (MessagingConstants.USER_ROLE_CHANGE_EVENT.equalsIgnoreCase(messageName)) {
String meetingId = payload.get("meeting_id").getAsString();
String userid = payload.get("userid").getAsString();
String role = payload.get("role").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserRoleChanged(meetingId, userid, role));
}
} else if (SendStunTurnInfoRequestMessage.SEND_STUN_TURN_INFO_REQUEST_MESSAGE.equalsIgnoreCase(messageName)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
for (MessageListener listener : listeners) {
listener.handle(new StunTurnInfoRequested(meetingId, requesterId));
}
}
}
}
}
}
}

View File

@ -1,25 +1,27 @@
package org.bigbluebutton.api.messaging;
import org.bigbluebutton.api.messaging.messages.IMessage;
import java.util.Set;
public class MessageDistributor {
private ReceivedMessageHandler handler;
private Set<MessageHandler> listeners;
public void setMessageListeners(Set<MessageHandler> listeners) {
this.listeners = listeners;
}
public void setMessageHandler(ReceivedMessageHandler handler) {
this.handler = handler;
if (handler != null) {
handler.setMessageDistributor(this);
}
}
public void notifyListeners(String pattern, String channel, String message) {
for (MessageHandler listener : listeners) {
listener.handleMessage(pattern, channel, message);
}
}
private ReceivedMessageHandler handler;
private Set<MessageListener> listeners;
public void setMessageListeners(Set<MessageListener> listeners) {
this.listeners = listeners;
}
public void setMessageHandler(ReceivedMessageHandler handler) {
this.handler = handler;
if (handler != null) {
handler.setMessageDistributor(this);
}
}
public void notifyListeners(IMessage message) {
for (MessageListener listener : listeners) {
listener.handle(message);
}
}
}

View File

@ -1,23 +1,24 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*
*/
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
* <p>
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.api.messaging;
import org.bigbluebutton.api.messaging.messages.IMessage;
public interface MessageHandler {
void handleMessage(String pattern, String channel, String message);
void handleMessage(IMessage message);
}

View File

@ -1,26 +1,25 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*
*/
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
* <p>
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.api.messaging;
import org.bigbluebutton.api.messaging.messages.IMessage;
public interface MessageListener {
void handle(IMessage message);
void handle(IMessage message);
}

View File

@ -1,115 +0,0 @@
package org.bigbluebutton.api.messaging;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;
import redis.clients.jedis.exceptions.JedisConnectionException;
public class MessageReceiver {
private static Logger log = LoggerFactory.getLogger(MessageReceiver.class);
private ReceivedMessageHandler handler;
private Jedis jedis;
private volatile boolean receiveMessage = false;
private final Executor msgReceiverExec = Executors.newSingleThreadExecutor();
private final Executor runExec = Executors.newSingleThreadExecutor();
private String host;
private int port;
public void stop() {
receiveMessage = false;
}
public void start() {
log.info("Ready to receive messages from Redis pubsub.");
try {
receiveMessage = true;
jedis = new Jedis(host, port);
// Set the name of this client to be able to distinguish when doing
// CLIENT LIST on redis-cli
jedis.clientSetname("BbbWebSub");
Runnable messageReceiver = new Runnable() {
public void run() {
if (receiveMessage) {
try {
jedis.psubscribe(new PubSubListener(), MessagingConstants.FROM_BBB_APPS_PATTERN);
} catch(JedisConnectionException ex) {
log.warn("Exception on Jedis connection. Resubscribing to pubsub.");
start();
} catch (Exception e) {
log.error("Error resubscribing to channels: " + e.getMessage());
}
}
}
};
msgReceiverExec.execute(messageReceiver);
} catch (Exception e) {
log.error("Error subscribing to channels: " + e.getMessage());
}
}
public void setHost(String host){
this.host = host;
}
public void setPort(int port) {
this.port = port;
}
public void setMessageHandler(ReceivedMessageHandler handler) {
this.handler = handler;
}
private class PubSubListener extends JedisPubSub {
public PubSubListener() {
super();
}
@Override
public void onMessage(String channel, String message) {
// Not used.
}
@Override
public void onPMessage(final String pattern, final String channel, final String message) {
Runnable task = new Runnable() {
public void run() {
handler.handleMessage(pattern, channel, message);
}
};
runExec.execute(task);
}
@Override
public void onPSubscribe(String pattern, int subscribedChannels) {
log.debug("Subscribed to the pattern: " + pattern);
}
@Override
public void onPUnsubscribe(String pattern, int subscribedChannels) {
// Not used.
}
@Override
public void onSubscribe(String channel, int subscribedChannels) {
// Not used.
}
@Override
public void onUnsubscribe(String channel, int subscribedChannels) {
// Not used.
}
}
}

View File

@ -1,49 +1,63 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*
*/
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
* <p>
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.api.messaging;
import org.bigbluebutton.presentation.messages.IDocConversionMsg;
import org.bigbluebutton.web.services.turn.StunServer;
import org.bigbluebutton.web.services.turn.TurnEntry;
import java.util.Map;
import java.util.Set;
public interface MessagingService {
void recordMeetingInfo(String meetingId, Map<String, String> info);
void recordBreakoutInfo(String meetingId, Map<String, String> breakoutInfo);
void addBreakoutRoom(String parentId, String breakoutId);
void send(String channel, String message);
void publishRecording(String recordId, String meetingId, String externalMeetingId, String format, boolean publish);
void deleteRecording(String recordId, String meetingId, String externalMeetingId, String format);
void createMeeting(String meetingID, String externalMeetingID,
String parentMeetingID, String meetingName, Boolean recorded,
String voiceBridge, Integer duration, Boolean autoStartRecording,
Boolean allowStartStopRecording, Boolean webcamsOnlyForModerator,
String moderatorPass, String viewerPass, Long createTime,
String createDate, Boolean isBreakout, Integer sequence,
Map<String, String> metadata, String guestPolicy);
void registerUser(String meetingID, String internalUserId, String fullname, String role,
String externUserID, String authToken, String avatarURL, Boolean guest, Boolean authed);
void destroyMeeting(String meetingID);
void endMeeting(String meetingId);
void sendKeepAlive(String system, Long timestamp);
void sendStunTurnInfo(String meetingId, String internalUserId, Set<StunServer> stuns, Set<TurnEntry> turns);
public interface MessagingService {
void recordMeetingInfo(String meetingId, Map<String, String> info);
void recordBreakoutInfo(String meetingId, Map<String, String> breakoutInfo);
void addBreakoutRoom(String parentId, String breakoutId);
/*
void send(String channel, String message);
void publishRecording(String recordId, String meetingId, String externalMeetingId, String format, boolean publish);
void deleteRecording(String recordId, String meetingId, String externalMeetingId, String format);
void createMeeting(String meetingID, String externalMeetingID,
String parentMeetingID, String meetingName, Boolean recorded,
String voiceBridge, Integer duration, Boolean autoStartRecording,
Boolean allowStartStopRecording, Boolean webcamsOnlyForModerator,
String moderatorPass, String viewerPass, Long createTime,
String createDate, Boolean isBreakout, Integer sequence,
Map<String, String> metadata, String guestPolicy);
void registerUser(String meetingID, String internalUserId, String fullname, String role,
String externUserID, String authToken, String avatarURL, Boolean guest, Boolean authed);
void destroyMeeting(String meetingID);
void endMeeting(String meetingId);
void sendKeepAlive(String system, Long timestamp);
void sendStunTurnInfo(String meetingId, String internalUserId, Set<StunServer> stuns, Set<TurnEntry> turns);
void sendDocConversionMsg(IDocConversionMsg msg);
*/
}

View File

@ -1,25 +1,16 @@
package org.bigbluebutton.api.messaging;
import org.bigbluebutton.api.messaging.messages.IMessage;
public class ReceivedMessage {
private final String pattern;
private final String channel;
private final String message;
public ReceivedMessage(String pattern, String channel, String message) {
this.pattern = pattern;
this.channel = channel;
this.message = message;
}
private final IMessage message;
public String getPattern() {
return pattern;
}
public ReceivedMessage(IMessage message) {
public String getChannel() {
return channel;
}
this.message = message;
}
public String getMessage() {
return message;
}
public IMessage getMessage() {
return message;
}
}

View File

@ -1,76 +1,76 @@
package org.bigbluebutton.api.messaging;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import org.bigbluebutton.api.IReceivedOldMessageHandler;
import org.bigbluebutton.api.messaging.messages.IMessage;
import org.bigbluebutton.api2.bus.OldMessageReceivedGW;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ReceivedMessageHandler implements IReceivedOldMessageHandler {
private static Logger log = LoggerFactory.getLogger(ReceivedMessageHandler.class);
private BlockingQueue<ReceivedMessage> receivedMessages = new LinkedBlockingQueue<ReceivedMessage>();
private volatile boolean processMessage = false;
private final Executor msgProcessorExec = Executors.newSingleThreadExecutor();
private final Executor runExec = Executors.newSingleThreadExecutor();
private MessageDistributor handler;
public void stop() {
processMessage = false;
}
public void start() {
log.info("Ready to handle messages from Redis pubsub!");
private static Logger log = LoggerFactory.getLogger(ReceivedMessageHandler.class);
try {
processMessage = true;
Runnable messageProcessor = new Runnable() {
public void run() {
while (processMessage) {
try {
ReceivedMessage msg = receivedMessages.take();
processMessage(msg);
} catch (InterruptedException e) {
log.warn("Error while taking received message from queue.");
}
}
}
};
msgProcessorExec.execute(messageProcessor);
} catch (Exception e) {
log.error("Error subscribing to channels: " + e.getMessage());
}
}
private void processMessage(final ReceivedMessage msg) {
Runnable task = new Runnable() {
public void run() {
if (handler != null) {
// log.debug("Let's process this message: " + msg.getMessage());
private BlockingQueue<ReceivedMessage> receivedMessages = new LinkedBlockingQueue<ReceivedMessage>();
handler.notifyListeners(msg.getPattern(), msg.getChannel(), msg.getMessage());
} else {
log.warn("No listeners interested in messages from Redis!");
}
}
};
runExec.execute(task);
}
public void handleMessage(String pattern, String channel, String message) {
ReceivedMessage rm = new ReceivedMessage(pattern, channel, message);
receivedMessages.add(rm);
}
public void setMessageDistributor(MessageDistributor h) {
this.handler = h;
}
private volatile boolean processMessage = false;
private final Executor msgProcessorExec = Executors.newSingleThreadExecutor();
private final Executor runExec = Executors.newSingleThreadExecutor();
private MessageDistributor outGW;
public void stop() {
processMessage = false;
}
public void start() {
log.info("Ready to handle messages from Redis pubsub!");
try {
processMessage = true;
Runnable messageProcessor = new Runnable() {
public void run() {
while (processMessage) {
try {
ReceivedMessage msg = receivedMessages.take();
processMessage(msg);
} catch (InterruptedException e) {
log.warn("Error while taking received message from queue.");
}
}
}
};
msgProcessorExec.execute(messageProcessor);
} catch (Exception e) {
log.error("Error subscribing to channels: " + e.getMessage());
}
}
private void notifyListeners(IMessage message) {
outGW.notifyListeners(message);
}
private void processMessage(final ReceivedMessage msg) {
Runnable task = new Runnable() {
public void run() {
notifyListeners(msg.getMessage());
}
};
runExec.execute(task);
}
public void handleMessage(IMessage message) {
ReceivedMessage rm = new ReceivedMessage(message);
receivedMessages.add(rm);
}
public void setMessageDistributor(MessageDistributor outGW) {
this.outGW = outGW;
}
}

View File

@ -1,21 +1,20 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*
*/
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
* <p>
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.api.messaging;
@ -31,6 +30,7 @@ import org.bigbluebutton.api.messaging.converters.messages.DestroyMeetingMessage
import org.bigbluebutton.api.messaging.converters.messages.EndMeetingMessage;
import org.bigbluebutton.api.messaging.converters.messages.PublishRecordingMessage;
import org.bigbluebutton.api.messaging.converters.messages.UnpublishRecordingMessage;
import org.bigbluebutton.api2.IBbbWebApiGWApp;
import org.bigbluebutton.common.converters.ToJsonEncoder;
import org.bigbluebutton.common.messages.Constants;
import org.bigbluebutton.common.messages.MessagingConstants;
@ -39,6 +39,7 @@ import org.bigbluebutton.messages.CreateMeetingRequest;
import org.bigbluebutton.messages.CreateMeetingRequestPayload;
import org.bigbluebutton.messages.RegisterUserMessage;
import org.bigbluebutton.messages.RegisterUserMessagePayload;
import org.bigbluebutton.presentation.messages.IDocConversionMsg;
import org.bigbluebutton.web.services.turn.StunServer;
import org.bigbluebutton.web.services.turn.TurnEntry;
import org.slf4j.Logger;
@ -46,162 +47,113 @@ import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
public class RedisMessagingService implements MessagingService {
private static Logger log = LoggerFactory.getLogger(RedisMessagingService.class);
private RedisStorageService storeService;
private MessageSender sender;
private ToJsonEncoder encoder = new ToJsonEncoder();
public void recordMeetingInfo(String meetingId, Map<String, String> info) {
storeService.recordMeetingInfo(meetingId, info);
}
public class RedisMessagingService {
private static Logger log = LoggerFactory.getLogger(RedisMessagingService.class);
public void recordBreakoutInfo(String meetingId, Map<String, String> breakoutInfo) {
storeService.recordBreakoutInfo(meetingId, breakoutInfo);
}
public void addBreakoutRoom(String parentId, String breakoutId) {
storeService.addBreakoutRoom(parentId, breakoutId);
}
public void destroyMeeting(String meetingID) {
DestroyMeetingMessage msg = new DestroyMeetingMessage(meetingID);
public void destroyMeeting(String meetingID) {
DestroyMeetingMessage msg = new DestroyMeetingMessage(meetingID);
String json = MessageToJson.destroyMeetingMessageToJson(msg);
log.info("Sending destroy meeting message to bbb-apps:[{}]", json);
sender.send(MessagingConstants.TO_MEETING_CHANNEL, json);
}
public void registerUser(String meetingID, String internalUserId, String fullname, String role,
String externUserID, String authToken, String avatarURL, Boolean guest, Boolean authed) {
RegisterUserMessagePayload payload = new RegisterUserMessagePayload(meetingID, internalUserId, fullname, role, externUserID,
authToken, avatarURL, guest, authed);
RegisterUserMessage msg = new RegisterUserMessage(payload);
}
Gson gson = new Gson();
String json = gson.toJson(msg);
log.info("*****Sending register user message to bbb-apps:[{}]", json);
sender.send(MessagingConstants.TO_MEETING_CHANNEL, json);
}
public void createMeeting(String meetingID, String externalMeetingID,
String parentMeetingID, String meetingName, Boolean recorded,
String voiceBridge, Integer duration, Boolean autoStartRecording,
Boolean allowStartStopRecording, Boolean webcamsOnlyForModerator,
String moderatorPass, String viewerPass, Long createTime,
String createDate, Boolean isBreakout, Integer sequence, Map<String, String> metadata,
String guestPolicy) {
CreateMeetingRequestPayload payload = new CreateMeetingRequestPayload(
meetingID, externalMeetingID, parentMeetingID, meetingName,
recorded, voiceBridge, duration, autoStartRecording,
allowStartStopRecording, webcamsOnlyForModerator,
moderatorPass, viewerPass, createTime, createDate, isBreakout,
sequence, metadata, guestPolicy);
CreateMeetingRequest msg = new CreateMeetingRequest(payload);
public void registerUser(String meetingID, String internalUserId, String fullname, String role,
String externUserID, String authToken, String avatarURL, Boolean guest, Boolean authed) {
RegisterUserMessagePayload payload = new RegisterUserMessagePayload(meetingID, internalUserId, fullname, role, externUserID,
authToken, avatarURL, guest, authed);
RegisterUserMessage msg = new RegisterUserMessage(payload);
Gson gson = new Gson();
String json = gson.toJson(msg);
log.info("Sending create meeting message to bbb-apps:[{}]", json);
sender.send(MessagingConstants.TO_MEETING_CHANNEL, json);
}
public void endMeeting(String meetingId) {
EndMeetingMessage msg = new EndMeetingMessage(meetingId);
String json = MessageToJson.endMeetingMessageToJson(msg);
log.info("Sending end meeting message to bbb-apps:[{}]", json);
sender.send(MessagingConstants.TO_MEETING_CHANNEL, json);
}
Gson gson = new Gson();
String json = gson.toJson(msg);
log.info("*****Sending register user message to bbb-apps:[{}]", json);
}
public void createMeeting(String meetingID, String externalMeetingID,
String parentMeetingID, String meetingName, Boolean recorded,
String voiceBridge, Integer duration, Boolean autoStartRecording,
Boolean allowStartStopRecording, Boolean webcamsOnlyForModerator,
String moderatorPass, String viewerPass, Long createTime,
String createDate, Boolean isBreakout, Integer sequence, Map<String, String> metadata,
String guestPolicy) {
CreateMeetingRequestPayload payload = new CreateMeetingRequestPayload(
meetingID, externalMeetingID, parentMeetingID, meetingName,
recorded, voiceBridge, duration, autoStartRecording,
allowStartStopRecording, webcamsOnlyForModerator,
moderatorPass, viewerPass, createTime, createDate, isBreakout,
sequence, metadata, guestPolicy);
CreateMeetingRequest msg = new CreateMeetingRequest(payload);
Gson gson = new Gson();
String json = gson.toJson(msg);
log.info("Sending create meeting message to bbb-apps:[{}]", json);
}
public void endMeeting(String meetingId) {
EndMeetingMessage msg = new EndMeetingMessage(meetingId);
String json = MessageToJson.endMeetingMessageToJson(msg);
log.info("Sending end meeting message to bbb-apps:[{}]", json);
}
public void sendKeepAlive(String system, Long timestamp) {
String json = encoder.encodePubSubPingMessage("BbbWeb", System.currentTimeMillis());
sender.send(MessagingConstants.TO_SYSTEM_CHANNEL, json);
}
public void send(String channel, String message) {
sender.send(channel, message);
}
public void sendPolls(String meetingId, String title, String question, String questionType, List<String> answers){
Gson gson = new Gson();
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("messageId", MessagingConstants.SEND_POLLS_EVENT);
map.put("meetingId", meetingId);
map.put("title", title);
map.put("question", question);
map.put("questionType", questionType);
map.put("answers", answers);
sender.send(MessagingConstants.TO_POLLING_CHANNEL, gson.toJson(map));
}
public void setMessageSender(MessageSender sender) {
this.sender = sender;
}
public void setRedisStorageService(RedisStorageService storeService) {
this.storeService = storeService;
public void sendPolls(String meetingId, String title, String question, String questionType, List<String> answers) {
Gson gson = new Gson();
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("messageId", MessagingConstants.SEND_POLLS_EVENT);
map.put("meetingId", meetingId);
map.put("title", title);
map.put("question", question);
map.put("questionType", questionType);
map.put("answers", answers);
}
public void removeMeeting(String meetingId){
storeService.removeMeeting(meetingId);
}
private void publishRecording(String recordId, String meetingId, String externalMeetingId, String format) {
PublishRecordingMessage msg = new PublishRecordingMessage(recordId, meetingId, externalMeetingId, format);
String json = MessageToJson.publishRecordingMessageToJson(msg);
sender.send(MessagingConstants.FROM_BBB_RECORDING_CHANNEL, json);
}
private void unpublishRecording(String recordId, String meetingId, String externalMeetingId, String format) {
UnpublishRecordingMessage msg = new UnpublishRecordingMessage(recordId, meetingId, externalMeetingId, format);
String json = MessageToJson.unpublishRecordingMessageToJson(msg);
sender.send(MessagingConstants.FROM_BBB_RECORDING_CHANNEL, json);
}
public void publishRecording(PublishRecordingMessage msg) {
public void publishRecording(String recordId, String meetingId, String externalMeetingId, String format, boolean publish) {
if (publish) {
publishRecording(recordId, meetingId, externalMeetingId, format);
} else {
unpublishRecording(recordId, meetingId, externalMeetingId, format);
}
}
String json = MessageToJson.publishRecordingMessageToJson(msg);
public void deleteRecording(String recordId, String meetingId, String externalMeetingId, String format) {
DeleteRecordingMessage msg = new DeleteRecordingMessage(recordId, meetingId, externalMeetingId, format);
String json = MessageToJson.deleteRecordingMessageToJson(msg);
sender.send(MessagingConstants.FROM_BBB_RECORDING_CHANNEL, json);
}
}
public void sendStunTurnInfo(String meetingId, String internalUserId, Set<StunServer> stuns, Set<TurnEntry> turns) {
ArrayList<String> stunsArrayList = new ArrayList<String>();
Iterator<StunServer> stunsIter = stuns.iterator();
public void unpublishRecording(UnpublishRecordingMessage msg) {
while (stunsIter.hasNext()) {
StunServer aStun = (StunServer) stunsIter.next();
if (aStun != null) {
stunsArrayList.add(aStun.url);
}
}
String json = MessageToJson.unpublishRecordingMessageToJson(msg);
ArrayList<Map<String, Object>> turnsArrayList = new ArrayList<Map<String, Object>>();
Iterator<TurnEntry> turnsIter = turns.iterator();
while (turnsIter.hasNext()) {
TurnEntry te = (TurnEntry) turnsIter.next();
if (null != te) {
Map<String, Object> map = new HashMap<String, Object>();
map.put(Constants.USERNAME, te.username);
map.put(Constants.URL, te.url);
map.put(Constants.TTL, te.ttl);
map.put(Constants.PASSWORD, te.password);
}
turnsArrayList.add(map);
}
}
public void publishRecording(String recordId, String meetingId, String externalMeetingId, String format, boolean publish) {
if (publish) {
PublishRecordingMessage msg = new PublishRecordingMessage(recordId, meetingId, externalMeetingId, format);
publishRecording(msg);
} else {
UnpublishRecordingMessage msg = new UnpublishRecordingMessage(recordId, meetingId, externalMeetingId, format);
unpublishRecording(msg);
}
}
SendStunTurnInfoReplyMessage msg = new SendStunTurnInfoReplyMessage(meetingId, internalUserId,
stunsArrayList, turnsArrayList);
public void deleteRecording(String recordId, String meetingId, String externalMeetingId, String format) {
DeleteRecordingMessage msg = new DeleteRecordingMessage(recordId, meetingId, externalMeetingId, format);
String json = MessageToJson.deleteRecordingMessageToJson(msg);
sender.send(MessagingConstants.TO_BBB_HTML5_CHANNEL, msg.toJson());
}
}
public void sendStunTurnInfo(String meetingId, String internalUserId, Set<StunServer> stuns, Set<TurnEntry> turns) {
}
public void sendDocConversionMsg(IDocConversionMsg msg) {
}
}

View File

@ -11,79 +11,79 @@ import redis.clients.jedis.JedisPool;
import redis.clients.jedis.Protocol;
public class RedisStorageService {
private static Logger log = LoggerFactory.getLogger(RedisStorageService.class);
private JedisPool redisPool;
private String host;
private int port;
public void stop() {
private static Logger log = LoggerFactory.getLogger(RedisStorageService.class);
}
public void start() {
// Set the name of this client to be able to distinguish when doing
// CLIENT LIST on redis-cli
redisPool = new JedisPool(new GenericObjectPoolConfig(), host, port, Protocol.DEFAULT_TIMEOUT, null,
Protocol.DEFAULT_DATABASE, "BbbRed5AppsPub");
}
public void recordMeetingInfo(String meetingId, Map<String, String> info) {
Jedis jedis = redisPool.getResource();
try {
for (String key : info.keySet()) {
log.debug("Storing metadata {} = {}", key, info.get(key));
}
private JedisPool redisPool;
private String host;
private int port;
log.debug("Saving metadata in {}", meetingId);
jedis.hmset("meeting:info:" + meetingId, info);
} catch (Exception e) {
log.warn("Cannot record the info meeting:" + meetingId, e);
} finally {
jedis.close();
}
public void stop() {
}
public void start() {
// Set the name of this client to be able to distinguish when doing
// CLIENT LIST on redis-cli
redisPool = new JedisPool(new GenericObjectPoolConfig(), host, port, Protocol.DEFAULT_TIMEOUT, null,
Protocol.DEFAULT_DATABASE, "BbbRed5AppsPub");
}
public void recordMeetingInfo(String meetingId, Map<String, String> info) {
Jedis jedis = redisPool.getResource();
try {
for (String key : info.keySet()) {
log.debug("Storing metadata {} = {}", key, info.get(key));
}
log.debug("Saving metadata in {}", meetingId);
jedis.hmset("meeting:info:" + meetingId, info);
} catch (Exception e) {
log.warn("Cannot record the info meeting:" + meetingId, e);
} finally {
jedis.close();
}
}
public void recordBreakoutInfo(String meetingId, Map<String, String> breakoutInfo) {
Jedis jedis = redisPool.getResource();
try {
log.debug("Saving breakout metadata in {}", meetingId);
jedis.hmset("meeting:breakout:" + meetingId, breakoutInfo);
} catch (Exception e) {
log.warn("Cannot record the info meeting:" + meetingId, e);
} finally {
jedis.close();
}
}
public void recordBreakoutInfo(String meetingId, Map<String, String> breakoutInfo) {
Jedis jedis = redisPool.getResource();
try {
log.debug("Saving breakout metadata in {}", meetingId);
jedis.hmset("meeting:breakout:" + meetingId, breakoutInfo);
} catch (Exception e) {
log.warn("Cannot record the info meeting:" + meetingId, e);
} finally {
jedis.close();
}
}
public void addBreakoutRoom(String parentId, String breakoutId) {
Jedis jedis = redisPool.getResource();
try {
public void addBreakoutRoom(String parentId, String breakoutId) {
Jedis jedis = redisPool.getResource();
try {
log.debug("Saving breakout room for meeting {}", parentId);
jedis.sadd("meeting:breakout:rooms:" + parentId, breakoutId);
} catch (Exception e) {
log.warn("Cannot record the info meeting:" + parentId, e);
} finally {
jedis.close();
}
}
public void removeMeeting(String meetingId){
Jedis jedis = redisPool.getResource();
try {
jedis.del("meeting-" + meetingId);
jedis.srem("meetings", meetingId);
} finally {
jedis.close();
}
}
public void setHost(String host){
this.host = host;
}
public void setPort(int port) {
this.port = port;
}
log.debug("Saving breakout room for meeting {}", parentId);
jedis.sadd("meeting:breakout:rooms:" + parentId, breakoutId);
} catch (Exception e) {
log.warn("Cannot record the info meeting:" + parentId, e);
} finally {
jedis.close();
}
}
public void removeMeeting(String meetingId) {
Jedis jedis = redisPool.getResource();
try {
jedis.del("meeting-" + meetingId);
jedis.srem("meetings", meetingId);
} finally {
jedis.close();
}
}
public void setHost(String host) {
this.host = host;
}
public void setPort(int port) {
this.port = port;
}
}

View File

@ -1,12 +1,12 @@
package org.bigbluebutton.api.messaging.converters.messages;
public class DestroyMeetingMessage {
public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event";
public static final String VERSION = "0.0.1";
public final String meetingId;
public DestroyMeetingMessage(String meetingId) {
this.meetingId = meetingId;
}
public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event";
public static final String VERSION = "0.0.1";
public final String meetingId;
public DestroyMeetingMessage(String meetingId) {
this.meetingId = meetingId;
}
}

View File

@ -1,12 +1,12 @@
package org.bigbluebutton.api.messaging.converters.messages;
public class EndMeetingMessage {
public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event";
public static final String VERSION = "0.0.1";
public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event";
public static final String VERSION = "0.0.1";
public final String meetingId;
public EndMeetingMessage(String meetingId) {
this.meetingId = meetingId;
}
public final String meetingId;
public EndMeetingMessage(String meetingId) {
this.meetingId = meetingId;
}
}

View File

@ -1,6 +1,10 @@
package org.bigbluebutton.api2;
import org.bigbluebutton.api.messaging.converters.messages.*;
import org.bigbluebutton.common.messages.SendStunTurnInfoReplyMessage;
import org.bigbluebutton.presentation.messages.IDocConversionMsg;
import java.util.Map;
public interface IBbbWebApiGWApp {
@ -15,4 +19,13 @@ public interface IBbbWebApiGWApp {
String dialNumber, Integer maxUsers);
void registerUser(String meetingID, String internalUserId, String fullname, String role,
String externUserID, String authToken, String avatarURL, Boolean guest, Boolean authed);
void destroyMeeting(DestroyMeetingMessage msg);
void endMeeting(EndMeetingMessage msg);
void sendKeepAlive(String system, Long timestamp);
void publishRecording(PublishRecordingMessage msg);
void unpublishRecording(UnpublishRecordingMessage msg);
void deleteRecording(DeleteRecordingMessage msg);
void sendStunTurnInfoReply(SendStunTurnInfoReplyMessage msg);
void sendDocConversionMsg(IDocConversionMsg msg);
}

View File

@ -20,6 +20,7 @@
package org.bigbluebutton.presentation;
import org.bigbluebutton.api.messaging.MessagingService;
import org.bigbluebutton.api2.IBbbWebApiGWApp;
import org.bigbluebutton.presentation.imp.ImageToSwfSlidesGenerationService;
import org.bigbluebutton.presentation.imp.OfficeToPdfConversionService;
import org.bigbluebutton.presentation.imp.PdfToSwfSlidesGenerationService;
@ -30,13 +31,13 @@ public class DocumentConversionServiceImp implements DocumentConversionService {
private static Logger log = LoggerFactory
.getLogger(DocumentConversionServiceImp.class);
private MessagingService messagingService;
private IBbbWebApiGWApp gw;
private OfficeToPdfConversionService officeToPdfConversionService;
private PdfToSwfSlidesGenerationService pdfToSwfSlidesGenerationService;
private ImageToSwfSlidesGenerationService imageToSwfSlidesGenerationService;
public void processDocument(UploadedPresentation pres) {
SupportedDocumentFilter sdf = new SupportedDocumentFilter(messagingService);
SupportedDocumentFilter sdf = new SupportedDocumentFilter(gw);
log.info("Start presentation conversion. meetingId=" + pres.getMeetingId()
+ " presId=" + pres.getId() + " name=" + pres.getName());
@ -45,8 +46,7 @@ public class DocumentConversionServiceImp implements DocumentConversionService {
if (SupportedFileTypes.isOfficeFile(fileType)) {
pres = officeToPdfConversionService.convertOfficeToPdf(pres);
OfficeToPdfConversionSuccessFilter ocsf = new OfficeToPdfConversionSuccessFilter(
messagingService);
OfficeToPdfConversionSuccessFilter ocsf = new OfficeToPdfConversionSuccessFilter(gw);
if (ocsf.didConversionSucceed(pres)) {
// Successfully converted to pdf. Call the process again, this time it
// should be handled by
@ -70,8 +70,8 @@ public class DocumentConversionServiceImp implements DocumentConversionService {
}
public void setMessagingService(MessagingService m) {
messagingService = m;
public void setBbbWebApiGWApp(IBbbWebApiGWApp m) {
gw = m;
}
public void setOfficeToPdfConversionService(OfficeToPdfConversionService s) {

View File

@ -24,21 +24,22 @@ import java.util.Map;
import org.bigbluebutton.api.messaging.MessagingConstants;
import org.bigbluebutton.api.messaging.MessagingService;
import org.bigbluebutton.api2.IBbbWebApiGWApp;
import org.bigbluebutton.presentation.messages.OfficeDocConversionProgress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
public class OfficeToPdfConversionSuccessFilter {
private static Logger log = LoggerFactory
.getLogger(OfficeToPdfConversionSuccessFilter.class);
private static Logger log = LoggerFactory.getLogger(OfficeToPdfConversionSuccessFilter.class);
private final MessagingService messagingService;
private final IBbbWebApiGWApp gw;
private static Map<String, String> conversionMessagesMap;
public OfficeToPdfConversionSuccessFilter(MessagingService m) {
messagingService = m;
public OfficeToPdfConversionSuccessFilter(IBbbWebApiGWApp m) {
gw = m;
conversionMessagesMap = new HashMap<String, String>();
conversionMessagesMap.put(
ConversionMessageConstants.OFFICE_DOC_CONVERSION_SUCCESS_KEY,
@ -70,18 +71,16 @@ public class OfficeToPdfConversionSuccessFilter {
log.info("Notifying of " + pres.getConversionStatus() + " for "
+ pres.getUploadedFile().getAbsolutePath());
sendNotification(msg);
sendProgress(pres);
}
private void sendNotification(Map<String, Object> msg) {
if (messagingService != null) {
Gson gson = new Gson();
String updateMsg = gson.toJson(msg);
log.debug("sending: " + updateMsg);
messagingService.send(MessagingConstants.TO_PRESENTATION_CHANNEL,
updateMsg);
} else {
log.warn("MessagingService has not been set!.");
}
public void sendProgress(UploadedPresentation pres) {
OfficeDocConversionProgress progress = new OfficeDocConversionProgress(pres.getMeetingId(),
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), pres.getConversionStatus());
gw.sendDocConversionMsg(progress);
}
}

View File

@ -1,21 +1,20 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*
*/
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
* <p>
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.presentation;
@ -24,54 +23,60 @@ import java.io.File;
import org.apache.commons.io.FilenameUtils;
import org.bigbluebutton.api.messaging.MessagingConstants;
import org.bigbluebutton.api.messaging.MessagingService;
import org.bigbluebutton.api2.IBbbWebApiGWApp;
import org.bigbluebutton.presentation.ConversionUpdateMessage.MessageBuilder;
import org.bigbluebutton.presentation.messages.OfficeDocConversionProgress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
public class SupportedDocumentFilter {
private static Logger log = LoggerFactory.getLogger(SupportedDocumentFilter.class);
private static Logger log = LoggerFactory.getLogger(SupportedDocumentFilter.class);
private final MessagingService messagingService;
public SupportedDocumentFilter(MessagingService m) {
messagingService = m;
}
public boolean isSupported(UploadedPresentation pres) {
File presentationFile = pres.getUploadedFile();
/* Get file extension - Perhaps try to rely on a more accurate method than an extension type ? */
String extension = FilenameUtils.getExtension(presentationFile.getName());
boolean supported = SupportedFileTypes.isFileSupported(extension);
notifyProgressListener(supported, pres);
if (supported) {
log.info("Received supported file {}", pres.getUploadedFile().getAbsolutePath());
pres.setFileType(extension);
}
else {
log.warn("Received not supported file {}", pres.getUploadedFile().getAbsolutePath());
}
return supported;
}
private void notifyProgressListener(boolean supported, UploadedPresentation pres) {
MessageBuilder builder = new ConversionUpdateMessage.MessageBuilder(pres);
if (supported) {
builder.messageKey(ConversionMessageConstants.SUPPORTED_DOCUMENT_KEY);
} else {
builder.messageKey(ConversionMessageConstants.UNSUPPORTED_DOCUMENT_KEY);
}
if(messagingService !=null){
Gson gson= new Gson();
String updateMsg=gson.toJson(builder.build().getMessage());
log.debug("sending: "+updateMsg);
messagingService.send(MessagingConstants.TO_PRESENTATION_CHANNEL, updateMsg);
} else {
log.warn("MessagingService has not been set!");
}
}
private final IBbbWebApiGWApp gw;
public SupportedDocumentFilter(IBbbWebApiGWApp m) {
gw = m;
}
public boolean isSupported(UploadedPresentation pres) {
File presentationFile = pres.getUploadedFile();
/* Get file extension - Perhaps try to rely on a more accurate method than an extension type ? */
String extension = FilenameUtils.getExtension(presentationFile.getName());
boolean supported = SupportedFileTypes.isFileSupported(extension);
notifyProgressListener(supported, pres);
if (supported) {
log.info("Received supported file {}", pres.getUploadedFile().getAbsolutePath());
pres.setFileType(extension);
} else {
log.warn("Received not supported file {}", pres.getUploadedFile().getAbsolutePath());
}
return supported;
}
private void notifyProgressListener(boolean supported, UploadedPresentation pres) {
MessageBuilder builder = new ConversionUpdateMessage.MessageBuilder(pres);
String msgKey = ConversionMessageConstants.SUPPORTED_DOCUMENT_KEY;
if (supported) {
msgKey = ConversionMessageConstants.SUPPORTED_DOCUMENT_KEY;
} else {
msgKey = ConversionMessageConstants.UNSUPPORTED_DOCUMENT_KEY;
}
if (gw != null) {
OfficeDocConversionProgress progress = new OfficeDocConversionProgress(pres.getMeetingId(),
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), msgKey);
gw.sendDocConversionMsg(progress);
} else {
log.warn("MessagingService has not been set!");
}
}
}

View File

@ -29,8 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OfficeToPdfConversionService {
private static Logger log = LoggerFactory
.getLogger(OfficeToPdfConversionService.class);
private static Logger log = LoggerFactory.getLogger(OfficeToPdfConversionService.class);
private OfficeDocumentValidator officeDocumentValidator;

View File

@ -42,14 +42,15 @@ import org.bigbluebutton.presentation.SvgImageCreator;
import org.bigbluebutton.presentation.TextFileCreator;
import org.bigbluebutton.presentation.ThumbnailCreator;
import org.bigbluebutton.presentation.UploadedPresentation;
import org.bigbluebutton.presentation.messages.DocPageCountExceeded;
import org.bigbluebutton.presentation.messages.DocPageCountFailed;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
public class PdfToSwfSlidesGenerationService {
private static Logger log = LoggerFactory
.getLogger(PdfToSwfSlidesGenerationService.class);
private static Logger log = LoggerFactory.getLogger(PdfToSwfSlidesGenerationService.class);
private SwfSlidesGenerationProgressNotifier notifier;
private PageCounterService counterService;
@ -94,20 +95,33 @@ public class PdfToSwfSlidesGenerationService {
return false;
}
private void sendFailedToCountPageMessage(CountingPageException e,
UploadedPresentation pres) {
private void sendFailedToCountPageMessage(CountingPageException e, UploadedPresentation pres) {
MessageBuilder builder = new ConversionUpdateMessage.MessageBuilder(pres);
if (e
.getExceptionType() == CountingPageException.ExceptionType.PAGE_COUNT_EXCEPTION) {
if (e.getExceptionType() == CountingPageException.ExceptionType.PAGE_COUNT_EXCEPTION) {
builder.messageKey(ConversionMessageConstants.PAGE_COUNT_FAILED_KEY);
} else if (e
.getExceptionType() == CountingPageException.ExceptionType.PAGE_EXCEEDED_EXCEPTION) {
DocPageCountFailed progress = new DocPageCountFailed(pres.getMeetingId(),
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), ConversionMessageConstants.PAGE_COUNT_FAILED_KEY);
notifier.sendDocConversionProgress(progress);
} else if (e.getExceptionType() == CountingPageException.ExceptionType.PAGE_EXCEEDED_EXCEPTION) {
builder.numberOfPages(e.getPageCount());
builder.maxNumberPages(e.getMaxNumberOfPages());
builder.messageKey(ConversionMessageConstants.PAGE_COUNT_EXCEEDED_KEY);
DocPageCountExceeded progress = new DocPageCountExceeded(pres.getMeetingId(),
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), ConversionMessageConstants.PAGE_COUNT_EXCEEDED_KEY,
e.getPageCount(), e.getMaxNumberOfPages());
notifier.sendDocConversionProgress(progress);
}
notifier.sendConversionUpdateMessage(builder.build().getMessage());
}
private void createThumbnails(UploadedPresentation pres) {

View File

@ -1,103 +1,103 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*
*/
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
* <p>
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.presentation.imp;
import java.util.Map;
import org.bigbluebutton.api.messaging.MessagingConstants;
import org.bigbluebutton.api.messaging.MessagingService;
import org.bigbluebutton.api2.IBbbWebApiGWApp;
import org.bigbluebutton.presentation.ConversionMessageConstants;
import org.bigbluebutton.presentation.ConversionUpdateMessage;
import org.bigbluebutton.presentation.ConversionUpdateMessage.MessageBuilder;
import org.bigbluebutton.presentation.GeneratedSlidesInfoHelper;
import org.bigbluebutton.presentation.UploadedPresentation;
import org.bigbluebutton.presentation.messages.DocPageCompletedProgress;
import org.bigbluebutton.presentation.messages.DocPageGeneratedProgress;
import org.bigbluebutton.presentation.messages.IDocConversionMsg;
import org.bigbluebutton.presentation.messages.OfficeDocConversionProgress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
public class SwfSlidesGenerationProgressNotifier {
private static Logger log = LoggerFactory.getLogger(SwfSlidesGenerationProgressNotifier.class);
private static Logger log = LoggerFactory.getLogger(SwfSlidesGenerationProgressNotifier.class);
private MessagingService messagingService;
private GeneratedSlidesInfoHelper generatedSlidesInfoHelper;
private void notifyProgressListener(Map<String, Object> msg) {
if(messagingService != null){
Gson gson= new Gson();
String updateMsg = gson.toJson(msg);
messagingService.send(MessagingConstants.TO_PRESENTATION_CHANNEL, updateMsg);
} else {
log.warn("MessagingService has not been set");
}
}
private IBbbWebApiGWApp messagingService;
public void sendConversionUpdateMessage(Map<String, Object> message) {
notifyProgressListener(message);
}
public void sendConversionUpdateMessage(int slidesCompleted, UploadedPresentation pres) {
MessageBuilder builder = new ConversionUpdateMessage.MessageBuilder(pres);
builder.messageKey(ConversionMessageConstants.GENERATED_SLIDE_KEY);
builder.numberOfPages(pres.getNumberOfPages());
builder.pagesCompleted(slidesCompleted);
notifyProgressListener(builder.build().getMessage());
}
public void sendCreatingThumbnailsUpdateMessage(UploadedPresentation pres) {
MessageBuilder builder = new ConversionUpdateMessage.MessageBuilder(pres);
builder.messageKey(ConversionMessageConstants.GENERATING_THUMBNAIL_KEY);
notifyProgressListener(builder.build().getMessage());
}
public void sendConversionCompletedMessage(UploadedPresentation pres) {
if (generatedSlidesInfoHelper == null) {
log.error("GeneratedSlidesInfoHelper was not set. Could not notify interested listeners.");
return;
}
MessageBuilder builder = new ConversionUpdateMessage.MessageBuilder(pres);
builder.messageKey(ConversionMessageConstants.CONVERSION_COMPLETED_KEY);
builder.numberOfPages(pres.getNumberOfPages());
builder.presBaseUrl(pres);
notifyProgressListener(builder.build().getMessage());
}
public void setMessagingService(MessagingService m) {
messagingService = m;
}
public void setGeneratedSlidesInfoHelper(GeneratedSlidesInfoHelper helper) {
generatedSlidesInfoHelper = helper;
}
private GeneratedSlidesInfoHelper generatedSlidesInfoHelper;
public void sendCreatingTextFilesUpdateMessage(UploadedPresentation pres) {
MessageBuilder builder = new ConversionUpdateMessage.MessageBuilder(pres);
builder.messageKey(ConversionMessageConstants.GENERATING_TEXTFILES_KEY);
notifyProgressListener(builder.build().getMessage());
}
public void sendCreatingSvgImagesUpdateMessage(UploadedPresentation pres) {
MessageBuilder builder = new ConversionUpdateMessage.MessageBuilder(pres);
builder.messageKey(ConversionMessageConstants.GENERATING_SVGIMAGES_KEY);
notifyProgressListener(builder.build().getMessage());
}
public void sendDocConversionProgress(IDocConversionMsg msg) {
messagingService.sendDocConversionMsg(msg);
}
public void sendConversionUpdateMessage(int slidesCompleted, UploadedPresentation pres) {
DocPageGeneratedProgress progress = new DocPageGeneratedProgress(pres.getMeetingId(),
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), ConversionMessageConstants.GENERATED_SLIDE_KEY,
pres.getNumberOfPages(), slidesCompleted);
messagingService.sendDocConversionMsg(progress);
}
public void sendCreatingThumbnailsUpdateMessage(UploadedPresentation pres) {
OfficeDocConversionProgress progress = new OfficeDocConversionProgress(pres.getMeetingId(),
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), ConversionMessageConstants.GENERATING_THUMBNAIL_KEY);
messagingService.sendDocConversionMsg(progress);
}
public void sendConversionCompletedMessage(UploadedPresentation pres) {
if (generatedSlidesInfoHelper == null) {
log.error("GeneratedSlidesInfoHelper was not set. Could not notify interested listeners.");
return;
}
DocPageCompletedProgress progress = new DocPageCompletedProgress(pres.getMeetingId(),
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), ConversionMessageConstants.CONVERSION_COMPLETED_KEY,
pres.getNumberOfPages(), generateBasePresUrl(pres));
messagingService.sendDocConversionMsg(progress);
}
private String generateBasePresUrl(UploadedPresentation pres) {
return pres.getBaseUrl() + "/" + pres.getMeetingId() + "/" + pres.getMeetingId() + "/" + pres.getId();
}
public void setMessagingService(IBbbWebApiGWApp m) {
messagingService = m;
}
public void setGeneratedSlidesInfoHelper(GeneratedSlidesInfoHelper helper) {
generatedSlidesInfoHelper = helper;
}
public void sendCreatingTextFilesUpdateMessage(UploadedPresentation pres) {
OfficeDocConversionProgress progress = new OfficeDocConversionProgress(pres.getMeetingId(),
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), ConversionMessageConstants.GENERATING_TEXTFILES_KEY);
messagingService.sendDocConversionMsg(progress);
}
public void sendCreatingSvgImagesUpdateMessage(UploadedPresentation pres) {
OfficeDocConversionProgress progress = new OfficeDocConversionProgress(pres.getMeetingId(),
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), ConversionMessageConstants.GENERATING_SVGIMAGES_KEY);
messagingService.sendDocConversionMsg(progress);
}
}

View File

@ -0,0 +1,30 @@
package org.bigbluebutton.presentation.messages;
public class DocPageCompletedProgress implements IDocConversionMsg {
public final String meetingId;
public final String presId;
public final String presInstance;
public final String filename;
public final String uploaderId;
public final String authzToken;
public final Boolean downloadable;
public final String key;
public final Integer numPages;
public final String presBaseUrl;
public DocPageCompletedProgress(String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable, String key,
Integer numPages, String presBaseUrl) {
this.meetingId = meetingId;
this.presId = presId;
this.presInstance = presInstance;
this.filename = filename;
this.uploaderId = uploaderId;
this.authzToken = authzToken;
this.downloadable = downloadable;
this.key = key;
this.numPages = numPages;
this.presBaseUrl = presBaseUrl;
}
}

View File

@ -0,0 +1,30 @@
package org.bigbluebutton.presentation.messages;
public class DocPageCountExceeded implements IDocConversionMsg {
public final String meetingId;
public final String presId;
public final String presInstance;
public final String filename;
public final String uploaderId;
public final String authzToken;
public final Boolean downloadable;
public final String key;
public final Integer numPages;
public final Integer maxNumPages;
public DocPageCountExceeded(String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable, String key,
Integer numPages, Integer maxNumPages) {
this.meetingId = meetingId;
this.presId = presId;
this.presInstance = presInstance;
this.filename = filename;
this.uploaderId = uploaderId;
this.authzToken = authzToken;
this.downloadable = downloadable;
this.key = key;
this.numPages = numPages;
this.maxNumPages = maxNumPages;
}
}

View File

@ -0,0 +1,25 @@
package org.bigbluebutton.presentation.messages;
public class DocPageCountFailed implements IDocConversionMsg {
public final String meetingId;
public final String presId;
public final String presInstance;
public final String filename;
public final String uploaderId;
public final String authzToken;
public final Boolean downloadable;
public final String key;
public DocPageCountFailed(String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable, String key) {
this.meetingId = meetingId;
this.presId = presId;
this.presInstance = presInstance;
this.filename = filename;
this.uploaderId = uploaderId;
this.authzToken = authzToken;
this.downloadable = downloadable;
this.key = key;
}
}

View File

@ -0,0 +1,30 @@
package org.bigbluebutton.presentation.messages;
public class DocPageGeneratedProgress implements IDocConversionMsg {
public final String meetingId;
public final String presId;
public final String presInstance;
public final String filename;
public final String uploaderId;
public final String authzToken;
public final Boolean downloadable;
public final String key;
public final Integer numPages;
public final Integer pagesCompleted;
public DocPageGeneratedProgress(String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable, String key,
Integer numPages, Integer pagesCompleted) {
this.meetingId = meetingId;
this.presId = presId;
this.presInstance = presInstance;
this.filename = filename;
this.uploaderId = uploaderId;
this.authzToken = authzToken;
this.downloadable = downloadable;
this.key = key;
this.numPages = numPages;
this.pagesCompleted = pagesCompleted;
}
}

View File

@ -0,0 +1,5 @@
package org.bigbluebutton.presentation.messages;
public interface IDocConversionMsg {
}

View File

@ -0,0 +1,26 @@
package org.bigbluebutton.presentation.messages;
import org.bigbluebutton.api.messaging.messages.IMessage;
public class OfficeDocConversionInvalid implements IMessage{
public final String meetingId;
public final String presId;
public final String presInstance;
public final String filename;
public final String uploaderId;
public final String authzToken;
public final Boolean downloadable;
public OfficeDocConversionInvalid(String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable) {
this.meetingId = meetingId;
this.presId = presId;
this.presInstance = presInstance;
this.filename = filename;
this.uploaderId = uploaderId;
this.authzToken = authzToken;
this.downloadable = downloadable;
}
}

View File

@ -0,0 +1,28 @@
package org.bigbluebutton.presentation.messages;
import org.bigbluebutton.api.messaging.messages.IMessage;
public class OfficeDocConversionProgress implements IDocConversionMsg {
public final String meetingId;
public final String presId;
public final String presInstance;
public final String filename;
public final String uploaderId;
public final String authzToken;
public final Boolean downloadable;
public final String key;
public OfficeDocConversionProgress(String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable, String key) {
this.meetingId = meetingId;
this.presId = presId;
this.presInstance = presInstance;
this.filename = filename;
this.uploaderId = uploaderId;
this.authzToken = authzToken;
this.downloadable = downloadable;
this.key = key;
}
}

View File

@ -0,0 +1,26 @@
package org.bigbluebutton.presentation.messages;
import org.bigbluebutton.api.messaging.messages.IMessage;
public class OfficeDocConversionSuccess implements IMessage{
public final String meetingId;
public final String presId;
public final String presInstance;
public final String filename;
public final String uploaderId;
public final String authzToken;
public final Boolean downloadable;
public OfficeDocConversionSuccess(String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable) {
this.meetingId = meetingId;
this.presId = presId;
this.presInstance = presInstance;
this.filename = filename;
this.uploaderId = uploaderId;
this.authzToken = authzToken;
this.downloadable = downloadable;
}
}

View File

@ -0,0 +1,26 @@
package org.bigbluebutton.presentation.messages;
import org.bigbluebutton.api.messaging.messages.IMessage;
public class OfficeDocConversionSupported implements IMessage{
public final String meetingId;
public final String presId;
public final String presInstance;
public final String filename;
public final String uploaderId;
public final String authzToken;
public final Boolean downloadable;
public OfficeDocConversionSupported(String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable) {
this.meetingId = meetingId;
this.presId = presId;
this.presInstance = presInstance;
this.filename = filename;
this.uploaderId = uploaderId;
this.authzToken = authzToken;
this.downloadable = downloadable;
}
}

View File

@ -0,0 +1,26 @@
package org.bigbluebutton.presentation.messages;
import org.bigbluebutton.api.messaging.messages.IMessage;
public class OfficeDocConversionUnsupported implements IMessage{
public final String meetingId;
public final String presId;
public final String presInstance;
public final String filename;
public final String uploaderId;
public final String authzToken;
public final Boolean downloadable;
public OfficeDocConversionUnsupported(String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable) {
this.meetingId = meetingId;
this.presId = presId;
this.presInstance = presInstance;
this.filename = filename;
this.uploaderId = uploaderId;
this.authzToken = authzToken;
this.downloadable = downloadable;
}
}

View File

@ -1,21 +1,20 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*
*/
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
* <p>
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.web.services;
@ -25,141 +24,138 @@ import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.bigbluebutton.api.messaging.MessageListener;
import org.bigbluebutton.api.messaging.MessagingService;
import org.bigbluebutton.api.messaging.messages.IMessage;
import org.bigbluebutton.api.messaging.messages.KeepAliveReply;
import org.bigbluebutton.api.pub.IPublisherService;
import org.bigbluebutton.api2.IBbbWebApiGWApp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class KeepAliveService implements MessageListener {
private static Logger log = LoggerFactory.getLogger(KeepAliveService.class);
private final String KEEP_ALIVE_REQUEST = "KEEP_ALIVE_REQUEST";
private MessagingService service;
private long runEvery = 10000;
private int maxLives = 5;
private KeepAliveTask task = new KeepAliveTask();
private volatile boolean processMessages = false;
private static Logger log = LoggerFactory.getLogger(KeepAliveService.class);
private final String KEEP_ALIVE_REQUEST = "KEEP_ALIVE_REQUEST";
private IBbbWebApiGWApp gw;
private long runEvery = 10000;
private int maxLives = 5;
private KeepAliveTask task = new KeepAliveTask();
private volatile boolean processMessages = false;
volatile boolean available = true;
private static final Executor msgSenderExec = Executors.newFixedThreadPool(1);
private static final Executor runExec = Executors.newFixedThreadPool(1);
private ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(1);
private BlockingQueue<KeepAliveMessage> messages = new LinkedBlockingQueue<KeepAliveMessage>();
private Long lastKeepAliveMessage = 0L;
private final String SYSTEM = "BbbWeb";
public void start() {
scheduledThreadPool.scheduleWithFixedDelay(task, 5000, runEvery, TimeUnit.MILLISECONDS);
processKeepAliveMessage();
}
public void stop() {
processMessages = false;
scheduledThreadPool.shutdownNow();
}
public void setRunEvery(long v) {
runEvery = v * 1000;
}
volatile boolean available = true;
public void setPublisherService(MessagingService service){
this.service = service;
}
class KeepAliveTask implements Runnable {
private static final Executor msgSenderExec = Executors.newFixedThreadPool(1);
private static final Executor runExec = Executors.newFixedThreadPool(1);
private ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(1);
private BlockingQueue<KeepAliveMessage> messages = new LinkedBlockingQueue<KeepAliveMessage>();
private Long lastKeepAliveMessage = 0L;
private final String SYSTEM = "BbbWeb";
public void start() {
scheduledThreadPool.scheduleWithFixedDelay(task, 5000, runEvery, TimeUnit.MILLISECONDS);
processKeepAliveMessage();
}
public void stop() {
processMessages = false;
scheduledThreadPool.shutdownNow();
}
public void setRunEvery(long v) {
runEvery = v * 1000;
}
public void setGw(IBbbWebApiGWApp gw) {
this.gw = gw;
}
class KeepAliveTask implements Runnable {
public void run() {
KeepAlivePing ping = new KeepAlivePing();
queueMessage(ping);
KeepAlivePing ping = new KeepAlivePing();
queueMessage(ping);
}
}
public boolean isDown(){
//return !available;
return false;
public boolean isDown() {
//return !available;
return false;
}
private void queueMessage(KeepAliveMessage msg) {
messages.add(msg);
messages.add(msg);
}
private void processKeepAliveMessage() {
processMessages = true;
Runnable sender = new Runnable() {
public void run() {
while (processMessages) {
KeepAliveMessage message;
try {
message = messages.take();
processMessage(message);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
log.error("Catching exception [{}]", e.toString());
}
}
}
};
msgSenderExec.execute(sender);
}
processMessages = true;
Runnable sender = new Runnable() {
public void run() {
while (processMessages) {
KeepAliveMessage message;
try {
message = messages.take();
processMessage(message);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
log.error("Catching exception [{}]", e.toString());
}
}
}
};
msgSenderExec.execute(sender);
}
private void processMessage(final KeepAliveMessage msg) {
Runnable task = new Runnable() {
public void run() {
if (msg instanceof KeepAlivePing) {
// processPing((KeepAlivePing) msg);
} else if (msg instanceof KeepAlivePong) {
// processPong((KeepAlivePong) msg);
}
}
};
Runnable task = new Runnable() {
public void run() {
if (msg instanceof KeepAlivePing) {
processPing((KeepAlivePing) msg);
} else if (msg instanceof KeepAlivePong) {
processPong((KeepAlivePong) msg);
}
}
};
runExec.execute(task);
}
private void processPing(KeepAlivePing msg) {
service.sendKeepAlive(SYSTEM, System.currentTimeMillis());
Boolean akkaAppsIsAvailable = available;
gw.sendKeepAlive(SYSTEM, System.currentTimeMillis());
Boolean akkaAppsIsAvailable = available;
if (lastKeepAliveMessage != 0 && (System.currentTimeMillis() - lastKeepAliveMessage > 30000)) {
if (akkaAppsIsAvailable) {
log.error("BBB Web pubsub error!");
// BBB-Apps has gone down. Mark it as unavailable. (ralam - april 29, 2014)
available = false;
}
}
if (lastKeepAliveMessage != 0 && (System.currentTimeMillis() - lastKeepAliveMessage > 30000)) {
if (akkaAppsIsAvailable) {
log.error("BBB Web pubsub error!");
// BBB-Apps has gone down. Mark it as unavailable. (ralam - april 29, 2014)
available = false;
}
}
}
private void processPong(KeepAlivePong msg) {
if (lastKeepAliveMessage != 0 && !available) {
log.error("BBB Web pubsub recovered!");
}
lastKeepAliveMessage = System.currentTimeMillis();
available = true;
}
private void handleKeepAliveReply(String system, Long timestamp) {
if (system.equals("BbbWeb")) {
KeepAlivePong pong = new KeepAlivePong(system, timestamp);
queueMessage(pong);
}
if (lastKeepAliveMessage != 0 && !available) {
log.error("BBB Web pubsub recovered!");
}
lastKeepAliveMessage = System.currentTimeMillis();
available = true;
}
@Override
private void handleKeepAliveReply(String system, Long timestamp) {
if (system.equals("BbbWeb")) {
KeepAlivePong pong = new KeepAlivePong(system, timestamp);
queueMessage(pong);
}
}
@Override
public void handle(IMessage message) {
if (message instanceof KeepAliveReply) {
KeepAliveReply msg = (KeepAliveReply) message;
handleKeepAliveReply(msg.system, msg.timestamp);
}
if (message instanceof KeepAliveReply) {
KeepAliveReply msg = (KeepAliveReply) message;
handleKeepAliveReply(msg.system, msg.timestamp);
}
}
}

View File

@ -3,10 +3,13 @@ package org.bigbluebutton.api2
import scala.collection.JavaConverters._
import akka.actor.ActorSystem
import akka.event.Logging
import org.bigbluebutton.api.messaging.converters.messages._
import org.bigbluebutton.api2.bus._
import org.bigbluebutton.api2.endpoint.redis.{AppsRedisSubscriberActor, MessageSender, RedisPublisher}
import org.bigbluebutton.api2.meeting.{CreateMeetingMsg, MeetingsManagerActor, RegisterUser}
import org.bigbluebutton.api2.meeting.{MeetingsManagerActor, OldMeetingMsgHdlrActor, RegisterUser}
import org.bigbluebutton.common.messages.SendStunTurnInfoReplyMessage
import org.bigbluebutton.common2.domain._
import org.bigbluebutton.presentation.messages.IDocConversionMsg
import scala.concurrent.duration._
@ -24,8 +27,7 @@ class BbbWebApiGWApp(val oldMessageReceivedGW: OldMessageReceivedGW) extends IBb
private val jsonMsgToAkkaAppsBus = new JsonMsgToAkkaAppsBus
private val redisPublisher = new RedisPublisher(system)
private val msgSender: MessageSender = new MessageSender(redisPublisher)
private val messageSenderActorRef = system.actorOf(
MessageSenderActor.props(msgSender), "messageSenderActor")
private val messageSenderActorRef = system.actorOf(MessageSenderActor.props(msgSender), "messageSenderActor")
jsonMsgToAkkaAppsBus.subscribe(messageSenderActorRef, toAkkaAppsJsonChannel)
@ -38,6 +40,11 @@ class BbbWebApiGWApp(val oldMessageReceivedGW: OldMessageReceivedGW) extends IBb
MeetingsManagerActor.props(msgToAkkaAppsEventBus), "meetingManagerActor")
msgFromAkkaAppsEventBus.subscribe(meetingManagerActorRef, fromAkkaAppsChannel)
private val oldMeetingMsgHdlrActor = system.actorOf(
OldMeetingMsgHdlrActor.props(oldMessageReceivedGW), "oldMeetingMsgHdlrActor"
)
msgFromAkkaAppsEventBus.subscribe(oldMeetingMsgHdlrActor, fromAkkaAppsChannel)
private val msgToAkkaAppsToJsonActor = system.actorOf(
MsgToAkkaAppsToJsonActor.props(jsonMsgToAkkaAppsBus), "msgToAkkaAppsToJsonActor")
@ -94,14 +101,58 @@ class BbbWebApiGWApp(val oldMessageReceivedGW: OldMessageReceivedGW) extends IBb
val defaultProps = DefaultProps(meetingProp, breakoutProps, durationProps, password, recordProp, welcomeProp, voiceProp,
usersProp, metadataProp, screenshareProps)
meetingManagerActorRef ! new CreateMeetingMsg(defaultProps)
//meetingManagerActorRef ! new CreateMeetingMsg(defaultProps)
val event = MsgBuilder.buildCreateMeetingRequestToAkkaApps(defaultProps)
msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event))
}
def registerUser (meetingId: String, intUserId: String, name: String,
role: String, extUserId: String, authToken: String, avatarURL: String,
guest: java.lang.Boolean, authed: java.lang.Boolean): Unit = {
meetingManagerActorRef ! new RegisterUser(meetingId = meetingId, intUserId = intUserId, name = name,
role = role, extUserId = extUserId, authToken = authToken, avatarURL = avatarURL,
guest = guest, authed = authed)
// meetingManagerActorRef ! new RegisterUser(meetingId = meetingId, intUserId = intUserId, name = name,
// role = role, extUserId = extUserId, authToken = authToken, avatarURL = avatarURL,
// guest = guest, authed = authed)
val regUser = new RegisterUser(meetingId = meetingId, intUserId = intUserId, name = name,
role = role, extUserId = extUserId, authToken = authToken, avatarURL = avatarURL,
guest = guest.booleanValue(), authed = authed.booleanValue())
val event = MsgBuilder.buildRegisterUserRequestToAkkaApps(regUser)
msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event))
}
def destroyMeeting (msg: DestroyMeetingMessage): Unit = {
}
def endMeeting(msg: EndMeetingMessage): Unit = {
}
def sendKeepAlive(system: String, timestamp: java.lang.Long): Unit = {
}
def publishRecording(msg: PublishRecordingMessage): Unit = {
}
def unpublishRecording(msg: UnpublishRecordingMessage): Unit = {
}
def deleteRecording(msg: DeleteRecordingMessage): Unit = {
}
def sendStunTurnInfoReply(msg: SendStunTurnInfoReplyMessage): Unit = {
}
def sendDocConversionMsg(msg: IDocConversionMsg): Unit = {
}
}

View File

@ -0,0 +1,29 @@
package org.bigbluebutton.api2
import org.bigbluebutton.api2.meeting.RegisterUser
import org.bigbluebutton.common2.domain.DefaultProps
import org.bigbluebutton.common2.msgs._
object MsgBuilder {
def buildCreateMeetingRequestToAkkaApps(props: DefaultProps): BbbCommonEnvCoreMsg = {
val routing = collection.immutable.HashMap("sender" -> "bbb-web")
val envelope = BbbCoreEnvelope(CreateMeetingReqMsg.NAME, routing)
val header = BbbCoreBaseHeader(CreateMeetingReqMsg.NAME)
val body = CreateMeetingReqMsgBody(props)
val req = CreateMeetingReqMsg(header, body)
BbbCommonEnvCoreMsg(envelope, req)
}
def buildRegisterUserRequestToAkkaApps(msg: RegisterUser): BbbCommonEnvCoreMsg = {
val routing = collection.immutable.HashMap("sender" -> "bbb-web")
val envelope = BbbCoreEnvelope(RegisterUserReqMsg.NAME, routing)
val header = BbbCoreHeaderWithMeetingId(RegisterUserReqMsg.NAME, msg.meetingId)
val body = RegisterUserReqMsgBody(meetingId = msg.meetingId, intUserId = msg.intUserId,
name = msg.name, role = msg.role, extUserId = msg.extUserId, authToken = msg.authToken,
avatarURL = msg.avatarURL, guest = msg.guest, authed = msg.authed)
val req = RegisterUserReqMsg(header, body)
BbbCommonEnvCoreMsg(envelope, req)
}
}

View File

@ -9,6 +9,6 @@ object OldMessageJsonReceiverActor{
class OldMessageJsonReceiverActor(gw: OldMessageReceivedGW) extends Actor with ActorLogging {
def receive = {
case msg: OldReceivedJsonMessage => gw.handle(msg.pattern, msg.channel, msg.msg)
case msg: OldReceivedJsonMessage => //gw.handle(msg.pattern, msg.channel, msg.msg)
}
}

View File

@ -1,11 +1,13 @@
package org.bigbluebutton.api2.bus
import org.bigbluebutton.api.IReceivedOldMessageHandler
import org.bigbluebutton.api.messaging.messages.IMessage
class OldMessageReceivedGW(handler: IReceivedOldMessageHandler) {
def handle(pattern: String, channel: String, msg: String): Unit = {
handler.handleMessage(pattern, channel, msg)
def handle(msg: IMessage): Unit = {
handler.handleMessage(msg)
}
}

View File

@ -0,0 +1,103 @@
package org.bigbluebutton.api2.meeting
import akka.actor.{Actor, ActorLogging, Props}
import org.bigbluebutton.api2.bus.OldMessageReceivedGW
import org.bigbluebutton.common2.msgs._
object OldMeetingMsgHdlrActor {
def props(olgMsgGW: OldMessageReceivedGW): Props =
Props(classOf[OldMeetingMsgHdlrActor], olgMsgGW)
}
class OldMeetingMsgHdlrActor(val olgMsgGW: OldMessageReceivedGW)
extends Actor with ActorLogging {
def receive = {
case msg: BbbCommonEnvCoreMsg => handleBbbCommonEnvCoreMsg(msg)
}
private def handleBbbCommonEnvCoreMsg(msg: BbbCommonEnvCoreMsg): Unit = {
msg.core match {
case m: MeetingCreatedEvtMsg => handleMeetingCreatedEvtMsg(m)
case _ => log.error("***** Cannot handle " + msg.envelope.name)
}
}
def handleMeetingCreatedEvtMsg(msg: MeetingCreatedEvtMsg): Unit = {
// listener.handle(new MeetingStarted(meetingId))
}
def handleMeetingEndedEvtMsg(msg: MeetingEndedEvtMsg): Unit = {
// listener.handle(new MeetingEnded(meetingId))
}
def handleMeetingDestroyedEvtMsg(msg: MeetingDestroyedEvtMsg): Unit = {
// listener.handle(new MeetingDestroyed(meetingId))
}
// def handleCreateBreakoutRoomSysCmdMsg(msg: CreateBreakoutRoomSysCmdMsg): Unit = {
/* listener.handle(new CreateBreakoutRoom(
msg.payload.breakoutMeetingId,
msg.payload.parentMeetingId,
msg.payload.name,
msg.payload.sequence,
msg.payload.voiceConfId,
msg.payload.viewerPassword,
msg.payload.moderatorPassword,
msg.payload.durationInMinutes,
msg.payload.sourcePresentationId,
msg.payload.sourcePresentationSlide,
msg.payload.record
)
);
*/
// }
// def handleEndBreakoutRoomSysCmdMsg(msg: EndBreakoutRoomSysCmdMsg): Unit = {
//listener.handle(new EndBreakoutRoom(msg.payload.meetingId))
// }
// def handlePubSubPongSysRespMsg(msg: PubSubPongSysRespMsg): Unit = {
// new KeepAliveReply(m.payload.system, m.payload.timestamp)
// }
// def handleUserJoinedMeetingEvtMsg(msg: UserJoinedMeetingEvtMsg): Unit = {
// listener.handle(new UserJoined(meetingId, userid, externuserid, username, role, avatarURL, guest, waitingForAcceptance));
// }
// def handleUserStausChangedEvtMsg(msg: UserStatusChangedEvtMsg): Unit = {
//listener.handle(new UserStatusChanged(meetingId, userid, status, value))
// }
// def handleUserLeftMeetingEvtMsg(msg: UserLeftMeetingEvtMsg): Unit = {
// listener.handle(new UserLeft(meetingId, userid))
// }
/**
* for (MessageListener listener : listeners) {
listener.handle(new UserJoinedVoice(meetingId, userid));
}
for (MessageListener listener : listeners) {
listener.handle(new UserLeftVoice(meetingId, userid));
}
for (MessageListener listener : listeners) {
listener.handle(new UserListeningOnly(meetingId, userid, listenOnly));
}
for (MessageListener listener : listeners) {
listener.handle(new UserSharedWebcam(meetingId, userid, stream));
}
for (MessageListener listener : listeners) {
listener.handle(new UserUnsharedWebcam(meetingId, userid, stream));
}
for (MessageListener listener : listeners) {
listener.handle(new UserRoleChanged(meetingId, userid, role));
}
for (MessageListener listener : listeners) {
listener.handle(new StunTurnInfoRequested(meetingId, requesterId));
}
*/
}

View File

@ -19,42 +19,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd
">
<bean id="redisStorageService" class="org.bigbluebutton.api.messaging.RedisStorageService"
init-method="start" destroy-method="stop">
<property name="host" value="${redisHost}" />
<property name="port" value="${redisPort}" />
</bean>
<bean id="redisMessageHandler" class="org.bigbluebutton.api.messaging.ReceivedMessageHandler"
init-method="start" destroy-method="stop">
<property name="messageDistributor"><ref bean="redisMessageDistributor" /></property>
</bean>
<bean id="redisMessageDistributor" class="org.bigbluebutton.api.messaging.MessageDistributor">
<property name="messageHandler"> <ref local="redisMessageHandler"/> </property>
<property name="messageListeners">
<set>
<ref bean="meetingMessageHandler" />
</set>
</property>
</bean>
<bean id="meetingMessageHandler" class="org.bigbluebutton.api.messaging.MeetingMessageHandler">
<property name="messageListeners">
<set>
<ref bean="meetingService" />
<ref bean="keepAliveService" />
</set>
</property>
</bean>
</beans>

View File

@ -19,88 +19,91 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="documentConversionService" class="org.bigbluebutton.presentation.DocumentConversionServiceImp">
<property name="messagingService" ref="messagingService"/>
<property name="officeToPdfConversionService" ref="officeToPdfConversionService"/>
<property name="pdfToSwfSlidesGenerationService" ref="pdfToSwfSlidesGenerationService"/>
<property name="imageToSwfSlidesGenerationService" ref="imageToSwfSlidesGenerationService"/>
</bean>
<bean id="officeDocumentValidator" class="org.bigbluebutton.presentation.imp.OfficeDocumentValidator"/>
<bean id="officeToPdfConversionService" class="org.bigbluebutton.presentation.imp.OfficeToPdfConversionService">
<property name="officeDocumentValidator" ref="officeDocumentValidator"/>
</bean>
<bean id="pageExtractor" class="org.bigbluebutton.presentation.imp.PageExtractorImp"/>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="png2SwfConverter" class="org.bigbluebutton.presentation.imp.Png2SwfPageConverter">
<property name="swfToolsDir" value="${swfToolsDir}"/>
</bean>
<bean id="jpg2SwfConverter" class="org.bigbluebutton.presentation.imp.Jpeg2SwfPageConverter">
<property name="swfToolsDir" value="${swfToolsDir}"/>
</bean>
<bean id="pageCounter" class="org.bigbluebutton.presentation.imp.PdfPageCounter"/>
<bean id="pageCounterService" class="org.bigbluebutton.presentation.imp.PageCounterService">
<property name="pageCounter" ref="pageCounter"/>
<property name="maxNumPages" value="${maxNumPages}"/>
</bean>
<bean id="pdf2SwfPageConverter" class="org.bigbluebutton.presentation.imp.Pdf2SwfPageConverter">
<property name="swfToolsDir" value="${swfToolsDir}"/>
<property name="fontsDir" value="${fontsDir}"/>
<property name="placementsThreshold" value="${placementsThreshold}"/>
<property name="defineTextThreshold" value="${defineTextThreshold}"/>
<property name="imageTagThreshold" value="${imageTagThreshold}"/>
</bean>
<bean id="thumbCreator" class="org.bigbluebutton.presentation.imp.ThumbnailCreatorImp">
<property name="imageMagickDir" value="${imageMagickDir}"/>
<property name="blankThumbnail" value="${BLANK_THUMBNAIL}"/>
</bean>
<bean id="textFileCreator" class="org.bigbluebutton.presentation.imp.TextFileCreatorImp"/>
<bean id="documentConversionService" class="org.bigbluebutton.presentation.DocumentConversionServiceImp">
<property name="bbbWebApiGWApp" ref="bbbWebApiGWApp"/>
<property name="officeToPdfConversionService" ref="officeToPdfConversionService"/>
<property name="pdfToSwfSlidesGenerationService" ref="pdfToSwfSlidesGenerationService"/>
<property name="imageToSwfSlidesGenerationService" ref="imageToSwfSlidesGenerationService"/>
</bean>
<bean id="svgImageCreator" class="org.bigbluebutton.presentation.imp.SvgImageCreatorImp">
<property name="imageMagickDir" value="${imageMagickDir}"/>
</bean>
<bean id="generatedSlidesInfoHelper" class="org.bigbluebutton.presentation.GeneratedSlidesInfoHelperImp"/>
<bean id="pdfToSwfSlidesGenerationService" class="org.bigbluebutton.presentation.imp.PdfToSwfSlidesGenerationService">
<constructor-arg index="0" value="${numConversionThreads}"/>
<property name="counterService" ref="pageCounterService"/>
<property name="pageConverter" ref="pdf2SwfPageConverter"/>
<property name="thumbnailCreator" ref="thumbCreator"/>
<property name="textFileCreator" ref="textFileCreator"/>
<property name="svgImageCreator" ref="svgImageCreator"/>
<property name="blankSlide" value="${BLANK_SLIDE}"/>
<property name="maxSwfFileSize" value="${MAX_SWF_FILE_SIZE}"/>
<property name="maxConversionTime" value="${maxConversionTime}"/>
<property name="swfSlidesGenerationProgressNotifier" ref="swfSlidesGenerationProgressNotifier"/>
<property name="svgImagesRequired" value="${svgImagesRequired}"/>
</bean>
<bean id="imageToSwfSlidesGenerationService" class="org.bigbluebutton.presentation.imp.ImageToSwfSlidesGenerationService">
<property name="pngPageConverter" ref="png2SwfConverter"/>
<property name="jpgPageConverter" ref="jpg2SwfConverter"/>
<property name="svgImageCreator" ref="svgImageCreator"/>
<property name="thumbnailCreator" ref="thumbCreator"/>
<property name="textFileCreator" ref="textFileCreator"/>
<property name="blankSlide" value="${BLANK_SLIDE}"/>
<property name="maxConversionTime" value="${maxConversionTime}"/>
<property name="swfSlidesGenerationProgressNotifier" ref="swfSlidesGenerationProgressNotifier"/>
</bean>
<bean id="swfSlidesGenerationProgressNotifier" class="org.bigbluebutton.presentation.imp.SwfSlidesGenerationProgressNotifier">
<property name="messagingService" ref="messagingService"/>
<property name="generatedSlidesInfoHelper" ref="generatedSlidesInfoHelper"/>
</bean>
<bean id="officeDocumentValidator" class="org.bigbluebutton.presentation.imp.OfficeDocumentValidator"/>
<bean id="officeToPdfConversionService" class="org.bigbluebutton.presentation.imp.OfficeToPdfConversionService">
<property name="officeDocumentValidator" ref="officeDocumentValidator"/>
</bean>
<bean id="pageExtractor" class="org.bigbluebutton.presentation.imp.PageExtractorImp"/>
<bean id="png2SwfConverter" class="org.bigbluebutton.presentation.imp.Png2SwfPageConverter">
<property name="swfToolsDir" value="${swfToolsDir}"/>
</bean>
<bean id="jpg2SwfConverter" class="org.bigbluebutton.presentation.imp.Jpeg2SwfPageConverter">
<property name="swfToolsDir" value="${swfToolsDir}"/>
</bean>
<bean id="pageCounter" class="org.bigbluebutton.presentation.imp.PdfPageCounter"/>
<bean id="pageCounterService" class="org.bigbluebutton.presentation.imp.PageCounterService">
<property name="pageCounter" ref="pageCounter"/>
<property name="maxNumPages" value="${maxNumPages}"/>
</bean>
<bean id="pdf2SwfPageConverter" class="org.bigbluebutton.presentation.imp.Pdf2SwfPageConverter">
<property name="swfToolsDir" value="${swfToolsDir}"/>
<property name="fontsDir" value="${fontsDir}"/>
<property name="placementsThreshold" value="${placementsThreshold}"/>
<property name="defineTextThreshold" value="${defineTextThreshold}"/>
<property name="imageTagThreshold" value="${imageTagThreshold}"/>
</bean>
<bean id="thumbCreator" class="org.bigbluebutton.presentation.imp.ThumbnailCreatorImp">
<property name="imageMagickDir" value="${imageMagickDir}"/>
<property name="blankThumbnail" value="${BLANK_THUMBNAIL}"/>
</bean>
<bean id="textFileCreator" class="org.bigbluebutton.presentation.imp.TextFileCreatorImp"/>
<bean id="svgImageCreator" class="org.bigbluebutton.presentation.imp.SvgImageCreatorImp">
<property name="imageMagickDir" value="${imageMagickDir}"/>
</bean>
<bean id="generatedSlidesInfoHelper" class="org.bigbluebutton.presentation.GeneratedSlidesInfoHelperImp"/>
<bean id="pdfToSwfSlidesGenerationService"
class="org.bigbluebutton.presentation.imp.PdfToSwfSlidesGenerationService">
<constructor-arg index="0" value="${numConversionThreads}"/>
<property name="counterService" ref="pageCounterService"/>
<property name="pageConverter" ref="pdf2SwfPageConverter"/>
<property name="thumbnailCreator" ref="thumbCreator"/>
<property name="textFileCreator" ref="textFileCreator"/>
<property name="svgImageCreator" ref="svgImageCreator"/>
<property name="blankSlide" value="${BLANK_SLIDE}"/>
<property name="maxSwfFileSize" value="${MAX_SWF_FILE_SIZE}"/>
<property name="maxConversionTime" value="${maxConversionTime}"/>
<property name="swfSlidesGenerationProgressNotifier" ref="swfSlidesGenerationProgressNotifier"/>
<property name="svgImagesRequired" value="${svgImagesRequired}"/>
</bean>
<bean id="imageToSwfSlidesGenerationService"
class="org.bigbluebutton.presentation.imp.ImageToSwfSlidesGenerationService">
<property name="pngPageConverter" ref="png2SwfConverter"/>
<property name="jpgPageConverter" ref="jpg2SwfConverter"/>
<property name="svgImageCreator" ref="svgImageCreator"/>
<property name="thumbnailCreator" ref="thumbCreator"/>
<property name="textFileCreator" ref="textFileCreator"/>
<property name="blankSlide" value="${BLANK_SLIDE}"/>
<property name="maxConversionTime" value="${maxConversionTime}"/>
<property name="swfSlidesGenerationProgressNotifier" ref="swfSlidesGenerationProgressNotifier"/>
</bean>
<bean id="swfSlidesGenerationProgressNotifier"
class="org.bigbluebutton.presentation.imp.SwfSlidesGenerationProgressNotifier">
<property name="messagingService" ref="bbbWebApiGWApp"/>
<property name="generatedSlidesInfoHelper" ref="generatedSlidesInfoHelper"/>
</bean>
</beans>

View File

@ -19,99 +19,115 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd">
http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<bean id="messagingService" class="org.bigbluebutton.api.messaging.RedisMessagingService">
<property name="messageSender" ref="messageSender"/>
<property name="redisStorageService" ref="redisStorageService"/>
</bean>
<bean id="messageSender" class="org.bigbluebutton.api.messaging.MessageSender">
<property name="gw" ref="bbbWebApiGWApp" />
</bean>
<bean id="registeredUserCleanupTimerTask" class="org.bigbluebutton.web.services.RegisteredUserCleanupTimerTask"/>
<bean id="keepAliveService" class="org.bigbluebutton.web.services.KeepAliveService"
init-method="start" destroy-method="stop">
init-method="start" destroy-method="stop">
<property name="runEvery" value="${checkBBBServerEvery}"/>
<property name="publisherService" ref="messagingService" />
<property name="gw" ref="bbbWebApiGWApp"/>
</bean>
<bean id="meetingService" class="org.bigbluebutton.api.MeetingService" init-method="start" destroy-method="stop">
<property name="messagingService" ref="messagingService"/>
<property name="redisStorageService" ref="redisStorageService"/>
<property name="recordingService" ref="recordingService"/>
<property name="presDownloadService" ref="presDownloadService"/>
<property name="paramsProcessorUtil" ref="paramsProcessorUtil"/>
<property name="stunTurnService" ref="stunTurnService"/>
<property name="registeredUserCleanupTimerTask" ref="registeredUserCleanupTimerTask"/>
<property name="gw" ref="bbbWebApiGWApp" />
<property name="gw" ref="bbbWebApiGWApp"/>
</bean>
<bean id="oldMessageReceivedGW" class="org.bigbluebutton.api2.bus.OldMessageReceivedGW">
<constructor-arg index="0" ref="redisMessageHandler"/>
</bean>
<bean id="bbbWebApiGWApp" class="org.bigbluebutton.api2.BbbWebApiGWApp">
<constructor-arg index="0" ref="oldMessageReceivedGW"/>
</bean>
<bean id="bbbWebApiGWApp" class="org.bigbluebutton.api2.BbbWebApiGWApp">
<constructor-arg index="0" ref="oldMessageReceivedGW"/>
</bean>
<bean id="recordingServiceHelper" class="org.bigbluebutton.api.RecordingServiceHelperImp"/>
<bean id="presDownloadService" class="org.bigbluebutton.presentation.PresentationUrlDownloadService" destroy-method="stop">
<property name="presentationDir" value="${presentationDir}"/>
<property name="presentationBaseURL" value="${presentationBaseURL}"/>
<property name="pageExtractor" ref="pageExtractor"/>
<property name="documentConversionService" ref="documentConversionService"/>
<property name="blankPresentation" value="${BLANK_PRESENTATION}"/>
</bean>
<bean id="recordingService" class="org.bigbluebutton.api.RecordingService" >
<property name="recordingStatusDir" value="${recordStatusDir}"/>
<property name="publishedDir" value="${publishedDir}"/>
<property name="unpublishedDir" value="${unpublishedDir}"/>
<property name="recordingServiceHelper" ref="recordingServiceHelper"/>
<!--property name="messagingService" ref="messagingService"/-->
</bean>
<bean id="configServiceHelper" class="org.bigbluebutton.api.ClientConfigServiceHelperImp"/>
<bean id="configService" class="org.bigbluebutton.api.ClientConfigService" init-method="init">
<property name="configDir" value="${configDir}"/>
<property name="clientConfigServiceHelper" ref="configServiceHelper"/>
</bean>
<bean id="paramsProcessorUtil" class="org.bigbluebutton.api.ParamsProcessorUtil">
<property name="apiVersion" value="${apiVersion}"/>
<property name="serviceEnabled" value="${serviceEnabled}"/>
<property name="securitySalt" value="${securitySalt}"/>
<property name="defaultMaxUsers" value="${defaultMaxUsers}"/>
<property name="defaultWelcomeMessage" value="${defaultWelcomeMessage}"/>
<property name="defaultWelcomeMessageFooter" value="${defaultWelcomeMessageFooter}"/>
<property name="defaultDialAccessNumber" value="${defaultDialAccessNumber}"/>
<property name="testVoiceBridge" value="${testVoiceBridge}"/>
<property name="testConferenceMock" value="${testConferenceMock}"/>
<property name="defaultLogoutUrl" value="${bigbluebutton.web.logoutURL}"/>
<property name="defaultServerUrl" value="${bigbluebutton.web.serverURL}"/>
<property name="defaultNumDigitsForTelVoice" value="${defaultNumDigitsForTelVoice}"/>
<property name="defaultClientUrl" value="${defaultClientUrl}"/>
<property name="defaultMeetingDuration" value="${defaultMeetingDuration}"/>
<property name="disableRecordingDefault" value="${disableRecordingDefault}"/>
<property name="autoStartRecording" value="${autoStartRecording}"/>
<property name="allowStartStopRecording" value="${allowStartStopRecording}"/>
<property name="webcamsOnlyForModerator" value="${webcamsOnlyForModerator}"/>
<property name="defaultAvatarURL" value="${defaultAvatarURL}"/>
<property name="defaultConfigURL" value="${defaultConfigURL}"/>
<property name="defaultGuestPolicy" value="${defaultGuestPolicy}"/>
</bean>
<import resource="doc-conversion.xml" />
<import resource="bbb-redis-pool.xml" />
<import resource="bbb-redis-messaging.xml" />
<import resource="turn-stun-servers.xml" />
<bean id="redisStorageService" class="org.bigbluebutton.api.messaging.RedisStorageService"
init-method="start" destroy-method="stop">
<property name="host" value="${redisHost}"/>
<property name="port" value="${redisPort}"/>
</bean>
<bean id="redisMessageHandler" class="org.bigbluebutton.api.messaging.ReceivedMessageHandler"
init-method="start" destroy-method="stop">
</bean>
<bean id="redisMessageDistributor" class="org.bigbluebutton.api.messaging.MessageDistributor">
<property name="messageHandler"> <ref local="redisMessageHandler"/> </property>
<property name="messageListeners">
<set>
<ref bean="meetingService" />
<ref bean="keepAliveService" />
</set>
</property>
</bean>
<bean id="recordingServiceHelper" class="org.bigbluebutton.api.RecordingServiceHelperImp"/>
<bean id="presDownloadService" class="org.bigbluebutton.presentation.PresentationUrlDownloadService"
destroy-method="stop">
<property name="presentationDir" value="${presentationDir}"/>
<property name="presentationBaseURL" value="${presentationBaseURL}"/>
<property name="pageExtractor" ref="pageExtractor"/>
<property name="documentConversionService" ref="documentConversionService"/>
<property name="blankPresentation" value="${BLANK_PRESENTATION}"/>
</bean>
<bean id="recordingService" class="org.bigbluebutton.api.RecordingService">
<property name="recordingStatusDir" value="${recordStatusDir}"/>
<property name="publishedDir" value="${publishedDir}"/>
<property name="unpublishedDir" value="${unpublishedDir}"/>
<property name="recordingServiceHelper" ref="recordingServiceHelper"/>
</bean>
<bean id="configServiceHelper" class="org.bigbluebutton.api.ClientConfigServiceHelperImp"/>
<bean id="configService" class="org.bigbluebutton.api.ClientConfigService" init-method="init">
<property name="configDir" value="${configDir}"/>
<property name="clientConfigServiceHelper" ref="configServiceHelper"/>
</bean>
<bean id="paramsProcessorUtil" class="org.bigbluebutton.api.ParamsProcessorUtil">
<property name="apiVersion" value="${apiVersion}"/>
<property name="serviceEnabled" value="${serviceEnabled}"/>
<property name="securitySalt" value="${securitySalt}"/>
<property name="defaultMaxUsers" value="${defaultMaxUsers}"/>
<property name="defaultWelcomeMessage" value="${defaultWelcomeMessage}"/>
<property name="defaultWelcomeMessageFooter" value="${defaultWelcomeMessageFooter}"/>
<property name="defaultDialAccessNumber" value="${defaultDialAccessNumber}"/>
<property name="testVoiceBridge" value="${testVoiceBridge}"/>
<property name="testConferenceMock" value="${testConferenceMock}"/>
<property name="defaultLogoutUrl" value="${bigbluebutton.web.logoutURL}"/>
<property name="defaultServerUrl" value="${bigbluebutton.web.serverURL}"/>
<property name="defaultNumDigitsForTelVoice" value="${defaultNumDigitsForTelVoice}"/>
<property name="defaultClientUrl" value="${defaultClientUrl}"/>
<property name="defaultMeetingDuration" value="${defaultMeetingDuration}"/>
<property name="disableRecordingDefault" value="${disableRecordingDefault}"/>
<property name="autoStartRecording" value="${autoStartRecording}"/>
<property name="allowStartStopRecording" value="${allowStartStopRecording}"/>
<property name="webcamsOnlyForModerator" value="${webcamsOnlyForModerator}"/>
<property name="defaultAvatarURL" value="${defaultAvatarURL}"/>
<property name="defaultConfigURL" value="${defaultConfigURL}"/>
<property name="defaultGuestPolicy" value="${defaultGuestPolicy}"/>
</bean>
<import resource="doc-conversion.xml"/>
<import resource="bbb-redis-pool.xml"/>
<!--
<import resource="bbb-redis-messaging.xml"/>
-->
<import resource="turn-stun-servers.xml"/>
</beans>