Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40a45bb
commit a79c5f4
Showing
15 changed files
with
553 additions
and
219 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...ton-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockMessageListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,48 @@ | |||
package org.bigbluebutton.conference.service.lock; | |||
|
|||
import org.bigbluebutton.conference.service.messaging.MessagingConstants; | |||
import org.bigbluebutton.conference.service.messaging.GetLockSettings; | |||
import org.bigbluebutton.conference.service.messaging.LockUser; | |||
import org.bigbluebutton.conference.service.messaging.SendLockSettings; | |||
import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; | |||
import org.bigbluebutton.core.api.IBigBlueButtonInGW; | |||
|
|||
import com.google.gson.JsonParser; | |||
import com.google.gson.JsonObject; | |||
|
|||
|
|||
public class LockMessageListener implements MessageHandler{ | |||
|
|||
private IBigBlueButtonInGW bbbGW; | |||
|
|||
public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { | |||
this.bbbGW = bbbGW; | |||
} | |||
|
|||
@Override | |||
public void handleMessage(String pattern, String channel, String message) { | |||
if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) { | |||
JsonParser parser = new JsonParser(); | |||
JsonObject obj = (JsonObject) parser.parse(message); | |||
|
|||
if (obj.has("header") && obj.has("payload")) { | |||
JsonObject header = (JsonObject) obj.get("header"); | |||
|
|||
if (header.has("name")) { | |||
String messageName = header.get("name").getAsString(); | |||
if (GetLockSettings.GET_LOCK_SETTINGS.equals(messageName)) { | |||
GetLockSettings msg = GetLockSettings.fromJson(message); | |||
bbbGW.getLockSettings(msg.meetingId, msg.userId); | |||
} else if(LockUser.LOCK_USER.equals(messageName)) { | |||
LockUser msg = LockUser.fromJson(message); | |||
bbbGW.lockUser(msg.meetingId, msg.requesterId, msg.lock, msg.internalUserId); | |||
} else if(SendLockSettings.SEND_LOCK_SETTINGS.equals(messageName)) { | |||
SendLockSettings msg = SendLockSettings.fromJson(message); | |||
System.out.println("\n\n(("+message); | |||
bbbGW.sendLockSettings(msg.meetingId, msg.userId, msg.newSettings); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...on-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetLockSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,54 @@ | |||
package org.bigbluebutton.conference.service.messaging; | |||
|
|||
import java.util.HashMap; | |||
|
|||
import com.google.gson.JsonObject; | |||
import com.google.gson.JsonParser; | |||
|
|||
public class GetLockSettings implements IMessage { | |||
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 GetLockSettings(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 GetLockSettings 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 GetLockSettings(meetingId, userId); | |||
} | |||
} | |||
} | |||
} | |||
return null; | |||
} | |||
} |
65 changes: 65 additions & 0 deletions
65
...luebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/LockUser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,65 @@ | |||
package org.bigbluebutton.conference.service.messaging; | |||
|
|||
import java.util.HashMap; | |||
|
|||
import com.google.gson.JsonObject; | |||
import com.google.gson.JsonParser; | |||
|
|||
public class LockUser implements IMessage { | |||
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 LockUser(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 LockUser 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 LockUser(meetingId, requesterId, lock, internalUserId); | |||
} | |||
} | |||
} | |||
} | |||
return null; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
...n-apps/src/main/java/org/bigbluebutton/conference/service/messaging/SendLockSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,120 @@ | |||
package org.bigbluebutton.conference.service.messaging; | |||
|
|||
import java.util.HashMap; | |||
import java.util.Map; | |||
|
|||
import com.google.gson.JsonObject; | |||
import com.google.gson.JsonParser; | |||
|
|||
public class SendLockSettings implements IMessage { | |||
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 SendLockSettings(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 SendLockSettings 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()); | |||
|
|||
System.out.println("AAAAAAAAAAAA:"+settingsObj.toString()); | |||
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 SendLockSettings(meetingId, userId, settingsMap); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
return null; | |||
} | |||
} |
Oops, something went wrong.