[OPENMEETINGS-551] existing video streams are being played on room enter
Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/a260f5a8 Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/a260f5a8 Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/a260f5a8 Branch: refs/heads/master Commit: a260f5a882b8f8c7fc28ee3ee07602f4c7f36f74 Parents: a600e32 Author: Maxim Solodovnik <[email protected]> Authored: Sun Apr 23 04:23:36 2017 +0000 Committer: Maxim Solodovnik <[email protected]> Committed: Sun Apr 23 04:23:36 2017 +0000 ---------------------------------------------------------------------- .../openmeetings/core/remote/MobileService.java | 22 +- .../core/remote/RecordingService.java | 20 +- .../core/remote/ScopeApplicationAdapter.java | 64 +- .../openmeetings/core/remote/UserService.java | 8 +- .../core/session/SessionManager.java | 68 +- .../core/session/store/DatabaseStore.java | 32 +- .../core/session/store/HashMapStore.java | 54 +- .../session/store/IClientPersistenceStore.java | 22 +- .../openmeetings/core/util/RoomHelper.java | 42 + .../org/apache/openmeetings/IApplication.java | 4 +- .../openmeetings/db/dao/room/ClientDao.java | 42 +- .../db/dao/server/ISessionManager.java | 30 +- .../db/dao/server/SessiondataDao.java | 4 +- .../openmeetings/db/dto/room/RoomStatus.java | 8 +- .../db/dto/server/ClientSessionInfo.java | 10 +- .../openmeetings/db/entity/basic/Client.java | 5 +- .../openmeetings/db/entity/basic/IClient.java | 2 +- .../openmeetings/db/entity/room/Client.java | 896 ------------------- .../openmeetings/db/entity/room/Room.java | 6 +- .../db/entity/room/StreamClient.java | 896 +++++++++++++++++++ .../openmeetings/service/user/UserManager.java | 6 +- .../web/admin/connection/ConnectionsPanel.java | 10 +- .../openmeetings/web/admin/rooms/RoomForm.java | 12 +- .../openmeetings/web/app/Application.java | 5 +- .../openmeetings/web/room/RoomBroadcaster.java | 8 +- .../apache/openmeetings/web/room/RoomPanel.java | 36 +- .../web/room/menu/RoomMenuPanel.java | 5 +- .../org/apache/openmeetings/web/room/room.js | 9 +- .../classes/META-INF/db2_persistence.xml | 2 +- .../classes/META-INF/derby_persistence.xml | 2 +- .../classes/META-INF/mssql_persistence.xml | 2 +- .../classes/META-INF/mysql_persistence.xml | 2 +- .../classes/META-INF/oracle_persistence.xml | 2 +- .../classes/META-INF/postgresql_persistence.xml | 2 +- .../test/session/TestDbSession.java | 44 +- .../test/session/TestDbSessionGetRoomIds.java | 8 +- .../test/session/TestHashMapSession.java | 4 +- 37 files changed, 1217 insertions(+), 1177 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/MobileService.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/MobileService.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/MobileService.java index be56543..3e571c2 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/MobileService.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/MobileService.java @@ -51,7 +51,7 @@ import org.apache.openmeetings.db.dao.server.SessiondataDao; import org.apache.openmeetings.db.dao.user.IUserManager; import org.apache.openmeetings.db.dao.user.UserDao; import org.apache.openmeetings.db.entity.basic.ChatMessage; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.room.Room; import org.apache.openmeetings.db.entity.server.Sessiondata; import org.apache.openmeetings.db.entity.user.Group; @@ -220,7 +220,7 @@ public class MobileService { if (u != null) { IConnection conn = Red5.getConnectionLocal(); String streamId = conn.getClient().getId(); - Client c = sessionManager.getClientByStreamId(streamId, null); + StreamClient c = sessionManager.getClientByStreamId(streamId, null); if (c == null) { // Failed to create client result.put("status", -1); @@ -257,7 +257,7 @@ public class MobileService { IConnection current = Red5.getConnectionLocal(); for (IConnection conn : current.getScope().getClientConnections()) { if (conn != null && conn instanceof IServiceCapableConnection) { - Client c = sessionManager.getClientByStreamId(conn.getClient().getId(), null); + StreamClient c = sessionManager.getClientByStreamId(conn.getClient().getId(), null); if (!Strings.isEmpty(c.getAvsettings()) && !c.isScreenClient()) { Map<String, Object> map = new HashMap<>(); add(map, "streamId", c.getStreamid()); @@ -299,7 +299,7 @@ public class MobileService { List<Map<String, Object>> result = new ArrayList<>(); // FIXME duplicated code IConnection current = Red5.getConnectionLocal(); - Client c = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient c = sessionManager.getClientByStreamId(current.getClient().getId(), null); User u = userDao.get(c.getUserId()); //my rooms List<Room> myl = new ArrayList<>(); @@ -336,7 +336,7 @@ public class MobileService { public Map<String, Object> roomConnect(String SID, Long userId) { // publicSid is changed on mobile room connect IConnection current = Red5.getConnectionLocal(); - Client c = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient c = sessionManager.getClientByStreamId(current.getClient().getId(), null); Map<String, Object> result = new HashMap<>(); result.put("publicSid", c.getPublicSID()); result.put("broadCastId", c.getBroadCastID()); @@ -345,7 +345,7 @@ public class MobileService { public Map<String, Object> updateAvMode(String avMode, String width, String height, Integer interviewPodId) { IConnection current = Red5.getConnectionLocal(); - Client c = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient c = sessionManager.getClientByStreamId(current.getClient().getId(), null); c.setAvsettings(avMode); if (!"n".equals(avMode)) { c.setBroadCastID(nextBroadCastId()); @@ -371,7 +371,7 @@ public class MobileService { public void sendChatMessage(String msg) { IConnection current = Red5.getConnectionLocal(); - Client c = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient c = sessionManager.getClientByStreamId(current.getClient().getId(), null); ChatMessage m = new ChatMessage(); m.setMessage(msg); @@ -391,7 +391,7 @@ public class MobileService { sendChatMessage(sessionManager.getClientByPublicSID(uid, null), m, fmt); } - public void sendChatMessage(Client c, ChatMessage m, FastDateFormat fmt) { + public void sendChatMessage(StreamClient c, ChatMessage m, FastDateFormat fmt) { if (c == null) { return; } @@ -404,14 +404,14 @@ public class MobileService { new MessageSender(scopeAdapter.getRoomScope("" + roomId), "sendVarsToMessageWithClient", hsm, scopeAdapter) { @Override public boolean filter(IConnection conn) { - Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); + StreamClient rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); return rcl.isScreenClient() || rcl.getRoomId() == null || !rcl.getRoomId().equals(roomId); } }.start(); } - private static boolean isModerator(Client c) { + private static boolean isModerator(StreamClient c) { return c.getIsMod() || c.getIsSuperModerator(); } @@ -435,7 +435,7 @@ public class MobileService { List<Map<String,Object>> myChatList = new ArrayList<>(); try { IConnection current = Red5.getConnectionLocal(); - Client c = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient c = sessionManager.getClientByStreamId(current.getClient().getId(), null); Long roomId = c.getRoomId(); log.debug("GET CHATROOM: " + roomId); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/RecordingService.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/RecordingService.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/RecordingService.java index 5e2fe7f..e0bcd21 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/RecordingService.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/RecordingService.java @@ -39,7 +39,7 @@ import org.apache.openmeetings.db.entity.file.FileItem.Type; import org.apache.openmeetings.db.entity.record.Recording; import org.apache.openmeetings.db.entity.record.RecordingMetaData; import org.apache.openmeetings.db.entity.record.RecordingMetaData.Status; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.user.User; import org.apache.openmeetings.util.CalendarPatterns; import org.apache.openmeetings.util.message.RoomMessage; @@ -94,7 +94,7 @@ public class RecordingService implements IPendingServiceCallback { return "rec_" + recordingId + "_stream_" + streamid + "_" + dateString; } - public String recordMeetingStream(IConnection current, Client client, String roomRecordingName, String comment, boolean isInterview) { + public String recordMeetingStream(IConnection current, StreamClient client, String roomRecordingName, String comment, boolean isInterview) { try { log.debug("##REC:: recordMeetingStream ::"); @@ -140,7 +140,7 @@ public class RecordingService implements IPendingServiceCallback { for (IConnection conn : current.getScope().getClientConnections()) { if (conn != null) { if (conn instanceof IServiceCapableConnection) { - Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); + StreamClient rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); // Send every user a notification that the recording did start WebSocketHelper.sendRoom(new TextRoomMessage(roomId, ownerId, RoomMessage.Type.recordingStarted, client.getPublicSID())); @@ -306,7 +306,7 @@ public class RecordingService implements IPendingServiceCallback { } } - public Long stopRecordAndSave(IScope scope, Client client, Long storedRecordingId) { + public Long stopRecordAndSave(IScope scope, StreamClient client, Long storedRecordingId) { try { log.debug("stopRecordAndSave " + client.getUsername() + "," + client.getUserip()); WebSocketHelper.sendRoom(new TextRoomMessage(client.getRoomId(), client.getUserId(), RoomMessage.Type.recordingStoped, client.getPublicSID())); @@ -315,7 +315,7 @@ public class RecordingService implements IPendingServiceCallback { for (IConnection conn : scope.getClientConnections()) { if (conn != null) { if (conn instanceof IServiceCapableConnection) { - Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); + StreamClient rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); if (rcl == null) { continue; @@ -372,18 +372,18 @@ public class RecordingService implements IPendingServiceCallback { return new Long(-1); } - public Client checkLzRecording() { + public StreamClient checkLzRecording() { try { IConnection current = Red5.getConnectionLocal(); String streamid = current.getClient().getId(); log.debug("getCurrentRoomClient -2- " + streamid); - Client currentClient = sessionManager.getClientByStreamId(streamid, null); + StreamClient currentClient = sessionManager.getClientByStreamId(streamid, null); log.debug("getCurrentRoomClient -#########################- " + currentClient.getRoomId()); - for (Client rcl : sessionManager.getClientListByRoomAll(currentClient.getRoomId())) { + for (StreamClient rcl : sessionManager.getClientListByRoomAll(currentClient.getRoomId())) { if (rcl.getIsRecording()) { return rcl; } @@ -395,7 +395,7 @@ public class RecordingService implements IPendingServiceCallback { return null; } - public void stopRecordingShowForClient(IScope scope, Client rcl) { + public void stopRecordingShowForClient(IScope scope, StreamClient rcl) { try { // this cannot be handled here, as to stop a stream and to leave a // room is not @@ -433,7 +433,7 @@ public class RecordingService implements IPendingServiceCallback { } } - public void addRecordingByStreamId(IConnection conn, Client rcl, Long recordingId) { + public void addRecordingByStreamId(IConnection conn, StreamClient rcl, Long recordingId) { try { Recording recording = recordingDao.get(recordingId); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java index 676737e..bfb251a 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java @@ -50,7 +50,7 @@ import org.apache.openmeetings.db.dao.server.ServerDao; import org.apache.openmeetings.db.dao.server.SessiondataDao; import org.apache.openmeetings.db.dao.user.UserDao; import org.apache.openmeetings.db.entity.log.ConferenceLog; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.room.Room; import org.apache.openmeetings.db.entity.server.Server; import org.apache.openmeetings.db.entity.server.Sessiondata; @@ -196,7 +196,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } StringValue scn = StringValue.valueOf(conn.getScope().getName()); long roomId = scn.toLong(Long.MIN_VALUE); - Client rcm = new Client(); + StreamClient rcm = new StreamClient(); IApplication iapp = (IApplication)Application.get(OpenmeetingsVariables.wicketApplicationName); if (!Strings.isEmpty(securityCode)) { //this is for external applications like ffmpeg [OPENMEETINGS-1574] @@ -215,7 +215,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp log.warn("Client is not found by security id, client is rejected"); return rejectClient(); } - Client parent = sessionManager.getClientByPublicSID(_uid, null); + StreamClient parent = sessionManager.getClientByPublicSID(_uid, null); if (parent == null || !parent.getScope().equals(scn.toString())) { log.warn("Security code is invalid, client is rejected"); return rejectClient(); @@ -327,7 +327,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp log.debug("----------- screenSharerAction ENTER"); IConnection current = Red5.getConnectionLocal(); - Client client = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient client = sessionManager.getClientByStreamId(current.getClient().getId(), null); if (client != null) { boolean changed = false; @@ -384,7 +384,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp log.debug("----------- setConnectionAsSharingClient"); IConnection current = Red5.getConnectionLocal(); - Client client = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient client = sessionManager.getClientByStreamId(current.getClient().getId(), null); if (client != null) { boolean startRecording = Boolean.parseBoolean("" + map.get("startRecording")); @@ -469,7 +469,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp try { log.debug("[roomLeave] {} {} {} {}", client.getId(), room.getClients().size(), room.getContextPath(), room.getName()); - Client rcl = sessionManager.getClientByStreamId(client.getId(), null); + StreamClient rcl = sessionManager.getClientByStreamId(client.getId(), null); // The Room Client can be null if the Client left the room by using // logicalRoomLeave @@ -483,7 +483,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } public void roomLeaveByScope(String uid, Long roomId) { - Client rcl = sessionManager.getClientByPublicSID(uid, null); + StreamClient rcl = sessionManager.getClientByPublicSID(uid, null); IScope scope = getRoomScope("" + roomId); log.debug("[roomLeaveByScope] {} {} {} {}", uid, roomId, rcl, scope); if (rcl != null && scope != null) { @@ -501,7 +501,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp * @param client * @param scope */ - public void roomLeaveByScope(Client client, IScope scope) { + public void roomLeaveByScope(StreamClient client, IScope scope) { try { log.debug("[roomLeaveByScope] currentClient " + client); if (client.isScreenClient() && client.isStartStreaming()) { @@ -539,7 +539,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp new MessageSender(scope, "roomDisconnect", client, this) { @Override public boolean filter(IConnection conn) { - Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); + StreamClient rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); if (rcl == null) { return true; } @@ -576,11 +576,11 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp log.debug("----------- streamPublishStart"); IConnection current = Red5.getConnectionLocal(); final String streamid = current.getClient().getId(); - final Client c = sessionManager.getClientByStreamId(streamid, null); + final StreamClient c = sessionManager.getClientByStreamId(streamid, null); //We make a second object the has the reference to the object //that we will use to send to all participents - Client clientObjectSendToSync = c; + StreamClient clientObjectSendToSync = c; // Notify all the clients that the stream had been started log.debug("start streamPublishStart broadcast start: " + stream.getPublishedName() + " CONN " + current); @@ -608,7 +608,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp new MessageSender(current, "newStream", clientObjectSendToSync, this) { @Override public boolean filter(IConnection conn) { - Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); + StreamClient rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); if (rcl == null) { log.debug("RCL IS NULL newStream SEND"); @@ -638,15 +638,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp return false; } }.start(); - JSONObject obj = new JSONObject().put("uid", c.getPublicSID()); - if (c.isScreenClient()) { - obj.put("screenShare", true) - .put("uid", c.getStreamPublishName()) - .put("broadcastId", stream.getPublishedName()) - .put("suid", c.getPublicSID()) - .put("width", c.getVWidth()) - .put("height", c.getVHeight()); - } + JSONObject obj = new JSONObject().put("uid", c.getPublicSID()).put("screenShare", c.isScreenClient()); WebSocketHelper.sendRoom(new TextRoomMessage(c.getRoomId(), c.getUserId(), RoomMessage.Type.newStream, obj.toString())); } catch (Exception err) { log.error("[streamPublishStart]", err); @@ -668,7 +660,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp try { IConnection current = Red5.getConnectionLocal(); String streamId = current.getClient().getId(); - Client rcl = sessionManager.getClientByStreamId(streamId, null); + StreamClient rcl = sessionManager.getClientByStreamId(streamId, null); if (rcl == null) { @@ -708,7 +700,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp public void setNewCursorPosition(Object item) { try { IConnection current = Red5.getConnectionLocal(); - Client c = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient c = sessionManager.getClientByStreamId(current.getClient().getId(), null); @SuppressWarnings("rawtypes") Map cursor = (Map) item; @@ -724,7 +716,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp try { log.debug("----------- switchMicMuted: " + publicSID); - Client currentClient = sessionManager.getClientByPublicSID(publicSID, null); + StreamClient currentClient = sessionManager.getClientByPublicSID(publicSID, null); if (currentClient == null) { return -1L; } @@ -791,7 +783,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp new MessageSender(getRoomScope("" + roomId), method, obj, this) { @Override public boolean filter(IConnection conn) { - Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); + StreamClient rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); return rcl == null || rcl.isScreenClient() || rcl.getRoomId() == null || !rcl.getRoomId().equals(roomId) || userDao.get(rcl.getUserId()) == null; } @@ -931,7 +923,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp public int sendMessageWithClientWithSyncObject(Object newMessage, boolean sync) { try { IConnection current = Red5.getConnectionLocal(); - Client currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null); Map<String, Object> hsm = new HashMap<>(); hsm.put("client", currentClient); @@ -989,7 +981,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp public int sendMessageWithClientById(Object newMessage, String clientId) { try { IConnection current = Red5.getConnectionLocal(); - Client currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null); Map<String, Object> hsm = new HashMap<>(); hsm.put("client", currentClient); @@ -1021,7 +1013,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp for (IConnection conn : current.getScope().getClientConnections()) { if (conn != null) { - Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); + StreamClient rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); if (rcl.getIsRecording()) { return true; @@ -1046,14 +1038,14 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp for (IConnection conn : current.getScope().getClientConnections()) { if (conn != null) { - Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); + StreamClient rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); if (rcl != null && rcl.getIsRecording()) { return false; } } } - Client current_rcl = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient current_rcl = sessionManager.getClientByStreamId(current.getClient().getId(), null); // Also set the Recording Flag to Record all Participants that enter // later @@ -1102,7 +1094,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp private Long checkRecordingClient(IConnection conn) { Long recordingId = null; if (conn != null) { - Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); + StreamClient rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); if (rcl != null && rcl.getIsRecording()) { rcl.setIsRecording(false); recordingId = rcl.getRecordingId(); @@ -1123,7 +1115,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp */ public boolean stopInterviewRecording() { IConnection current = Red5.getConnectionLocal(); - Client currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null); + StreamClient currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null); return _stopInterviewRecording(currentClient, current.getScope()); } @@ -1132,7 +1124,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp * * @return true if interview was found */ - private boolean _stopInterviewRecording(Client currentClient, IScope currentScope) { + private boolean _stopInterviewRecording(StreamClient currentClient, IScope currentScope) { try { log.debug("----------- stopInterviewRecording"); Long clientRecordingId = currentClient.getRecordingId(); @@ -1182,7 +1174,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp //verify for (Iterator<Long> i = result.iterator(); i.hasNext();) { Long id = i.next(); - List<Client> rcs = sessionManager.getClientListByRoom(id); + List<StreamClient> rcs = sessionManager.getClientListByRoom(id); if (rcs.size() == 0 || (rcs.size() == 1 && rcs.get(0).isSipTransport())) { i.remove(); } @@ -1220,7 +1212,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp log.debug("----------- updateSipTransport"); IConnection current = Red5.getConnectionLocal(); String streamid = current.getClient().getId(); - Client client = sessionManager.getClientByStreamId(streamid, null); + StreamClient client = sessionManager.getClientByStreamId(streamid, null); Long roomId = client.getRoomId(); Integer count = getSipConferenceMembersNumber(roomId); String newNumber = getSipTransportLastname(count); @@ -1241,7 +1233,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp IClient c = current.getClient(); String streamid = c.getId(); // Notify all clients of the same scope (room) - Client currentClient = sessionManager.getClientByStreamId(streamid, null); + StreamClient currentClient = sessionManager.getClientByStreamId(streamid, null); currentClient.setSipTransport(true); currentClient.setRoomId(roomId); currentClient.setRoomEnter(new Date()); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/UserService.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/UserService.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/UserService.java index 7cc741a..6df8b37 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/UserService.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/UserService.java @@ -31,7 +31,7 @@ import org.apache.openmeetings.db.dao.server.ServerDao; import org.apache.openmeetings.db.dao.server.SessiondataDao; import org.apache.openmeetings.db.dao.user.IUserService; import org.apache.openmeetings.db.dao.user.UserDao; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.server.Server; import org.apache.openmeetings.db.entity.server.Sessiondata; import org.apache.openmeetings.db.entity.user.User; @@ -130,7 +130,7 @@ public class UserService implements IUserService { // admins only if (AuthLevelUtil.hasAdminLevel(userDao.getRights(sd.getUserId()))) { if (serverId == 0) { - Client rcl = sessionManager.getClientByStreamId(streamid, null); + StreamClient rcl = sessionManager.getClientByStreamId(streamid, null); if (rcl == null) { return true; @@ -150,7 +150,7 @@ public class UserService implements IUserService { return true; } else { Server server = serverDao.get(serverId); - Client rcl = sessionManager.getClientByStreamId( + StreamClient rcl = sessionManager.getClientByStreamId( streamid, server); slaveHTTPConnectionManager.kickSlaveUser(server, rcl.getPublicSID()); @@ -183,7 +183,7 @@ public class UserService implements IUserService { Sessiondata sd = sessionDao.check(sid); // users only if (AuthLevelUtil.hasUserLevel(userDao.getRights(sd.getUserId()))) { - Client rcl = sessionManager.getClientByPublicSID(publicSID, null); + StreamClient rcl = sessionManager.getClientByPublicSID(publicSID, null); if (rcl == null) { return true; http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/SessionManager.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/SessionManager.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/SessionManager.java index cc3121f..84f2bf9 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/SessionManager.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/SessionManager.java @@ -33,7 +33,7 @@ import org.apache.openmeetings.core.session.store.IClientPersistenceStore; import org.apache.openmeetings.db.dao.server.ISessionManager; import org.apache.openmeetings.db.dto.basic.SearchResult; import org.apache.openmeetings.db.dto.server.ClientSessionInfo; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.server.Server; import org.apache.wicket.util.string.Strings; import org.red5.logging.Red5LoggerFactory; @@ -41,7 +41,7 @@ import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; /** - * Handle {@link Client} objects. + * Handle {@link StreamClient} objects. * * Use a kind of decorator pattern to inject the {@link Server} into every call. * @@ -75,7 +75,7 @@ public class SessionManager implements ISessionManager { } @Override - public Client add(Client c, Server server) { + public StreamClient add(StreamClient c, Server server) { if (c == null) { return null; } @@ -99,7 +99,7 @@ public class SessionManager implements ISessionManager { } @Override - public Client addClientListItem(String streamId, String scopeName, + public StreamClient addClientListItem(String streamId, String scopeName, int remotePort, String remoteAddress, String swfUrl, Server server) { if (server == null) { server = serverUtil.getCurrentServer(); @@ -107,7 +107,7 @@ public class SessionManager implements ISessionManager { try { // Store the Connection into a bean and add it to the HashMap - Client rcm = new Client(); + StreamClient rcm = new StreamClient(); rcm.setConnectedSince(new Date()); rcm.setStreamid(streamId); rcm.setScope(scopeName); @@ -134,17 +134,17 @@ public class SessionManager implements ISessionManager { } @Override - public Collection<Client> getClients() { + public Collection<StreamClient> getClients() { return cache.getClients(); } @Override - public Collection<Client> getClientsWithServer() { + public Collection<StreamClient> getClientsWithServer() { return cache.getClientsWithServer(); } @Override - public Client getClientByStreamId(String streamId, Server server) { + public StreamClient getClientByStreamId(String streamId, Server server) { if (server == null) { server = serverUtil.getCurrentServer(); } @@ -161,12 +161,12 @@ public class SessionManager implements ISessionManager { } @Override - public Client getClientByPublicSID(String publicSID, Server server) { + public StreamClient getClientByPublicSID(String publicSID, Server server) { if (server == null) { server = serverUtil.getCurrentServer(); } try { - List<Client> list = cache.getClientsByPublicSID(server, publicSID); + List<StreamClient> list = cache.getClientsByPublicSID(server, publicSID); return list == null || list.isEmpty() ? null : list.get(0); } catch (Exception err) { log.error("[getClientByPublicSID]", err); @@ -177,8 +177,8 @@ public class SessionManager implements ISessionManager { @Override public ClientSessionInfo getClientByPublicSIDAnyServer(String publicSID) { try { - for (Entry<Long,List<Client>> entry : cache.getClientsByPublicSID(publicSID).entrySet()) { - for (Client rcl : entry.getValue()) { + for (Entry<Long,List<StreamClient>> entry : cache.getClientsByPublicSID(publicSID).entrySet()) { + for (StreamClient rcl : entry.getValue()) { return new ClientSessionInfo(rcl, entry.getKey()); } } @@ -189,9 +189,9 @@ public class SessionManager implements ISessionManager { } @Override - public Client getClientByUserId(Long userId) { + public StreamClient getClientByUserId(Long userId) { try { - for (Client rcl : cache.getClientsByUserId(null, userId)) { + for (StreamClient rcl : cache.getClientsByUserId(null, userId)) { if (rcl.isScreenClient()) { continue; } @@ -205,13 +205,13 @@ public class SessionManager implements ISessionManager { } @Override - public boolean updateAVClientByStreamId(String streamId, Client rcm, Server server) { + public boolean updateAVClientByStreamId(String streamId, StreamClient rcm, Server server) { if (server == null) { server = serverUtil.getCurrentServer(); } try { // get the corresponding user session object and update the settings - Client rclUsual = getClientByPublicSID(rcm.getPublicSID(), server); + StreamClient rclUsual = getClientByPublicSID(rcm.getPublicSID(), server); if (rclUsual != null) { rclUsual.setBroadCastID(rcm.getBroadCastID()); rclUsual.setAvsettings(rcm.getAvsettings()); @@ -219,7 +219,7 @@ public class SessionManager implements ISessionManager { rclUsual.setVWidth(rcm.getVWidth()); rclUsual.setVX(rcm.getVX()); rclUsual.setVY(rcm.getVY()); - Client rclSaved = cache.get(server, rclUsual.getStreamid()); + StreamClient rclSaved = cache.get(server, rclUsual.getStreamid()); if (rclSaved != null) { cache.put(rclUsual.getStreamid(), rclUsual); } else { @@ -236,12 +236,12 @@ public class SessionManager implements ISessionManager { } @Override - public boolean updateClientByStreamId(String streamId, Client rcm, boolean updateRoomCount, Server server) { + public boolean updateClientByStreamId(String streamId, StreamClient rcm, boolean updateRoomCount, Server server) { if (server == null) { server = serverUtil.getCurrentServer(); } try { - Client rclSaved = cache.get(server, streamId); + StreamClient rclSaved = cache.get(server, streamId); if (rclSaved != null) { cache.put(streamId, rcm); @@ -274,10 +274,10 @@ public class SessionManager implements ISessionManager { } @Override - public List<Client> getClientListByRoom(Long roomId) { - List<Client> roomClientList = new ArrayList<>(); + public List<StreamClient> getClientListByRoom(Long roomId) { + List<StreamClient> roomClientList = new ArrayList<>(); try { - for (Client rcl : cache.getClientsByRoomId(roomId)) { + for (StreamClient rcl : cache.getClientsByRoomId(roomId)) { if (rcl.isScreenClient()) { continue; } @@ -294,7 +294,7 @@ public class SessionManager implements ISessionManager { } @Override - public Collection<Client> getClientListByRoomAll(Long roomId) { + public Collection<StreamClient> getClientListByRoomAll(Long roomId) { try { return cache.getClientsByRoomId(roomId); } catch (Exception err) { @@ -304,10 +304,10 @@ public class SessionManager implements ISessionManager { } @Override - public List<Client> getCurrentModeratorByRoom(Long roomId) { - List<Client> rclList = new LinkedList<>(); - List<Client> currentClients = this.getClientListByRoom(roomId); - for (Client rcl : currentClients) { + public List<StreamClient> getCurrentModeratorByRoom(Long roomId) { + List<StreamClient> rclList = new LinkedList<>(); + List<StreamClient> currentClients = this.getClientListByRoom(roomId); + for (StreamClient rcl : currentClients) { if (rcl.getIsMod()) { rclList.add(rcl); } @@ -316,9 +316,9 @@ public class SessionManager implements ISessionManager { } @Override - public SearchResult<Client> getListByStartAndMax(int start, int max, String orderby, boolean asc) { - SearchResult<Client> sResult = new SearchResult<>(); - sResult.setObjectName(Client.class.getName()); + public SearchResult<StreamClient> getListByStartAndMax(int start, int max, String orderby, boolean asc) { + SearchResult<StreamClient> sResult = new SearchResult<>(); + sResult.setObjectName(StreamClient.class.getName()); sResult.setRecords(Long.valueOf(cache.size())); sResult.setResult(cache.getClientsWithServer()); return sResult; @@ -326,9 +326,9 @@ public class SessionManager implements ISessionManager { @Override public long getRecordingCount(long roomId) { - List<Client> currentClients = this.getClientListByRoom(roomId); + List<StreamClient> currentClients = this.getClientListByRoom(roomId); int numberOfRecordingUsers = 0; - for (Client rcl : currentClients) { + for (StreamClient rcl : currentClients) { if (rcl.isStartRecording()) { numberOfRecordingUsers++; } @@ -338,9 +338,9 @@ public class SessionManager implements ISessionManager { @Override public long getPublishingCount(long roomId) { - List<Client> currentClients = this.getClientListByRoom(roomId); + List<StreamClient> currentClients = this.getClientListByRoom(roomId); int numberOfPublishingUsers = 0; - for (Client rcl : currentClients) { + for (StreamClient rcl : currentClients) { if (rcl.isStreamPublishStarted()) { numberOfPublishingUsers++; } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/DatabaseStore.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/DatabaseStore.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/DatabaseStore.java index 5e79da3..84ce5b2 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/DatabaseStore.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/DatabaseStore.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.Map; import org.apache.openmeetings.db.dao.room.ClientDao; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.server.Server; import org.springframework.beans.factory.annotation.Autowired; @@ -40,7 +40,7 @@ public class DatabaseStore implements IClientPersistenceStore { } @Override - public void put(String streamId, Client rcl) { + public void put(String streamId, StreamClient rcl) { if (rcl.getId() != null) { clientDao.update(rcl); } else { @@ -54,29 +54,29 @@ public class DatabaseStore implements IClientPersistenceStore { } @Override - public Client get(Server server, String streamId) { + public StreamClient get(Server server, String streamId) { return clientDao.getClientByServerAndStreamId(server, streamId); } @Override - public List<Client> getClientsByPublicSID(Server server, String publicSID) { + public List<StreamClient> getClientsByPublicSID(Server server, String publicSID) { return clientDao.getClientsByPublicSIDAndServer(server, publicSID); } @Override - public Map<Long, List<Client>> getClientsByPublicSID(String publicSID) { - Map<Long, List<Client>> returnMap = new HashMap<>(); - List<Client> clientList = clientDao.getClientsByPublicSID(publicSID); - for (Client cl : clientList) { + public Map<Long, List<StreamClient>> getClientsByPublicSID(String publicSID) { + Map<Long, List<StreamClient>> returnMap = new HashMap<>(); + List<StreamClient> clientList = clientDao.getClientsByPublicSID(publicSID); + for (StreamClient cl : clientList) { if (cl.getServer() == null) { - List<Client> clList = returnMap.get(null); + List<StreamClient> clList = returnMap.get(null); if (clList == null) { clList = new ArrayList<>(); } clList.add(cl); returnMap.put(null, clList); } else { - List<Client> clList = returnMap.get(cl.getServer().getId()); + List<StreamClient> clList = returnMap.get(cl.getServer().getId()); if (clList == null) { clList = new ArrayList<>(); } @@ -88,27 +88,27 @@ public class DatabaseStore implements IClientPersistenceStore { } @Override - public Collection<Client> getClients() { + public Collection<StreamClient> getClients() { return clientDao.getClients(); } @Override - public Collection<Client> getClientsWithServer() { + public Collection<StreamClient> getClientsWithServer() { return clientDao.getClientsWithServer(); } @Override - public Collection<Client> getClientsByServer(Server server) { + public Collection<StreamClient> getClientsByServer(Server server) { return clientDao.getClientsByServer(server); } @Override - public List<Client> getClientsByUserId(Server server, Long userId) { + public List<StreamClient> getClientsByUserId(Server server, Long userId) { return clientDao.getClientsByUserId(server, userId); } @Override - public List<Client> getClientsByRoomId(Long roomId) { + public List<StreamClient> getClientsByRoomId(Long roomId) { return clientDao.getClientsByRoomId(roomId); } @@ -128,7 +128,7 @@ public class DatabaseStore implements IClientPersistenceStore { } @Override - public Collection<Client> values() { + public Collection<StreamClient> values() { return clientDao.getClients(); } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/HashMapStore.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/HashMapStore.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/HashMapStore.java index c896b34..57a0c25 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/HashMapStore.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/HashMapStore.java @@ -29,7 +29,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.server.Server; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; @@ -52,7 +52,7 @@ import org.slf4j.Logger; public class HashMapStore implements IClientPersistenceStore { protected static final Logger log = Red5LoggerFactory.getLogger(HashMapStore.class, webAppRootKey); - private Map<String, Client> clientsByStreamId = new ConcurrentHashMap<>(); + private Map<String, StreamClient> clientsByStreamId = new ConcurrentHashMap<>(); @Override public void clear() { @@ -60,7 +60,7 @@ public class HashMapStore implements IClientPersistenceStore { } @Override - public void put(String streamId, Client rcl) { + public void put(String streamId, StreamClient rcl) { clientsByStreamId.put(rcl.getStreamid(), rcl); } @@ -70,15 +70,15 @@ public class HashMapStore implements IClientPersistenceStore { } @Override - public Client get(Server server, String streamId) { + public StreamClient get(Server server, String streamId) { return clientsByStreamId.get(streamId); } @Override - public List<Client> getClientsByPublicSID(Server server, String publicSID) { - List<Client> clientList = new ArrayList<>(); - for (Map.Entry<String, Client> e: clientsByStreamId.entrySet()) { - Client cl = e.getValue(); + public List<StreamClient> getClientsByPublicSID(Server server, String publicSID) { + List<StreamClient> clientList = new ArrayList<>(); + for (Map.Entry<String, StreamClient> e: clientsByStreamId.entrySet()) { + StreamClient cl = e.getValue(); if (cl.getPublicSID().equals(publicSID)) { clientList.add(cl); } @@ -87,11 +87,11 @@ public class HashMapStore implements IClientPersistenceStore { } @Override - public Map<Long,List<Client>> getClientsByPublicSID(String publicSID) { - Map<Long,List<Client>> clientMapList = new HashMap<>(); - List<Client> clientList = new ArrayList<>(); - for (Map.Entry<String, Client> e: clientsByStreamId.entrySet()) { - Client cl = e.getValue(); + public Map<Long,List<StreamClient>> getClientsByPublicSID(String publicSID) { + Map<Long,List<StreamClient>> clientMapList = new HashMap<>(); + List<StreamClient> clientList = new ArrayList<>(); + for (Map.Entry<String, StreamClient> e: clientsByStreamId.entrySet()) { + StreamClient cl = e.getValue(); if (cl.getPublicSID().equals(publicSID)) { clientList.add(cl); } @@ -101,27 +101,27 @@ public class HashMapStore implements IClientPersistenceStore { } @Override - public Collection<Client> getClients() { + public Collection<StreamClient> getClients() { return clientsByStreamId.values(); } @Override - public Collection<Client> getClientsWithServer() { + public Collection<StreamClient> getClientsWithServer() { //there is no server object to be loaded, memory cache means //there is no cluster enabled return getClients(); } @Override - public Collection<Client> getClientsByServer(Server server) { + public Collection<StreamClient> getClientsByServer(Server server) { return clientsByStreamId.values(); } @Override - public List<Client> getClientsByUserId(Server server, Long userId) { - List<Client> clientList = new ArrayList<>(); - for (Map.Entry<String, Client> e: clientsByStreamId.entrySet()) { - Client cl = e.getValue(); + public List<StreamClient> getClientsByUserId(Server server, Long userId) { + List<StreamClient> clientList = new ArrayList<>(); + for (Map.Entry<String, StreamClient> e: clientsByStreamId.entrySet()) { + StreamClient cl = e.getValue(); if (cl.getUserId().equals(userId)) { clientList.add(cl); } @@ -130,10 +130,10 @@ public class HashMapStore implements IClientPersistenceStore { } @Override - public List<Client> getClientsByRoomId(Long roomId) { - List<Client> clientList = new ArrayList<>(); - for (Map.Entry<String, Client> e: clientsByStreamId.entrySet()) { - Client cl = e.getValue(); + public List<StreamClient> getClientsByRoomId(Long roomId) { + List<StreamClient> clientList = new ArrayList<>(); + for (Map.Entry<String, StreamClient> e: clientsByStreamId.entrySet()) { + StreamClient cl = e.getValue(); if (cl.getRoomId() != null && cl.getRoomId().equals(roomId)) { clientList.add(cl); } @@ -157,7 +157,7 @@ public class HashMapStore implements IClientPersistenceStore { } @Override - public Collection<Client> values() { + public Collection<StreamClient> values() { return clientsByStreamId.values(); } @@ -194,8 +194,8 @@ public class HashMapStore implements IClientPersistenceStore { @Override public List<Long> getRoomsIdsByServer(Server server) { Set<Long> rooms = new HashSet<>(); - for (Map.Entry<String, Client> e: clientsByStreamId.entrySet()) { - Client cl = e.getValue(); + for (Map.Entry<String, StreamClient> e: clientsByStreamId.entrySet()) { + StreamClient cl = e.getValue(); Long roomId = cl.getRoomId(); if (roomId != null && roomId.longValue() > 0 && !rooms.contains(roomId)) { rooms.add(roomId); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/IClientPersistenceStore.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/IClientPersistenceStore.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/IClientPersistenceStore.java index a511680..5ca0634 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/IClientPersistenceStore.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/IClientPersistenceStore.java @@ -22,7 +22,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.server.Server; public interface IClientPersistenceStore { @@ -41,7 +41,7 @@ public interface IClientPersistenceStore { * @param streamId * @param rcl */ - void put(String streamId, Client rcl); + void put(String streamId, StreamClient rcl); /** * @@ -58,7 +58,7 @@ public interface IClientPersistenceStore { * @param streamId * @return will return null if the client does not exist in the list */ - Client get(Server server, String streamId); + StreamClient get(Server server, String streamId); /** * @@ -66,7 +66,7 @@ public interface IClientPersistenceStore { * @param publicSID * @return will return an empty list if nothing available */ - List<Client> getClientsByPublicSID(Server server, String publicSID); + List<StreamClient> getClientsByPublicSID(Server server, String publicSID); /** * Searches for the publicSID across all servers @@ -74,9 +74,9 @@ public interface IClientPersistenceStore { * @param publicSID * @return will return a map with the serverId as key and the RoomClients as list in the value */ - Map<Long, List<Client>> getClientsByPublicSID(String publicSID); + Map<Long, List<StreamClient>> getClientsByPublicSID(String publicSID); - Collection<Client> getClients(); + Collection<StreamClient> getClients(); /** * get all clients by a specific {@link Server} @@ -84,7 +84,7 @@ public interface IClientPersistenceStore { * @param server * @return will return an empty map if nothing available */ - Collection<Client> getClientsByServer(Server server); + Collection<StreamClient> getClientsByServer(Server server); /** * @@ -92,7 +92,7 @@ public interface IClientPersistenceStore { * @param userId * @return will return an empty list if nothing available */ - Collection<Client> getClientsByUserId(Server server, Long userId); + Collection<StreamClient> getClientsByUserId(Server server, Long userId); /** * @@ -101,7 +101,7 @@ public interface IClientPersistenceStore { * @param roomId * @return will return an empty map if nothing available */ - List<Client> getClientsByRoomId(Long roomId); + List<StreamClient> getClientsByRoomId(Long roomId); void remove(Server server, String streamId); @@ -109,7 +109,7 @@ public interface IClientPersistenceStore { int sizeByServer(Server server); - Collection<Client> values(); + Collection<StreamClient> values(); /** * Get some session statistics @@ -135,5 +135,5 @@ public interface IClientPersistenceStore { * * @return */ - Collection<Client> getClientsWithServer(); + Collection<StreamClient> getClientsWithServer(); } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-core/src/main/java/org/apache/openmeetings/core/util/RoomHelper.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/util/RoomHelper.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/util/RoomHelper.java new file mode 100644 index 0000000..508bd4a --- /dev/null +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/util/RoomHelper.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.openmeetings.core.util; + +import org.apache.openmeetings.db.dao.server.ISessionManager; +import org.apache.openmeetings.db.entity.basic.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; + +import com.github.openjson.JSONObject; + +public class RoomHelper { + + public static JSONObject videoJson(Client c, boolean self, String sid, ISessionManager mgr, boolean share) { + JSONObject json = c.toJson(self).put("sid", sid); + if (share) { + StreamClient sc = mgr.getClientByPublicSID(c.getUid(), null); //TODO check server + + json.put("screenShare", true) + .put("uid", sc.getPublicSID()) // unique screen-sharing ID + .put("broadcastId", sc.getBroadCastID()) + .put("width", sc.getVWidth()) + .put("height", sc.getVHeight()); + } + return json; + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-db/src/main/java/org/apache/openmeetings/IApplication.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/IApplication.java b/openmeetings-db/src/main/java/org/apache/openmeetings/IApplication.java index a266a42..799b2aa 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/IApplication.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/IApplication.java @@ -24,7 +24,7 @@ import java.util.function.Supplier; import javax.servlet.ServletContext; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.room.Invitation; import org.apache.wicket.request.IExceptionMapper; import org.apache.wicket.request.IRequestMapper; @@ -40,7 +40,7 @@ public interface IApplication { String getOmString(String key, long languageId); String getOmString(String key, final Locale loc, String... params); org.apache.openmeetings.db.entity.basic.Client getOmClient(String uid); - Client updateClient(Client rcl, boolean forceSize); + StreamClient updateClient(StreamClient rcl, boolean forceSize); List<org.apache.openmeetings.db.entity.basic.Client> getOmRoomClients(Long roomId); List<org.apache.openmeetings.db.entity.basic.Client> getOmClients(Long userId); String getOmContactsLink(); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/ClientDao.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/ClientDao.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/ClientDao.java index 66996af..99af2cb 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/ClientDao.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/ClientDao.java @@ -26,7 +26,7 @@ import javax.persistence.PersistenceContext; import javax.persistence.Query; import javax.persistence.TypedQuery; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.server.Server; import org.springframework.transaction.annotation.Transactional; @@ -54,17 +54,17 @@ public class ClientDao { executeUpdate(); } - public Client add(Client entity) { + public StreamClient add(StreamClient entity) { em.persist(entity); return entity; } - public Client update(Client entity) { + public StreamClient update(StreamClient entity) { em.merge(entity); return entity; } - public void delete(Client entity) { + public void delete(StreamClient entity) { Query q = em.createNamedQuery("deletedById"); q.setParameter("id", entity.getId()); q.executeUpdate(); @@ -102,11 +102,11 @@ public class ClientDao { * @param streamId * @return */ - public Client getClientByServerAndStreamId(Server server, String streamId) { - TypedQuery<Client> q = em.createNamedQuery("getClientByServerAndStreamId", Client.class); + public StreamClient getClientByServerAndStreamId(Server server, String streamId) { + TypedQuery<StreamClient> q = em.createNamedQuery("getClientByServerAndStreamId", StreamClient.class); q.setParameter("streamid", streamId); q.setParameter("server", server); - List<Client> ll = q.getResultList(); + List<StreamClient> ll = q.getResultList(); if (ll.size() == 1) { return ll.get(0); } else if (ll.size() == 0) { @@ -115,42 +115,42 @@ public class ClientDao { throw new RuntimeException("more then one client was found streamId "+ streamId + " server "+server); } - public List<Client> getClientsByPublicSIDAndServer(Server server, String publicSID) { - TypedQuery<Client> q = em.createNamedQuery("getClientsByPublicSIDAndServer", Client.class); + public List<StreamClient> getClientsByPublicSIDAndServer(Server server, String publicSID) { + TypedQuery<StreamClient> q = em.createNamedQuery("getClientsByPublicSIDAndServer", StreamClient.class); q.setParameter("server", server); q.setParameter("publicSID", publicSID); return q.getResultList(); } - public List<Client> getClientsByPublicSID(String publicSID) { - TypedQuery<Client> q = em.createNamedQuery("getClientsByPublicSID", Client.class); + public List<StreamClient> getClientsByPublicSID(String publicSID) { + TypedQuery<StreamClient> q = em.createNamedQuery("getClientsByPublicSID", StreamClient.class); q.setParameter("publicSID", publicSID); return q.getResultList(); } - public List<Client> getClientsByServer(Server server) { - TypedQuery<Client> q = em.createNamedQuery("getClientsByServer", Client.class); + public List<StreamClient> getClientsByServer(Server server) { + TypedQuery<StreamClient> q = em.createNamedQuery("getClientsByServer", StreamClient.class); q.setParameter("server", server); return q.getResultList(); } - public List<Client> getClients() { - return em.createNamedQuery("getClients", Client.class).getResultList(); + public List<StreamClient> getClients() { + return em.createNamedQuery("getClients", StreamClient.class).getResultList(); } - public List<Client> getClientsWithServer() { - return em.createNamedQuery("getClientsWithServer", Client.class).getResultList(); + public List<StreamClient> getClientsWithServer() { + return em.createNamedQuery("getClientsWithServer", StreamClient.class).getResultList(); } - public List<Client> getClientsByUserId(Server server, Long userId) { - TypedQuery<Client> q = em.createNamedQuery("getClientsByUserId", Client.class); + public List<StreamClient> getClientsByUserId(Server server, Long userId) { + TypedQuery<StreamClient> q = em.createNamedQuery("getClientsByUserId", StreamClient.class); q.setParameter("server", server); q.setParameter("userId", userId); return q.getResultList(); } - public List<Client> getClientsByRoomId(Long roomId) { - TypedQuery<Client> q = em.createNamedQuery("getClientsByRoomId", Client.class); + public List<StreamClient> getClientsByRoomId(Long roomId) { + TypedQuery<StreamClient> q = em.createNamedQuery("getClientsByRoomId", StreamClient.class); q.setParameter("roomId", roomId); return q.getResultList(); } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/ISessionManager.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/ISessionManager.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/ISessionManager.java index 698dbe0..5bd1be2 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/ISessionManager.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/ISessionManager.java @@ -23,11 +23,11 @@ import java.util.List; import org.apache.openmeetings.db.dto.basic.SearchResult; import org.apache.openmeetings.db.dto.server.ClientSessionInfo; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.server.Server; /** - * Methods to add/get/remove {@link Client}s to the session + * Methods to add/get/remove {@link StreamClient}s to the session * * * @author sebawagner @@ -42,7 +42,7 @@ public interface ISessionManager { */ void sessionStart(); - Client add(Client c, Server server); + StreamClient add(StreamClient c, Server server); /** * add a new client item * @@ -54,16 +54,16 @@ public interface ISessionManager { * @param server * @return */ - Client addClientListItem(String streamId, String scopeName, int remotePort, String remoteAddress, String swfUrl, Server server); + StreamClient addClientListItem(String streamId, String scopeName, int remotePort, String remoteAddress, String swfUrl, Server server); - Collection<Client> getClients(); + Collection<StreamClient> getClients(); /** * loads the server into the client (only if database cache is used) * * @return */ - Collection<Client> getClientsWithServer(); + Collection<StreamClient> getClientsWithServer(); /** * Get a client by its streamId @@ -72,7 +72,7 @@ public interface ISessionManager { * @param server * @return */ - Client getClientByStreamId(String streamId, Server server); + StreamClient getClientByStreamId(String streamId, Server server); /** * get a client by its publicSID and the server, @@ -81,7 +81,7 @@ public interface ISessionManager { * @param server * @return */ - Client getClientByPublicSID(String publicSID, Server server); + StreamClient getClientByPublicSID(String publicSID, Server server); /** * same as {@link #getClientByPublicSID(String, boolean, Server)} but it ignores @@ -105,7 +105,7 @@ public interface ISessionManager { * then this call would return a list not a single user */ @Deprecated - Client getClientByUserId(Long userId); + StreamClient getClientByUserId(Long userId); /** * Update the session object of the audio/video-connection and additionally @@ -116,7 +116,7 @@ public interface ISessionManager { * @param rcm * @return */ - boolean updateAVClientByStreamId(String streamId, Client rcm, Server server); + boolean updateAVClientByStreamId(String streamId, StreamClient rcm, Server server); /** * Update the session object @@ -131,7 +131,7 @@ public interface ISessionManager { * true means the count for the room has to be updated * @return */ - boolean updateClientByStreamId(String streamId, Client rcm, boolean updateRoomCount, Server server); + boolean updateClientByStreamId(String streamId, StreamClient rcm, boolean updateRoomCount, Server server); /** * Remove a client from the session store @@ -149,9 +149,9 @@ public interface ISessionManager { * @param roomId * @return */ - List<Client> getClientListByRoom(Long roomId); + List<StreamClient> getClientListByRoom(Long roomId); - Collection<Client> getClientListByRoomAll(Long roomId); + Collection<StreamClient> getClientListByRoomAll(Long roomId); /** * get the current Moderator in this room @@ -159,7 +159,7 @@ public interface ISessionManager { * @param roomname * @return */ - List<Client> getCurrentModeratorByRoom(Long roomId); + List<StreamClient> getCurrentModeratorByRoom(Long roomId); /** * Get list of current client sessions @@ -170,7 +170,7 @@ public interface ISessionManager { * @param asc * @return */ - SearchResult<Client> getListByStartAndMax(int start, int max, String orderby, boolean asc); + SearchResult<StreamClient> getListByStartAndMax(int start, int max, String orderby, boolean asc); /** * returns number of current users recording http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/SessiondataDao.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/SessiondataDao.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/SessiondataDao.java index 3226433..aba491d 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/SessiondataDao.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/SessiondataDao.java @@ -28,7 +28,7 @@ import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.server.Sessiondata; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; @@ -205,7 +205,7 @@ public class SessiondataDao { */ public void clearSessionByRoomId(Long roomId) { try { - for (Client rcl : sessionManager.getClientListByRoom(roomId)) { + for (StreamClient rcl : sessionManager.getClientListByRoom(roomId)) { String aux = rcl.getSwfurl(); //FIXME TODO this need to be refactored ! http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/RoomStatus.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/RoomStatus.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/RoomStatus.java index 98831a2..1c5bc51 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/RoomStatus.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/RoomStatus.java @@ -20,18 +20,18 @@ package org.apache.openmeetings.db.dto.room; import java.util.List; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; public class RoomStatus { - List<Client> clientList; + List<StreamClient> clientList; BrowserStatus browserStatus; public RoomStatus() {} - public List<Client> getClientList() { + public List<StreamClient> getClientList() { return clientList; } - public void setClientList(List<Client> clientList) { + public void setClientList(List<StreamClient> clientList) { this.clientList = clientList; } public BrowserStatus getBrowserStatus() { http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/server/ClientSessionInfo.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/server/ClientSessionInfo.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/server/ClientSessionInfo.java index cd437e7..d257d8c 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/server/ClientSessionInfo.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/server/ClientSessionInfo.java @@ -18,26 +18,26 @@ */ package org.apache.openmeetings.db.dto.server; -import org.apache.openmeetings.db.entity.room.Client; +import org.apache.openmeetings.db.entity.room.StreamClient; public class ClientSessionInfo { - private Client rcl; + private StreamClient rcl; public Long serverId; public ClientSessionInfo() {} - public ClientSessionInfo(Client rcl, Long serverId) { + public ClientSessionInfo(StreamClient rcl, Long serverId) { super(); this.rcl = rcl; this.serverId = serverId; } - public Client getRcl() { + public StreamClient getRcl() { return rcl; } - public void setRcl(Client rcl) { + public void setRcl(StreamClient rcl) { this.rcl = rcl; } public Long getServerId() { http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java index 19e9787..0950125 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java @@ -26,6 +26,7 @@ import java.util.UUID; import org.apache.openmeetings.db.dao.user.UserDao; import org.apache.openmeetings.db.entity.room.Room.Right; +import org.apache.openmeetings.db.entity.room.StreamClient; import org.apache.openmeetings.db.entity.user.User; import org.apache.wicket.protocol.ws.api.registry.IKey; import org.apache.wicket.util.string.Strings; @@ -34,7 +35,7 @@ import com.github.openjson.JSONArray; import com.github.openjson.JSONObject; /** - * Temporary class, later will be merged with {@link org.apache.openmeetings.db.entity.room.Client} + * Temporary class, later will be merged with {@link org.apache.openmeetings.db.entity.room.StreamClient} * @author solomax * */ @@ -80,7 +81,7 @@ public class Client implements IClient { sid = UUID.randomUUID().toString(); } - public Client(org.apache.openmeetings.db.entity.room.Client rcl, UserDao dao) { + public Client(StreamClient rcl, UserDao dao) { this.sessionId = UUID.randomUUID().toString(); this.pageId = 0; this.user = dao.get(rcl.getUserId()); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a260f5a8/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/IClient.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/IClient.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/IClient.java index 3e72c0e..d052a8b 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/IClient.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/IClient.java @@ -22,7 +22,7 @@ import org.apache.openmeetings.db.entity.IDataProviderEntity; /** * Temporary interface, will be removed after 2 types of cliens will be merged - * {@link org.apache.openmeetings.db.entity.room.Client} + * {@link org.apache.openmeetings.db.entity.room.StreamClient} * {@link org.apache.openmeetings.db.entity.basic.Client} * @author solomax *
