- standalone bbb-apps now compiles

This commit is contained in:
Richard Alam 2015-05-13 20:23:49 +00:00
parent 3ab2fc6c3a
commit e91d2bd4bf
229 changed files with 15803 additions and 1615 deletions

47
labs/bbb-apps/build.sbt Normal file → Executable file
View File

@ -5,7 +5,7 @@ organization := "org.bigbluebutton"
version := "0.1-SNAPSHOT"
scalaVersion := "2.10.2"
scalaVersion := "2.11.6"
scalacOptions ++= Seq(
"-unchecked",
@ -13,13 +13,14 @@ scalacOptions ++= Seq(
"-Xlint",
"-Ywarn-dead-code",
"-language:_",
"-target:jvm-1.6",
"-target:jvm-1.7",
"-encoding", "UTF-8"
)
resolvers ++= Seq(
"spray repo" at "http://repo.spray.io/",
"rediscala" at "https://github.com/etaty/rediscala-mvn/raw/master/releases/"
"rediscala" at "http://dl.bintray.com/etaty/maven",
"blindside-repos" at "http://blindside.googlecode.com/svn/repository/"
)
publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/dev/repo/maven-repo/releases" )) )
@ -34,29 +35,29 @@ testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "html", "console",
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-h", "target/scalatest-reports")
libraryDependencies ++= {
val akkaVersion = "2.2.3"
val sprayVersion = "1.2-RC3"
val akkaVersion = "2.3.10"
val sprayVersion = "1.3.2"
Seq(
"io.spray" % "spray-can" % sprayVersion,
"io.spray" % "spray-routing" % sprayVersion,
"io.spray" % "spray-testkit" % sprayVersion % "test",
"io.spray" %% "spray-json" % "1.2.5",
"com.github.sstone" %% "amqp-client" % "1.3-ML1",
"com.typesafe.akka" %% "akka-camel" % akkaVersion,
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
"org.specs2" %% "specs2" % "2.2.3" % "test",
"org.scalatest" % "scalatest_2.10" % "2.0" % "test",
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"ch.qos.logback" % "logback-classic" % "1.0.3",
"org.pegdown" % "pegdown" % "1.4.0",
"junit" % "junit" % "4.11",
"com.etaty.rediscala" %% "rediscala" % "1.3",
"commons-codec" % "commons-codec" % "1.8",
"joda-time" % "joda-time" % "2.3",
"net.virtual-void" %% "json-lenses" % "0.5.4"
"io.spray" %% "spray-json" % sprayVersion,
"io.spray" %% "spray-routing" % sprayVersion,
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"ch.qos.logback" % "logback-classic" % "1.0.3",
"org.pegdown" % "pegdown" % "1.4.0",
"junit" % "junit" % "4.11",
"com.etaty.rediscala" %% "rediscala" % "1.4.0",
"commons-codec" % "commons-codec" % "1.8",
"joda-time" % "joda-time" % "2.3",
"net.virtual-void" %% "json-lenses" % "0.5.4",
"com.google.code.gson" % "gson" % "1.7.1",
"redis.clients" % "jedis" % "2.1.0",
"org.jboss.netty" % "netty" % "3.2.1.Final",
"org.apache.commons" % "commons-lang3" % "3.2"
)}
libraryDependencies += "org.freeswitch" % "fs-esl-client" % "0.8.2" from "http://blindside.googlecode.com/svn/repository/org/freeswitch/fs-esl-client/0.8.2/fs-esl-client-0.8.2.jar"
seq(Revolver.settings: _*)
scalariformSettings

View File

@ -1 +1 @@
sbt.version=0.12.3
sbt.version=0.13.8

View File

@ -1,7 +1,5 @@
addSbtPlugin("io.spray" % "sbt-revolver" % "0.6.2")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.0.1")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.4.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")

View File

@ -0,0 +1,112 @@
package org.bigbluebutton.conference.meeting.messaging.redis;
import java.util.HashMap;
import java.util.Map;
import org.bigbluebutton.conference.service.messaging.CreateMeetingMessage;
import org.bigbluebutton.conference.service.messaging.DestroyMeetingMessage;
import org.bigbluebutton.conference.service.messaging.EndMeetingMessage;
import org.bigbluebutton.conference.service.messaging.IMessage;
import org.bigbluebutton.conference.service.messaging.KeepAliveMessage;
import org.bigbluebutton.conference.service.messaging.MessageFromJsonConverter;
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
import org.bigbluebutton.conference.service.messaging.RegisterUserMessage;
import org.bigbluebutton.conference.service.messaging.UserConnectedToGlobalAudio;
import org.bigbluebutton.conference.service.messaging.UserDisconnectedFromGlobalAudio;
import org.bigbluebutton.conference.service.messaging.ValidateAuthTokenMessage;
import org.bigbluebutton.conference.service.messaging.GetAllMeetingsRequest;
import org.bigbluebutton.conference.service.messaging.redis.MessageHandler;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import com.google.gson.Gson;
public class MeetingMessageHandler implements MessageHandler {
private IBigBlueButtonInGW bbbGW;
@Override
public void handleMessage(String pattern, String channel, String message) {
// System.out.println("Checking message: " + pattern + " " + channel + " " + message);
if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) {
// System.out.println("Meeting message: " + channel + " " + message);
IMessage msg = MessageFromJsonConverter.convert(message);
if (msg != null) {
if (msg instanceof EndMeetingMessage) {
EndMeetingMessage emm = (EndMeetingMessage) msg;
// log.info("Received end meeting request. Meeting id [{}]", emm.meetingId);
bbbGW.endMeeting(emm.meetingId);
} else if (msg instanceof CreateMeetingMessage) {
CreateMeetingMessage emm = (CreateMeetingMessage) msg;
// log.info("Received create meeting request. Meeting id [{}]", emm.id);
bbbGW.createMeeting2(emm.id, emm.externalId, emm.name, emm.record, emm.voiceBridge,
emm.duration, emm.autoStartRecording, emm.allowStartStopRecording,
emm.moderatorPass, emm.viewerPass, emm.createTime, emm.createDate);
} else if (msg instanceof RegisterUserMessage) {
RegisterUserMessage emm = (RegisterUserMessage) msg;
// log.info("Received register user request. Meeting id [{}], userid=[{}], token=[{}]", emm.meetingID, emm.internalUserId, emm.authToken);
bbbGW.registerUser(emm.meetingID, emm.internalUserId, emm.fullname, emm.role, emm.externUserID, emm.authToken);
} else if (msg instanceof DestroyMeetingMessage) {
DestroyMeetingMessage emm = (DestroyMeetingMessage) msg;
// log.info("Received destroy meeting request. Meeting id [{}]", emm.meetingId);
bbbGW.destroyMeeting(emm.meetingId);
} else if (msg instanceof ValidateAuthTokenMessage) {
ValidateAuthTokenMessage emm = (ValidateAuthTokenMessage) msg;
// log.info("Received ValidateAuthTokenMessage token request. Meeting id [{}]", emm.meetingId);
// log.warn("TODO: Need to pass sessionId on ValidateAuthTokenMessage message.");
String sessionId = "tobeimplemented";
bbbGW.validateAuthToken(emm.meetingId, emm.userId, emm.token, emm.replyTo, sessionId);
} else if (msg instanceof UserConnectedToGlobalAudio) {
UserConnectedToGlobalAudio emm = (UserConnectedToGlobalAudio) msg;
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("voiceConf", emm.voiceConf);
logData.put("userId", emm.userid);
logData.put("username", emm.name);
logData.put("event", "user_connected_to_global_audio");
logData.put("description", "User connected to global audio.");
Gson gson = new Gson();
String logStr = gson.toJson(logData);
// log.info("User connected to global audio: data={}", logStr);
bbbGW.userConnectedToGlobalAudio(emm.voiceConf, emm.userid, emm.name);
} else if (msg instanceof UserDisconnectedFromGlobalAudio) {
UserDisconnectedFromGlobalAudio emm = (UserDisconnectedFromGlobalAudio) msg;
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("voiceConf", emm.voiceConf);
logData.put("userId", emm.userid);
logData.put("username", emm.name);
logData.put("event", "user_disconnected_from_global_audio");
logData.put("description", "User disconnected from global audio.");
Gson gson = new Gson();
String logStr = gson.toJson(logData);
// log.info("User disconnected from global audio: data={}", logStr);
bbbGW.userDisconnectedFromGlobalAudio(emm.voiceConf, emm.userid, emm.name);
}
else if (msg instanceof GetAllMeetingsRequest) {
GetAllMeetingsRequest emm = (GetAllMeetingsRequest) msg;
// log.info("Received GetAllMeetingsRequest");
bbbGW.getAllMeetings("no_need_of_a_meeting_id");
}
}
} else if (channel.equalsIgnoreCase(MessagingConstants.TO_SYSTEM_CHANNEL)) {
IMessage msg = MessageFromJsonConverter.convert(message);
if (msg != null) {
if (msg instanceof KeepAliveMessage) {
KeepAliveMessage emm = (KeepAliveMessage) msg;
// log.debug("Received KeepAliveMessage request. Meeting id [{}]", emm.keepAliveId);
bbbGW.isAliveAudit(emm.keepAliveId);
}
}
}
}
public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) {
this.bbbGW = bbbGW;
}
}

View File

@ -0,0 +1,13 @@
package org.bigbluebutton.conference.service.chat;
public class ChatKeyUtil {
public static final String CHAT_TYPE = "chatType";
public static final String FROM_USERID = "fromUserID";
public static final String FROM_USERNAME = "fromUsername";
public static final String FROM_COLOR = "fromColor";
public static final String FROM_TIME = "fromTime";
public static final String FROM_TZ_OFFSET = "fromTimezoneOffset";
public static final String TO_USERID = "toUserID";
public static final String TO_USERNAME = "toUsername";
public static final String MESSAGE = "message";
}

View File

@ -0,0 +1,78 @@
package org.bigbluebutton.conference.service.chat;
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
import org.bigbluebutton.conference.service.messaging.redis.MessageHandler;
import com.google.gson.JsonParser;
import com.google.gson.JsonObject;
import java.util.Map;
import java.util.HashMap;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
public class ChatMessageListener implements MessageHandler{
private IBigBlueButtonInGW bbbGW;
public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) {
this.bbbGW = bbbGW;
}
@Override
public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.TO_CHAT_CHANNEL)) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
JsonObject headerObject = (JsonObject) obj.get("header");
JsonObject payloadObject = (JsonObject) obj.get("payload");
JsonObject messageObject = (JsonObject) payloadObject.get("message");
String eventName = headerObject.get("name").toString();
eventName = eventName.replace("\"", "");
if (eventName.equalsIgnoreCase(MessagingConstants.SEND_PUBLIC_CHAT_MESSAGE_REQUEST) ||
eventName.equalsIgnoreCase(MessagingConstants.SEND_PRIVATE_CHAT_MESSAGE_REQUEST)){
String meetingID = payloadObject.get("meeting_id").toString().replace("\"", "");
String requesterID = payloadObject.get("requester_id").toString().replace("\"", "");
//case getChatHistory
if(eventName.equalsIgnoreCase("get_chat_history")) {
String replyTo = meetingID + "/" + requesterID;
bbbGW.getChatHistory(meetingID, requesterID, replyTo);
}
else {
String chatType = messageObject.get("chat_type").toString().replace("\"", "");
String fromUserID = messageObject.get("from_userid").toString().replace("\"", "");
String fromUsername = messageObject.get("from_username").toString().replace("\"", "");
String fromColor = messageObject.get("from_color").toString().replace("\"", "");
String fromTime = messageObject.get("from_time").toString().replace("\"", "");
String fromTimezoneOffset = messageObject.get("from_tz_offset").toString().replace("\"", "");
String toUserID = messageObject.get("to_userid").toString().replace("\"", "");
String toUsername = messageObject.get("to_username").toString().replace("\"", "");
String tempChat = messageObject.get("message").toString();
String chatText = tempChat.substring(1, tempChat.length() - 1).replace("\\\"", "\"");
Map<String, String> map = new HashMap<String, String>();
map.put(ChatKeyUtil.CHAT_TYPE, chatType);
map.put(ChatKeyUtil.FROM_USERID, fromUserID);
map.put(ChatKeyUtil.FROM_USERNAME, fromUsername);
map.put(ChatKeyUtil.FROM_COLOR, fromColor);
map.put(ChatKeyUtil.FROM_TIME, fromTime);
map.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset);
map.put(ChatKeyUtil.TO_USERID, toUserID);
map.put(ChatKeyUtil.TO_USERNAME, toUsername);
map.put(ChatKeyUtil.MESSAGE, chatText);
if(eventName.equalsIgnoreCase(MessagingConstants.SEND_PUBLIC_CHAT_MESSAGE_REQUEST)) {
bbbGW.sendPublicMessage(meetingID, requesterID, map);
}
else if(eventName.equalsIgnoreCase(MessagingConstants.SEND_PRIVATE_CHAT_MESSAGE_REQUEST)) {
bbbGW.sendPrivateMessage(meetingID, requesterID, map);
}
}
}
}
}
}

View File

@ -0,0 +1,45 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.layout;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import scala.Option;
public class LayoutApplication {
private IBigBlueButtonInGW bbbInGW;
public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) {
bbbInGW = inGW;
}
public void broadcastLayout(String meetingID, String requesterID, String layout) {
bbbInGW.broadcastLayout(meetingID, requesterID, layout);
}
public void lockLayout(String meetingId, String setById,
Boolean lock, Boolean viewersOnly,
Option<String> layout) {
bbbInGW.lockLayout(meetingId, setById, lock, viewersOnly, layout);
}
public void getCurrentLayout(String meetingID, String requesterID) {
bbbInGW.getCurrentLayout(meetingID, requesterID);
}
}

View File

@ -0,0 +1,96 @@
package org.bigbluebutton.conference.service.messaging;
public class Constants {
public static final String NAME = "name";
public static final String HEADER = "header";
public static final String PAYLOAD = "payload";
public static final String MEETING_ID = "meeting_id";
public static final String EXTERNAL_MEETING_ID = "external_meeting_id";
public static final String TIMESTAMP = "timestamp";
public static final String USER_ID = "userid";
public static final String RECORDED = "recorded";
public static final String MEETING_NAME = "meeting_name";
public static final String VOICE_CONF = "voice_conf";
public static final String DURATION = "duration";
public static final String AUTH_TOKEN = "auth_token";
public static final String ROLE = "role";
public static final String EXT_USER_ID = "external_user_id";
public static final String REQUESTER_ID = "requester_id";
public static final String REPLY_TO = "reply_to";
public static final String LOWERED_BY = "lowered_by";
public static final String STREAM = "stream";
public static final String LOCKED = "locked";
public static final String SETTINGS = "settings";
public static final String LOCK = "lock";
public static final String EXCEPT_USERS = "except_users";
public static final String STATUS = "status";
public static final String VALUE = "value";
public static final String NEW_PRESENTER_ID = "new_presenter_id";
public static final String NEW_PRESENTER_NAME = "new_presenter_name";
public static final String ASSIGNED_BY = "assigned_by";
public static final String RECORDING = "recording";
public static final String AUTO_START_RECORDING = "auto_start_recording";
public static final String ALLOW_START_STOP_RECORDING = "allow_start_stop_recording";
public static final String LAYOUT_ID = "layout_id";
public static final String POLL = "poll";
public static final String POLL_ID = "poll_id";
public static final String FORCE = "force";
public static final String RESPONSE = "response";
public static final String PRESENTATION_ID = "presentation_id";
public static final String X_OFFSET = "x_offset";
public static final String Y_OFFSET = "y_offset";
public static final String WIDTH_RATIO = "width_ratio";
public static final String HEIGHT_RATIO = "height_ratio";
public static final String PAGE = "page";
public static final String SHARE = "share";
public static final String PRESENTATIONS = "presentations";
public static final String MESSAGE_KEY = "message_key";
public static final String CODE = "code";
public static final String PRESENTATION_NAME = "presentation_name";
public static final String NUM_PAGES = "num_pages";
public static final String MAX_NUM_PAGES = "max_num_pages";
public static final String PAGES_COMPLETED = "pages_completed";
public static final String MUTE = "mute";
public static final String CALLER_ID_NUM = "caller_id_num";
public static final String CALLER_ID_NAME = "caller_id_name";
public static final String TALKING = "talking";
public static final String USER = "user";
public static final String MUTED = "muted";
public static final String VOICE_USER = "voice_user";
public static final String RECORDING_FILE = "recording_file";
public static final String ANNOTATION = "annotation";
public static final String WHITEBOARD_ID = "whiteboard_id";
public static final String ENABLE = "enable";
public static final String PRESENTER = "presenter";
public static final String USERS = "users";
public static final String RAISE_HAND = "raise_hand";
public static final String HAS_STREAM = "has_stream";
public static final String WEBCAM_STREAM = "webcam_stream";
public static final String PHONE_USER = "phone_user";
public static final String PERMISSIONS = "permissions";
public static final String VALID = "valid";
public static final String CHAT_HISTORY = "chat_history";
public static final String MESSAGE = "message";
public static final String SET_BY_USER_ID = "set_by_user_id";
public static final String POLLS = "polls";
public static final String REASON = "reason";
public static final String RESPONDER = "responder";
public static final String PRESENTATION_INFO = "presentation_info";
public static final String SHAPES = "shapes";
public static final String SHAPE = "shape";
public static final String SHAPE_ID = "shape_id";
public static final String PRESENTATION = "presentation";
public static final String ID = "id";
public static final String CURRENT = "current";
public static final String PAGES = "pages";
public static final String WEB_USER_ID = "web_user_id";
public static final String JOINED = "joined";
public static final String X_PERCENT = "x_percent";
public static final String Y_PERCENT = "y_percent";
public static final String KEEP_ALIVE_ID = "keep_alive_id";
public static final String INTERNAL_USER_ID = "internal_user_id";
public static final String MODERATOR_PASS = "moderator_pass";
public static final String VIEWER_PASS = "viewer_pass";
public static final String CREATE_TIME = "create_time";
public static final String CREATE_DATE = "create_date";
}

View File

@ -0,0 +1,37 @@
package org.bigbluebutton.conference.service.messaging;
public class CreateMeetingMessage implements IMessage {
public static final String CREATE_MEETING_REQUEST_EVENT = "create_meeting_request";
public static final String VERSION = "0.0.1";
public final String id;
public final String externalId;
public final String name;
public final Boolean record;
public final String voiceBridge;
public final Long duration;
public final Boolean autoStartRecording;
public final Boolean allowStartStopRecording;
public final String moderatorPass;
public final String viewerPass;
public final Long createTime;
public final String createDate;
public CreateMeetingMessage(String id, String externalId, String name, Boolean record, String voiceBridge,
Long duration, Boolean autoStartRecording,
Boolean allowStartStopRecording, String moderatorPass,
String viewerPass, Long createTime, String createDate) {
this.id = id;
this.externalId = externalId;
this.name = name;
this.record = record;
this.voiceBridge = voiceBridge;
this.duration = duration;
this.autoStartRecording = autoStartRecording;
this.allowStartStopRecording = allowStartStopRecording;
this.moderatorPass = moderatorPass;
this.viewerPass = viewerPass;
this.createTime = createTime;
this.createDate = createDate;
}
}

View File

@ -0,0 +1,12 @@
package org.bigbluebutton.conference.service.messaging;
public class DestroyMeetingMessage implements IMessage {
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

@ -0,0 +1,12 @@
package org.bigbluebutton.conference.service.messaging;
public class EndMeetingMessage implements IMessage {
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;
}
}

View File

@ -0,0 +1,12 @@
package org.bigbluebutton.conference.service.messaging;
public class GetAllMeetingsRequest implements IMessage {
public static final String GET_ALL_MEETINGS_REQUEST_EVENT = "get_all_meetings_request";
public static final String VERSION = "0.0.1";
public final String meetingId;
public GetAllMeetingsRequest(String meetingId) {
this.meetingId = meetingId;
}
}

View File

@ -0,0 +1,5 @@
package org.bigbluebutton.conference.service.messaging;
public interface IMessage {
}

View File

@ -0,0 +1,12 @@
package org.bigbluebutton.conference.service.messaging;
public class KeepAliveMessage implements IMessage {
public static final String KEEP_ALIVE_REQUEST = "keep_alive_request";
public static final String VERSION = "0.0.1";
public final String keepAliveId;
public KeepAliveMessage(String keepAliveId) {
this.keepAliveId = keepAliveId;
}
}

View File

@ -0,0 +1,36 @@
package org.bigbluebutton.conference.service.messaging;
import java.util.concurrent.TimeUnit;
import com.google.gson.Gson;
public class MessageBuilder {
public final static String VERSION = "version";
public static long generateTimestamp() {
return TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
}
public static java.util.HashMap<String, Object> buildHeader(String name, String version, String replyTo) {
java.util.HashMap<String, Object> header = new java.util.HashMap<String, Object>();
header.put(Constants.NAME, name);
header.put(VERSION, version);
header.put(Constants.TIMESTAMP, generateTimestamp());
if (replyTo != null && replyTo != "")
header.put(Constants.REPLY_TO, replyTo);
return header;
}
public static String buildJson(java.util.HashMap<String, Object> header,
java.util.HashMap<String, Object> payload) {
java.util.HashMap<String, java.util.HashMap<String, Object>> message = new java.util.HashMap<String, java.util.HashMap<String, Object>>();
message.put(Constants.HEADER, header);
message.put(Constants.PAYLOAD, payload);
Gson gson = new Gson();
return gson.toJson(message);
}
}

View File

@ -0,0 +1,89 @@
package org.bigbluebutton.conference.service.messaging;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MessageFromJsonConverter {
public static IMessage convert(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
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();
switch (messageName) {
case CreateMeetingMessage.CREATE_MEETING_REQUEST_EVENT:
return processCreateMeeting(payload);
case DestroyMeetingMessage.DESTROY_MEETING_REQUEST_EVENT:
return processDestroyMeeting(payload);
case EndMeetingMessage.END_MEETING_REQUEST_EVENT:
return processEndMeetingMessage(payload);
case KeepAliveMessage.KEEP_ALIVE_REQUEST:
return processKeepAlive(payload);
case RegisterUserMessage.REGISTER_USER:
System.out.println("Registering a user");
return RegisterUserMessage.fromJson(message);
case ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN:
return processValidateAuthTokenMessage(header, payload);
case UserConnectedToGlobalAudio.USER_CONNECTED_TO_GLOBAL_AUDIO:
return UserConnectedToGlobalAudio.fromJson(message);
case UserDisconnectedFromGlobalAudio.USER_DISCONNECTED_FROM_GLOBAL_AUDIO:
return UserDisconnectedFromGlobalAudio.fromJson(message);
case GetAllMeetingsRequest.GET_ALL_MEETINGS_REQUEST_EVENT:
return new GetAllMeetingsRequest("the_string_is_not_used_anywhere");
}
}
}
return null;
}
private static IMessage processValidateAuthTokenMessage(JsonObject header, JsonObject payload) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
String authToken = payload.get(Constants.AUTH_TOKEN).getAsString();
String replyTo = header.get(Constants.REPLY_TO).getAsString();
String sessionId = "tobeimplemented";
return new ValidateAuthTokenMessage(id, userid, authToken, replyTo,
sessionId);
}
private static IMessage processCreateMeeting(JsonObject payload) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String externalId = payload.get(Constants.EXTERNAL_MEETING_ID).getAsString();
String name = payload.get(Constants.NAME).getAsString();
Boolean record = payload.get(Constants.RECORDED).getAsBoolean();
String voiceBridge = payload.get(Constants.VOICE_CONF).getAsString();
Long duration = payload.get(Constants.DURATION).getAsLong();
Boolean autoStartRecording = payload.get(Constants.AUTO_START_RECORDING).getAsBoolean();
Boolean allowStartStopRecording = payload.get(Constants.ALLOW_START_STOP_RECORDING).getAsBoolean();
String moderatorPassword = payload.get(Constants.MODERATOR_PASS).getAsString();
String viewerPassword = payload.get(Constants.VIEWER_PASS).getAsString();
Long createTime = payload.get(Constants.CREATE_TIME).getAsLong();
String createDate = payload.get(Constants.CREATE_DATE).getAsString();
return new CreateMeetingMessage(id, externalId, name, record, voiceBridge,
duration, autoStartRecording, allowStartStopRecording,
moderatorPassword, viewerPassword, createTime, createDate);
}
private static IMessage processDestroyMeeting(JsonObject payload) {
String id = payload.get(Constants.MEETING_ID).getAsString();
return new DestroyMeetingMessage(id);
}
private static IMessage processEndMeetingMessage(JsonObject payload) {
String id = payload.get(Constants.MEETING_ID).getAsString();
return new EndMeetingMessage(id);
}
private static IMessage processKeepAlive(JsonObject payload) {
String id = payload.get(Constants.KEEP_ALIVE_ID).getAsString();
return new KeepAliveMessage(id);
}
//private static IMessage processGetAllMeetings(JsonObject)
}

View File

@ -0,0 +1,59 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.conference.service.messaging;
public class MessagingConstants {
public static final String FROM_BBB_APPS_CHANNEL = "bigbluebutton:from-bbb-apps";
public static final String FROM_BBB_APPS_PATTERN = FROM_BBB_APPS_CHANNEL + ":*";
public static final String FROM_SYSTEM_CHANNEL = FROM_BBB_APPS_CHANNEL + ":system";
public static final String FROM_MEETING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":meeting";
public static final String FROM_PRESENTATION_CHANNEL = FROM_BBB_APPS_CHANNEL + ":presentation";
public static final String FROM_POLLING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":polling";
public static final String FROM_USERS_CHANNEL = FROM_BBB_APPS_CHANNEL + ":users";
public static final String FROM_CHAT_CHANNEL = FROM_BBB_APPS_CHANNEL + ":chat";
public static final String FROM_WHITEBOARD_CHANNEL = FROM_BBB_APPS_CHANNEL + ":whiteboard";
public static final String TO_BBB_APPS_CHANNEL = "bigbluebutton:to-bbb-apps";
public static final String TO_BBB_APPS_PATTERN = TO_BBB_APPS_CHANNEL + ":*";
public static final String TO_MEETING_CHANNEL = TO_BBB_APPS_CHANNEL + ":meeting";
public static final String TO_SYSTEM_CHANNEL = TO_BBB_APPS_CHANNEL + ":system";
public static final String TO_PRESENTATION_CHANNEL = TO_BBB_APPS_CHANNEL + ":presentation";
public static final String TO_POLLING_CHANNEL = TO_BBB_APPS_CHANNEL + ":polling";
public static final String TO_USERS_CHANNEL = TO_BBB_APPS_CHANNEL + ":users";
public static final String TO_CHAT_CHANNEL = TO_BBB_APPS_CHANNEL + ":chat";
public static final String TO_VOICE_CHANNEL = TO_BBB_APPS_CHANNEL + ":voice";
public static final String TO_WHITEBOARD_CHANNEL = TO_BBB_APPS_CHANNEL + ":whiteboard";
public static final String DESTROY_MEETING_REQUEST_EVENT = "DestroyMeetingRequestEvent";
public static final String CREATE_MEETING_REQUEST_EVENT = "CreateMeetingRequestEvent";
public static final String END_MEETING_REQUEST_EVENT = "EndMeetingRequestEvent";
public static final String MEETING_STARTED_EVENT = "meeting_created_message";
public static final String MEETING_ENDED_EVENT = "meeting_ended_event";
public static final String MEETING_DESTROYED_EVENT = "meeting_destroyed_event";
public static final String USER_JOINED_EVENT = "UserJoinedEvent";
public static final String USER_LEFT_EVENT = "UserLeftEvent";
public static final String USER_LEFT_VOICE_REQUEST = "user_left_voice_request";
public static final String USER_STATUS_CHANGE_EVENT = "UserStatusChangeEvent";
public static final String SEND_POLLS_EVENT = "SendPollsEvent";
public static final String RECORD_STATUS_EVENT = "RecordStatusEvent";
public static final String SEND_PUBLIC_CHAT_MESSAGE_REQUEST = "send_public_chat_message_request";
public static final String SEND_PRIVATE_CHAT_MESSAGE_REQUEST = "send_private_chat_message_request";
public static final String MUTE_USER_REQUEST = "mute_user_request";
}

View File

@ -0,0 +1,27 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.messaging;
import redis.clients.jedis.Jedis;
public interface MessagingService {
public void send(String channel, String message);
public Jedis createRedisClient();
public void dropRedisClient(Jedis jedis);
}

View File

@ -0,0 +1,73 @@
package org.bigbluebutton.conference.service.messaging;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class RegisterUserMessage implements IMessage {
public static final String REGISTER_USER = "register_user_request";
public final String VERSION = "0.0.1";
public final String meetingID;
public final String internalUserId;
public final String fullname;
public final String role;
public final String externUserID;
public final String authToken;
public RegisterUserMessage(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken) {
this.meetingID = meetingID;
this.internalUserId = internalUserId;
this.fullname = fullname;
this.role = role;
this.externUserID = externUserID;
this.authToken = authToken;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingID);
payload.put(Constants.INTERNAL_USER_ID, internalUserId);
payload.put(Constants.NAME, fullname);
payload.put(Constants.ROLE, role);
payload.put(Constants.EXT_USER_ID, externUserID);
payload.put(Constants.AUTH_TOKEN, authToken);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(REGISTER_USER, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static RegisterUserMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
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 (REGISTER_USER.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.NAME)
&& payload.has(Constants.ROLE)
&& payload.has(Constants.EXT_USER_ID)
&& payload.has(Constants.AUTH_TOKEN)) {
String meetingID = payload.get(Constants.MEETING_ID).getAsString();
String fullname = payload.get(Constants.NAME).getAsString();
String role = payload.get(Constants.ROLE).getAsString();
String externUserID = payload.get(Constants.EXT_USER_ID).getAsString();
String authToken = payload.get(Constants.AUTH_TOKEN).getAsString();
//use externalUserId twice - once for external, once for internal
return new RegisterUserMessage(meetingID, externUserID, fullname, role, externUserID, authToken);
}
}
}
}
System.out.println("Failed to parse RegisterUserMessage");
return null;
}
}

View File

@ -0,0 +1,59 @@
package org.bigbluebutton.conference.service.messaging;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class UserConnectedToGlobalAudio implements IMessage {
public static final String USER_CONNECTED_TO_GLOBAL_AUDIO = "user_connected_to_global_audio";
public static final String VERSION = "0.0.1";
public final String voiceConf;
public final String name;
public final String userid;
public UserConnectedToGlobalAudio(String voiceConf, String userid, String name) {
this.voiceConf = voiceConf;
this.userid = userid;
this.name = name;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.VOICE_CONF, voiceConf);
payload.put(Constants.USER_ID, userid);
payload.put(Constants.NAME, name);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(USER_CONNECTED_TO_GLOBAL_AUDIO, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static UserConnectedToGlobalAudio fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
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 (USER_CONNECTED_TO_GLOBAL_AUDIO.equals(messageName)) {
if (payload.has(Constants.VOICE_CONF)
&& payload.has(Constants.USER_ID)
&& payload.has(Constants.NAME)) {
String voiceConf = payload.get(Constants.VOICE_CONF).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
String name = payload.get(Constants.NAME).getAsString();
return new UserConnectedToGlobalAudio(voiceConf, userid, name);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,56 @@
package org.bigbluebutton.conference.service.messaging;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class UserDisconnectedFromGlobalAudio implements IMessage {
public static final String USER_DISCONNECTED_FROM_GLOBAL_AUDIO = "user_disconnected_from_global_audio";
public static final String VERSION = "0.0.1";
public final String voiceConf;
public final String name;
public final String userid;
public UserDisconnectedFromGlobalAudio(String voiceConf, String userid, String name) {
this.voiceConf = voiceConf;
this.userid = userid;
this.name = name;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.VOICE_CONF, voiceConf);
payload.put(Constants.USER_ID, userid);
payload.put(Constants.NAME, name);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(USER_DISCONNECTED_FROM_GLOBAL_AUDIO, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static UserDisconnectedFromGlobalAudio fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
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 (USER_DISCONNECTED_FROM_GLOBAL_AUDIO.equals(messageName)) {
if (payload.has(Constants.VOICE_CONF)
&& payload.has(Constants.USER_ID)
&& payload.has(Constants.NAME)) {
String voiceConf = payload.get(Constants.VOICE_CONF).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
String name = payload.get(Constants.NAME).getAsString();
return new UserDisconnectedFromGlobalAudio(voiceConf, userid, name);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,20 @@
package org.bigbluebutton.conference.service.messaging;
public class ValidateAuthTokenMessage implements IMessage {
public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public final String token;
public final String replyTo;
public final String sessionId;
public ValidateAuthTokenMessage(String meetingId, String userId, String token, String replyTo, String sessionId) {
this.meetingId = meetingId;
this.userId = userId;
this.token = token;
this.replyTo = replyTo;
this.sessionId = sessionId;
}
}

View File

@ -0,0 +1,25 @@
package org.bigbluebutton.conference.service.messaging.redis;
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);
}
}
}

View File

@ -0,0 +1,23 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.messaging.redis;
public interface MessageHandler {
void handleMessage(String pattern, String channel, String message);
}

View File

@ -0,0 +1,85 @@
package org.bigbluebutton.conference.service.messaging.redis;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPubSub;
public class MessageReceiver {
private ReceivedMessageHandler handler;
private JedisPool redisPool;
private volatile boolean receiveMessage = false;
private final Executor msgReceiverExec = Executors.newSingleThreadExecutor();
public void stop() {
receiveMessage = false;
}
public void start() {
// log.info("Ready to receive messages from Redis pubsub.");
try {
receiveMessage = true;
final Jedis jedis = redisPool.getResource();
Runnable messageReceiver = new Runnable() {
public void run() {
if (receiveMessage) {
jedis.psubscribe(new PubSubListener(), MessagingConstants.TO_BBB_APPS_PATTERN);
}
}
};
msgReceiverExec.execute(messageReceiver);
} catch (Exception e) {
// log.error("Error subscribing to channels: " + e.getMessage());
}
}
public void setRedisPool(JedisPool redisPool){
this.redisPool = redisPool;
}
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(String pattern, String channel, String message) {
handler.handleMessage(pattern, channel, message);
}
@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

@ -0,0 +1,70 @@
package org.bigbluebutton.conference.service.messaging.redis;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
public class MessageSender {
private JedisPool redisPool;
private volatile boolean sendMessage = false;
private final Executor msgSenderExec = Executors.newSingleThreadExecutor();
private final Executor runExec = Executors.newSingleThreadExecutor();
private BlockingQueue<MessageToSend> messages = new LinkedBlockingQueue<MessageToSend>();
public void stop() {
sendMessage = false;
}
public void start() {
// log.info("Redis message publisher starting!");
try {
sendMessage = true;
Runnable messageSender = new Runnable() {
public void run() {
while (sendMessage) {
try {
MessageToSend msg = messages.take();
publish(msg.getChannel(), msg.getMessage());
} catch (InterruptedException e) {
// log.warn("Failed to get message from queue.");
}
}
}
};
msgSenderExec.execute(messageSender);
} catch (Exception e) {
// log.error("Error subscribing to channels: " + e.getMessage());
}
}
public void send(String channel, String message) {
MessageToSend msg = new MessageToSend(channel, message);
messages.add(msg);
}
private void publish(final String channel, final String message) {
Runnable task = new Runnable() {
public void run() {
Jedis jedis = redisPool.getResource();
try {
jedis.publish(channel, message);
} catch(Exception e){
// log.warn("Cannot publish the message to redis", e);
} finally {
redisPool.returnResource(jedis);
}
}
};
runExec.execute(task);
}
public void setRedisPool(JedisPool redisPool){
this.redisPool = redisPool;
}
}

View File

@ -0,0 +1,19 @@
package org.bigbluebutton.conference.service.messaging.redis;
public class MessageToSend {
private final String channel;
private final String message;
public MessageToSend(String channel, String message) {
this.channel = channel;
this.message = message;
}
public String getChannel() {
return channel;
}
public String getMessage() {
return message;
}
}

View File

@ -0,0 +1,28 @@
package org.bigbluebutton.conference.service.messaging.redis;
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;
}
public String getPattern() {
return pattern;
}
public String getChannel() {
return channel;
}
public String getMessage() {
return message;
}
}

View File

@ -0,0 +1,68 @@
package org.bigbluebutton.conference.service.messaging.redis;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
public class ReceivedMessageHandler {
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!");
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) {
handler.notifyListeners(msg.getPattern(), msg.getChannel(), msg.getMessage());
} else {
// log.info("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;
}
}

View File

@ -0,0 +1,56 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.presentation;
public class ConversionUpdatesProcessor {
// private PresentationApplication presentationApplication;
public void sendConversionUpdate(String messageKey, String conference,
String code, String presId, String presName) {
// presentationApplication.sendConversionUpdate(messageKey, conference,
// code, presId, presName);
}
public void sendPageCountError(String messageKey, String conference,
String code, String presId, int numberOfPages,
int maxNumberPages, String presName) {
// presentationApplication.sendPageCountError(messageKey, conference,
// code, presId, numberOfPages,
// maxNumberPages, presName);
}
public void sendSlideGenerated(String messageKey, String conference,
String code, String presId, int numberOfPages,
int pagesCompleted, String presName) {
// presentationApplication.sendSlideGenerated(messageKey, conference,
// code, presId, numberOfPages, pagesCompleted, presName);
}
public void sendConversionCompleted(String messageKey, String conference,
String code, String presId, Integer numberOfPages, String presName,
String presBaseUrl) {
// presentationApplication.sendConversionCompleted(messageKey, conference,
// code, presId, numberOfPages, presName, presBaseUrl);
}
// public void setPresentationApplication(PresentationApplication a) {
// presentationApplication = a;
// }
}

View File

@ -0,0 +1,147 @@
package org.bigbluebutton.conference.service.presentation;
import java.util.HashMap;
import java.util.Map;
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
import org.bigbluebutton.conference.service.messaging.redis.MessageHandler;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import com.google.gson.JsonParser;
import com.google.gson.JsonObject;
public class PresentationMessageListener implements MessageHandler {
public static final String OFFICE_DOC_CONVERSION_SUCCESS_KEY = "OFFICE_DOC_CONVERSION_SUCCESS";
public static final String OFFICE_DOC_CONVERSION_FAILED_KEY = "OFFICE_DOC_CONVERSION_FAILED";
public static final String SUPPORTED_DOCUMENT_KEY = "SUPPORTED_DOCUMENT";
public static final String UNSUPPORTED_DOCUMENT_KEY = "UNSUPPORTED_DOCUMENT";
public static final String PAGE_COUNT_FAILED_KEY = "PAGE_COUNT_FAILED";
public static final String PAGE_COUNT_EXCEEDED_KEY = "PAGE_COUNT_EXCEEDED";
public static final String GENERATED_SLIDE_KEY = "GENERATED_SLIDE";
public static final String GENERATING_THUMBNAIL_KEY = "GENERATING_THUMBNAIL";
public static final String GENERATED_THUMBNAIL_KEY = "GENERATED_THUMBNAIL";
public static final String CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED";
private ConversionUpdatesProcessor conversionUpdatesProcessor;
private IBigBlueButtonInGW bbbInGW;
public void setConversionUpdatesProcessor(ConversionUpdatesProcessor p) {
conversionUpdatesProcessor = p;
}
public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) {
bbbInGW = inGW;
}
private void sendConversionUpdate(String messageKey, String conference,
String code, String presId, String filename) {
conversionUpdatesProcessor.sendConversionUpdate(messageKey, conference,
code, presId, filename);
}
public void sendPageCountError(String messageKey, String conference,
String code, String presId, Integer numberOfPages,
Integer maxNumberPages, String filename) {
conversionUpdatesProcessor.sendPageCountError(messageKey, conference,
code, presId, numberOfPages,
maxNumberPages, filename);
}
private void sendSlideGenerated(String messageKey, String conference,
String code, String presId, Integer numberOfPages,
Integer pagesCompleted, String filename) {
conversionUpdatesProcessor.sendSlideGenerated(messageKey, conference,
code, presId, numberOfPages,
pagesCompleted, filename);
}
private void sendConversionCompleted(String messageKey, String conference,
String code, String presId, Integer numberOfPages,
String filename, String presBaseUrl) {
conversionUpdatesProcessor.sendConversionCompleted(messageKey, conference,
code, presId, numberOfPages, filename, presBaseUrl);
}
@Override
public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.TO_PRESENTATION_CHANNEL)) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if(obj.has("payload") && obj.has("header")) {
JsonObject headerObject = (JsonObject) obj.get("header");
JsonObject payloadObject = (JsonObject) obj.get("payload");
String eventName = headerObject.get("name").toString().replace("\"", "");
if(eventName.equalsIgnoreCase("presentation_page_changed_message") ||
eventName.equalsIgnoreCase("presentation_page_resized_message")) {
JsonObject pageObject = (JsonObject) payloadObject.get("page");
String roomName = payloadObject.get("meeting_id").toString().replace("\"", "");
if(eventName.equalsIgnoreCase("presentation_page_changed_message")) {
String pageId = pageObject.get("id").toString().replace("\"", "");
bbbInGW.gotoSlide(roomName, pageId);
} else if(eventName.equalsIgnoreCase("presentation_page_resized_message")) {
String xOffset = pageObject.get("x_offset").toString().replace("\"", "");
String yOffset = pageObject.get("y_offset").toString().replace("\"", "");
String widthRatio = pageObject.get("width_ratio").toString().replace("\"", "");
String heightRatio = pageObject.get("height_ratio").toString().replace("\"", "");
bbbInGW.resizeAndMoveSlide(roomName, Double.parseDouble(xOffset), Double.parseDouble(yOffset), Double.parseDouble(widthRatio), Double.parseDouble(heightRatio));
}
}
}
else {
Gson gson = new Gson();
HashMap<String,String> map = gson.fromJson(message, new TypeToken<Map<String, String>>() {}.getType());
String code = (String) map.get("returnCode");
String presId = (String) map.get("presentationId");
String filename = (String) map.get("filename");
String conference = (String) map.get("conference");
String messageKey = (String) map.get("messageKey");
if (messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_SUCCESS_KEY) ||
messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_FAILED_KEY) ||
messageKey.equalsIgnoreCase(SUPPORTED_DOCUMENT_KEY) ||
messageKey.equalsIgnoreCase(UNSUPPORTED_DOCUMENT_KEY) ||
messageKey.equalsIgnoreCase(GENERATING_THUMBNAIL_KEY) ||
messageKey.equalsIgnoreCase(GENERATED_THUMBNAIL_KEY) ||
messageKey.equalsIgnoreCase(PAGE_COUNT_FAILED_KEY)){
sendConversionUpdate(messageKey, conference, code, presId, filename);
} else if(messageKey.equalsIgnoreCase(PAGE_COUNT_EXCEEDED_KEY)){
Integer numberOfPages = new Integer((String) map.get("numberOfPages"));
Integer maxNumberPages = new Integer((String) map.get("maxNumberPages"));
sendPageCountError(messageKey, conference, code,
presId, numberOfPages, maxNumberPages, filename);
} else if(messageKey.equalsIgnoreCase(GENERATED_SLIDE_KEY)){
Integer numberOfPages = new Integer((String) map.get("numberOfPages"));
Integer pagesCompleted = new Integer((String) map.get("pagesCompleted"));
sendSlideGenerated(messageKey, conference, code,
presId, numberOfPages, pagesCompleted, filename);
} else if(messageKey.equalsIgnoreCase(CONVERSION_COMPLETED_KEY)){
Integer numberOfPages = new Integer((String) map.get("numberOfPages"));
String presBaseUrl = (String) map.get("presentationBaseUrl");
sendConversionCompleted(messageKey, conference, code,
presId, numberOfPages, filename, presBaseUrl);
}
}
}
}
}

View File

@ -0,0 +1,12 @@
package org.bigbluebutton.conference.service.presentation;
public class PreuploadedPresentation {
public final String id;
public final int numPages;
public PreuploadedPresentation(String id, int numPages) {
this.id = id;
this.numPages = numPages;
}
}

View File

@ -0,0 +1,55 @@
package org.bigbluebutton.conference.service.presentation;
import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
import java.util.ArrayList;
public class PreuploadedPresentationsUtil {
private String bbbDir = "/var/bigbluebutton/";
public ArrayList<PreuploadedPresentation> getPreuploadedPresentations(String meetingID) {
ArrayList<PreuploadedPresentation> preuploadedPresentations = new ArrayList<PreuploadedPresentation>();
try {
// TODO: this is hard-coded, and not really a great abstraction. need to fix this up later
String folderPath = bbbDir + meetingID + "/" + meetingID;
File folder = new File(folderPath);
//log.debug("folder: {} - exists: {} - isDir: {}", folder.getAbsolutePath(), folder.exists(), folder.isDirectory());
if (folder.exists() && folder.isDirectory()) {
File[] presentations = folder.listFiles(new FileFilter() {
public boolean accept(File path) {
return path.isDirectory();
}
});
for (File presFile : presentations) {
int numPages = getNumPages(presFile);
PreuploadedPresentation p = new PreuploadedPresentation(presFile.getName(), numPages);
preuploadedPresentations.add(p);
}
}
} catch (Exception ex) {
}
return preuploadedPresentations;
}
private int getNumPages(File presDir) {
File[] files = presDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".swf");
}
});
return files.length;
}
public void setBigBlueButtonDirectory(String dir) {
if (dir.endsWith("/")) bbbDir = dir;
else bbbDir = dir + "/";
}
}

View File

@ -0,0 +1,142 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder;
import org.apache.commons.pool.impl.GenericObjectPool;
public class GenericObjectPoolConfigWrapper {
private final GenericObjectPool.Config config;
public GenericObjectPoolConfigWrapper() {
this.config = new GenericObjectPool.Config();
}
public GenericObjectPool.Config getConfig() {
return config;
}
public int getMaxIdle() {
return this.config.maxIdle;
}
public void setMaxIdle(int maxIdle) {
this.config.maxIdle = maxIdle;
}
public int getMinIdle() {
return this.config.minIdle;
}
public void setMinIdle(int minIdle) {
this.config.minIdle = minIdle;
}
public int getMaxActive() {
return this.config.maxActive;
}
public void setMaxActive(int maxActive) {
this.config.maxActive = maxActive;
}
public long getMaxWait() {
return this.config.maxWait;
}
public void setMaxWait(long maxWait) {
this.config.maxWait = maxWait;
}
public byte getWhenExhaustedAction() {
return this.config.whenExhaustedAction;
}
public void setWhenExhaustedAction(byte whenExhaustedAction) {
this.config.whenExhaustedAction = whenExhaustedAction;
}
public boolean isTestOnBorrow() {
return this.config.testOnBorrow;
}
public void setTestOnBorrow(boolean testOnBorrow) {
this.config.testOnBorrow = testOnBorrow;
}
public boolean isTestOnReturn() {
return this.config.testOnReturn;
}
public void setTestOnReturn(boolean testOnReturn) {
this.config.testOnReturn = testOnReturn;
}
public boolean isTestWhileIdle() {
return this.config.testWhileIdle;
}
public void setTestWhileIdle(boolean testWhileIdle) {
this.config.testWhileIdle = testWhileIdle;
}
public long getTimeBetweenEvictionRunsMillis() {
return this.config.timeBetweenEvictionRunsMillis;
}
public void setTimeBetweenEvictionRunsMillis(
long timeBetweenEvictionRunsMillis) {
this.config.timeBetweenEvictionRunsMillis =
timeBetweenEvictionRunsMillis;
}
public int getNumTestsPerEvictionRun() {
return this.config.numTestsPerEvictionRun;
}
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
this.config.numTestsPerEvictionRun = numTestsPerEvictionRun;
}
public long getMinEvictableIdleTimeMillis() {
return this.config.minEvictableIdleTimeMillis;
}
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) {
this.config.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
}
public long getSoftMinEvictableIdleTimeMillis() {
return this.config.softMinEvictableIdleTimeMillis;
}
public void setSoftMinEvictableIdleTimeMillis(
long softMinEvictableIdleTimeMillis) {
this.config.softMinEvictableIdleTimeMillis =
softMinEvictableIdleTimeMillis;
}
public boolean isLifo() {
return this.config.lifo;
}
public void setLifo(boolean lifo) {
this.config.lifo = lifo;
}
}

View File

@ -0,0 +1,85 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder;
import java.util.HashMap;
/**
* Abstract class for all events that need to be recorded.
* @author Richard Alam
*
*/
public abstract class RecordEvent {
protected final HashMap<String, String> eventMap = new HashMap<String, String>();
protected final static String MODULE = "module";
protected final static String TIMESTAMP = "timestamp";
protected final static String MEETING = "meetingId";
protected final static String EVENT = "eventName";
public final String getMeetingID() {
return eventMap.get(MEETING);
}
/**
* Set the module that generated the event.
* @param module
*/
public final void setModule(String module) {
eventMap.put(MODULE, module);
}
/**
* Set the timestamp of the event.
* @param timestamp
*/
public final void setTimestamp(long timestamp) {
eventMap.put(TIMESTAMP, Long.toString(timestamp));
}
/**
* Set the meetingId for this particular event.
* @param meetingId
*/
public final void setMeetingId(String meetingId) {
eventMap.put(MEETING, meetingId);
}
/**
* Set the name of the event.
* @param event
*/
public final void setEvent(String event) {
eventMap.put(EVENT, event);
}
/**
* Convert the event into a Map to be recorded.
* @return
*/
public final HashMap<String, String> toMap() {
return eventMap;
}
@Override
public String toString() {
return eventMap.get(MODULE) + " " + eventMap.get(EVENT);
}
}

View File

@ -0,0 +1,35 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder;
/**
*
* The IRecorder interface define all the neccesary methods to implement for
* dispatch events to a JMS queue
*
* */
public interface Recorder {
/**
* Receive the messages from the bigbluebutton modules and send
* them to a queue. These messages are the events generated in a conference.
* @param message a JSON String message with the attributes of an event
*/
public void record(String session, RecordEvent event);
}

View File

@ -0,0 +1,105 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import org.bigbluebutton.service.recording.RedisListRecorder;
/**
*
* The RecorderApplication class is used for setting the record module
* in BigBlueButton for send events messages to a JMS queue.
* The class follows the same standard as the others modules of BigBlueButton Apps.
*/
public class RecorderApplication {
private static final int NTHREADS = 1;
private static final Executor exec = Executors.newFixedThreadPool(NTHREADS);
private static final Executor runExec = Executors.newFixedThreadPool(NTHREADS);
private BlockingQueue<RecordEvent> messages;
private volatile boolean recordEvents = false;
private RedisListRecorder redisListRecorder;
private Recorder recorder;
public RecorderApplication() {
messages = new LinkedBlockingQueue<RecordEvent>();
}
public void start() {
recordEvents = true;
Runnable sender = new Runnable() {
public void run() {
while (recordEvents) {
RecordEvent message;
try {
message = messages.take();
recordEvent(message);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
};
exec.execute(sender);
}
public void stop() {
recordEvents = false;
}
public void destroyRecordSession(String meetingID) {
// recordingSessions.remove(meetingID);
}
public void createRecordSession(String meetingID) {
// recordingSessions.put(meetingID, meetingID);
}
public void record(String meetingID, RecordEvent message) {
messages.offer(message);
}
private void recordEvent(final RecordEvent message) {
Runnable task = new Runnable() {
public void run() {
recorder.record(message.getMeetingID(), message);
}
};
runExec.execute(task);
}
public void setRecorder(Recorder recorder) {
this.recorder = recorder;
// log.debug("setting recorder");
}
public void setRedisListRecorder(RedisListRecorder rec) {
redisListRecorder = rec;
}
}

View File

@ -0,0 +1,53 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.conference.service.recorder;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
public class RedisDispatcher implements Recorder {
private static final String COLON=":";
JedisPool redisPool;
public RedisDispatcher() {
super();
}
@Override
public void record(String session, RecordEvent message) {
Jedis jedis = redisPool.getResource();
try {
Long msgid = jedis.incr("global:nextRecordedMsgId");
jedis.hmset("recording" + COLON + session + COLON + msgid, message.toMap());
jedis.rpush("meeting" + COLON + session + COLON + "recordings", msgid.toString());
} finally {
redisPool.returnResource(jedis);
}
}
public JedisPool getRedisPool() {
return redisPool;
}
public void setRedisPool(JedisPool redisPool) {
this.redisPool = redisPool;
}
}

View File

@ -0,0 +1,28 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.chat;
import org.bigbluebutton.conference.service.recorder.RecordEvent;
public abstract class AbstractChatRecordEvent extends RecordEvent {
public AbstractChatRecordEvent() {
setModule("CHAT");
}
}

View File

@ -0,0 +1,43 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.chat;
public class PublicChatRecordEvent extends AbstractChatRecordEvent {
private static final String SENDER = "sender";
private static final String MESSAGE = "message";
private static final String COLOR = "color";
public PublicChatRecordEvent() {
super();
setEvent("PublicChatEvent");
}
public void setSender(String sender) {
eventMap.put(SENDER, sender);
}
public void setMessage(String message) {
eventMap.put(MESSAGE, message);
}
public void setColor(String color) {
eventMap.put(COLOR, color);
}
}

View File

@ -0,0 +1,28 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.participants;
import org.bigbluebutton.conference.service.recorder.RecordEvent;
public abstract class AbstractParticipantRecordEvent extends RecordEvent {
public AbstractParticipantRecordEvent() {
setModule("PARTICIPANT");
}
}

View File

@ -0,0 +1,39 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.participants;
public class AssignPresenterRecordEvent extends AbstractParticipantRecordEvent {
public AssignPresenterRecordEvent() {
super();
setEvent("AssignPresenterEvent");
}
public void setUserId(String userid) {
eventMap.put("userid", userid);
}
public void setName(String name) {
eventMap.put("name", name);
}
public void setAssignedBy(String by) {
eventMap.put("assignedBy", by);
}
}

View File

@ -0,0 +1,27 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.participants;
public class ParticipantEndAndKickAllRecordEvent extends AbstractParticipantRecordEvent {
public ParticipantEndAndKickAllRecordEvent() {
super();
setEvent("EndAndKickAllEvent");
}
}

View File

@ -0,0 +1,47 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.conference.service.recorder.participants;
public class ParticipantJoinRecordEvent extends AbstractParticipantRecordEvent {
public ParticipantJoinRecordEvent() {
super();
setEvent("ParticipantJoinEvent");
}
public void setUserId(String userId) {
eventMap.put("userId", userId);
}
public void setName(String name){
eventMap.put("name",name);
}
/**
* Sets the role of the user as MODERATOR or VIEWER
* @param role
*/
public void setRole(String role) {
eventMap.put("role", role);
}
public void setStatus(String status) {
eventMap.put("status", status);
}
}

View File

@ -0,0 +1,32 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.participants;
public class ParticipantLeftRecordEvent extends AbstractParticipantRecordEvent {
public ParticipantLeftRecordEvent() {
super();
setEvent("ParticipantLeftEvent");
}
public void setUserId(String userId) {
eventMap.put("userId", userId);
}
}

View File

@ -0,0 +1,39 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.participants;
public class ParticipantStatusChangeRecordEvent extends AbstractParticipantRecordEvent {
public ParticipantStatusChangeRecordEvent() {
super();
setEvent("ParticipantStatusChangeEvent");
}
public void setUserId(String userId) {
eventMap.put("userId", userId);
}
public void setStatus(String status) {
eventMap.put("status", status);
}
public void setValue(String value) {
eventMap.put("value", value);
}
}

View File

@ -0,0 +1,35 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.participants;
public class RecordStatusRecordEvent extends AbstractParticipantRecordEvent {
public RecordStatusRecordEvent() {
super();
setEvent("RecordStatusEvent");
}
public void setUserId(String userId) {
eventMap.put("userId", userId);
}
public void setRecordingStatus(String status) {
eventMap.put("status", status);
}
}

View File

@ -0,0 +1,29 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.conference.service.recorder.polling;
import org.bigbluebutton.conference.service.recorder.RecordEvent;
public abstract class AbstractPollRecordEvent extends RecordEvent {
public AbstractPollRecordEvent() {
setModule("POLL");
}
}

View File

@ -0,0 +1,35 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.polling;
public class PollClearedRecordEvent extends AbstractPollRecordEvent {
private static final String POLL_ID = "pollID";
public PollClearedRecordEvent(){
super();
setEvent("PollClearedEvent");
}
public void setPollID(String pollID) {
eventMap.put(POLL_ID, pollID);
}
}

View File

@ -0,0 +1,66 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.polling;
public class PollCreatedRecordEvent extends AbstractPollRecordEvent {
private static final String POLL_ID = "pollID";
private static final String TITLE = "title";
private static final String QUESTION_PATTERN = "question";
private static final String QUESTION_TEXT = "text";
private static final String QUESTION_MULTIRESPONSE = "multiresponse";
private static final String RESPONSE_PATTERN = "response";
private static final String RESPONSE_TEXT = "text";
private static final String RESPONDER_PATTERN = "responder";
private static final String RESPONDER_USER = "user";
private static final String SEPARATOR = "-";
public PollCreatedRecordEvent() {
super();
setEvent("PollCreatedEvent");
}
public void setPollID(String pollID) {
eventMap.put(POLL_ID, pollID);
}
public void setTitle(String title) {
eventMap.put(TITLE, title);
}
public void addQuestion(String id, String question, Boolean multiresponse) {
eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_TEXT, question);
eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_MULTIRESPONSE, multiresponse.toString());
}
public void addResponse(String questionID, String responseID, String response) {
eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response);
}
/*public void addResponder(String questionID, String responseID, String responderID, String userID) {
eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response);
}*/
}

View File

@ -0,0 +1,37 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.polling;
public class PollRemovedRecordEvent extends AbstractPollRecordEvent {
private static final String POLL_ID = "pollID";
public PollRemovedRecordEvent(){
super();
setEvent("PollRemovedEvent");
}
public void setPollID(String pollID) {
eventMap.put(POLL_ID, pollID);
}
}

View File

@ -0,0 +1,35 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.polling;
public class PollStartedRecordEvent extends AbstractPollRecordEvent {
private static final String POLL_ID = "pollID";
public PollStartedRecordEvent(){
super();
setEvent("PollStartedEvent");
}
public void setPollID(String pollID) {
eventMap.put(POLL_ID, pollID);
}
}

View File

@ -0,0 +1,35 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.polling;
public class PollStoppedRecordEvent extends AbstractPollRecordEvent {
private static final String POLL_ID = "pollID";
public PollStoppedRecordEvent(){
super();
setEvent("PollStoppedEvent");
}
public void setPollID(String pollID) {
eventMap.put(POLL_ID, pollID);
}
}

View File

@ -0,0 +1,60 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.polling;
public class PollUpdatedRecordEvent extends AbstractPollRecordEvent {
private static final String POLL_ID = "pollID";
private static final String TITLE = "title";
private static final String QUESTION_PATTERN = "question";
private static final String QUESTION_TEXT = "text";
private static final String QUESTION_MULTIRESPONSE = "multiresponse";
private static final String RESPONSE_PATTERN = "response";
private static final String RESPONSE_TEXT = "text";
private static final String RESPONDER_PATTERN = "responder";
private static final String RESPONDER_USER = "user";
private static final String SEPARATOR = "-";
public PollUpdatedRecordEvent(){
super();
setEvent("PollUpdatedEvent");
}
public void setPollID(String pollID) {
eventMap.put(POLL_ID, pollID);
}
public void setTitle(String title) {
eventMap.put(TITLE, title);
}
public void addQuestion(String id, String question, Boolean multiresponse) {
eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_TEXT, question);
eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_MULTIRESPONSE, multiresponse.toString());
}
public void addResponse(String questionID, String responseID, String response) {
eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response);
}
}

View File

@ -0,0 +1,28 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.presentation;
import org.bigbluebutton.conference.service.recorder.RecordEvent;
public abstract class AbstractPresentationRecordEvent extends RecordEvent {
public AbstractPresentationRecordEvent() {
setModule("PRESENTATION");
}
}

View File

@ -0,0 +1,40 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.presentation;
public class ConversionCompletedPresentationRecordEvent extends
AbstractPresentationRecordEvent {
public ConversionCompletedPresentationRecordEvent() {
super();
setEvent("ConversionCompletedEvent");
}
public void setPresentationName(String name) {
eventMap.put("presentationName", name);
}
public void setOriginalFilename(String name) {
eventMap.put("originalFilename", name);
}
public void setSlidesInfo(String slidesInfo) {
eventMap.put("slidesInfo", slidesInfo);
}
}

View File

@ -0,0 +1,36 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.presentation;
public class CursorUpdateRecordEvent extends AbstractPresentationRecordEvent{
public CursorUpdateRecordEvent() {
super();
setEvent("CursorMoveEvent");
}
public void setXPercent(double percent) {
eventMap.put("xOffset", Double.toString(percent));
}
public void setYPercent(double percent) {
eventMap.put("yOffset", Double.toString(percent));
}
}

View File

@ -0,0 +1,40 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.presentation;
public class GenerateSlidePresentationRecordEvent extends
AbstractPresentationRecordEvent {
public GenerateSlidePresentationRecordEvent() {
super();
setEvent("GenerateSlideEvent");
}
public void setPresentationName(String name) {
eventMap.put("presentationName", name);
}
public void setNumberOfPages(int numPages) {
eventMap.put("numberOfPages", Integer.toString(numPages));
}
public void setPagesCompleted(int pagesCompleted) {
eventMap.put("pagesCompleted", Integer.toString(pagesCompleted));
}
}

View File

@ -0,0 +1,81 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.presentation;
public class GotoSlidePresentationRecordEvent extends
AbstractPresentationRecordEvent {
public GotoSlidePresentationRecordEvent() {
super();
setEvent("GotoSlideEvent");
}
public void setSlide(int slide) {
/**
* Subtract 1 from the page number to be zero-based to be
* compatible with 0.81 and earlier. (ralam Sept 2, 2014)
*/
eventMap.put("slide", Integer.toString(slide - 1));
}
public void setId(String id) {
eventMap.put("id", id);
}
public void setNum(int num) {
eventMap.put("num", Integer.toString(num));
}
public void setCurrent(boolean current) {
eventMap.put("current", Boolean.toString(current));
}
public void setThumbUri(String thumbUri) {
eventMap.put("thumbUri", thumbUri);
}
public void setSwfUri(String swfUri) {
eventMap.put("swfUri", swfUri);
}
public void setTxtUri(String txtUri) {
eventMap.put("txtUri", txtUri);
}
public void setPngUri(String pngUri) {
eventMap.put("pngUri", pngUri);
}
public void setXOffset(double offset) {
eventMap.put("xOffset", Double.toString(offset));
}
public void setYOffset(double offset) {
eventMap.put("yOffset", Double.toString(offset));
}
public void setWidthRatio(double ratio) {
eventMap.put("widthRatio", Double.toString(ratio));
}
public void setHeightRatio(double ratio) {
eventMap.put("heightRatio", Double.toString(ratio));
}
}

View File

@ -0,0 +1,33 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.presentation;
public class RemovePresentationPresentationRecordEvent extends
AbstractPresentationRecordEvent {
public RemovePresentationPresentationRecordEvent() {
super();
setEvent("RemovePresentationEvent");
}
public void setPresentationName(String name) {
eventMap.put("presentationName", name);
}
}

View File

@ -0,0 +1,72 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.presentation;
public class ResizeAndMoveSlidePresentationRecordEvent extends
AbstractPresentationRecordEvent {
public ResizeAndMoveSlidePresentationRecordEvent() {
super();
setEvent("ResizeAndMoveSlideEvent");
}
public void setId(String id) {
eventMap.put("id", id);
}
public void setNum(int num) {
eventMap.put("num", Integer.toString(num));
}
public void setCurrent(boolean current) {
eventMap.put("current", Boolean.toString(current));
}
public void setThumbUri(String thumbUri) {
eventMap.put("thumbUri", thumbUri);
}
public void setSwfUri(String swfUri) {
eventMap.put("swfUri", swfUri);
}
public void setTxtUri(String txtUri) {
eventMap.put("txtUri", txtUri);
}
public void setPngUri(String pngUri) {
eventMap.put("pngUri", pngUri);
}
public void setXOffset(double offset) {
eventMap.put("xOffset", Double.toString(offset));
}
public void setYOffset(double offset) {
eventMap.put("yOffset", Double.toString(offset));
}
public void setWidthRatio(double ratio) {
eventMap.put("widthRatio", Double.toString(ratio));
}
public void setHeightRatio(double ratio) {
eventMap.put("heightRatio", Double.toString(ratio));
}
}

View File

@ -0,0 +1,40 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.recorder.presentation;
public class SharePresentationPresentationRecordEvent extends
AbstractPresentationRecordEvent {
public SharePresentationPresentationRecordEvent() {
super();
setEvent("SharePresentationEvent");
}
public void setPresentationName(String name) {
eventMap.put("presentationName", name);
}
public void setOriginalFilename(String name) {
eventMap.put("originalFilename", name);
}
public void setShare(boolean share) {
eventMap.put("share", Boolean.toString(share));
}
}

View File

@ -0,0 +1,6 @@
package org.bigbluebutton.conference.service.voice;
public class VoiceKeyUtil {
public static final String MUTE = "mute";
public static final String USERID = "userId";
}

View File

@ -0,0 +1,50 @@
package org.bigbluebutton.conference.service.voice;
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
import org.bigbluebutton.conference.service.messaging.redis.MessageHandler;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class VoiceMessageListener implements MessageHandler{
private IBigBlueButtonInGW bbbGW;
public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) {
this.bbbGW = bbbGW;
}
@Override
public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.TO_VOICE_CHANNEL)) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
JsonObject headerObject = (JsonObject) obj.get("header");
JsonObject payloadObject = (JsonObject) obj.get("payload");
String eventName = headerObject.get("name").toString().replace("\"", "");
if (eventName.equalsIgnoreCase(MessagingConstants.MUTE_USER_REQUEST)){
String meetingID = payloadObject.get("meeting_id").toString().replace("\"", "");
String requesterID = payloadObject.get("requester_id").toString().replace("\"", "");
String userID = payloadObject.get("userid").toString().replace("\"", "");
String muteString = payloadObject.get(VoiceKeyUtil.MUTE).toString().replace("\"", "");
Boolean mute = Boolean.valueOf(muteString);
System.out.println("handling mute_user_request");
bbbGW.muteUser(meetingID, requesterID, userID, mute);
}
else if (eventName.equalsIgnoreCase(MessagingConstants.USER_LEFT_VOICE_REQUEST)){
String meetingID = payloadObject.get("meeting_id").toString().replace("\"", "");
String userID = payloadObject.get("userid").toString().replace("\"", "");
System.out.println("handling user_left_voice_request");
bbbGW.voiceUserLeft(meetingID, userID);
}
}
}
}

View File

@ -0,0 +1,16 @@
package org.bigbluebutton.conference.service.whiteboard;
public class WhiteboardKeyUtil {
public static final String TEXT_TYPE = "text";
public static final String PENCIL_TYPE = "pencil";
public static final String RECTANGLE_TYPE = "rectangle";
public static final String ELLIPSE_TYPE = "ellipse";
public static final String TRIANGLE_TYPE = "triangle";
public static final String LINE_TYPE = "line";
public static final String TEXT_CREATED_STATUS = "textCreated";
public static final String DRAW_START_STATUS = "DRAW_START";
public static final String DRAW_END_STATUS = "DRAW_END";
}

View File

@ -0,0 +1,51 @@
package org.bigbluebutton.conference.service.whiteboard;
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
import org.bigbluebutton.conference.service.messaging.redis.MessageHandler;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import com.google.gson.JsonParser;
import com.google.gson.JsonObject;
public class WhiteboardListener implements MessageHandler{
private IBigBlueButtonInGW bbbInGW;
public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbInGW) {
this.bbbInGW = bbbInGW;
}
@Override
public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.TO_WHITEBOARD_CHANNEL)) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
JsonObject headerObject = (JsonObject) obj.get("header");
JsonObject payloadObject = (JsonObject) obj.get("payload");
String eventName = headerObject.get("name").toString().replace("\"", "");
if(eventName.equalsIgnoreCase("get_whiteboard_shapes_request")){
//more cases to follow
String roomName = payloadObject.get("meeting_id").toString().replace("\"", "");
if(eventName.equalsIgnoreCase("get_whiteboard_shapes_request")){
String requesterID = payloadObject.get("requester_id").toString().replace("\"", "");
if(payloadObject.get("whiteboard_id") != null){
String whiteboardID = payloadObject.get("whiteboard_id").toString().replace("\"", "");
System.out.println("\n FOUND A whiteboardID:" + whiteboardID + "\n");
bbbInGW.requestWhiteboardAnnotationHistory(roomName, requesterID, whiteboardID, requesterID);
}
else {
System.out.println("\n DID NOT FIND A whiteboardID \n");
}
System.out.println("\n user<" + requesterID + "> requested the shapes.\n");
}
}
}
}
}

View File

@ -0,0 +1,46 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.whiteboard.redis;
import org.bigbluebutton.conference.service.recorder.RecordEvent;
public abstract class AbstractWhiteboardRecordEvent extends RecordEvent {
public AbstractWhiteboardRecordEvent() {
setModule("WHITEBOARD");
}
public void setPresentation(String name) {
eventMap.put("presentation", name);
}
public void setPageNumber(String page) {
/**
* Subtract 1 from the page number to be zero-based to be
* compatible with 0.81 and earlier. (ralam Sept 2, 2014)
*/
Integer num = new Integer(page);
// System.out.println("WB Page Number real pagenum=[" + num + "] rec pagenum=[" + (num - 1) + "]");
eventMap.put("pageNumber", new Integer(num - 1).toString());
}
public void setWhiteboardId(String id) {
eventMap.put("whiteboardId", id);
}
}

View File

@ -0,0 +1,69 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.whiteboard.redis;
import java.util.ArrayList;
import java.util.Map;
public class AddShapeWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent {
public AddShapeWhiteboardRecordEvent() {
super();
setEvent("AddShapeEvent");
}
public void addAnnotation(Map<String, Object> annotation) {
for (Map.Entry<String, Object> entry : annotation.entrySet()) {
String key = entry.getKey();
if (key.equals("points")) {
eventMap.put("dataPoints", pointsToString((ArrayList<Object>)entry.getValue()));
} else {
Object value = entry.getValue();
eventMap.put(key, value.toString());
}
}
}
private String pointsToString(ArrayList<Object> points){
String datapoints = "";
for (int i = 0; i < points.size(); i++) {
datapoints += (points.get(i)).toString() + ",";
}
// Trim the trailing comma
return datapoints.substring(0, datapoints.length() - 1);
}
public void setFillColor(int fillColor) {
eventMap.put("fillColor", Integer.toString(fillColor));
}
public void setThickness(int thickness) {
eventMap.put("thickness", Integer.toString(thickness));
}
public void setFill(boolean fill) {
eventMap.put("fill", Boolean.toString(fill));
}
public void setTransparent(boolean transparent) {
eventMap.put("transparent", Boolean.toString(transparent));
}
}

View File

@ -0,0 +1,54 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.whiteboard.redis;
import java.util.ArrayList;
import java.util.Map;
public class AddTextWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent {
public AddTextWhiteboardRecordEvent() {
super();
setEvent("AddTextEvent");
}
public void addAnnotation(Map<String, Object> annotation) {
for (Map.Entry<String, Object> entry : annotation.entrySet()) {
String key = entry.getKey();
if (key.equals("points")) {
ArrayList<Double> value = (ArrayList<Double>)entry.getValue();
eventMap.put("dataPoints", pointsToString(value));
} else {
Object value = entry.getValue();
eventMap.put(key, value.toString());
}
}
}
private String pointsToString(ArrayList<Double> points){
String datapoints = "";
for (Double i : points) {
datapoints += i + ",";
}
// Trim the trailing comma
return datapoints.substring(0, datapoints.length() - 1);
}
}

View File

@ -0,0 +1,28 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.whiteboard.redis;
public class ClearPageWhiteboardRecordEvent extends
AbstractWhiteboardRecordEvent {
public ClearPageWhiteboardRecordEvent() {
super();
setEvent("ClearPageEvent");
}
}

View File

@ -0,0 +1,53 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.conference.service.whiteboard.redis;
import java.util.ArrayList;
import java.util.Map;
public class ModifyTextWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent {
public ModifyTextWhiteboardRecordEvent() {
super();
setEvent("ModifyTextEvent");
}
public void addAnnotation(Map<String, Object> annotation) {
for (Map.Entry<String, Object> entry : annotation.entrySet()) {
String key = entry.getKey();
if (key.equals("points")) {
ArrayList<Double> value = (ArrayList<Double>)entry.getValue();
eventMap.put("dataPoints", pointsToString(value));
} else {
Object value = entry.getValue();
eventMap.put(key, value.toString());
}
}
}
private String pointsToString(ArrayList<Double> points){
String datapoints = "";
for (Double i : points) {
datapoints += i + ",";
}
// Trim the trailing comma
return datapoints.substring(0, datapoints.length() - 1);
}
}

View File

@ -0,0 +1,33 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.whiteboard.redis;
public class ToggleGridWhiteboardRecordEvent extends
AbstractWhiteboardRecordEvent {
public ToggleGridWhiteboardRecordEvent() {
super();
setEvent("ToggleGridEvent");
}
public void setGridEnabled(boolean enabled) {
eventMap.put("gridEnabled", Boolean.toString(enabled));
}
}

View File

@ -0,0 +1,32 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.conference.service.whiteboard.redis;
public class UndoShapeWhiteboardRecordEvent extends
AbstractWhiteboardRecordEvent {
public UndoShapeWhiteboardRecordEvent() {
super();
setEvent("UndoShapeEvent");
}
public void setShapeId(String id) {
eventMap.put("shapeId", id);
}
}

View File

@ -0,0 +1,119 @@
package org.bigbluebutton.core.api;
import java.util.Map;
public interface IBigBlueButtonInGW {
void isAliveAudit(String aliveID);
void statusMeetingAudit(String meetingID);
void endMeeting(String meetingID);
void endAllMeetings();
void createMeeting2(String meetingID, String externalMeetingID, String meetingName, boolean recorded,
String voiceBridge, long duration, boolean autoStartRecording,
boolean allowStartStopRecording, String moderatorPass, String viewerPass,
long createTime, String createDate);
void destroyMeeting(String meetingID);
void getAllMeetings(String meetingID);
void lockSettings(String meetingID, Boolean locked, Map<String, Boolean> lockSettigs);
// Lock
void initLockSettings(String meetingID, Map<String, Boolean> settings);
void sendLockSettings(String meetingID, String userId, Map<String, Boolean> settings);
void getLockSettings(String meetingId, String userId);
void lockUser(String meetingId, String requesterID, boolean lock, String internalUserID);
// Users
void validateAuthToken(String meetingId, String userId, String token, String correlationId, String sessionId);
void registerUser(String roomName, String userid, String username, String role, String externUserID, String authToken);
void userRaiseHand(String meetingId, String userId);
void lowerHand(String meetingId, String userId, String loweredBy);
void shareWebcam(String meetingId, String userId, String stream);
void unshareWebcam(String meetingId, String userId, String stream);
void setUserStatus(String meetingID, String userID, String status, Object value);
void getUsers(String meetingID, String requesterID);
void userLeft(String meetingID, String userID, String sessionId);
void userJoin(String meetingID, String userID, String authToken);
void getCurrentPresenter(String meetingID, String requesterID);
void assignPresenter(String meetingID, String newPresenterID, String newPresenterName, String assignedBy);
void setRecordingStatus(String meetingId, String userId, Boolean recording);
void getRecordingStatus(String meetingId, String userId);
void userConnectedToGlobalAudio(String voiceConf, String userid, String name);
void userDisconnectedFromGlobalAudio(String voiceConf, String userid, String name);
// Voice
void initAudioSettings(String meetingID, String requesterID, Boolean muted);
void muteAllExceptPresenter(String meetingID, String requesterID, Boolean mute);
void muteAllUsers(String meetingID, String requesterID, Boolean mute);
void isMeetingMuted(String meetingID, String requesterID);
void muteUser(String meetingID, String requesterID, String userID, Boolean mute);
void lockMuteUser(String meetingID, String requesterID, String userID, Boolean lock);
void ejectUserFromVoice(String meetingID, String userId, String ejectedBy);
void ejectUserFromMeeting(String meetingId, String userId, String ejectedBy);
void voiceUserJoined(String meetingId, String userId, String webUserId, String conference,
String callerIdNum, String callerIdName,
Boolean muted, Boolean speaking);
void voiceUserLeft(String meetingId, String userId);
void voiceUserLocked(String meetingId, String userId, Boolean locked);
void voiceUserMuted(String meetingId, String userId, Boolean muted);
void voiceUserTalking(String meetingId, String userId, Boolean talking);
void voiceRecording(String meetingId, String recordingFile,
String timestamp, Boolean recording);
// Presentation
void clear(String meetingID);
void removePresentation(String meetingID, String presentationID);
void getPresentationInfo(String meetingID, String requesterID, String replyTo);
void sendCursorUpdate(String meetingID, double xPercent, double yPercent);
void resizeAndMoveSlide(String meetingID, double xOffset, double yOffset, double widthRatio, double heightRatio);
void gotoSlide(String meetingID, String page);
void sharePresentation(String meetingID, String presentationID, boolean share);
void getSlideInfo(String meetingID, String requesterID, String replyTo);
void sendConversionUpdate(String messageKey, String meetingId,
String code, String presId, String presName);
void sendPageCountError(String messageKey, String meetingId,
String code, String presId, int numberOfPages,
int maxNumberPages, String presName);
void sendSlideGenerated(String messageKey, String meetingId,
String code, String presId, int numberOfPages,
int pagesCompleted, String presName);
void sendConversionCompleted(String messageKey, String meetingId,
String code, String presId, int numPages, String presName, String presBaseUrl);
// Polling
void getPolls(String meetingID, String requesterID);
void createPoll(String meetingID, String requesterID, String msg);
void updatePoll(String meetingID, String requesterID, String msg);
void startPoll(String meetingID, String requesterID, String msg);
void stopPoll(String meetingID, String requesterID, String msg);
void removePoll(String meetingID, String requesterID, String msg);
void respondPoll(String meetingID, String requesterID, String msg);
void preCreatedPoll(String meetingID, String msg);
// Layout
void getCurrentLayout(String meetingID, String requesterID);
void broadcastLayout(String meetingID, String requesterID, String layout);
void lockLayout(String meetingID, String setById,
boolean lock, boolean viewersOnly,
scala.Option<String> layout);
// Chat
void getChatHistory(String meetingID, String requesterID, String replyTo);
void sendPublicMessage(String meetingID, String requesterID, Map<String, String> message);
void sendPrivateMessage(String meetingID, String requesterID, Map<String, String> message);
// Whiteboard
void sendWhiteboardAnnotation(String meetingID, String requesterID, java.util.Map<String, Object> annotation);
void requestWhiteboardAnnotationHistory(String meetingID, String requesterID, String whiteboardId, String replyTo);
void clearWhiteboard(String meetingID, String requesterID, String whiteboardId);
void undoWhiteboard(String meetingID, String requesterID, String whiteboardId);
void enableWhiteboard(String meetingID, String requesterID, Boolean enable);
void isWhiteboardEnabled(String meetingID, String requesterID, String replyTo);
}

View File

@ -0,0 +1,6 @@
package org.bigbluebutton.core.api;
public interface IDispatcher {
void dispatch(String jsonMessage);
}

View File

@ -0,0 +1,5 @@
package org.bigbluebutton.core.api;
public interface IOutMessage {
}

View File

@ -0,0 +1,21 @@
package org.bigbluebutton.core.api;
import java.util.Set;
public class MessageOutGateway {
private Set<OutMessageListener2> listeners;
public void send(IOutMessage msg) {
// log.debug("before listeners send. check message:" + msg);
for (OutMessageListener2 l : listeners) {
// log.debug("listener " + l);
l.handleMessage(msg);
}
}
public void setListeners(Set<OutMessageListener2> listeners) {
this.listeners = listeners;
}
}

View File

@ -0,0 +1,6 @@
package org.bigbluebutton.core.api;
public interface OutMessageListener2 {
void handleMessage(IOutMessage msg);
}

View File

@ -0,0 +1,66 @@
package org.bigbluebutton.core.api;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
public class RedisLpushDispatcher implements IDispatcher {
private static final int NTHREADS = 1;
private static final Executor exec = Executors.newFixedThreadPool(NTHREADS);
private static final String BBBMESSAGES = "bbb:meeting:messages";
private BlockingQueue<String> messages;
private volatile boolean dispatchEvents = false;
private JedisPool redisPool;
public RedisLpushDispatcher() {
messages = new LinkedBlockingQueue<String>();
}
@Override
public void dispatch(String jsonMessage) {
messages.offer(jsonMessage);
}
private void saveMessage(String msg) {
Jedis jedis = redisPool.getResource();
try {
jedis.lpush(BBBMESSAGES, msg);
} finally {
redisPool.returnResource(jedis);
}
}
public void start() {
dispatchEvents = true;
Runnable sender = new Runnable() {
public void run() {
while (dispatchEvents) {
String message;
try {
message = messages.take();
saveMessage(message);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
};
exec.execute(sender);
}
public void stop() {
dispatchEvents = false;
}
public void setRedisPool(JedisPool redisPool) {
this.redisPool = redisPool;
}
}

View File

@ -0,0 +1,5 @@
package org.bigbluebutton.service.recording;
public class RecordMessage {
}

View File

@ -0,0 +1,73 @@
package org.bigbluebutton.service.recording;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import org.bigbluebutton.conference.service.recorder.RecordEvent;
import com.google.gson.Gson;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
public class RedisListRecorder {
private static final int NTHREADS = 1;
private static final Executor exec = Executors.newFixedThreadPool(NTHREADS);
private static final Executor runExec = Executors.newFixedThreadPool(NTHREADS);
private BlockingQueue<RecordEvent> messages = new LinkedBlockingQueue<RecordEvent>();
private volatile boolean recordEvents = false;
JedisPool redisPool;
public void start() {
recordEvents = true;
Runnable sender = new Runnable() {
public void run() {
while (recordEvents) {
RecordEvent message;
try {
message = messages.take();
recordEvent(message);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
};
exec.execute(sender);
}
public void stop() {
recordEvents = false;
}
private void recordEvent(final RecordEvent message) {
Runnable task = new Runnable() {
public void run() {
Jedis jedis = redisPool.getResource();
try {
String key = "bbb:recording:" + message.getMeetingID();
Gson gson= new Gson();
jedis.rpush(key, gson.toJson(message.toMap()));
} finally {
redisPool.returnResource(jedis);
}
}
};
runExec.execute(task);
}
public void record(RecordEvent message) {
messages.offer(message);
}
public JedisPool getRedisPool() {
return redisPool;
}
public void setRedisPool(JedisPool redisPool) {
this.redisPool = redisPool;
}
}

View File

@ -0,0 +1,32 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
import org.bigbluebutton.conference.service.recorder.RecordEvent;
public abstract class AbstractVoiceRecordEvent extends RecordEvent {
public AbstractVoiceRecordEvent() {
setModule("VOICE");
}
public void setBridge(String bridge) {
eventMap.put("bridge", bridge);
}
}

View File

@ -0,0 +1,26 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
public interface ConferenceServerListener {
public void joined(String room, Integer participant, String name, Boolean muted, Boolean talking);
public void left(String room, Integer participant);
public void muted(String room, Integer participant, Boolean muted);
public void talking(String room, Integer participant, Boolean talking);
}

View File

@ -0,0 +1,28 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
public interface ConferenceServiceProvider {
public void populateRoom(String room);
public void mute(String room, String participant, Boolean mute);
public void eject(String room, String participant);
public void ejectAll(String room);
public void record(String room, String meetingid);
public void broadcast(String room, String meetingid);
}

View File

@ -0,0 +1,115 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent;
import org.bigbluebutton.webconference.voice.events.ConferenceEventListener;
import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent;
import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent;
import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent;
import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent;
import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent;
public class FreeswitchConferenceEventListener implements ConferenceEventListener {
private static final int SENDERTHREADS = 1;
private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS);
private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS);
private BlockingQueue<VoiceConferenceEvent> messages = new LinkedBlockingQueue<VoiceConferenceEvent>();
private volatile boolean sendMessages = false;
private IVoiceConferenceService vcs;
public void setVoiceConferenceService(IVoiceConferenceService vcs) {
this.vcs = vcs;
}
private void queueMessage(VoiceConferenceEvent event) {
try {
messages.offer(event, 5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void sendMessageToBigBlueButton(final VoiceConferenceEvent event) {
Runnable task = new Runnable() {
public void run() {
if (event instanceof VoiceUserJoinedEvent) {
System.out.println("************** FreeswitchConferenceEventListener received voiceUserJoined ");
VoiceUserJoinedEvent evt = (VoiceUserJoinedEvent) event;
vcs.voiceUserJoined(evt.getVoiceUserId(), evt.getUserId(), evt.getRoom(),
evt.getCallerIdNum(), evt.getCallerIdName(),
evt.getMuted(), evt.getSpeaking());
} else if (event instanceof VoiceUserLeftEvent) {
System.out.println("************** FreeswitchConferenceEventListener received VoiceUserLeftEvent ");
VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event;
vcs.voiceUserLeft(evt.getUserId(), evt.getRoom());
} else if (event instanceof VoiceUserMutedEvent) {
System.out.println("************** FreeswitchConferenceEventListener VoiceUserMutedEvent ");
VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event;
vcs.voiceUserMuted(evt.getUserId(), evt.getRoom(), evt.isMuted());
} else if (event instanceof VoiceUserTalkingEvent) {
System.out.println("************** FreeswitchConferenceEventListener VoiceUserTalkingEvent ");
VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event;
vcs.voiceUserTalking(evt.getUserId(), evt.getRoom(), evt.isTalking());
} else if (event instanceof VoiceStartRecordingEvent) {
VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event;
System.out.println("************** FreeswitchConferenceEventListener VoiceStartRecordingEvent recording=[" + evt.startRecord() + "]");
vcs.voiceStartedRecording(evt.getRoom(), evt.getRecordingFilename(), evt.getTimestamp(), evt.startRecord());
}
}
};
runExec.execute(task);
}
public void start() {
sendMessages = true;
Runnable sender = new Runnable() {
public void run() {
while (sendMessages) {
VoiceConferenceEvent message;
try {
message = messages.take();
sendMessageToBigBlueButton(message);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
};
msgSenderExec.execute(sender);
}
public void stop() {
sendMessages = false;
}
public void handleConferenceEvent(VoiceConferenceEvent event) {
queueMessage(event);
}
}

View File

@ -0,0 +1,13 @@
package org.bigbluebutton.webconference.voice;
public interface IVoiceConferenceService {
void voiceUserJoined(String userId, String webUserId, String conference,
String callerIdNum, String callerIdName,
Boolean muted, Boolean speaking);
void voiceUserLeft(String meetingId, String userId);
void voiceUserLocked(String meetingId, String userId, Boolean locked);
void voiceUserMuted(String meetingId, String userId, Boolean muted);
void voiceUserTalking(String meetingId, String userId, Boolean talking);
void voiceStartedRecording(String conference, String recordingFile,
String timestamp, Boolean recording);
}

View File

@ -0,0 +1,51 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
public class ParticipantJoinedVoiceRecordEvent extends AbstractVoiceRecordEvent {
public ParticipantJoinedVoiceRecordEvent() {
super();
setEvent("ParticipantJoinedEvent");
}
public void setParticipant(String p) {
eventMap.put("participant", p);
}
public void setCallerName(String name) {
eventMap.put("callername", name);
}
public void setCallerNumber(String name) {
eventMap.put("callernumber", name);
}
public void setMuted(boolean muted) {
eventMap.put("muted", Boolean.toString(muted));
}
public void setTalking(boolean talking) {
eventMap.put("talking", Boolean.toString(talking));
}
public void setLocked(boolean locked) {
eventMap.put("locked", Boolean.toString(locked));
}
}

View File

@ -0,0 +1,31 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
public class ParticipantLeftVoiceRecordEvent extends AbstractVoiceRecordEvent {
public ParticipantLeftVoiceRecordEvent() {
super();
setEvent("ParticipantLeftEvent");
}
public void setParticipant(String p) {
eventMap.put("participant", p);
}
}

View File

@ -0,0 +1,35 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
public class ParticipantLockedVoiceRecordEvent extends AbstractVoiceRecordEvent {
public ParticipantLockedVoiceRecordEvent() {
super();
setEvent("ParticipantLockedEvent");
}
public void setParticipant(String p) {
eventMap.put("participant", p);
}
public void setLocked(boolean locked) {
eventMap.put("locked", Boolean.toString(locked));
}
}

View File

@ -0,0 +1,35 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
public class ParticipantMutedVoiceRecordEvent extends AbstractVoiceRecordEvent {
public ParticipantMutedVoiceRecordEvent() {
super();
setEvent("ParticipantMutedEvent");
}
public void setParticipant(String p) {
eventMap.put("participant", p);
}
public void setMuted(boolean muted) {
eventMap.put("muted", Boolean.toString(muted));
}
}

View File

@ -0,0 +1,36 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
public class ParticipantTalkingVoiceRecordEvent extends AbstractVoiceRecordEvent {
public ParticipantTalkingVoiceRecordEvent() {
super();
setEvent("ParticipantTalkingEvent");
}
public void setParticipant(String p) {
eventMap.put("participant", p);
}
public void setTalking(boolean talking) {
eventMap.put("talking", Boolean.toString(talking));
}
}

View File

@ -0,0 +1,38 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
public class StartRecordingVoiceRecordEvent extends AbstractVoiceRecordEvent {
public StartRecordingVoiceRecordEvent(boolean record) {
super();
if (record)
setEvent("StartRecordingEvent");
else
setEvent("StopRecordingEvent");
}
public void setRecordingTimestamp(String timestamp) {
eventMap.put("recordingTimestamp", timestamp);
}
public void setFilename(String filename) {
eventMap.put("filename", filename);
}
}

View File

@ -0,0 +1,141 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice;
import java.util.concurrent.TimeUnit;
import org.bigbluebutton.conference.service.recorder.RecorderApplication;
import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent;
import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent;
import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent;
import org.bigbluebutton.webconference.voice.events.VoiceUserLockedEvent;
import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent;
import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent;
import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent;
public class VoiceEventRecorder {
private RecorderApplication recorder;
private Long genTimestamp() {
return TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
}
public void recordConferenceEvent(VoiceConferenceEvent event, String room) {
if (event instanceof VoiceUserJoinedEvent) {
recordParticipantJoinedEvent(event, room);
} else if (event instanceof VoiceUserLeftEvent) {
recordParticipantLeftEvent(event, room);
} else if (event instanceof VoiceUserMutedEvent) {
recordParticipantMutedEvent(event, room);
} else if (event instanceof VoiceUserTalkingEvent) {
recordParticipantTalkingEvent(event, room);
} else if (event instanceof VoiceUserLockedEvent) {
recordParticipantLockedEvent(event, room);
} else if (event instanceof VoiceStartRecordingEvent) {
recordStartRecordingEvent(event, room);
} else {
// log.debug("Processing UnknownEvent " + event.getClass().getName() + " for room: " + event.getRoom() );
}
}
private void recordStartRecordingEvent(VoiceConferenceEvent event, String room) {
VoiceStartRecordingEvent sre = (VoiceStartRecordingEvent) event;
StartRecordingVoiceRecordEvent evt = new StartRecordingVoiceRecordEvent(sre.startRecord());
evt.setMeetingId(room);
evt.setTimestamp(genTimestamp());
evt.setBridge(event.getRoom());
evt.setRecordingTimestamp(sre.getTimestamp());
evt.setFilename(sre.getRecordingFilename());
System.out.println("*** Recording voice " + sre.startRecord() + " timestamp: " + evt.toMap().get("recordingTimestamp") + " file: " + evt.toMap().get("filename"));
recorder.record(room, evt);
}
private void recordParticipantJoinedEvent(VoiceConferenceEvent event, String room) {
VoiceUserJoinedEvent pje = (VoiceUserJoinedEvent) event;
ParticipantJoinedVoiceRecordEvent evt = new ParticipantJoinedVoiceRecordEvent();
evt.setMeetingId(room);
evt.setTimestamp(genTimestamp());
evt.setBridge(event.getRoom());
evt.setParticipant(pje.getUserId().toString());
evt.setCallerName(pje.getCallerIdName());
evt.setCallerNumber(pje.getCallerIdName());
evt.setMuted(pje.getMuted());
evt.setTalking(pje.getSpeaking());
recorder.record(room, evt);
}
private void recordParticipantLeftEvent(VoiceConferenceEvent event, String room) {
ParticipantLeftVoiceRecordEvent evt = new ParticipantLeftVoiceRecordEvent();
evt.setMeetingId(room);
evt.setTimestamp(genTimestamp());
evt.setBridge(event.getRoom());
evt.setParticipant(((VoiceUserLeftEvent)event).getUserId().toString());
recorder.record(room, evt);
}
private void recordParticipantMutedEvent(VoiceConferenceEvent event, String room) {
VoiceUserMutedEvent pme = (VoiceUserMutedEvent) event;
ParticipantMutedVoiceRecordEvent evt = new ParticipantMutedVoiceRecordEvent();
evt.setMeetingId(room);
evt.setTimestamp(genTimestamp());
evt.setBridge(event.getRoom());
evt.setParticipant(((VoiceUserMutedEvent)event).getUserId().toString());
evt.setMuted(pme.isMuted());
recorder.record(room, evt);
}
private void recordParticipantTalkingEvent(VoiceConferenceEvent event, String room) {
VoiceUserTalkingEvent pte = (VoiceUserTalkingEvent) event;
ParticipantTalkingVoiceRecordEvent evt = new ParticipantTalkingVoiceRecordEvent();
evt.setMeetingId(room);
evt.setTimestamp(genTimestamp());
evt.setBridge(event.getRoom());
evt.setParticipant(((VoiceUserTalkingEvent)event).getUserId().toString());
evt.setTalking(pte.isTalking());
recorder.record(room, evt);
}
private void recordParticipantLockedEvent(VoiceConferenceEvent event, String room) {
VoiceUserLockedEvent ple = (VoiceUserLockedEvent) event;
ParticipantLockedVoiceRecordEvent evt = new ParticipantLockedVoiceRecordEvent();
evt.setMeetingId(room);
evt.setTimestamp(genTimestamp());
evt.setBridge(event.getRoom());
evt.setParticipant(((VoiceUserLockedEvent)event).getUserId().toString());
evt.setLocked(ple.isLocked());
recorder.record(room, evt);
}
public void setRecorderApplication(RecorderApplication recorder) {
this.recorder = recorder;
}
}

View File

@ -0,0 +1,40 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice.commands;
public abstract class ConferenceCommand {
private final String room;
private final Integer requesterId;
public ConferenceCommand(String room, Integer requesterId) {
this.room = room;
this.requesterId = requesterId;
}
public String getRoom() {
return room;
}
public Integer getRequesterId() {
return requesterId;
}
}

View File

@ -0,0 +1,56 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice.commands;
public class ConferenceCommandResult {
private final String room;
private final Integer requesterId;
private boolean success = false;
private String message = "";
public ConferenceCommandResult(String room, Integer requesterId) {
this.room = room;
this.requesterId = requesterId;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getRoom() {
return room;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getRequesterId() {
return requesterId;
}
}

View File

@ -0,0 +1,34 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice.commands;
public class EjectParticipantCommand extends ConferenceCommand {
private final Integer participantId;
public EjectParticipantCommand(String room, Integer requesterId, Integer participantId) {
super(room, requesterId);
this.participantId = participantId;
}
public Integer getParticipantId() {
return participantId;
}
}

View File

@ -0,0 +1,27 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice.commands;
public class GetParticipantsCommand extends ConferenceCommand {
public GetParticipantsCommand(String room, Integer requesterId) {
super(room, requesterId);
}
}

View File

@ -0,0 +1,40 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice.commands;
public class MuteParticipantCommand extends ConferenceCommand {
private final Integer participantId;
private final boolean mute;
public MuteParticipantCommand(String room, Integer requesterId, Integer participantId, boolean mute) {
super(room, requesterId);
this.participantId = participantId;
this.mute = mute;
}
public Integer getParticipantId() {
return participantId;
}
public boolean isMute() {
return mute;
}
}

View File

@ -0,0 +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/>.
*
*/
package org.bigbluebutton.webconference.voice.events;
public interface ConferenceEventListener {
public void handleConferenceEvent(VoiceConferenceEvent event);
}

View File

@ -0,0 +1,27 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.webconference.voice.events;
public class UnknownConferenceEvent extends VoiceConferenceEvent {
public UnknownConferenceEvent(String participantId, String room) {
super(room);
}
}

Some files were not shown because too many files have changed in this diff Show More