Merge remote-tracking branch 'origin/extract-out-bbb-apps-after-upgrading-scala' into merge-with-akka-fs-and-akk-apps

Conflicts:
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/Constants.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/CreateMeetingMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/DestroyMeetingMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/EndMeetingMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/GetAllMeetingsRequest.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/KeepAliveMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/MessageBuilder.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/MessageFromJsonConverter.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/MessagingService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/RegisterUserMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/UserConnectedToGlobalAudio.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/common/messages/UserDisconnectedFromGlobalAudio.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/BroadcastClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ConnectionInvokerService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DirectClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DisconnectAllClientsMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DisconnectClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/BigBlueButtonApplication.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/IBigBlueButtonInGW.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/MessageOutGateway.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/messaging/BroadcastClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/messaging/ClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/messaging/ConnectionInvokerService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/messaging/DirectClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/messaging/DisconnectAllClientsMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/messaging/DisconnectClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/messaging/SharedObjectClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/BroadcastClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/ClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/ConnectionInvokerService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DirectClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DisconnectAllClientsMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DisconnectClientMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/redis/MeetingMessageHandler.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/Constants.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/CreateMeetingMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/DestroyMeetingMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/EndMeetingMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/GetAllMeetingsRequest.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/KeepAliveMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessageBuilder.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessageFromJsonConverter.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessagingConstants.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessagingService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/RegisterUserMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/UserConnectedToGlobalAudio.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/UserDisconnectedFromGlobalAudio.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/ValidateAuthTokenMessage.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/GenericObjectPoolConfigWrapper.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageReceiver.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatKeyUtil.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/LayoutService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/LockService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ParticipantsService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/PresentationApplication.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/PresentationService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/VoiceKeyUtil.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/VoiceService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/WhiteboardApplication.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/WhiteboardKeyUtil.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/WhiteboardService.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatKeyUtil.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatMessageListener.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsListener.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/presentation/PreuploadedPresentation.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceKeyUtil.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceMessageListener.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardKeyUtil.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardListener.java
	bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ConversionUpdatesProcessor.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PreuploadedPresentationsUtil.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/GenericObjectPoolConfigWrapper.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/Recorder.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RecorderApplication.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RedisDispatcher.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/chat/AbstractChatRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/chat/PublicChatRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/AbstractParticipantRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/AssignPresenterRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantJoinRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantLeftRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantStatusChangeRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/RecordStatusRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/AbstractPresentationRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/CursorUpdateRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/GotoSlidePresentationRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/SharePresentationPresentationRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/AbstractVoiceRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantJoinedVoiceRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantLeftVoiceRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantLockedVoiceRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantMutedVoiceRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantTalkingVoiceRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/StartRecordingVoiceRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/VoiceEventRecorder.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/ConferenceEventListener.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/UnknownConferenceEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceConferenceEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceStartRecordingEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserJoinedEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserLeftEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserLockedEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserMutedEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserTalkingEvent.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java
	labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisPublisher.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingEventRedisPublisher.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingMessageToJsonConverter.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PesentationMessageToJsonConverter.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisPublisher.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisPublisher.scala
	labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardMessageToJsonConverter.scala
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectUserCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetUsersCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteUserCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectUserCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/GetAllUsersCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteUserCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/RecordConferenceCommand.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java
	labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java
This commit is contained in:
Richard Alam 2015-06-02 18:39:18 +00:00
commit 151d790b17
421 changed files with 22818 additions and 2875 deletions

View File

@ -99,24 +99,6 @@ dependencies {
//compile 'redis.clients:jedis:2.0.0'
providedCompile 'commons-pool:commons-pool:1.5.6'
// Libraries needed to run the scala tools
scalaTools 'org.scala-lang:scala-compiler:2.11.6'
scalaTools 'org.scala-lang:scala-library:2.11.6'
// Libraries needed for scala api
compile 'org.scala-lang:scala-library:2.11.6'
compile 'com.typesafe.akka:akka-actor_2.11:2.3.10'
compile 'com.typesafe.akka:akka-testkit_2.11:2.3.10'
compile 'com.typesafe.akka:akka-slf4j_2.11:2.3.10'
// workaround for http://issues.gradle.org/browse/GRADLE-1273
//compileScala.classpath = sourceSets.main.compileClasspath + files(sourceSets.main.classesDir)
//compileTestScala.classpath = sourceSets.test.compileClasspath + files(sourceSets.test.classesDir)
// Freeswitch ESL Client
compile 'org/freeswitch:fs-esl-client:0.8.2@jar'
compile 'org.jboss.netty:netty:3.2.1.Final@jar'
compile 'com.google.code.gson:gson:1.7.1'
providedCompile 'org.apache.commons:commons-lang3:3.2'

View File

@ -48,6 +48,7 @@ import org.bigbluebutton.common.messages.UserRaisedHandMessage;
import org.bigbluebutton.common.messages.UserShareWebcamRequestMessage;
import org.bigbluebutton.common.messages.UserUnshareWebcamRequestMessage;
import org.bigbluebutton.common.messages.ValidateAuthTokenMessage;
import org.bigbluebutton.red5.api.IBigBlueButtonInGW;
import org.bigbluebutton.red5.pubsub.redis.MessageSender;
public class Red5BBBInGw implements IBigBlueButtonInGW {

View File

@ -22,8 +22,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import org.bigbluebutton.red5.api.IBigBlueButtonInGW;
import org.bigbluebutton.red5.client.messaging.ConnectionInvokerService;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.adapter.IApplication;
@ -123,7 +122,7 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
lsMap = new HashMap<String, Boolean>();
}
}
String userId = internalUserID;
String sessionId = CONN + userId;
BigBlueButtonSession bbbSession = new BigBlueButtonSession(room, internalUserID, username, role,
@ -246,7 +245,8 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
log.info("User validate token bbb-apps: data={}", logStr);
red5InGW.validateAuthToken(meetingId, userId, token, meetingId + "/" + userId, sessionId);
}
public void setApplicationListeners(Set<IApplication> listeners) {
Iterator<IApplication> iter = listeners.iterator();
while (iter.hasNext()) {

View File

@ -1,8 +1,7 @@
package org.bigbluebutton.core.api;
package org.bigbluebutton.red5.api;
import java.util.Map;
public interface IBigBlueButtonInGW {
void isAliveAudit(String aliveID);

View File

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

View File

@ -0,0 +1,23 @@
package org.bigbluebutton.red5.api;
import java.util.Set;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
public class MessageOutGateway {
private static Logger log = Red5LoggerFactory.getLogger(MessageOutGateway.class, "bigbluebutton");
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.red5.api;
public interface OutMessageListener2 {
void handleMessage(IOutMessage msg);
}

View File

@ -53,16 +53,16 @@ public class MessageSender {
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);
}
}
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);

View File

@ -35,9 +35,9 @@ public class ChatService {
public void sendPublicChatHistory() {
String meetingID = Red5.getConnectionLocal().getScope().getName();
String requesterID = getBbbSession().getInternalUserID();
// Just hardcode as we don't really need it for flash client. (ralam may 7, 2014)
String replyTo = meetingID + "/" + requesterID;
String replyTo = meetingID + "/" + requesterID;
red5BBBInGw.getChatHistory(meetingID, requesterID, replyTo);
}
@ -77,6 +77,7 @@ public class ChatService {
public void setBigBlueButtonInGW(Red5BBBInGw inGW) {
red5BBBInGw = inGW;
}
public void sendPrivateMessage(Map<String, Object> msg){
String chatType = msg.get(ChatKeyUtil.CHAT_TYPE).toString();

View File

@ -20,9 +20,9 @@ package org.bigbluebutton.red5.service;
import java.util.Map;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import org.bigbluebutton.red5.BigBlueButtonSession;
import org.bigbluebutton.red5.Constants;
import org.bigbluebutton.red5.api.IBigBlueButtonInGW;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.Red5;
import org.slf4j.Logger;

View File

@ -26,15 +26,14 @@ import org.red5.server.api.scope.IScope;
import java.util.Map;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import org.bigbluebutton.red5.BigBlueButtonSession;
import org.bigbluebutton.red5.Constants;
import org.bigbluebutton.red5.api.IBigBlueButtonInGW;
public class ParticipantsService {
private static Logger log = Red5LoggerFactory.getLogger( ParticipantsService.class, "bigbluebutton" );
private IBigBlueButtonInGW red5InGW;
public void assignPresenter(Map<String, String> msg) {
IScope scope = Red5.getConnectionLocal().getScope();
String meetingId = scope.getName();
@ -102,7 +101,7 @@ public class ParticipantsService {
red5InGW.setUserStatus(meetingId, userId, status, value);
}
public void setRecordingStatus(Map<String, Object> msg) {
IScope scope = Red5.getConnectionLocal().getScope();
String meetingId = scope.getName();

View File

@ -26,34 +26,45 @@ import org.red5.server.api.Red5;
import org.red5.server.api.scope.IScope;
import org.bigbluebutton.red5.BigBlueButtonSession;
import org.bigbluebutton.red5.Constants;
import org.bigbluebutton.red5.api.IBigBlueButtonInGW;
public class PresentationService {
private static Logger log = Red5LoggerFactory.getLogger( PresentationService.class, "bigbluebutton" );
private PresentationApplication presentationApplication;
private IBigBlueButtonInGW bbbInGW;
public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) {
bbbInGW = inGW;
}
public void removePresentation(Map<String, Object> msg) {
String presentationID = (String) msg.get("presentationID");
IScope scope = Red5.getConnectionLocal().getScope();
presentationApplication.removePresentation(scope.getName(), presentationID);
bbbInGW.removePresentation(scope.getName(), presentationID);
}
public void getSlideInfo() {
IScope scope = Red5.getConnectionLocal().getScope();
log.debug("Getting slide info for meeting [{}]", scope.getName());
presentationApplication.getSlideInfo(scope.getName(), getBbbSession().getInternalUserID());
String meetingID = scope.getName();
String requesterID = getBbbSession().getInternalUserID();
// Just hardcode as we don't really need it for flash client. (ralam may 7, 2014)
String replyTo = meetingID + "/" + requesterID;
bbbInGW.getSlideInfo(meetingID, requesterID, replyTo);
}
public void clear() {
IScope scope = Red5.getConnectionLocal().getScope();
presentationApplication.clear(scope.getName());
bbbInGW.clear(scope.getName());
}
public void getPresentationInfo() {
IScope scope = Red5.getConnectionLocal().getScope();
log.debug("Getting presentation info for meeting [{}]", scope.getName());
presentationApplication.getPresentationInfo(scope.getName(), getBbbSession().getInternalUserID());
String meetingID = scope.getName();
String requesterID = getBbbSession().getInternalUserID();
// Just hardcode as we don't really need it for flash client. (ralam may 7, 2014)
String replyTo = meetingID + "/" + requesterID;
bbbInGW.getPresentationInfo(meetingID, requesterID, replyTo);
}
public void gotoSlide(Map<String, Object> msg) {
@ -62,7 +73,7 @@ public class PresentationService {
IScope scope = Red5.getConnectionLocal().getScope();
log.debug("Got GotoSlide for meeting [{}] page=[{}]", scope.getName(), pageId);
presentationApplication.gotoSlide(scope.getName(), pageId);
bbbInGW.gotoSlide(scope.getName(), pageId);
}
public void sharePresentation(Map<String, Object> msg) {
@ -70,7 +81,7 @@ public class PresentationService {
Boolean share = (Boolean) msg.get("share");
IScope scope = Red5.getConnectionLocal().getScope();
presentationApplication.sharePresentation(scope.getName(), presentationID, share);
bbbInGW.sharePresentation(scope.getName(), presentationID, share);
}
public void sendCursorUpdate(Map<String, Object> msg) {
@ -93,7 +104,7 @@ public class PresentationService {
yPercent = (Double) msg.get("yPercent");
}
presentationApplication.sendCursorUpdate(scope.getName(), xPercent, yPercent);
bbbInGW.sendCursorUpdate(scope.getName(), xPercent, yPercent);
}
public void resizeAndMoveSlide(Map<String, Object> msg) {
@ -132,11 +143,7 @@ public class PresentationService {
}
IScope scope = Red5.getConnectionLocal().getScope();
presentationApplication.resizeAndMoveSlide(scope.getName(), xOffset, yOffset, widthRatio, heightRatio);
}
public void setPresentationApplication(PresentationApplication a) {
presentationApplication = a;
bbbInGW.resizeAndMoveSlide(scope.getName(), xOffset, yOffset, widthRatio, heightRatio);
}
private BigBlueButtonSession getBbbSession() {

View File

@ -17,11 +17,11 @@
*
*/
package org.bigbluebutton.red5.service;
import java.util.Map;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import java.util.Map;
import org.bigbluebutton.red5.BigBlueButtonSession;
import org.bigbluebutton.red5.Constants;
import org.bigbluebutton.red5.api.IBigBlueButtonInGW;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.Red5;
import org.slf4j.Logger;

View File

@ -24,7 +24,6 @@ import org.red5.server.api.IClient;
import org.red5.server.api.IConnection;
import org.red5.server.api.scope.IScope;
import org.slf4j.Logger;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import org.bigbluebutton.core.api.Red5BBBInGw;
public class WhiteboardApplication implements IApplication {

View File

@ -19,27 +19,27 @@
package org.bigbluebutton.red5.service;
import java.util.Map;
import org.bigbluebutton.red5.BigBlueButtonSession;
import org.bigbluebutton.red5.Constants;
import org.bigbluebutton.red5.api.IBigBlueButtonInGW;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.Red5;
import org.slf4j.Logger;
public class WhiteboardService {
private static Logger log = Red5LoggerFactory.getLogger(WhiteboardService.class, "bigbluebutton");
private WhiteboardApplication application;
private final static String TYPE = "type";
private final static String STATUS = "status";
private final static String COR_ID = "id";
private final static String WB_ID = "whiteboardId";
private final static String TYPE = "type";
private final static String STATUS = "status";
private final static String COR_ID = "id";
private final static String WB_ID = "whiteboardId";
public void setWhiteboardApplication(WhiteboardApplication a){
log.debug("Setting whiteboard application instance");
this.application = a;
}
private IBigBlueButtonInGW bbbInGW;
public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) {
bbbInGW = inGW;
}
private boolean validMessage(Map<String, Object> shp) {
if (shp.containsKey(COR_ID) && shp.containsKey(TYPE) &&
shp.containsKey(STATUS) && shp.containsKey(WB_ID)) return true;
@ -64,7 +64,7 @@ public class WhiteboardService {
String requesterID = getBbbSession().getInternalUserID();
if (validMessage(annotation)) {
application.sendWhiteboardAnnotation(meetingID, requesterID, annotation);
bbbInGW.sendWhiteboardAnnotation(meetingID, requesterID, annotation);
}
}
@ -86,9 +86,11 @@ public class WhiteboardService {
String meetingID = getMeetingId();
String requesterID = getBbbSession().getInternalUserID();
String wbId = (String) message.get(WB_ID);
if (wbId != null) {
application.requestAnnotationHistory(meetingID, requesterID, wbId);
String whiteboardId = (String) message.get(WB_ID);
if (whiteboardId != null) {
// Just hardcode as we don't really need it for flash client. (ralam may 7, 2014)
String replyTo = meetingID + "/" + requesterID;
bbbInGW.requestWhiteboardAnnotationHistory(meetingID, requesterID, whiteboardId, replyTo);
}
}
@ -99,7 +101,7 @@ public class WhiteboardService {
String requesterID = getBbbSession().getInternalUserID();
String wbId = (String) message.get(WB_ID);
if (wbId != null) {
application.clearWhiteboard(meetingID, requesterID, wbId);
bbbInGW.clearWhiteboard(meetingID, requesterID, wbId);
}
}
@ -110,7 +112,7 @@ public class WhiteboardService {
String requesterID = getBbbSession().getInternalUserID();
String wbId = (String) message.get(WB_ID);
if (wbId != null) {
application.undoWhiteboard(meetingID, requesterID, wbId);
bbbInGW.undoWhiteboard(meetingID, requesterID, wbId);
}
}
@ -125,14 +127,16 @@ public class WhiteboardService {
String meetingID = getMeetingId();
String requesterID = getBbbSession().getInternalUserID();
Boolean enable = (Boolean)message.get("enabled");
application.setWhiteboardEnable(meetingID, requesterID, enable);
bbbInGW.enableWhiteboard(meetingID, requesterID, enable);
}
public void isWhiteboardEnabled() {
String meetingID = getMeetingId();
String requesterID = getBbbSession().getInternalUserID();
application.setIsWhiteboardEnabled(meetingID, requesterID);
// Just hardcode as we don't really need it for flash client. (ralam may 7, 2014)
String replyTo = meetingID + "/" + requesterID;
bbbInGW.isWhiteboardEnabled(meetingID, requesterID, replyTo);
}
private BigBlueButtonSession getBbbSession() {

View File

@ -55,7 +55,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<property name="connInvokerService"><ref bean="connInvokerService"/></property>
<property name="red5InGW"> <ref bean="red5BbbInGW"/> </property>
</bean>
<bean id="connInvokerService" class="org.bigbluebutton.red5.client.messaging.ConnectionInvokerService"
init-method="start" destroy-method="stop"/>
@ -105,4 +105,5 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<import resource="bbb-redis-pool.xml"/>
<import resource="bbb-red5-redis-pubsub.xml"/>
</beans>

62
labs/akka-bbb-apps/build.sbt Executable file
View File

@ -0,0 +1,62 @@
name := "apps"
organization := "org.bigbluebutton"
version := "0.1-SNAPSHOT"
scalaVersion := "2.11.6"
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-Xlint",
"-Ywarn-dead-code",
"-language:_",
"-target:jvm-1.7",
"-encoding", "UTF-8"
)
resolvers ++= Seq(
"spray repo" at "http://repo.spray.io/",
"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" )) )
// We want to have our jar files in lib_managed dir.
// This way we'll have the right path when we import
// into eclipse.
retrieveManaged := true
testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "html", "console", "junitxml")
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-h", "target/scalatest-reports")
libraryDependencies ++= {
val akkaVersion = "2.3.10"
val sprayVersion = "1.3.2"
Seq(
"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"
)}
seq(Revolver.settings: _*)
scalariformSettings

View File

@ -0,0 +1 @@
sbt.version=0.13.8

View File

@ -0,0 +1,5 @@
addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")

View File

@ -0,0 +1,64 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class AssignPresenterRequestMessage implements IPublishedMessage {
public static final String ASSIGN_PRESENTER_REQUEST = "assign_presenter_request_message";
public final String VERSION = "0.0.1";
public final String meetingId;
public final String newPresenterId;
public final String newPresenterName;
public final String assignedBy;
public AssignPresenterRequestMessage(String meetingID, String newPresenterId, String newPresenterName, String assignedBy) {
this.meetingId = meetingID;
this.newPresenterId = newPresenterId;
this.newPresenterName = newPresenterName;
this.assignedBy = assignedBy;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.NEW_PRESENTER_ID, newPresenterId);
payload.put(Constants.NEW_PRESENTER_NAME, newPresenterName);
payload.put(Constants.ASSIGNED_BY, assignedBy);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(ASSIGN_PRESENTER_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static AssignPresenterRequestMessage 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 (ASSIGN_PRESENTER_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)
&& payload.has(Constants.NEW_PRESENTER_ID)
&& payload.has(Constants.NEW_PRESENTER_NAME)
&& payload.has(Constants.ASSIGNED_BY)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String newPresenterId = payload.get(Constants.USER_ID).getAsString();
String newPresenterName = payload.get(Constants.NEW_PRESENTER_NAME).getAsString();
String assignedBy = payload.get(Constants.ASSIGNED_BY).getAsString();
return new AssignPresenterRequestMessage(meetingId, newPresenterId, newPresenterName, assignedBy);
}
}
}
}
System.out.println("Failed to parse DisconnectUserMessage");
return null;
}
}

View File

@ -0,0 +1,80 @@
package org.bigbluebutton.common.messages;
import java.util.ArrayList;
import java.util.HashMap;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class BroadcastLayoutMessage implements ISubscribedMessage {
public static final String BROADCAST_LAYOUT = "broadcast_layout_message";
public static final String VERSION = "0.0.1";
public static final String SET_BY_USERID = "set_by_userid";
public static final String LAYOUT = "layout";
public static final String LOCKED = "locked";
public static final String USERS = "users";
public final String meetingId;
public final String setByUserid;
public final String layout;
public final Boolean locked;
public final ArrayList<String> users;
public BroadcastLayoutMessage(String meetingId, String setByUserid, String layout, Boolean locked, ArrayList<String> users) {
this.meetingId = meetingId;
this.setByUserid = setByUserid;
this.layout = layout;
this.locked = locked;
this.users = users;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(SET_BY_USERID, setByUserid);
payload.put(LAYOUT, layout);
payload.put(LOCKED, locked);
payload.put(USERS, users);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(BROADCAST_LAYOUT, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static BroadcastLayoutMessage 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 (BROADCAST_LAYOUT.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(LOCKED)
&& payload.has(SET_BY_USERID)
&& payload.has(USERS)
&& payload.has(LAYOUT)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String setByUserid = payload.get(SET_BY_USERID).getAsString();
String layout = payload.get(LAYOUT).getAsString();
Boolean locked = payload.get(LOCKED).getAsBoolean();
JsonArray usersArr = (JsonArray) payload.get(USERS);
Util util = new Util();
ArrayList<String> users = util.extractUserids(usersArr);
return new BroadcastLayoutMessage(id, setByUserid, layout, locked, users);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,61 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class BroadcastLayoutRequestMessage implements ISubscribedMessage {
public static final String BROADCAST_LAYOUT_REQUEST = "broadcast_layout_request_message";
public static final String VERSION = "0.0.1";
public final static String LAYOUT = "layout";
public final String meetingId;
public final String userId;
public final String layout;
public BroadcastLayoutRequestMessage(String meetingId, String userId, String layout) {
this.meetingId = meetingId;
this.userId = userId;
this.layout = layout;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.USER_ID, userId);
payload.put(LAYOUT, layout);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(BROADCAST_LAYOUT_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static BroadcastLayoutRequestMessage 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 (BROADCAST_LAYOUT_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)
&& payload.has(LAYOUT)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
String layout = payload.get(LAYOUT).getAsString();
return new BroadcastLayoutRequestMessage(id, userid, layout);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,61 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class ClearWhiteboardReplyMessage implements ISubscribedMessage {
public static final String WHITEBOARD_CLEARED_MESSAGE = "whiteboard_cleared_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String whiteboardId;
public final String requesterId;
public ClearWhiteboardReplyMessage(String meetingId, String requesterId, String whiteboardId) {
this.meetingId = meetingId;
this.whiteboardId = whiteboardId;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.WHITEBOARD_ID, whiteboardId);
payload.put(Constants.REQUESTER_ID, requesterId);
System.out.println("ClearWhiteboardReplyMessage toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(WHITEBOARD_CLEARED_MESSAGE, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static ClearWhiteboardReplyMessage 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 (WHITEBOARD_CLEARED_MESSAGE.equals(messageName)) {
System.out.println("4"+payload.toString());
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.WHITEBOARD_ID)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
System.out.println("ClearWhiteboardReplyMessage fromJson");
return new ClearWhiteboardReplyMessage(meetingId, requesterId, whiteboardId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,60 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class ClearWhiteboardRequestMessage implements ISubscribedMessage {
public static final String CLEAR_WHITEBOARD_REQUEST = "clear_whiteboard_request";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String whiteboardId;
public final String requesterId;
public ClearWhiteboardRequestMessage(String meetingId, String requesterId, String whiteboardId) {
this.meetingId = meetingId;
this.whiteboardId = whiteboardId;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.WHITEBOARD_ID, whiteboardId);
payload.put(Constants.REQUESTER_ID, requesterId);
System.out.println("ClearWhiteboardRequestMessage toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(CLEAR_WHITEBOARD_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static ClearWhiteboardRequestMessage 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 (CLEAR_WHITEBOARD_REQUEST.equals(messageName)) {
System.out.println("4"+payload.toString());
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.WHITEBOARD_ID)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
System.out.println("ClearWhiteboardRequestMessage fromJson");
return new ClearWhiteboardRequestMessage(meetingId, requesterId, whiteboardId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,130 @@
package org.bigbluebutton.common.messages;
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 MEETING_MUTED = "meetingMuted";
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 EXTERN_USERID = "extern_userid";
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 LISTENONLY = "listenOnly";
public static final String LISTEN_ONLY = "listen_only";
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 CALLERNUM = "callernum";
public static final String CALLERNAME = "callername";
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 VOICEUSER = "voiceUser";
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 WEB_USERID = "web_userid";
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";
public static final String PRESENTATION_BASE_URL = "presentation_base_url";
public static final String DISABLE_CAMERA = "disable_camera";
public static final String LOCK_ON_JOIN_CONFIGURABLE = "lock_on_join_configurable";
public static final String DISABLE_MICROPHONE = "disable_microphone";
public static final String DISABLE_PRIVATE_CHAT = "disable_private_chat";
public static final String DISABLE_PUBLIC_CHAT = "disable_public_chat";
public static final String LOCK_ON_JOIN = "lock_on_join";
public static final String LOCKED_LAYOUT = "locked_layout";
public static final String CHAT_TYPE = "chat_type";
public static final String TO_USERNAME = "to_username";
public static final String FROM_USERNAME = "from_username";
public static final String FROM_USERID = "from_userid";
public static final String FROM_TZ_OFFSET = "from_tz_offset";
public static final String FROM_COLOR = "from_color";
public static final String TO_USERID = "to_userid";
public static final String FROM_TIME = "from_time";
public static final String PERM_DISABLE_CAM = "disableCam";
public static final String PERM_DISABLE_MIC = "disableMic";
public static final String PERM_DISABLE_PRIVCHAT = "disablePrivChat";
public static final String PERM_DISABLE_PUBCHAT = "disablePubChat";
public static final String PERM_LOCKED_LAYOUT = "lockedLayout";
public static final String PERM_LOCK_ON_JOIN = "lockOnJoin";
public static final String PERM_LOCK_ON_JOIN_CONFIG = "lockOnJoinConfigurable";
public static final String ENABLED = "enabled";
}

View File

@ -0,0 +1,37 @@
package org.bigbluebutton.common.messages;
public class CreateMeetingMessage implements IPublishedMessage {
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.common.messages;
public class DestroyMeetingMessage implements IPublishedMessage {
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,48 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class DisconnectAllUsersMessage implements IPublishedMessage {
public static final String DISCONNECT_All_USERS = "disconnect_all_users_message";
public final String VERSION = "0.0.1";
public final String meetingId;
public DisconnectAllUsersMessage(String meetingID) {
this.meetingId = meetingID;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(DISCONNECT_All_USERS, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static DisconnectAllUsersMessage 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 (DISCONNECT_All_USERS.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
return new DisconnectAllUsersMessage(meetingId);
}
}
}
}
System.out.println("Failed to parse DisconnectAllUsersMessage");
return null;
}
}

View File

@ -0,0 +1,51 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class DisconnectUserMessage implements IPublishedMessage {
public static final String DISCONNECT_USER = "disconnect_user_message";
public final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public DisconnectUserMessage(String meetingID, String userId) {
this.meetingId = meetingID;
this.userId = userId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(DISCONNECT_USER, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static DisconnectUserMessage 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 (DISCONNECT_USER.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String userId = payload.get(Constants.USER_ID).getAsString();
return new DisconnectUserMessage(meetingId, userId);
}
}
}
}
System.out.println("Failed to parse DisconnectUserMessage");
return null;
}
}

View File

@ -0,0 +1,56 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class EjectAllUsersFromVoiceConfRequestMessage {
public static final String EJECT_ALL_VOICE_USERS_REQUEST = "eject_all_users_from_voice_conf_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String VOICE_CONF_ID = "voice_conf_id";
public final String meetingId;
public final String voiceConfId;
public EjectAllUsersFromVoiceConfRequestMessage(String meetingId, String voiceConfId) {
this.meetingId = meetingId;
this.voiceConfId = voiceConfId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(VOICE_CONF_ID, voiceConfId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(EJECT_ALL_VOICE_USERS_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static EjectAllUsersFromVoiceConfRequestMessage 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 (EJECT_ALL_VOICE_USERS_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(VOICE_CONF_ID)) {
String id = payload.get(MEETING_ID).getAsString();
String voiceConfId = payload.get(VOICE_CONF_ID).getAsString();
return new EjectAllUsersFromVoiceConfRequestMessage(id, voiceConfId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,61 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class EjectUserFromMeetingRequestMessage implements ISubscribedMessage {
public static final String EJECT_USER_FROM_MEETING_REQUEST = "eject_user_from_meeting_request_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public final String ejectedBy;
private static final String EJECTED_BY = "ejected_by";
public EjectUserFromMeetingRequestMessage(String meetingId, String userId, String ejectedBy) {
this.meetingId = meetingId;
this.userId = userId;
this.ejectedBy = ejectedBy;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.USER_ID, userId);
payload.put(EJECTED_BY, ejectedBy);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(EJECT_USER_FROM_MEETING_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static EjectUserFromMeetingRequestMessage 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 (EJECT_USER_FROM_MEETING_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)
&& payload.has(EJECTED_BY)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
String ejectedBy = payload.get(EJECTED_BY).getAsString();
return new EjectUserFromMeetingRequestMessage(id, userid, ejectedBy);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,62 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class EjectUserFromVoiceConfRequestMessage {
public static final String EJECT_VOICE_USER_REQUEST = "eject_user_from_voice_conf_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String VOICE_CONF_ID = "voice_conf_id";
public static final String VOICE_USER_ID = "voice_user_id";
public final String meetingId;
public final String voiceConfId;
public final String voiceUserId;
public EjectUserFromVoiceConfRequestMessage(String meetingId, String voiceConfId, String voiceUserId) {
this.meetingId = meetingId;
this.voiceConfId = voiceConfId;
this.voiceUserId = voiceUserId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(VOICE_CONF_ID, voiceConfId);
payload.put(VOICE_USER_ID, voiceUserId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(EJECT_VOICE_USER_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static EjectUserFromVoiceConfRequestMessage 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 (EJECT_VOICE_USER_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(VOICE_CONF_ID)
&& payload.has(VOICE_USER_ID)) {
String id = payload.get(MEETING_ID).getAsString();
String voiceConfId = payload.get(VOICE_CONF_ID).getAsString();
String voiceUserId = payload.get(VOICE_USER_ID).getAsString();
return new EjectUserFromVoiceConfRequestMessage(id, voiceConfId, voiceUserId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,63 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class EjectUserFromVoiceRequestMessage implements ISubscribedMessage {
public static final String EJECT_USER_FROM_VOICE_REQUEST = "eject_user_from_voice_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String REQUESTER_ID = "requester_id";
public static final String USER_ID = "user_id";
public final String meetingId;
public final String requesterId;
public final String userId;
public EjectUserFromVoiceRequestMessage(String meetingId, String requesterId, String userId) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.userId = userId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(REQUESTER_ID, requesterId);
payload.put(USER_ID, userId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(EJECT_USER_FROM_VOICE_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static EjectUserFromVoiceRequestMessage 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 (EJECT_USER_FROM_VOICE_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(REQUESTER_ID)
&& payload.has(USER_ID)) {
String id = payload.get(MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
String userId = payload.get(USER_ID).getAsString();
return new EjectUserFromVoiceRequestMessage(id, requesterId, userId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,61 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class EnableWhiteboardRequestMessage implements ISubscribedMessage {
public static final String ENABLE_WHITEBOARD_REQUEST = "enable_whiteboard_request";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final boolean enable;
public EnableWhiteboardRequestMessage(String meetingId,
String requesterId, boolean enable) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.enable = enable;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
payload.put(Constants.ENABLE, enable);
System.out.println("EnableWhiteboardRequestMessage toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(ENABLE_WHITEBOARD_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static EnableWhiteboardRequestMessage 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 (ENABLE_WHITEBOARD_REQUEST.equals(messageName)) {
System.out.println("4"+payload.toString());
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.ENABLE)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
boolean enable = payload.get(Constants.ENABLE).getAsBoolean();
System.out.println("EnableWhiteboardRequestMessage fromJson");
return new EnableWhiteboardRequestMessage(meetingId, requesterId, enable);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,12 @@
package org.bigbluebutton.common.messages;
public class EndMeetingMessage implements IPublishedMessage {
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.common.messages;
public class GetAllMeetingsRequest implements IPublishedMessage {
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,59 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetChatHistory implements IPublishedMessage {
public static final String GET_CHAT_HISTORY_REQUEST = "get_chat_history_request";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String replyTo;
public final String requesterId;
public GetChatHistory(String meetingId, String requesterId, String replyTo) {
this.meetingId = meetingId;
this.replyTo = replyTo;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REPLY_TO, replyTo);
payload.put(Constants.REQUESTER_ID, requesterId);
System.out.println("GetChatHistory toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetChatHistory 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 (GET_CHAT_HISTORY_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REPLY_TO)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String replyTo = payload.get(Constants.REPLY_TO).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
System.out.println("GetChatHistory fromJson");
return new GetChatHistory(meetingId, replyTo, requesterId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,66 @@
package org.bigbluebutton.common.messages;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetChatHistoryReplyMessage implements ISubscribedMessage {
public static final String GET_CHAT_HISTORY_REPLY = "get_chat_history_reply";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final ArrayList<Map<String, Object>> chatHistory;
public GetChatHistoryReplyMessage(String meetingId, String requesterId, ArrayList<Map<String, Object>> chatHistory) {
this.meetingId = meetingId;
this.chatHistory = chatHistory;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.CHAT_HISTORY, chatHistory);
payload.put(Constants.REQUESTER_ID, requesterId);
System.out.println("GetChatHistoryReplyMessage toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetChatHistoryReplyMessage 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 (GET_CHAT_HISTORY_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.CHAT_HISTORY)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
JsonArray history = (JsonArray) payload.get(Constants.CHAT_HISTORY);
Util util = new Util();
ArrayList<Map<String, Object>> chatHistory = util.extractChatHistory(history);
System.out.println("GetChatHistoryReplyMessage fromJson");
return new GetChatHistoryReplyMessage(meetingId, requesterId, chatHistory);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,58 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetChatHistoryRequestMessage implements IPublishedMessage {
public static final String GET_CHAT_HISTORY_REQUEST = "get_chat_history_request";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String replyTo;
public final String requesterId;
public GetChatHistoryRequestMessage(String meetingId, String requesterId, String replyTo) {
this.meetingId = meetingId;
this.replyTo = replyTo;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REPLY_TO, replyTo);
payload.put(Constants.REQUESTER_ID, requesterId);
System.out.println("GetChatHistory toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetChatHistoryRequestMessage 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 (GET_CHAT_HISTORY_REQUEST.equals(messageName)) {
System.out.println("4"+payload.toString());
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REPLY_TO)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String replyTo = payload.get(Constants.REPLY_TO).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
System.out.println("GetChatHistory fromJson");
return new GetChatHistoryRequestMessage(meetingId, replyTo, requesterId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,74 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetCurrentLayoutReplyMessage implements ISubscribedMessage {
public static final String GET_CURRENT_LAYOUT_REPLY = "get_current_layout_reply_message";
public static final String VERSION = "0.0.1";
public static final String SET_BY_USERID = "set_by_userid";
public static final String REQUESTED_BY_USERID = "requested_by_userid";
public static final String LAYOUT = "layout";
public static final String LOCKED = "locked";
public final String meetingId;
public final String requestedByUserid;
public final String setByUserid;
public final String layout;
public final Boolean locked;
public GetCurrentLayoutReplyMessage(String meetingId, String requestedByUserid, String setByUserid, String layout, Boolean locked) {
this.meetingId = meetingId;
this.requestedByUserid = requestedByUserid;
this.setByUserid = setByUserid;
this.layout = layout;
this.locked = locked;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(REQUESTED_BY_USERID, requestedByUserid);
payload.put(SET_BY_USERID, setByUserid);
payload.put(LAYOUT, layout);
payload.put(LOCKED, locked);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_CURRENT_LAYOUT_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetCurrentLayoutReplyMessage 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 (GET_CURRENT_LAYOUT_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(REQUESTED_BY_USERID)
&& payload.has(SET_BY_USERID)
&& payload.has(LOCKED)
&& payload.has(LAYOUT)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String requestedByUserid = payload.get(REQUESTED_BY_USERID).getAsString();
String setByUserid = payload.get(SET_BY_USERID).getAsString();
String layout = payload.get(LAYOUT).getAsString();
Boolean locked = payload.get(LOCKED).getAsBoolean();
return new GetCurrentLayoutReplyMessage(id, requestedByUserid, setByUserid, layout, locked);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,55 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetCurrentLayoutRequestMessage implements ISubscribedMessage {
public static final String GET_CURRENT_LAYOUT_REQUEST = "get_current_layout_request_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public GetCurrentLayoutRequestMessage(String meetingId, String userId) {
this.meetingId = meetingId;
this.userId = userId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.USER_ID, userId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_CURRENT_LAYOUT_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetCurrentLayoutRequestMessage 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 (GET_CURRENT_LAYOUT_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
return new GetCurrentLayoutRequestMessage(id, userid);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,54 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetLockSettingsMessage implements IPublishedMessage {
public static final String GET_LOCK_SETTINGS = "get_lock_settings";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public GetLockSettingsMessage(String meetingId, String userId) {
this.meetingId = meetingId;
this.userId = userId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.USER_ID, userId);
System.out.println("GetLockSettings toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_LOCK_SETTINGS, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetLockSettingsMessage 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 (GET_LOCK_SETTINGS.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String userId = payload.get(Constants.USER_ID).getAsString();
System.out.println("GetLockSettings fromJson");
return new GetLockSettingsMessage(meetingId, userId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,58 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetPresentationInfoMessage implements IPublishedMessage {
public static final String GET_PRESENTATION_INFO = "get_presentation_info";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final String replyTo;
public GetPresentationInfoMessage(String meetingId, String requesterId, String replyTo) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.replyTo = replyTo;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
payload.put(Constants.REPLY_TO, replyTo);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_PRESENTATION_INFO, VERSION, null);
System.out.println("GetPresentationInfo toJson");
return MessageBuilder.buildJson(header, payload);
}
public static GetPresentationInfoMessage 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 (GET_PRESENTATION_INFO.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REQUESTER_ID)
&& payload.has(Constants.REPLY_TO)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
String replyTo = payload.get(Constants.REPLY_TO).getAsString();
System.out.println("GetPresentationInfo fromJson");
return new GetPresentationInfoMessage(meetingId, requesterId, replyTo);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,72 @@
package org.bigbluebutton.common.messages;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetPresentationInfoReplyMessage implements IPublishedMessage {
public static final String GET_PRESENTATION_INFO_REPLY = "get_presentation_info_reply";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final Map<String, Object> presenter;
public final ArrayList<Map<String, Object>> presentations;
public GetPresentationInfoReplyMessage(String meetingId, String requesterId,
Map<String, Object> presenter, ArrayList<Map<String, Object>> presentations) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.presenter = presenter;
this.presentations = presentations;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
payload.put(Constants.PRESENTER, presenter);
payload.put(Constants.PRESENTATIONS, presentations);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_PRESENTATION_INFO_REPLY, VERSION, null);
System.out.println("GetPresentationInfo toJson");
return MessageBuilder.buildJson(header, payload);
}
public static GetPresentationInfoReplyMessage 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 (GET_PRESENTATION_INFO_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REQUESTER_ID)
&& payload.has(Constants.PRESENTER)
&& payload.has(Constants.PRESENTATIONS)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
JsonObject presenterJsonObject = payload.get(Constants.PRESENTER).getAsJsonObject();
Util util = new Util();
Map<String, Object> presenter = util.extractCurrentPresenter(presenterJsonObject);
JsonArray presentationsJsonArray = payload.get(Constants.PRESENTATIONS).getAsJsonArray();
ArrayList<Map<String, Object>> presentations = util.extractPresentations(presentationsJsonArray);
return new GetPresentationInfoReplyMessage(meetingId, requesterId, presenter, presentations);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,59 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetRecordingStatusReplyMessage implements ISubscribedMessage {
public static final String Get_RECORDING_STATUS_REPLY = "get_recording_status_reply";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public final Boolean recording;
public GetRecordingStatusReplyMessage(String meetingId, String userId, Boolean recording) {
this.meetingId = meetingId;
this.userId = userId;
this.recording = recording;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.USER_ID, userId);
payload.put(Constants.RECORDING, recording);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(Get_RECORDING_STATUS_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetRecordingStatusReplyMessage 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 (Get_RECORDING_STATUS_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)
&& payload.has(Constants.RECORDING)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
Boolean recording = payload.get(Constants.RECORDING).getAsBoolean();
return new GetRecordingStatusReplyMessage(id, userid, recording);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,54 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetRecordingStatusRequestMessage implements ISubscribedMessage {
public static final String GET_RECORDING_STATUS_REQUEST = "get_recording_status_request_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public GetRecordingStatusRequestMessage(String meetingId, String userId) {
this.meetingId = meetingId;
this.userId = userId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.USER_ID, userId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_RECORDING_STATUS_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetRecordingStatusRequestMessage 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 (GET_RECORDING_STATUS_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
return new GetRecordingStatusRequestMessage(id, userid);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,59 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetSlideInfoMessage implements IPublishedMessage {
public static final String GET_SLIDE_INFO = "get_slide_info";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final String replyTo;
public GetSlideInfoMessage(String meetingId, String requesterId, String replyTo){
this.meetingId = meetingId;
this.requesterId = requesterId;
this.replyTo = replyTo;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
payload.put(Constants.REPLY_TO, replyTo);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_SLIDE_INFO, VERSION, null);
System.out.println("GetSlideInfo toJson");
return MessageBuilder.buildJson(header, payload);
}
public static GetSlideInfoMessage 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 (GET_SLIDE_INFO.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REQUESTER_ID)
&& payload.has(Constants.REPLY_TO)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
String replyTo = payload.get(Constants.REPLY_TO).getAsString();
System.out.println("GetSlideInfo fromJson");
return new GetSlideInfoMessage(meetingId, requesterId, replyTo);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,56 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetUsersFromVoiceConfRequestMessage {
public static final String GET_VOICE_USERS_REQUEST = "get_users_from_voice_conf_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String VOICE_CONF_ID = "voice_conf_id";
public final String meetingId;
public final String voiceConfId;
public GetUsersFromVoiceConfRequestMessage(String meetingId, String voiceConfId) {
this.meetingId = meetingId;
this.voiceConfId = voiceConfId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(VOICE_CONF_ID, voiceConfId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_VOICE_USERS_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetUsersFromVoiceConfRequestMessage 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 (GET_VOICE_USERS_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(VOICE_CONF_ID)) {
String id = payload.get(MEETING_ID).getAsString();
String voiceConfId = payload.get(VOICE_CONF_ID).getAsString();
return new GetUsersFromVoiceConfRequestMessage(id, voiceConfId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,66 @@
package org.bigbluebutton.common.messages;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetUsersReplyMessage implements ISubscribedMessage {
public static final String GET_USERS_REPLY = "get_users_reply";
public final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final ArrayList<Map<String, Object>> users;
public GetUsersReplyMessage(String meetingID, String requesterId, ArrayList<Map<String, Object>> users) {
this.meetingId = meetingID;
this.requesterId = requesterId;
this.users = users;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_USERS_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetUsersReplyMessage 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 (GET_USERS_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REQUESTER_ID)
&& payload.has(Constants.USERS)) {
String meetingID = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
JsonArray users = (JsonArray) payload.get(Constants.USERS);
Util util = new Util();
ArrayList<Map<String, Object>> usersList = util.extractUsers(users);
if (usersList != null) {
return new GetUsersReplyMessage(meetingID, requesterId, usersList);
}
}
}
}
}
System.out.println("Failed to parse GetUsersReplyMessage");
return null;
}
}

View File

@ -0,0 +1,53 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetUsersRequestMessage implements IPublishedMessage {
public static final String GET_USERS_REQUEST = "get_users_request_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public GetUsersRequestMessage(String meetingId, String requesterId) {
this.meetingId = meetingId;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_USERS_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetUsersRequestMessage 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 (GET_USERS_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
System.out.println("GetChatHistory fromJson");
return new GetUsersRequestMessage(meetingId, requesterId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,73 @@
package org.bigbluebutton.common.messages;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetWhiteboardShapesReplyMessage implements ISubscribedMessage {
public static final String GET_WHITEBOARD_SHAPES_REPLY = "get_whiteboard_shapes_reply";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final String whiteboardId;
public final ArrayList<Map<String, Object>> shapes;
public GetWhiteboardShapesReplyMessage(String meetingId, String requesterId,
String whiteboardId, ArrayList<Map<String, Object>> shapes) {
this.meetingId = meetingId;
this.whiteboardId = whiteboardId;
this.requesterId = requesterId;
this.shapes = shapes;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.SHAPES, shapes);
payload.put(Constants.WHITEBOARD_ID, whiteboardId);
payload.put(Constants.REQUESTER_ID, requesterId);
System.out.println("GetWhiteboardShapesReplyMessage toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_WHITEBOARD_SHAPES_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetWhiteboardShapesReplyMessage 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 (GET_WHITEBOARD_SHAPES_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.WHITEBOARD_ID)
&& payload.has(Constants.SHAPES)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString();
JsonArray shapes = (JsonArray) payload.get(Constants.SHAPES);
Util util = new Util();
ArrayList<Map<String, Object>> shapesList = util.extractShapes(shapes);
System.out.println("GetWhiteboardShapesReplyMessage fromJson" + shapesList.toString());
return new GetWhiteboardShapesReplyMessage(meetingId, requesterId,
whiteboardId, shapesList);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,54 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GoToSlideMessage implements IPublishedMessage {
public static final String GO_TO_SLIDE = "go_to_slide";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String page;
public GoToSlideMessage(String meetingId, String page){
this.meetingId = meetingId;
this.page = page;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.PAGE, page);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GO_TO_SLIDE, VERSION, null);
System.out.println("GoToSlide toJson");
return MessageBuilder.buildJson(header, payload);
}
public static GoToSlideMessage 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 (GO_TO_SLIDE.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.PAGE)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String page = payload.get(Constants.PAGE).getAsString();
System.out.println("GoToSlide fromJson");
return new GoToSlideMessage(meetingId, page);
}
}
}
}
return null;
}
}

View File

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

View File

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

View File

@ -0,0 +1,58 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class InitAudioSettingsMessage implements ISubscribedMessage {
public static final String INIT_AUDIO_SETTING = "init_audio_settings_message";
public final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public final Boolean muted;
public InitAudioSettingsMessage(String meetingID, String userId, Boolean muted) {
this.meetingId = meetingID;
this.userId = userId;
this.muted = muted;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(INIT_AUDIO_SETTING, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static InitAudioSettingsMessage 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 (INIT_AUDIO_SETTING.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)
&& payload.has(Constants.MUTED)) {
String meetingID = payload.get(Constants.MEETING_ID).getAsString();
String userId = payload.get(Constants.USER_ID).getAsString();
Boolean muted = payload.get(Constants.MUTED).getAsBoolean();
return new InitAudioSettingsMessage(meetingID, userId, muted);
}
}
}
}
System.out.println("Failed to parse NewPermissionsSettingMessage");
return null;
}
}

View File

@ -0,0 +1,61 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class InitPermissionsSettingMessage implements ISubscribedMessage {
public static final String INIT_PERMISSIONS_SETTING = "init_permission_settings_message";
public final String VERSION = "0.0.1";
public final String meetingId;
public final Map<String, Boolean> permissions;
public InitPermissionsSettingMessage(String meetingID, Map<String, Boolean> permissions) {
this.meetingId = meetingID;
this.permissions = permissions;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(INIT_PERMISSIONS_SETTING, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static InitPermissionsSettingMessage 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 (INIT_PERMISSIONS_SETTING.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USERS)
&& payload.has(Constants.PERMISSIONS)) {
String meetingID = payload.get(Constants.MEETING_ID).getAsString();
JsonObject permissions = (JsonObject) payload.get(Constants.PERMISSIONS);
Util util = new Util();
Map<String, Boolean> permissionsMap = util.extractPermission(permissions);
if (permissionsMap != null) {
return new InitPermissionsSettingMessage(meetingID, permissionsMap);
}
}
}
}
}
System.out.println("Failed to parse NewPermissionsSettingMessage");
return null;
}
}

View File

@ -0,0 +1,63 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class IsMeetingMutedReplyMessage implements ISubscribedMessage {
public static final String IS_MEETING_MUTED_REPLY = "is_meeting_muted_reply_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String REQUESTER_ID = "requester_id";
public static final String MUTED = "muted";
public final String meetingId;
public final String requesterId;
public final Boolean muted;
public IsMeetingMutedReplyMessage(String meetingId, String requesterId, Boolean muted) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.muted = muted;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(REQUESTER_ID, requesterId);
payload.put(MUTED, muted);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(IS_MEETING_MUTED_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static IsMeetingMutedReplyMessage 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 (IS_MEETING_MUTED_REPLY.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(REQUESTER_ID)
&& payload.has(MUTED)) {
String id = payload.get(MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
Boolean muted = payload.get(MUTED).getAsBoolean();
return new IsMeetingMutedReplyMessage(id, requesterId, muted);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,57 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class IsMeetingMutedRequestMessage implements ISubscribedMessage {
public static final String IS_MEETING_MUTED_REQUEST = "is_meeting_muted_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String REQUESTER_ID = "requester_id";
public final String meetingId;
public final String requesterId;
public IsMeetingMutedRequestMessage(String meetingId, String requesterId) {
this.meetingId = meetingId;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(REQUESTER_ID, requesterId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(IS_MEETING_MUTED_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static IsMeetingMutedRequestMessage 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 (IS_MEETING_MUTED_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(REQUESTER_ID)) {
String id = payload.get(MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
return new IsMeetingMutedRequestMessage(id, requesterId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,61 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class IsWhiteboardEnabledReplyMessage implements ISubscribedMessage {
public static final String IS_WHITEBOARD_ENABLED_REPLY = "whiteboard_enabled_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final boolean enabled;
public IsWhiteboardEnabledReplyMessage(String meetingId, String requesterId, boolean enabled) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.enabled = enabled;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
payload.put(Constants.ENABLED, enabled);
System.out.println("IsWhiteboardEnabledReplyMessage toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(IS_WHITEBOARD_ENABLED_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static IsWhiteboardEnabledReplyMessage 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 (IS_WHITEBOARD_ENABLED_REPLY.equals(messageName)) {
System.out.println("4"+payload.toString());
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REQUESTER_ID)
&& payload.has(Constants.ENABLED)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
boolean enabled = payload.get(Constants.ENABLED).getAsBoolean();
System.out.println("IsWhiteboardEnabledReplyMessage fromJson");
return new IsWhiteboardEnabledReplyMessage(meetingId, requesterId, enabled);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,61 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class IsWhiteboardEnabledRequestMessage implements ISubscribedMessage {
public static final String IS_WHITEBOARD_ENABLED_REQUEST = "is_whiteboard_enabled";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final String replyTo;
public IsWhiteboardEnabledRequestMessage(String meetingId,
String requesterId, String replyTo) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.replyTo = replyTo;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
payload.put(Constants.REPLY_TO, replyTo);
System.out.println("IsWhiteboardEnabledRequestMessage toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(IS_WHITEBOARD_ENABLED_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static IsWhiteboardEnabledRequestMessage 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 (IS_WHITEBOARD_ENABLED_REQUEST.equals(messageName)) {
System.out.println("4"+payload.toString());
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REPLY_TO)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
String replyTo = payload.get(Constants.REPLY_TO).getAsString();
System.out.println("IsWhiteboardEnabledRequestMessage fromJson");
return new IsWhiteboardEnabledRequestMessage(meetingId, requesterId, replyTo);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,12 @@
package org.bigbluebutton.common.messages;
public class KeepAliveMessage implements IPublishedMessage {
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,74 @@
package org.bigbluebutton.common.messages;
import java.util.ArrayList;
import java.util.HashMap;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class LockLayoutMessage implements ISubscribedMessage {
public static final String LOCK_LAYOUT = "lock_layout_message";
public static final String VERSION = "0.0.1";
public static final String SET_BY_USERID = "set_by_userid";
public static final String LOCKED = "locked";
public static final String USERS = "users";
public final String meetingId;
public final String setByUserid;
public final Boolean locked;
public final ArrayList<String> users;
public LockLayoutMessage(String meetingId, String setByUserid, Boolean locked, ArrayList<String> users) {
this.meetingId = meetingId;
this.setByUserid = setByUserid;
this.locked = locked;
this.users = users;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(SET_BY_USERID, setByUserid);
payload.put(LOCKED, locked);
payload.put(USERS, users);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(LOCK_LAYOUT, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static LockLayoutMessage 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 (LOCK_LAYOUT.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(LOCKED)
&& payload.has(SET_BY_USERID)
&& payload.has(USERS)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String setByUserid = payload.get(SET_BY_USERID).getAsString();
Boolean locked = payload.get(LOCKED).getAsBoolean();
JsonArray usersArr = (JsonArray) payload.get(USERS);
Util util = new Util();
ArrayList<String> users = util.extractUserids(usersArr);
return new LockLayoutMessage(id, setByUserid, locked, users);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,75 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class LockLayoutRequestMessage implements ISubscribedMessage {
public static final String LOCK_LAYOUT_REQUEST = "lock_layout_request_message";
public static final String VERSION = "0.0.1";
public final static String LAYOUT = "layout";
public final static String LOCK = "lock";
public final static String VIEWERS_ONLY = "viewers_only";
public final String meetingId;
public final String userId;
public final Boolean lock;
public final Boolean viewersOnly;
public final String layout;
public LockLayoutRequestMessage(String meetingId, String userId, Boolean lock, Boolean viewersOnly, String layout) {
this.meetingId = meetingId;
this.userId = userId;
this.lock = lock;
this.viewersOnly = viewersOnly;
this.layout = layout;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.USER_ID, userId);
payload.put(LOCK, lock);
payload.put(VIEWERS_ONLY, viewersOnly);
payload.put(LAYOUT, layout);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(LOCK_LAYOUT_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static LockLayoutRequestMessage 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 (LOCK_LAYOUT_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)
&& payload.has(LOCK)
&& payload.has(VIEWERS_ONLY)
&& payload.has(LAYOUT)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
Boolean lock = payload.get(LOCK).getAsBoolean();
Boolean viewersOnly = payload.get(VIEWERS_ONLY).getAsBoolean();
String layout = payload.get(LAYOUT).getAsString();
return new LockLayoutRequestMessage(id, userid, lock, viewersOnly, layout);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,69 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class LockMuteUserRequestMessage implements ISubscribedMessage {
public static final String LOCK_MUTE_USER_REQUEST = "lock_mute_user_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String REQUESTER_ID = "requester_id";
public static final String USER_ID = "user_id";
public static final String LOCK = "lock";
public final String meetingId;
public final String requesterId;
public final String userId;
public final Boolean lock;
public LockMuteUserRequestMessage(String meetingId, String requesterId, String userId, Boolean lock) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.userId = userId;
this.lock = lock;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(REQUESTER_ID, requesterId);
payload.put(USER_ID, userId);
payload.put(LOCK, lock);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(LOCK_MUTE_USER_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static LockMuteUserRequestMessage 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 (LOCK_MUTE_USER_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(REQUESTER_ID)
&& payload.has(USER_ID)
&& payload.has(LOCK)) {
String id = payload.get(MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
String userId = payload.get(USER_ID).getAsString();
Boolean lock = payload.get(LOCK).getAsBoolean();
return new LockMuteUserRequestMessage(id, requesterId, userId, lock);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,65 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class LockUserMessage implements IPublishedMessage {
public static final String LOCK_USER = "lock_user";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final boolean lock;
public final String internalUserId;
public LockUserMessage(String meetingId, String requesterId, boolean lock, String internalUserId) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.lock = lock;
this.internalUserId = internalUserId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
payload.put(Constants.LOCK, lock);
payload.put(Constants.INTERNAL_USER_ID, internalUserId);
System.out.println("LockUser toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(LOCK_USER, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static LockUserMessage 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 (LOCK_USER.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REQUESTER_ID)
&& payload.has(Constants.LOCK)
&& payload.has(Constants.INTERNAL_USER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
boolean lock = payload.get(Constants.LOCK).getAsBoolean();
String internalUserId = payload.get(Constants.INTERNAL_USER_ID).getAsString();
System.out.println("LockUser fromJson");
return new LockUserMessage(meetingId, requesterId, lock, internalUserId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,48 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MeetingEndedMessage implements ISubscribedMessage {
public static final String MEETING_ENDED = "meeting_ended_message";
public final String VERSION = "0.0.1";
public final String meetingId;
public MeetingEndedMessage(String meetingID) {
this.meetingId = meetingID;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(MEETING_ENDED, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static MeetingEndedMessage 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 (MEETING_ENDED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
return new MeetingEndedMessage(meetingId);
}
}
}
}
System.out.println("Failed to parse MeetingEndedMessage");
return null;
}
}

View File

@ -0,0 +1,48 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MeetingHasEndedMessage implements ISubscribedMessage {
public static final String MEETING_HAS_ENDED = "meeting_has_ended_message";
public final String VERSION = "0.0.1";
public final String meetingId;
public MeetingHasEndedMessage(String meetingID) {
this.meetingId = meetingID;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(MEETING_HAS_ENDED, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static MeetingHasEndedMessage 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 (MEETING_HAS_ENDED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
return new MeetingHasEndedMessage(meetingId);
}
}
}
}
System.out.println("Failed to parse MeetingHasEndedMessage");
return null;
}
}

View File

@ -0,0 +1,54 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MeetingMutedMessage implements ISubscribedMessage {
public static final String MEETING_MUTED = "meeting_muted_message";
public final String VERSION = "0.0.1";
public final String meetingId;
public final Boolean muted;
public MeetingMutedMessage(String meetingID, Boolean muted) {
this.meetingId = meetingID;
this.muted = muted;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(MEETING_MUTED, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static MeetingMutedMessage 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 (MEETING_MUTED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.MEETING_MUTED)) {
String meetingID = payload.get(Constants.MEETING_ID).getAsString();
Boolean muted = payload.get(Constants.MEETING_MUTED).getAsBoolean();
return new MeetingMutedMessage(meetingID, muted);
}
}
}
}
System.out.println("Failed to parse MeetingMutedMessage");
return null;
}
}

View File

@ -0,0 +1,67 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MeetingStateMessage implements ISubscribedMessage {
public static final String MEETING_STATE = "meeting_state_message";
public final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public final Map<String, Boolean> permissions;
public final Boolean muted;
public MeetingStateMessage(String meetingID, String userId, Map<String, Boolean> permissions, Boolean muted) {
this.meetingId = meetingID;
this.userId = userId;
this.permissions = permissions;
this.muted = muted;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(MEETING_STATE, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static MeetingStateMessage 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 (MEETING_STATE.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)
&& payload.has(Constants.PERMISSIONS)
&& payload.has(Constants.MEETING_MUTED)) {
String meetingID = payload.get(Constants.MEETING_ID).getAsString();
String userId = payload.get(Constants.USER_ID).getAsString();
Boolean muted = payload.get(Constants.MEETING_MUTED).getAsBoolean();
JsonObject premissions = (JsonObject) payload.get(Constants.PERMISSIONS);
Util util = new Util();
Map<String, Boolean> premissionsMap = util.extractPermission(premissions);
if (premissionsMap != null) {
return new MeetingStateMessage(meetingID, userId, premissionsMap, muted);
}
}
}
}
}
System.out.println("Failed to parse UserJoinedMessage");
return null;
}
}

View File

@ -0,0 +1,36 @@
package org.bigbluebutton.common.messages;
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,91 @@
package org.bigbluebutton.common.messages;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MessageFromJsonConverter {
public static IPublishedMessage 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:
System.out.println("Process ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN");
return processValidateAuthTokenMessage(header, payload);
// return ValidateAuthTokenMessage.fromJson(message);
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 IPublishedMessage 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 IPublishedMessage 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 IPublishedMessage processDestroyMeeting(JsonObject payload) {
String id = payload.get(Constants.MEETING_ID).getAsString();
return new DestroyMeetingMessage(id);
}
private static IPublishedMessage processEndMeetingMessage(JsonObject payload) {
String id = payload.get(Constants.MEETING_ID).getAsString();
return new EndMeetingMessage(id);
}
private static IPublishedMessage 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,66 @@
/**
* 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.common.messages;
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 TO_VOICE_CONF_CHANNEL = "bigbluebutton:to-voice-conf";
public static final String TO_VOICE_CONF_PATTERN = TO_VOICE_CONF_CHANNEL + ":*";
public static final String TO_VOICE_CONF_SYSTEM_CHAN = TO_VOICE_CONF_CHANNEL + ":system";
public static final String FROM_VOICE_CONF_CHANNEL = "bigbluebutton:from-voice-conf";
public static final String FROM_VOICE_CONF_PATTERN = FROM_VOICE_CONF_CHANNEL + ":*";
public static final String FROM_VOICE_CONF_SYSTEM_CHAN = FROM_VOICE_CONF_CHANNEL + ":system";
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.common.messages;
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,63 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MuteAllExceptPresenterRequestMessage implements ISubscribedMessage {
public static final String MUTE_ALL_EXCEPT_PRESENTER_REQUEST = "mute_all_except_presenter_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String REQUESTER_ID = "requester_id";
public static final String MUTE = "mute";
public final String meetingId;
public final String requesterId;
public final Boolean mute;
public MuteAllExceptPresenterRequestMessage(String meetingId, String requesterId, Boolean mute) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.mute = mute;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(REQUESTER_ID, requesterId);
payload.put(MUTE, mute);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(MUTE_ALL_EXCEPT_PRESENTER_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static MuteAllExceptPresenterRequestMessage 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 (MUTE_ALL_EXCEPT_PRESENTER_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(REQUESTER_ID)
&& payload.has(MUTE)) {
String id = payload.get(MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
Boolean mute = payload.get(MUTE).getAsBoolean();
return new MuteAllExceptPresenterRequestMessage(id, requesterId, mute);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,63 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MuteAllRequestMessage implements ISubscribedMessage {
public static final String MUTE_ALL_REQUEST = "mute_all_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String REQUESTER_ID = "requester_id";
public static final String MUTE = "mute";
public final String meetingId;
public final String requesterId;
public final Boolean mute;
public MuteAllRequestMessage(String meetingId, String requesterId, Boolean mute) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.mute = mute;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(REQUESTER_ID, requesterId);
payload.put(MUTE, mute);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(MUTE_ALL_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static MuteAllRequestMessage 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 (MUTE_ALL_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(REQUESTER_ID)
&& payload.has(MUTE)) {
String id = payload.get(MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
Boolean mute = payload.get(MUTE).getAsBoolean();
return new MuteAllRequestMessage(id, requesterId, mute);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,68 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MuteUserInVoiceConfRequestMessage {
public static final String MUTE_VOICE_USER_REQUEST = "mute_user_in_voice_conf_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String VOICE_CONF_ID = "voice_conf_id";
public static final String VOICE_USER_ID = "voice_user_id";
public static final String MUTE = "mute";
public final String meetingId;
public final String voiceConfId;
public final String voiceUserId;
public final Boolean mute;
public MuteUserInVoiceConfRequestMessage(String meetingId, String voiceConfId, String voiceUserId, Boolean mute) {
this.meetingId = meetingId;
this.voiceConfId = voiceConfId;
this.voiceUserId = voiceUserId;
this.mute = mute;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(VOICE_CONF_ID, voiceConfId);
payload.put(VOICE_USER_ID, voiceUserId);
payload.put(MUTE, mute);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(MUTE_VOICE_USER_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static MuteUserInVoiceConfRequestMessage 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 (MUTE_VOICE_USER_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(VOICE_CONF_ID)
&& payload.has(VOICE_USER_ID)
&& payload.has(MUTE)) {
String id = payload.get(MEETING_ID).getAsString();
String voiceConfId = payload.get(VOICE_CONF_ID).getAsString();
String voiceUserId = payload.get(VOICE_USER_ID).getAsString();
Boolean mute = payload.get(MUTE).getAsBoolean();
return new MuteUserInVoiceConfRequestMessage(id, voiceConfId, voiceUserId, mute);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,69 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MuteUserRequestMessage implements ISubscribedMessage {
public static final String MUTE_USER_REQUEST = "mute_user_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String REQUESTER_ID = "requester_id";
public static final String USER_ID = "user_id";
public static final String MUTE = "mute";
public final String meetingId;
public final String requesterId;
public final String userId;
public final Boolean mute;
public MuteUserRequestMessage(String meetingId, String requesterId, String userId, Boolean mute) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.userId = userId;
this.mute = mute;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(REQUESTER_ID, requesterId);
payload.put(USER_ID, userId);
payload.put(MUTE, mute);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(MUTE_USER_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static MuteUserRequestMessage 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 (MUTE_USER_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(REQUESTER_ID)
&& payload.has(USER_ID)
&& payload.has(MUTE)) {
String id = payload.get(MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
String userId = payload.get(USER_ID).getAsString();
Boolean mute = payload.get(MUTE).getAsBoolean();
return new MuteUserRequestMessage(id, requesterId, userId, mute);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,69 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class MuteVoiceUserRequestMessage implements ISubscribedMessage {
public static final String MUTE_USER_REQUEST = "mute_user_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String REQUESTER_ID = "requester_id";
public static final String USER_ID = "user_id";
public static final String MUTE = "mute";
public final String meetingId;
public final String requesterId;
public final String userId;
public final Boolean mute;
public MuteVoiceUserRequestMessage(String meetingId, String requesterId, String userId, Boolean mute) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.userId = userId;
this.mute = mute;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(REQUESTER_ID, requesterId);
payload.put(USER_ID, userId);
payload.put(MUTE, mute);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(MUTE_USER_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static MuteVoiceUserRequestMessage 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 (MUTE_USER_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(REQUESTER_ID)
&& payload.has(USER_ID)
&& payload.has(MUTE)) {
String id = payload.get(MEETING_ID).getAsString();
String requesterId = payload.get(REQUESTER_ID).getAsString();
String userId = payload.get(USER_ID).getAsString();
Boolean mute = payload.get(MUTE).getAsBoolean();
return new MuteVoiceUserRequestMessage(id, requesterId, userId, mute);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,69 @@
package org.bigbluebutton.common.messages;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class NewPermissionsSettingMessage implements ISubscribedMessage {
public static final String NEW_PERMISSIONS_SETTING = "new_permission_settings";
public final String VERSION = "0.0.1";
public final String meetingId;
public final ArrayList<Map<String, Object>> users;
public final Map<String, Boolean> permissions;
public NewPermissionsSettingMessage(String meetingID, Map<String, Boolean> permissions, ArrayList<Map<String, Object>> users) {
this.meetingId = meetingID;
this.users = users;
this.permissions = permissions;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(NEW_PERMISSIONS_SETTING, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static NewPermissionsSettingMessage 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 (NEW_PERMISSIONS_SETTING.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USERS)
&& payload.has(Constants.PERMISSIONS)) {
String meetingID = payload.get(Constants.MEETING_ID).getAsString();
JsonObject permissions = (JsonObject) payload.get(Constants.PERMISSIONS);
Util util = new Util();
Map<String, Boolean> permissionsMap = util.extractPermission(permissions);
JsonArray users = (JsonArray) payload.get(Constants.USERS);
ArrayList<Map<String, Object>> usersList = util.extractUsers(users);
if (usersList != null && permissionsMap != null) {
return new NewPermissionsSettingMessage(meetingID, permissionsMap, usersList);
}
}
}
}
}
System.out.println("Failed to parse NewPermissionsSettingMessage");
return null;
}
}

View File

@ -0,0 +1,56 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class PresentationRemovedMessage implements ISubscribedMessage {
public static final String PRESENTATION_REMOVED = "presentation_removed_message";
public final String VERSION = "0.0.1";
public static final String PRESENTATION_ID = "presentation_id";
public static final String MEETING_ID = "meeting_id";
public final String meetingId;
public final String presentationId;
public PresentationRemovedMessage(String meetingId, String presentationId) {
this.meetingId = meetingId;
this.presentationId = presentationId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(PRESENTATION_ID, presentationId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(PRESENTATION_REMOVED, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static PresentationRemovedMessage 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 (PRESENTATION_REMOVED.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(PRESENTATION_ID)) {
String meetingId = payload.get(MEETING_ID).getAsString();
String presentationId = payload.get(MEETING_ID).getAsString();
return new PresentationRemovedMessage(meetingId, presentationId);
}
}
}
}
System.out.println("Failed to parse PesentationRemovedMessage");
return null;
}
}

View File

@ -0,0 +1,64 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class PresenterAssignedMessage implements ISubscribedMessage {
public static final String PRESENTER_ASSIGNED = "presenter_assigned_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String newPresenterId;
public final String newPresenterName;
public final String assignedBy;
public PresenterAssignedMessage(String meetingId, String newPresenterId, String newPresenterName,
String assignedBy) {
this.meetingId = meetingId;
this.newPresenterId = newPresenterId;
this.newPresenterName = newPresenterName;
this.assignedBy = assignedBy;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.NEW_PRESENTER_ID, newPresenterId);
payload.put(Constants.NEW_PRESENTER_NAME, newPresenterName);
payload.put(Constants.ASSIGNED_BY, assignedBy);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(PRESENTER_ASSIGNED, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static PresenterAssignedMessage 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 (PRESENTER_ASSIGNED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.NEW_PRESENTER_ID)
&& payload.has(Constants.NEW_PRESENTER_NAME)
&& payload.has(Constants.ASSIGNED_BY)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String presenterId = payload.get(Constants.NEW_PRESENTER_ID).getAsString();
String presenterName = payload.get(Constants.NEW_PRESENTER_NAME).getAsString();
String assignedBy = payload.get(Constants.ASSIGNED_BY).getAsString();
return new PresenterAssignedMessage(id, presenterId, presenterName, assignedBy);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,62 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class RecordVoiceConfRequestMessage {
public static final String RECORD_VOICE_CONF_REQUEST = "record_voice_conf_request_message";
public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id";
public static final String VOICE_CONF_ID = "voice_conf_id";
public static final String RECORD = "record";
public final String meetingId;
public final String voiceConfId;
public final Boolean record;
public RecordVoiceConfRequestMessage(String meetingId, String voiceConfId, Boolean record) {
this.meetingId = meetingId;
this.voiceConfId = voiceConfId;
this.record = record;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(MEETING_ID, meetingId);
payload.put(VOICE_CONF_ID, voiceConfId);
payload.put(RECORD, record);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(RECORD_VOICE_CONF_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static RecordVoiceConfRequestMessage 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 (RECORD_VOICE_CONF_REQUEST.equals(messageName)) {
if (payload.has(MEETING_ID)
&& payload.has(VOICE_CONF_ID)
&& payload.has(RECORD)) {
String id = payload.get(MEETING_ID).getAsString();
String voiceConfId = payload.get(VOICE_CONF_ID).getAsString();
Boolean record = payload.get(RECORD).getAsBoolean();
return new RecordVoiceConfRequestMessage(id, voiceConfId, record);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,59 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class RecordingStatusChangedMessage implements ISubscribedMessage {
public static final String RECORDING_STATUS_CHANGED = "recording_status_changed_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public final Boolean recording;
public RecordingStatusChangedMessage(String meetingId, String userId, Boolean recording) {
this.meetingId = meetingId;
this.userId = userId;
this.recording = recording;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.USER_ID, userId);
payload.put(Constants.RECORDING, recording);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(RECORDING_STATUS_CHANGED, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static RecordingStatusChangedMessage 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 (RECORDING_STATUS_CHANGED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)
&& payload.has(Constants.RECORDING)) {
String id = payload.get(Constants.MEETING_ID).getAsString();
String userid = payload.get(Constants.USER_ID).getAsString();
Boolean recording = payload.get(Constants.RECORDING).getAsBoolean();
return new RecordingStatusChangedMessage(id, userid, recording);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,73 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class RegisterUserMessage implements IPublishedMessage {
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,54 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class RemovePresentationMessage implements IPublishedMessage {
public static final String REMOVE_PRESENTATION = "remove_presentation";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String presentationId;
public RemovePresentationMessage(String meetingId, String presentationId){
this.meetingId = meetingId;
this.presentationId = presentationId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.PRESENTATION_ID, presentationId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(REMOVE_PRESENTATION, VERSION, null);
System.out.println("RemovePresentation toJson");
return MessageBuilder.buildJson(header, payload);
}
public static RemovePresentationMessage 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 (REMOVE_PRESENTATION.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.PRESENTATION_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String presentationId = payload.get(Constants.PRESENTATION_ID).getAsString();
System.out.println("RemovePresentation fromJson");
return new RemovePresentationMessage(meetingId, presentationId);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,66 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class RequestWhiteboardAnnotationHistoryRequestMessage implements ISubscribedMessage {
public static final String REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST = "request_whiteboard_annotation_history_request";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String whiteboardId;
public final String requesterId;
public final String replyTo;
public RequestWhiteboardAnnotationHistoryRequestMessage(String meetingId,
String requesterId, String whiteboardId, String replyTo) {
this.meetingId = meetingId;
this.whiteboardId = whiteboardId;
this.requesterId = requesterId;
this.replyTo = replyTo;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.WHITEBOARD_ID, whiteboardId);
payload.put(Constants.REQUESTER_ID, requesterId);
payload.put(Constants.REPLY_TO, replyTo);
System.out.println("RequestWhiteboardAnnotationHistoryRequestMessage toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static RequestWhiteboardAnnotationHistoryRequestMessage 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 (REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST.equals(messageName)) {
System.out.println("4"+payload.toString());
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.WHITEBOARD_ID)
&& payload.has(Constants.REPLY_TO)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
String replyTo = payload.get(Constants.REPLY_TO).getAsString();
System.out.println("RequestWhiteboardAnnotationHistoryRequestMessage fromJson");
return new RequestWhiteboardAnnotationHistoryRequestMessage(meetingId, requesterId, whiteboardId, replyTo);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,69 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class ResizeAndMoveSlideMessage implements IPublishedMessage {
public static final String RESIZE_AND_MOVE_SLIDE = "resize_and_move_slide";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final double xOffset;
public final double yOffset;
public final double widthRatio;
public final double heightRatio;
public ResizeAndMoveSlideMessage(String meetingId, double xOffset, double yOffset,
double widthRatio, double heightRatio) {
this.meetingId = meetingId;
this.xOffset = xOffset;
this.yOffset = yOffset;
this.heightRatio = heightRatio;
this.widthRatio = widthRatio;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.X_OFFSET, xOffset);
payload.put(Constants.Y_OFFSET, yOffset);
payload.put(Constants.HEIGHT_RATIO, heightRatio);
payload.put(Constants.WIDTH_RATIO, widthRatio);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(RESIZE_AND_MOVE_SLIDE, VERSION, null);
System.out.println("ResizeAndMoveSlide toJson");
return MessageBuilder.buildJson(header, payload);
}
public static ResizeAndMoveSlideMessage 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 (RESIZE_AND_MOVE_SLIDE.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.X_OFFSET)
&& payload.has(Constants.Y_OFFSET)
&& payload.has(Constants.HEIGHT_RATIO)
&& payload.has(Constants.WIDTH_RATIO)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
double xOffset = payload.get(Constants.X_OFFSET).getAsDouble();
double yOffset = payload.get(Constants.Y_OFFSET).getAsDouble();
double heightRatio = payload.get(Constants.HEIGHT_RATIO).getAsDouble();
double widthRatio = payload.get(Constants.WIDTH_RATIO).getAsDouble();
System.out.println("ResizeAndMoveSlide fromJson");
return new ResizeAndMoveSlideMessage(meetingId, xOffset, yOffset, widthRatio, heightRatio);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,80 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendConversionCompletedMessage implements IPublishedMessage {
public static final String SEND_CONVERSION_COMPLETED = "send_conversion_completed";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String messageKey;
public final String code;
public final String presId;
public final int numPages;
public final String presName;
public final String presBaseUrl;
public SendConversionCompletedMessage(String messageKey, String meetingId, String code,
String presId, int numPages, String presName, String presBaseUrl) {
this.meetingId = meetingId;
this.messageKey = messageKey;
this.code = code;
this.presId = presId;
this.numPages = numPages;
this.presName = presName;
this.presBaseUrl = presBaseUrl;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.MESSAGE_KEY, messageKey);
payload.put(Constants.CODE, code);
payload.put(Constants.PRESENTATION_ID, presId);
payload.put(Constants.NUM_PAGES, numPages);
payload.put(Constants.PRESENTATION_NAME, presName);
payload.put(Constants.PRESENTATION_BASE_URL, presBaseUrl);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_CONVERSION_COMPLETED, VERSION, null);
System.out.println("SendConversionCompleted toJson");
return MessageBuilder.buildJson(header, payload);
}
public static SendConversionCompletedMessage 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 (SEND_CONVERSION_COMPLETED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.MESSAGE_KEY)
&& payload.has(Constants.CODE)
&& payload.has(Constants.PRESENTATION_ID)
&& payload.has(Constants.NUM_PAGES)
&& payload.has(Constants.PRESENTATION_NAME)
&& payload.has(Constants.PRESENTATION_BASE_URL)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String messageKey = payload.get(Constants.MESSAGE_KEY).getAsString();
String code = payload.get(Constants.CODE).getAsString();
String presId = payload.get(Constants.PRESENTATION_ID).getAsString();
int numPages = payload.get(Constants.NUM_PAGES).getAsInt();
String presName = payload.get(Constants.PRESENTATION_NAME).getAsString();
String presBaseUrl = payload.get(Constants.PRESENTATION_BASE_URL).getAsString();
System.out.println("SendConversionCompleted fromJson");
return new SendConversionCompletedMessage(messageKey, meetingId, code, presId, numPages, presName, presBaseUrl);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,70 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendConversionUpdateMessage implements IPublishedMessage {
public static final String SEND_CONVERSION_UPDATE = "send_conversion_update";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String messageKey;
public final String code;
public final String presId;
public final String presName;
public SendConversionUpdateMessage(String messageKey, String meetingId,
String code, String presId, String presName) {
this.meetingId = meetingId;
this.messageKey = messageKey;
this.code = code;
this.presId = presId;
this.presName = presName;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.MESSAGE_KEY, messageKey);
payload.put(Constants.CODE, code);
payload.put(Constants.PRESENTATION_ID, presId);
payload.put(Constants.PRESENTATION_NAME, presName);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_CONVERSION_UPDATE, VERSION, null);
System.out.println("SendConversionUpdate toJson");
return MessageBuilder.buildJson(header, payload);
}
public static SendConversionUpdateMessage 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 (SEND_CONVERSION_UPDATE.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.MESSAGE_KEY)
&& payload.has(Constants.CODE)
&& payload.has(Constants.PRESENTATION_NAME)
&& payload.has(Constants.PRESENTATION_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String code = payload.get(Constants.CODE).getAsString();
String messageKey = payload.get(Constants.MESSAGE_KEY).getAsString();
String presId = payload.get(Constants.PRESENTATION_ID).getAsString();
String presName = payload.get(Constants.PRESENTATION_NAME).getAsString();
System.out.println("SendConversionUpdate fromJson");
return new SendConversionUpdateMessage(messageKey, meetingId, code, presId, presName);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,58 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendCursorUpdateMessage implements IPublishedMessage {
public static final String SEND_CURSOR_UPDATE = "send_cursor_update";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final double xPercent;
public final double yPercent;
public SendCursorUpdateMessage(String meetingId, double xPercent, double yPercent){
this.meetingId = meetingId;
this.xPercent = xPercent;
this.yPercent = yPercent;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.X_PERCENT, xPercent);
payload.put(Constants.Y_PERCENT, yPercent);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_CURSOR_UPDATE, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static SendCursorUpdateMessage 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 (SEND_CURSOR_UPDATE.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.X_PERCENT)
&& payload.has(Constants.Y_PERCENT)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
double xPercent = payload.get(Constants.X_PERCENT).getAsDouble();
double yPercent = payload.get(Constants.Y_PERCENT).getAsDouble();
return new SendCursorUpdateMessage(meetingId, xPercent, yPercent);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,111 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendLockSettingsMessage implements IPublishedMessage {
public static final String SEND_LOCK_SETTINGS = "send_lock_settings";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String userId;
public final Map<String, Boolean> newSettings;
public SendLockSettingsMessage(String meetingId, String userId, Map<String, Boolean> newSettings) {
this.meetingId = meetingId;
this.userId = userId;
this.newSettings = newSettings;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
Map<String, Boolean> settingsMap = new HashMap<String, Boolean>();
settingsMap.put(Constants.DISABLE_CAMERA, newSettings.get("disableCam"));
settingsMap.put(Constants.DISABLE_MICROPHONE, newSettings.get("disableMic"));
settingsMap.put(Constants.DISABLE_PRIVATE_CHAT, newSettings.get("disablePrivateChat"));
settingsMap.put(Constants.DISABLE_PUBLIC_CHAT, newSettings.get("disablePublicChat"));
settingsMap.put(Constants.LOCKED_LAYOUT, newSettings.get("lockedLayout"));
settingsMap.put(Constants.LOCK_ON_JOIN, newSettings.get("lockOnJoin"));
settingsMap.put(Constants.LOCK_ON_JOIN_CONFIGURABLE, newSettings.get("lockOnJoinConfigurable"));
// System.out.println("\n\n" + newSettings.toString() + "\n\n");
// settingsMap.put(Constants.DISABLE_CAMERA, newSettings.get(Constants.DISABLE_CAMERA));
// settingsMap.put(Constants.DISABLE_MICROPHONE, newSettings.get(Constants.DISABLE_MICROPHONE));
// settingsMap.put(Constants.DISABLE_PRIVATE_CHAT, newSettings.get(Constants.DISABLE_PRIVATE_CHAT));
// settingsMap.put(Constants.DISABLE_PUBLIC_CHAT, newSettings.get(Constants.DISABLE_PUBLIC_CHAT));
// settingsMap.put(Constants.LOCKED_LAYOUT, newSettings.get(Constants.LOCKED_LAYOUT));
// settingsMap.put(Constants.LOCK_ON_JOIN, newSettings.get(Constants.LOCK_ON_JOIN));
// settingsMap.put(Constants.LOCK_ON_JOIN_CONFIGURABLE, newSettings.get(Constants.LOCK_ON_JOIN_CONFIGURABLE));
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.USER_ID, userId);
payload.put(Constants.SETTINGS, settingsMap);
System.out.println("SendLockSettings toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_LOCK_SETTINGS, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static SendLockSettingsMessage 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 (SEND_LOCK_SETTINGS.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.USER_ID)
&& payload.has(Constants.SETTINGS)) {
JsonObject settingsObj = (JsonObject) payload.get(Constants.SETTINGS).getAsJsonObject();
if (settingsObj.has(Constants.DISABLE_CAMERA)
&& settingsObj.has(Constants.DISABLE_CAMERA)
&& settingsObj.has(Constants.DISABLE_MICROPHONE)
&& settingsObj.has(Constants.DISABLE_PRIVATE_CHAT)
&& settingsObj.has(Constants.DISABLE_PUBLIC_CHAT)
&& settingsObj.has(Constants.LOCKED_LAYOUT)
&& settingsObj.has(Constants.LOCK_ON_JOIN)
&& settingsObj.has(Constants.LOCK_ON_JOIN_CONFIGURABLE)) {
Map<String, Boolean> settingsMap = new HashMap<String, Boolean>();
// settingsMap.put(Constants.DISABLE_CAMERA, settingsObj.get(Constants.DISABLE_CAMERA).getAsBoolean());
// settingsMap.put(Constants.DISABLE_MICROPHONE, settingsObj.get(Constants.DISABLE_MICROPHONE).getAsBoolean());
// settingsMap.put(Constants.DISABLE_PRIVATE_CHAT, settingsObj.get(Constants.DISABLE_PRIVATE_CHAT).getAsBoolean());
// settingsMap.put(Constants.DISABLE_PUBLIC_CHAT, settingsObj.get(Constants.DISABLE_PUBLIC_CHAT).getAsBoolean());
// settingsMap.put(Constants.LOCKED_LAYOUT, settingsObj.get(Constants.LOCKED_LAYOUT).getAsBoolean());
// settingsMap.put(Constants.LOCK_ON_JOIN, settingsObj.get(Constants.LOCK_ON_JOIN).getAsBoolean());
// settingsMap.put(Constants.LOCK_ON_JOIN_CONFIGURABLE, settingsObj.get(Constants.LOCK_ON_JOIN_CONFIGURABLE).getAsBoolean());
settingsMap.put("disableCam", settingsObj.get(Constants.DISABLE_CAMERA).getAsBoolean());
settingsMap.put("disableMic", settingsObj.get(Constants.DISABLE_MICROPHONE).getAsBoolean());
settingsMap.put("disablePrivateChat", settingsObj.get(Constants.DISABLE_PRIVATE_CHAT).getAsBoolean());
settingsMap.put("disablePublicChat", settingsObj.get(Constants.DISABLE_PUBLIC_CHAT).getAsBoolean());
settingsMap.put("lockedLayout", settingsObj.get(Constants.LOCKED_LAYOUT).getAsBoolean());
settingsMap.put("lockOnJoin", settingsObj.get(Constants.LOCK_ON_JOIN).getAsBoolean());
settingsMap.put("lockOnJoinConfigurable", settingsObj.get(Constants.LOCK_ON_JOIN_CONFIGURABLE).getAsBoolean());
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String userId = payload.get(Constants.USER_ID).getAsString();
System.out.println("SendLockSettings fromJson");
return new SendLockSettingsMessage(meetingId, userId, settingsMap);
}
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,81 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendPageCountErrorMessage implements IPublishedMessage {
public static final String SEND_PAGE_COUNT_ERROR = "send_page_count_error";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String messageKey;
public final String code;
public final String presId;
public final int numberOfPages;
public final int maxNumberPages;
public final String presName;
public SendPageCountErrorMessage(String messageKey, String meetingId,
String code, String presId, int numberOfPages, int maxNumberPages,
String presName) {
this.meetingId = meetingId;
this.messageKey = messageKey;
this.code = code;
this.presId = presId;
this.numberOfPages = numberOfPages;
this.maxNumberPages = maxNumberPages;
this.presName = presName;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.MESSAGE_KEY, messageKey);
payload.put(Constants.CODE, code);
payload.put(Constants.PRESENTATION_ID, presId);
payload.put(Constants.NUM_PAGES, numberOfPages);
payload.put(Constants.MAX_NUM_PAGES, maxNumberPages);
payload.put(Constants.PRESENTATION_NAME, presName);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_PAGE_COUNT_ERROR, VERSION, null);
System.out.println("SendPageCountError toJson");
return MessageBuilder.buildJson(header, payload);
}
public static SendPageCountErrorMessage 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 (SEND_PAGE_COUNT_ERROR.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.MESSAGE_KEY)
&& payload.has(Constants.CODE)
&& payload.has(Constants.PRESENTATION_ID)
&& payload.has(Constants.MAX_NUM_PAGES)
&& payload.has(Constants.NUM_PAGES)
&& payload.has(Constants.PRESENTATION_NAME)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String messageKey = payload.get(Constants.MESSAGE_KEY).getAsString();
String code = payload.get(Constants.CODE).getAsString();
String presId = payload.get(Constants.PRESENTATION_ID).getAsString();
int numberOfPages = payload.get(Constants.NUM_PAGES).getAsInt();
int maxNumberPages = payload.get(Constants.MAX_NUM_PAGES).getAsInt();
String presName = payload.get(Constants.PRESENTATION_NAME).getAsString();
System.out.println("SendPageCountError fromJson");
return new SendPageCountErrorMessage(messageKey, meetingId, code, presId, numberOfPages, maxNumberPages, presName);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,119 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import java.util.Map;
import org.bigbluebutton.core.service.chat.ChatKeyUtil;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendPrivateChatMessage implements IPublishedMessage {
public static final String SEND_PRIVATE_CHAT_MESSAGE = "send_private_chat_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final Map<String, String> messageInfo;
public SendPrivateChatMessage(String meetingId, String requesterId,
Map<String, String> message) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.messageInfo = message;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
Map<String, String> message = new HashMap<String, String>();
message.put(ChatKeyUtil.CHAT_TYPE, messageInfo.get(ChatKeyUtil.CHAT_TYPE));
message.put(ChatKeyUtil.MESSAGE, messageInfo.get(ChatKeyUtil.MESSAGE));
message.put(ChatKeyUtil.TO_USERNAME, messageInfo.get(ChatKeyUtil.TO_USERNAME));
message.put(ChatKeyUtil.FROM_TZ_OFFSET, messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET));
message.put(ChatKeyUtil.FROM_COLOR, messageInfo.get(ChatKeyUtil.FROM_COLOR));
message.put(ChatKeyUtil.TO_USERID, messageInfo.get(ChatKeyUtil.TO_USERID));
message.put(ChatKeyUtil.FROM_USERID, messageInfo.get(ChatKeyUtil.FROM_USERID));
message.put(ChatKeyUtil.FROM_TIME, messageInfo.get(ChatKeyUtil.FROM_TIME));
message.put(ChatKeyUtil.FROM_USERNAME, messageInfo.get(ChatKeyUtil.FROM_USERNAME));
payload.put(Constants.MESSAGE, message);
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_PRIVATE_CHAT_MESSAGE, VERSION, null);
System.out.println("SendPrivateChatMessage toJson");
return MessageBuilder.buildJson(header, payload);
}
public static SendPrivateChatMessage 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 (SEND_PRIVATE_CHAT_MESSAGE.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.MESSAGE)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
JsonObject msgObj = (JsonObject) payload.get(Constants.MESSAGE).getAsJsonObject();
Map<String, String> messageInfo = new HashMap<String, String>();
if (msgObj.has(ChatKeyUtil.CHAT_TYPE)
&& msgObj.has(ChatKeyUtil.MESSAGE)
&& msgObj.has(ChatKeyUtil.TO_USERNAME)
&& msgObj.has(ChatKeyUtil.FROM_TZ_OFFSET)
&& msgObj.has(ChatKeyUtil.FROM_COLOR)
&& msgObj.has(ChatKeyUtil.TO_USERID)
&& msgObj.has(ChatKeyUtil.FROM_USERID)
&& msgObj.has(ChatKeyUtil.FROM_TIME)
&& msgObj.has(ChatKeyUtil.FROM_USERNAME)){
messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(ChatKeyUtil.CHAT_TYPE).getAsString());
messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(ChatKeyUtil.MESSAGE).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(ChatKeyUtil.TO_USERNAME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(ChatKeyUtil.FROM_TZ_OFFSET).getAsString());
messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(ChatKeyUtil.FROM_COLOR).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(ChatKeyUtil.TO_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(ChatKeyUtil.FROM_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(ChatKeyUtil.FROM_TIME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(ChatKeyUtil.FROM_USERNAME).getAsString());
String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID);
System.out.println("SendPrivateChatMessage fromJson");
return new SendPrivateChatMessage(meetingId, requesterId, messageInfo);
} else if (msgObj.has(Constants.CHAT_TYPE)
&& msgObj.has(Constants.MESSAGE)
&& msgObj.has(Constants.TO_USERNAME)
&& msgObj.has(Constants.FROM_TZ_OFFSET)
&& msgObj.has(Constants.FROM_COLOR)
&& msgObj.has(Constants.TO_USERID)
&& msgObj.has(Constants.FROM_USERID)
&& msgObj.has(Constants.FROM_TIME)
&& msgObj.has(Constants.FROM_USERNAME)){
messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(Constants.CHAT_TYPE).getAsString());
messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(Constants.MESSAGE).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(Constants.TO_USERNAME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(Constants.FROM_TZ_OFFSET).getAsString());
messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(Constants.FROM_COLOR).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(Constants.TO_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(Constants.FROM_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(Constants.FROM_TIME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(Constants.FROM_USERNAME).getAsString());
String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID);
System.out.println("sendPrivateChatMessage fromJson");
return new SendPrivateChatMessage(meetingId, requesterId, messageInfo);
}
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,119 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import java.util.Map;
import org.bigbluebutton.core.service.chat.ChatKeyUtil;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendPublicChatMessage implements IPublishedMessage {
public static final String SEND_PUBLIC_CHAT_MESSAGE = "send_public_chat_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final Map<String, String> messageInfo;
public SendPublicChatMessage(String meetingId, String requesterId,
Map<String, String> message) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.messageInfo = message;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
Map<String, String> message = new HashMap<String, String>();
message.put(ChatKeyUtil.CHAT_TYPE, messageInfo.get(ChatKeyUtil.CHAT_TYPE));
message.put(ChatKeyUtil.MESSAGE, messageInfo.get(ChatKeyUtil.MESSAGE));
message.put(ChatKeyUtil.TO_USERNAME, messageInfo.get(ChatKeyUtil.TO_USERNAME));
message.put(ChatKeyUtil.FROM_TZ_OFFSET, messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET));
message.put(ChatKeyUtil.FROM_COLOR, messageInfo.get(ChatKeyUtil.FROM_COLOR));
message.put(ChatKeyUtil.TO_USERID, messageInfo.get(ChatKeyUtil.TO_USERID));
message.put(ChatKeyUtil.FROM_USERID, messageInfo.get(ChatKeyUtil.FROM_USERID));
message.put(ChatKeyUtil.FROM_TIME, messageInfo.get(ChatKeyUtil.FROM_TIME));
message.put(ChatKeyUtil.FROM_USERNAME, messageInfo.get(ChatKeyUtil.FROM_USERNAME));
payload.put(Constants.MESSAGE, message);
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_PUBLIC_CHAT_MESSAGE, VERSION, null);
System.out.println("sendPublicChatMessage toJson");
return MessageBuilder.buildJson(header, payload);
}
public static SendPublicChatMessage 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 (SEND_PUBLIC_CHAT_MESSAGE.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.MESSAGE)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
JsonObject msgObj = (JsonObject) payload.get(Constants.MESSAGE).getAsJsonObject();
Map<String, String> messageInfo = new HashMap<String, String>();
if (msgObj.has(ChatKeyUtil.CHAT_TYPE)
&& msgObj.has(ChatKeyUtil.MESSAGE)
&& msgObj.has(ChatKeyUtil.TO_USERNAME)
&& msgObj.has(ChatKeyUtil.FROM_TZ_OFFSET)
&& msgObj.has(ChatKeyUtil.FROM_COLOR)
&& msgObj.has(ChatKeyUtil.TO_USERID)
&& msgObj.has(ChatKeyUtil.FROM_USERID)
&& msgObj.has(ChatKeyUtil.FROM_TIME)
&& msgObj.has(ChatKeyUtil.FROM_USERNAME)){
messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(ChatKeyUtil.CHAT_TYPE).getAsString());
messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(ChatKeyUtil.MESSAGE).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(ChatKeyUtil.TO_USERNAME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(ChatKeyUtil.FROM_TZ_OFFSET).getAsString());
messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(ChatKeyUtil.FROM_COLOR).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(ChatKeyUtil.TO_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(ChatKeyUtil.FROM_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(ChatKeyUtil.FROM_TIME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(ChatKeyUtil.FROM_USERNAME).getAsString());
String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID);
System.out.println("sendPublicChatMessage fromJson");
return new SendPublicChatMessage(meetingId, requesterId, messageInfo);
} else if (msgObj.has(Constants.CHAT_TYPE)
&& msgObj.has(Constants.MESSAGE)
&& msgObj.has(Constants.TO_USERNAME)
&& msgObj.has(Constants.FROM_TZ_OFFSET)
&& msgObj.has(Constants.FROM_COLOR)
&& msgObj.has(Constants.TO_USERID)
&& msgObj.has(Constants.FROM_USERID)
&& msgObj.has(Constants.FROM_TIME)
&& msgObj.has(Constants.FROM_USERNAME)){
messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(Constants.CHAT_TYPE).getAsString());
messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(Constants.MESSAGE).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(Constants.TO_USERNAME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(Constants.FROM_TZ_OFFSET).getAsString());
messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(Constants.FROM_COLOR).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(Constants.TO_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(Constants.FROM_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(Constants.FROM_TIME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(Constants.FROM_USERNAME).getAsString());
String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID);
System.out.println("sendPublicChatMessage fromJson");
return new SendPublicChatMessage(meetingId, requesterId, messageInfo);
}
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,81 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendSlideGeneratedMessage implements IPublishedMessage {
public static final String SEND_SLIDE_GENERATED = "send_slide_generated";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String messageKey;
public final String code;
public final String presId;
public final int numberOfPages;
public final int pagesCompleted;
public final String presName;
public SendSlideGeneratedMessage(String messageKey, String meetingId,
String code, String presId, int numberOfPages, int pagesCompleted,
String presName) {
this.meetingId = meetingId;
this.messageKey = messageKey;
this.code = code;
this.presId = presId;
this.numberOfPages = numberOfPages;
this.pagesCompleted = pagesCompleted;
this.presName = presName;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.MESSAGE_KEY, messageKey);
payload.put(Constants.CODE, code);
payload.put(Constants.PRESENTATION_ID, presId);
payload.put(Constants.NUM_PAGES, numberOfPages);
payload.put(Constants.PAGES_COMPLETED, pagesCompleted);
payload.put(Constants.PRESENTATION_NAME, presName);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_SLIDE_GENERATED, VERSION, null);
System.out.println("SendSlideGenerated toJson");
return MessageBuilder.buildJson(header, payload);
}
public static SendSlideGeneratedMessage 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 (SEND_SLIDE_GENERATED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.MESSAGE_KEY)
&& payload.has(Constants.CODE)
&& payload.has(Constants.PRESENTATION_ID)
&& payload.has(Constants.PAGES_COMPLETED)
&& payload.has(Constants.NUM_PAGES)
&& payload.has(Constants.PRESENTATION_NAME)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String messageKey = payload.get(Constants.MESSAGE_KEY).getAsString();
String code = payload.get(Constants.CODE).getAsString();
String presId = payload.get(Constants.PRESENTATION_ID).getAsString();
int numberOfPages = payload.get(Constants.NUM_PAGES).getAsInt();
int pagesCompleted = payload.get(Constants.PAGES_COMPLETED).getAsInt();
String presName = payload.get(Constants.PRESENTATION_NAME).getAsString();
System.out.println("SendSlideGenerated fromJson");
return new SendSlideGeneratedMessage(messageKey, meetingId, code, presId, numberOfPages, pagesCompleted, presName);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,74 @@
package org.bigbluebutton.common.messages;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendWhiteboardAnnotationReplyMessage implements ISubscribedMessage {
public static final String SEND_WHITEBOARD_ANNOTATION_REPLY = "send_whiteboard_shape_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final String whiteboardId;
public final Map<String, Object> shape;
public SendWhiteboardAnnotationReplyMessage(String meetingId, String requesterId,
String whiteboardId, Map<String, Object> shape) {
this.meetingId = meetingId;
this.whiteboardId = whiteboardId;
this.requesterId = requesterId;
this.shape = shape;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.SHAPE, shape);
payload.put(Constants.WHITEBOARD_ID, whiteboardId);
payload.put(Constants.REQUESTER_ID, requesterId);
System.out.println("SendWhiteboardAnnotationReplyMessage toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_WHITEBOARD_ANNOTATION_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static SendWhiteboardAnnotationReplyMessage 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 (SEND_WHITEBOARD_ANNOTATION_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.WHITEBOARD_ID)
&& payload.has(Constants.SHAPE)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString();
JsonObject shape = (JsonObject) payload.get(Constants.SHAPE);
Util util = new Util();
Map<String, Object> annotation = util.extractOuterAnnotation(shape);
System.out.println("SendWhiteboardAnnotationReplyMessage fromJson");
return new SendWhiteboardAnnotationReplyMessage(meetingId, requesterId,
whiteboardId, annotation);
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,66 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendWhiteboardAnnotationRequestMessage implements ISubscribedMessage {
public static final String SEND_WHITEBOARD_ANNOTATION_REQUEST = "send_whiteboard_annotation_request";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final Map<String, Object> annotation;
public SendWhiteboardAnnotationRequestMessage(String meetingId,
String requesterId, Map<String, Object> annotation) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.annotation = annotation;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
payload.put(Constants.ANNOTATION, annotation);
System.out.println("SendWhiteboardAnnotationRequestMessage toJson");
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_WHITEBOARD_ANNOTATION_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static SendWhiteboardAnnotationRequestMessage 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 (SEND_WHITEBOARD_ANNOTATION_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.ANNOTATION)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
JsonObject annotationElement = (JsonObject) payload.get(Constants.ANNOTATION);
Util util = new Util();
Map<String, Object> annotation = util.extractAnnotation(annotationElement);
System.out.println("SendWhiteboardAnnotationRequestMessage fromJson");
return new SendWhiteboardAnnotationRequestMessage(meetingId, requesterId, annotation);
}
}
}
}
return null;
}
}

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