- fix compile errors

This commit is contained in:
Richard Alam 2014-01-28 22:01:45 +00:00
parent 29e94500c4
commit f251892cab
10 changed files with 70 additions and 156 deletions

View File

@ -24,8 +24,6 @@ import java.util.Map;
import org.bigbluebutton.conference.BigBlueButtonSession;
import org.bigbluebutton.conference.Constants;
import org.bigbluebutton.conference.Room;
import org.bigbluebutton.conference.RoomsManager;
import org.bigbluebutton.conference.User;
import org.bigbluebutton.conference.service.participants.ParticipantsApplication;
import org.red5.logging.Red5LoggerFactory;
@ -58,10 +56,11 @@ public class LockService {
* */
public Map<String, Boolean> getLockSettings(){
String roomID = getBbbSession().getRoom();
RoomsManager rm = application.getRoomsManager();
Room room = rm.getRoom(roomID);
// RoomsManager rm = application.getRoomsManager();
// Room room = rm.getRoom(roomID);
log.error("TODO: Need to implement!");
return room.getLockSettings().toMap();
return null;
}
/**
@ -74,11 +73,13 @@ public class LockService {
* */
public void setLockSettings(Map<String, Boolean> newSettings){
String roomID = getBbbSession().getRoom();
RoomsManager rm = application.getRoomsManager();
Room room = rm.getRoom(roomID);
// RoomsManager rm = application.getRoomsManager();
// Room room = rm.getRoom(roomID);
room.setLockSettings(new LockSettings(newSettings));
// room.setLockSettings(new LockSettings(newSettings));
//Send notification to clients
log.error("TODO: Need to implement!");
}
/**
@ -86,10 +87,12 @@ public class LockService {
* */
public boolean isRoomLocked(){
String roomID = getBbbSession().getRoom();
RoomsManager rm = application.getRoomsManager();
Room room = rm.getRoom(roomID);
// RoomsManager rm = application.getRoomsManager();
// Room room = rm.getRoom(roomID);
return room.isLocked();
log.error("TODO: Need to implement!");
return true;
}
/**
@ -98,6 +101,10 @@ public class LockService {
* */
public void setAllUsersLock(Boolean lock, ArrayList<String> dontLockTheseUsers){
log.debug("setAllUsersLock ({}, {})", new Object[] { lock, dontLockTheseUsers });
log.error("TODO: Need to implement!");
/*
String roomID = getBbbSession().getRoom();
RoomsManager rm = application.getRoomsManager();
Room room = rm.getRoom(roomID);
@ -121,6 +128,8 @@ public class LockService {
log.debug("setAllUsersLock::Will lock user " + user.getInternalUserID());
application.setParticipantStatus(roomID, user.getInternalUserID(), "locked", lock);
}
*/
}
/**
@ -128,6 +137,8 @@ public class LockService {
* */
public void setUserLock(Boolean lock, String internalUserID){
log.debug("setUserLock ({}, {}, {})", new Object[] { lock, internalUserID });
/*
String roomID = getBbbSession().getRoom();
Map<String, User> roomUserMap = application.getParticipants(roomID);
@ -144,5 +155,7 @@ public class LockService {
application.setParticipantStatus(roomID, user.getInternalUserID(), "locked", lock);
}
*/
log.error("TODO: Need to implement!");
}
}

View File

@ -20,61 +20,18 @@ package org.bigbluebutton.conference.service.participants;
import org.slf4j.Logger;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.Red5;
import java.util.ArrayList;
import java.util.Map;
import org.bigbluebutton.conference.ConnectionInvokerService;
import org.bigbluebutton.conference.RoomsManager;
import org.bigbluebutton.conference.Room; import org.bigbluebutton.conference.User; import org.bigbluebutton.conference.IRoomListener;
import org.bigbluebutton.conference.service.lock.LockSettings;
import java.util.Map;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
public class ParticipantsApplication {
private static Logger log = Red5LoggerFactory.getLogger( ParticipantsApplication.class, "bigbluebutton" );
private ConnectionInvokerService connInvokerService;
private RoomsManager roomsManager;
public boolean createRoom(String name, Boolean locked, LockSettings lockSettings) {
if(!roomsManager.hasRoom(name)){
log.info("Creating room " + name);
roomsManager.addRoom(new Room(name, locked, lockSettings));
return true;
}
return false;
}
public boolean destroyRoom(String name) {
if (roomsManager.hasRoom(name)) {
log.info("Destroying room " + name);
roomsManager.removeRoom(name);
} else {
log.warn("Destroying non-existing room " + name);
}
return true;
}
public void destroyAllRooms() {
roomsManager.destroyAllRooms();
}
public boolean hasRoom(String name) {
return roomsManager.hasRoom(name);
}
private IBigBlueButtonInGW bbbInGW;
public void setParticipantStatus(String room, String userid, String status, Object value) {
bbbInGW.setUserStatus(room, userid, status, value);
}
public Map<String, User> getParticipants(String roomName) {
log.debug("getParticipants - " + roomName);
if (! roomsManager.hasRoom(roomName)) {
log.warn("Could not find room " + roomName + ". Total rooms " + roomsManager.numberOfRooms());
return null;
}
return roomsManager.getParticipants(roomName);
}
public boolean participantLeft(String roomName, String userid) {
log.debug("Participant " + userid + " leaving room " + roomName);
bbbInGW.userLeft(userid, userid);
@ -84,29 +41,6 @@ public class ParticipantsApplication {
public boolean participantJoin(String roomName, String userid, String username, String role, String externUserID, Map status) {
bbbInGW.userJoin(roomName, userid, username, role, externUserID);
log.debug("participant joining room " + roomName);
if (roomsManager.hasRoom(roomName)) {
Room room = roomsManager.getRoom(roomName);
Boolean userLocked = false;
LockSettings ls = room.getLockSettings();
if(room.isLocked()) {
//If room is locked and it's not a moderator, user join as locked
if(!"MODERATOR".equals(role))
userLocked = true;
else {
//If it's a moderator, check for lockSettings
if(ls.getAllowModeratorLocking()) {
userLocked = true;
}
}
}
User p = new User(userid, username, role, externUserID, status, userLocked);
room.addParticipant(p);
log.debug("participant joined room " + roomName);
return true;
}
@ -123,23 +57,4 @@ public class ParticipantsApplication {
bbbInGW = inGW;
}
public RoomsManager getRoomsManager() {
return roomsManager;
}
private String getMeetingId(){
return Red5.getConnectionLocal().getScope().getName();
}
public void setConnInvokerService(ConnectionInvokerService connInvokerService) {
this.connInvokerService = connInvokerService;
}
public void setRecordingStatus(String room, String userid, Boolean recording) {
roomsManager.changeRecordingStatus(room, userid, recording);
}
public Boolean getRecordingStatus(String roomName) {
return roomsManager.getRecordingStatus(roomName);
}
}

View File

@ -58,13 +58,18 @@ public class ParticipantsService {
}
public void setRecordingStatus(String userid, Boolean recording) {
String roomName = Red5.getConnectionLocal().getScope().getName();
log.debug("Setting recording status " + roomName + " " + userid + " " + recording);
application.setRecordingStatus(roomName, userid, recording);
log.error("TODO: Setting recording status " + roomName + " " + userid + " " + recording);
//application.setRecordingStatus(roomName, userid, recording);
}
public Boolean getRecordingStatus() {
String roomName = Red5.getConnectionLocal().getScope().getName();
log.info("Client is requesting the recording status in [" + roomName + "].");
return application.getRecordingStatus(roomName);
log.error("TODO: Client is requesting the recording status in [" + roomName + "].");
return false;
//return application.getRecordingStatus(roomName);
}
private BigBlueButtonSession getBbbSession() {
return (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION);
}
}

View File

@ -118,9 +118,12 @@ public class VoiceHandler extends ApplicationAdapter implements IApplication{
connection.getScope().setAttribute(VOICE_BRIDGE, getBbbSession().getVoiceBridge());
}
log.debug("Setting up voiceBridge " + voiceBridge);
clientManager.addSharedObject(connection.getScope().getName(), voiceBridge, so);
conferenceService.createConference(voiceBridge, meetingid, record, muted);
log.error("TODO: Implement muting users");
// conferenceService.createConference(voiceBridge, meetingid, record, muted);
// conferenceService.createConference(voiceBridge, meetingid, record);
return true;

View File

@ -21,11 +21,11 @@ package org.bigbluebutton.conference.service.voice;
import java.util.HashMap;
import org.slf4j.Logger; import org.red5.server.api.Red5; import org.bigbluebutton.conference.BigBlueButtonSession; import org.bigbluebutton.conference.Constants; import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import org.red5.logging.Red5LoggerFactory; import java.util.ArrayList; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bigbluebutton.conference.BigBlueButtonSession;
import org.bigbluebutton.conference.Constants;
import org.bigbluebutton.webconference.voice.ConferenceService;
import org.bigbluebutton.webconference.voice.Participant;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.Red5;
@ -69,7 +69,10 @@ public class VoiceService {
public void muteAllUsers(boolean mute, List<Integer> dontMuteThese) {
String conference = getBbbSession().getVoiceBridge();
log.debug("Mute all users in room[" + conference + "], dontLockThese list size = " + dontMuteThese.size());
conferenceService.muteAllBut(conference, mute, dontMuteThese);
log.error("TODO: Implement this");
// conferenceService.muteAllBut(conference, mute, dontMuteThese);
}
public void muteAllUsers(boolean mute) {

View File

@ -24,4 +24,6 @@ public interface Participant {
public String getId();
public String getName();
public String getUserID();
public boolean isMuteLocked();
public void setLock(boolean lock);
}

View File

@ -63,4 +63,8 @@ public class VoiceUserJoinedEvent extends VoiceConferenceEvent {
public Boolean getSpeaking() {
return speaking;
}
public Boolean isLocked() {
return locked;
}
}

View File

@ -29,6 +29,7 @@ class ParticipantImp implements Participant {
private final String name;
private boolean muted = false;
private boolean talking = false;
private boolean locked = false;
private final String userID;
@ -71,6 +72,10 @@ class ParticipantImp implements Participant {
return id;
}
public void setLock(boolean lock) {
locked = lock;
}
public String getName() {
return name;
}

View File

@ -23,17 +23,12 @@ import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import net.jcip.annotations.ThreadSafe;
import org.bigbluebutton.webconference.voice.Participant;
import org.bigbluebutton.webconference.voice.Room;
@ThreadSafe
import org.bigbluebutton.webconference.voice.Participant;
import org.bigbluebutton.webconference.voice.Room;
>>>>>>> refactor-voice-users
public class RoomImp implements Room {
private final String name;
@ -49,7 +44,7 @@ public class RoomImp implements Room {
this.record = record;
this.meetingid = meetingid;
this.muted = muted;
participants = new ConcurrentHashMap<Integer, Participant>();
participants = new ConcurrentHashMap<String, Participant>();
}
public String getName() {

View File

@ -19,23 +19,7 @@
package org.bigbluebutton.webconference.voice.internal;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
<<<<<<< HEAD
import net.jcip.annotations.ThreadSafe;
import org.bigbluebutton.webconference.voice.ConferenceService;
import org.bigbluebutton.webconference.voice.Participant;
import org.bigbluebutton.webconference.voice.VoiceEventRecorder;
import org.bigbluebutton.webconference.voice.events.ConferenceEvent;
import org.bigbluebutton.webconference.voice.events.ParticipantJoinedEvent;
import org.bigbluebutton.webconference.voice.events.ParticipantLeftEvent;
import org.bigbluebutton.webconference.voice.events.ParticipantMutedEvent;
import org.bigbluebutton.webconference.voice.events.ParticipantTalkingEvent;
import org.bigbluebutton.webconference.voice.events.StartRecordingEvent;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
=======
import java.util.concurrent.ConcurrentHashMap;
import org.bigbluebutton.webconference.voice.Participant;
import org.bigbluebutton.webconference.voice.VoiceEventRecorder;
import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent;
@ -45,7 +29,7 @@ import org.bigbluebutton.webconference.voice.events.VoiceUserLockedEvent;
import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent;
import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent;
import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent;
>>>>>>> refactor-voice-users
public class RoomManager {
private final ConcurrentHashMap<String, RoomImp> rooms;
@ -63,15 +47,9 @@ public class RoomManager {
return "";
}
<<<<<<< HEAD
public void createRoom(String name, boolean record, String meetingid, Boolean muted) {
log.debug("Creating room: " + name);
RoomImp r = new RoomImp(name, record, meetingid, muted);
=======
public void createRoom(String name, boolean record, String meetingid) {
RoomImp r = new RoomImp(name, record, meetingid);
>>>>>>> refactor-voice-users
RoomImp r = new RoomImp(name, record, meetingid, muted);
rooms.putIfAbsent(name, r);
}
@ -108,8 +86,6 @@ public class RoomManager {
}
return rm.getParticipants();
}
<<<<<<< HEAD
=======
public boolean isParticipantMuteLocked(String participant, String room) {
RoomImp rm = rooms.get(room);
@ -128,7 +104,7 @@ public class RoomManager {
p.setLock(lock);
}
}
>>>>>>> refactor-voice-users
/**
* Process the event from the voice conferencing server.
@ -149,14 +125,10 @@ public class RoomManager {
} else if (event instanceof VoiceUserMutedEvent) {
handleParticipantMutedEvent(event, rm);
} else if (event instanceof VoiceUserTalkingEvent) {
handleParticipantTalkingEvent(event, rm);
<<<<<<< HEAD
} else if (event instanceof StartRecordingEvent) {
=======
handleParticipantTalkingEvent(event, rm);
} else if (event instanceof VoiceUserLockedEvent) {
handleParticipantLockedEvent(event, rm);
} else if (event instanceof VoiceStartRecordingEvent) {
>>>>>>> refactor-voice-users
} else if (event instanceof VoiceStartRecordingEvent) {
// do nothing but let it through.
// later on we need to dispatch an event to the client that the voice recording has started.
} else {
@ -222,15 +194,12 @@ public class RoomManager {
// ParticipantImp p = (ParticipantImp) rm.getParticipant(event.getUserId());
// if (p != null) p.setTalking(pte.isTalking());
}
<<<<<<< HEAD
=======
private void handleParticipantLockedEvent(VoiceConferenceEvent event, RoomImp rm) {
VoiceUserLockedEvent ple = (VoiceUserLockedEvent) event;
lockParticipant(ple.getRoom(), ple.getUserId(), ple.isLocked());
}
>>>>>>> refactor-voice-users
public void setVoiceEventRecorder(VoiceEventRecorder recorder) {
this.recorder = recorder;
}