[OPENMEETINGS-1677] Hazelcast is added to handle cluster

Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/bbcdbf7e
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/bbcdbf7e
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/bbcdbf7e

Branch: refs/heads/master
Commit: bbcdbf7e044d2fd8ed2d1745cedd2e02c202ee3f
Parents: d4cc7b3
Author: Maxim Solodovnik <[email protected]>
Authored: Sun Jul 30 22:55:37 2017 +0700
Committer: Maxim Solodovnik <[email protected]>
Committed: Mon Jul 31 20:30:54 2017 +0700

----------------------------------------------------------------------
 .../core/data/conference/RoomManager.java       |   6 +-
 .../remote/ISlaveHTTPConnectionManager.java     |  25 --
 .../openmeetings/core/remote/MobileService.java |   8 +-
 .../core/remote/RecordingService.java           |   2 -
 .../core/remote/ScopeApplicationAdapter.java    |  21 +-
 .../openmeetings/core/session/ServerUtil.java   |  82 -----
 .../core/session/SessionManager.java            | 240 ++++-----------
 .../core/session/store/DatabaseStore.java       | 142 ---------
 .../core/session/store/HashMapStore.java        | 216 -------------
 .../session/store/IClientPersistenceStore.java  | 136 ---------
 .../openmeetings/core/util/IClientUtil.java     |   8 +-
 .../openmeetings/core/util/RoomHelper.java      |   4 +-
 .../org/apache/openmeetings/IApplication.java   |  11 +-
 .../openmeetings/db/dao/room/ClientDao.java     | 142 ---------
 .../openmeetings/db/dao/room/RoomDao.java       |   3 +-
 .../db/dao/server/ISessionManager.java          | 103 ++-----
 .../openmeetings/db/dao/server/ServerDao.java   | 222 --------------
 .../db/dao/server/SessiondataDao.java           |   2 +-
 .../openmeetings/db/dao/user/IUserManager.java  |   5 +-
 .../db/dto/server/ClientSessionInfo.java        |  50 ---
 .../openmeetings/db/dto/server/ServerDTO.java   | 181 -----------
 .../openmeetings/db/entity/basic/Client.java    |  60 ++--
 .../openmeetings/db/entity/basic/IClient.java   |   2 +
 .../db/entity/room/StreamClient.java            | 201 +-----------
 .../openmeetings/db/entity/server/Server.java   | 304 -------------------
 .../openmeetings/backup/BackupExport.java       |   9 -
 .../openmeetings/backup/BackupImport.java       |  18 +-
 .../installation/ImportInitvalues.java          |   3 +-
 .../src/site/xdoc/Clustering.xml                |  18 +-
 .../service/quartz/scheduler/CleanupJob.java    |   6 +-
 .../openmeetings/service/user/UserManager.java  |   6 +-
 openmeetings-web/pom.xml                        |   5 +
 .../web/admin/connection/ConnectionsPanel.java  |  10 +-
 .../openmeetings/web/admin/rooms/RoomForm.java  |   4 +-
 .../web/admin/servers/ServerForm.java           | 140 ---------
 .../web/admin/servers/ServersPanel.html         | 103 -------
 .../web/admin/servers/ServersPanel.java         |  95 ------
 .../openmeetings/web/app/Application.java       | 150 ++++++---
 .../openmeetings/web/room/RoomBroadcaster.java  |  10 +-
 .../apache/openmeetings/web/room/RoomPanel.java |  23 +-
 .../apache/openmeetings/web/room/SwfPanel.java  |  51 ++++
 .../web/room/menu/RoomMenuPanel.java            |   4 +-
 .../web/room/menu/StartSharingButton.java       |   4 +-
 .../web/room/sidebar/RoomSidebar.java           |  12 +-
 .../openmeetings/web/util/OmUrlFragment.java    |   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 -
 .../WEB-INF/classes/applicationContext.xml      |  28 +-
 .../main/webapp/WEB-INF/classes/cxf-servlet.xml |   3 -
 .../main/webapp/WEB-INF/classes/hazelcast.xml   |  32 ++
 .../webapp/WEB-INF/classes/logback-config.xml   |   7 +-
 .../webapp/WEB-INF/classes/rebel-remote.xml     |   6 +-
 .../src/main/webapp/WEB-INF/classes/rebel.xml   |   6 +-
 .../test/session/TestDbSession.java             | 179 -----------
 .../test/session/TestDbSessionGetRoomIds.java   |  92 ------
 .../test/session/TestHashMapSession.java        |  73 -----
 .../openmeetings/webservice/RoomWebService.java |   4 +-
 .../webservice/ServerWebService.java            | 171 -----------
 .../openmeetings/webservice/UserWebService.java | 142 +++++----
 .../webservice/cluster/RestClient.java          | 196 ------------
 .../cluster/SlaveHTTPConnectionManager.java     |  99 ------
 .../webservice/cluster/UserService.java         | 158 ----------
 66 files changed, 501 insertions(+), 3563 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/conference/RoomManager.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/conference/RoomManager.java
 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/conference/RoomManager.java
index 05f5b16..840a2dd 100644
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/conference/RoomManager.java
+++ 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/conference/RoomManager.java
@@ -82,7 +82,7 @@ public class RoomManager {
                                        asc);
 
                        for (Room room : rooms) {
-                               
room.setCurrentusers(sessionManager.getClientListByRoom(room.getId()));
+                               
room.setCurrentusers(sessionManager.listByRoom(room.getId()));
                        }
 
                        sResult.setResult(rooms);
@@ -99,7 +99,7 @@ public class RoomManager {
                                        asc);
 
                        for (Room room : rooms) {
-                               
room.setCurrentusers(sessionManager.getClientListByRoom(room.getId()));
+                               
room.setCurrentusers(sessionManager.listByRoom(room.getId()));
                        }
 
                        return rooms;
@@ -114,7 +114,7 @@ public class RoomManager {
                        List<Room> rooms = this.getRoomsInternatlbyType(start, 
max, orderby, asc, externalType);
 
                        for (Room room : rooms) {
-                               
room.setCurrentusers(sessionManager.getClientListByRoom(room.getId()));
+                               
room.setCurrentusers(sessionManager.listByRoom(room.getId()));
                        }
 
                        return rooms;

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ISlaveHTTPConnectionManager.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ISlaveHTTPConnectionManager.java
 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ISlaveHTTPConnectionManager.java
deleted file mode 100644
index 8fc0957..0000000
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ISlaveHTTPConnectionManager.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.remote;
-
-import org.apache.openmeetings.db.entity.server.Server;
-
-public interface ISlaveHTTPConnectionManager {
-       void kickSlaveUser(Server server, String publicSID) throws Exception;
-}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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 668526b..edfb987 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
@@ -239,8 +239,8 @@ public class MobileService {
                        Sessiondata sd = sessionDao.create(u.getId(), 
u.getLanguageId());
                        StreamClient c = create(u, sd);
                        c.setScope(conn.getScope().getName());
-                       sessionManager.add(c, null);
-                       IClientUtil.init(conn.getClient(), c.getId(), false);
+                       sessionManager.add(c);
+                       IClientUtil.init(conn.getClient(), c.getUid(), false);
 
                        add(result, "sid", sd.getSessionId());
                        add(result, "publicSid", c.getUid());
@@ -295,7 +295,7 @@ public class MobileService {
                        room.put("org", org);
                }
                room.put("first", first);
-               room.put("users", 
sessionManager.getClientListByRoom(r.getId()).size());
+               room.put("users", sessionManager.listByRoom(r.getId()).size());
                room.put("total", r.getNumberOfPartizipants());
                room.put("audioOnly", r.isAudioOnly());
                result.add(room);
@@ -394,7 +394,7 @@ public class MobileService {
        }
 
        public void sendChatMessage(String uid, ChatMessage m, FastDateFormat 
fmt) {
-               sendChatMessage(sessionManager.getClientByUid(uid, null), m, 
fmt);
+               sendChatMessage(sessionManager.get(uid), m, fmt);
        }
 
        public void sendChatMessage(StreamClient c, ChatMessage m, 
FastDateFormat fmt) {

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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 14d584b..5500ddc 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
@@ -370,7 +370,6 @@ public class RecordingService implements 
IPendingServiceCallback {
                }
        }
 
-       //TODO copy/paste
        public void stopRecordingShowForClient(IScope scope, StreamClient rcl) {
                try {
                        // this cannot be handled here, as to stop a stream and 
to leave a
@@ -453,7 +452,6 @@ public class RecordingService implements 
IPendingServiceCallback {
                                recordShow(conn, rcl.getBroadCastId(), 
streamName, metaDataId, false, recording.isInterview());
 
                                rcl.setMetaId(metaDataId);
-
                                sessionManager.update(rcl);
                        }
                } catch (Exception err) {

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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 d91419d..759ce67 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
@@ -157,7 +157,6 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                        EXT_PROCESS_TTL = 
cfgDao.getConfValue(CONFIG_EXT_PROCESS_TTL, Integer.class, "" + 
EXT_PROCESS_TTL);
                        Version.logOMStarted();
                        recordingDao.resetProcessingStatus(); //we are starting 
so all processing recordings are now errors
-                       sessionManager.clearCache(); // 'sticky' clients should 
be cleaned up from DB
                } catch (Exception err) {
                        _log.error("[appStart]", err);
                }
@@ -233,12 +232,12 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                if (map.containsKey("screenClient")) {
                        rcm.setSharing(true);
                }
-               rcm = sessionManager.add(iapp.updateClient(rcm, false), null);
+               rcm = sessionManager.add(iapp.updateClient(rcm, false));
                if (rcm == null) {
                        _log.warn("Failed to create Client on room connect");
                        return false;
                }
-               IClientUtil.init(conn.getClient(), rcm.getId(), 
rcm.isSharing());
+               IClientUtil.init(conn.getClient(), rcm.getUid(), 
rcm.isSharing());
 
                // Log the User
                conferenceLogDao.add(ConferenceLog.Type.clientConnect,
@@ -400,7 +399,7 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
        }
 
        public void roomLeaveByScope(String uid, Long roomId) {
-               StreamClient rcl = sessionManager.getClientByUid(uid, null);
+               StreamClient rcl = sessionManager.get(uid);
                IScope scope = getRoomScope("" + roomId);
                _log.debug("[roomLeaveByScope] {} {} {} {}", uid, roomId, rcl, 
scope);
                if (rcl != null && scope != null) {
@@ -451,7 +450,7 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                                IApplication app = 
(IApplication)Application.get(wicketApplicationName);
                                app.exit(client.getUid());
                        }
-                       sessionManager.remove(client.getId());
+                       sessionManager.remove(client.getUid());
                } catch (Exception err) {
                        _log.error("[roomLeaveByScope]", err);
                }
@@ -539,8 +538,8 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                                        .put("ownerSid", c.getOwnerSid())
                                        .put("uid", c.getUid())
                                        .put("screenShare", c.isSharing())
-                                       .put("streamClientId", c.getId())
-                                       .put("stream", streamName);
+                                       .put("streamId", c.getId())
+                                       .put("streamName", streamName);
                        WebSocketHelper.sendRoom(new 
TextRoomMessage(c.getRoomId(), c.getUserId(), RoomMessage.Type.newStream, 
obj.toString()));
                } catch (Exception err) {
                        _log.error("[streamPublishStart]", err);
@@ -617,7 +616,7 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
        public void setNewCursorPosition(Map<String, Object> cursor) {
                try {
                        IConnection current = Red5.getConnectionLocal();
-                       StreamClient c = 
sessionManager.getClientByStreamId(current.getClient().getId(), null);
+                       StreamClient c = 
sessionManager.get(IClientUtil.getId(current.getClient()));
 
                        cursor.put("streamPublishName", 
c.getStreamPublishName());
 
@@ -632,7 +631,7 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                try {
                        _log.debug("-----------  switchMicMuted: " + publicSID);
 
-                       StreamClient currentClient = 
sessionManager.getClientByUid(publicSID, null);
+                       StreamClient currentClient = 
sessionManager.get(publicSID);
                        if (currentClient == null) {
                                return -1L;
                        }
@@ -1115,7 +1114,7 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
        }
 
        public List<Long> getActiveRoomIds() {
-               return 
((IApplication)Application.get(wicketApplicationName)).getActiveRooms();
+               return new 
ArrayList<>(((IApplication)Application.get(wicketApplicationName)).getActiveRoomIds());
        }
 
        public synchronized int updateSipTransport() {
@@ -1128,7 +1127,7 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                _log.debug("getSipConferenceMembersNumber: " + newNumber);
                if (!newNumber.equals(client.getLastname())) {
                        IApplication iapp = 
(IApplication)Application.get(wicketApplicationName);
-                       org.apache.openmeetings.db.entity.basic.Client cl = 
iapp.getOmOnlineClient(client.getUid());
+                       Client cl = iapp.getOmOnlineClient(client.getUid());
                        cl.getUser().setLastname(newNumber);
                        client.setLastname(newNumber);
                        sessionManager.update(client);

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/ServerUtil.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/ServerUtil.java
 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/ServerUtil.java
deleted file mode 100644
index 4c909e6..0000000
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/ServerUtil.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.session;
-
-import org.apache.openmeetings.db.dao.server.ServerDao;
-import org.apache.openmeetings.db.entity.server.Server;
-import org.apache.openmeetings.util.OpenmeetingsVariables;
-import org.red5.logging.Red5LoggerFactory;
-import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * Configures the current reference to the {@link Server} for this 
Tomcat/Web-Container.
- * 
- * It is a Spring Bean and configured as Singleton. There is only one instance 
of this 
- * bean in the entire Web-Application.  
- * 
- * @author sebawagner
- *
- */
-public class ServerUtil {
-       protected static final Logger log = Red5LoggerFactory.getLogger(
-                       ServerUtil.class, OpenmeetingsVariables.webAppRootKey);
-
-       @Autowired
-       private ServerDao serverDao;
-       
-       /**
-        * Injected via Spring configuration
-        * 
-        * for cluster configuration, if only using one server (no cluster), 
serverId is null,
-        * this is the current serverId of this Tomcat instance (null means no 
cluster is configured)
-        */
-       private String serverId = null;
-       
-       /**
-        * a reference of the current server in that Tomcat instance
-        */
-       private Server currentServer;
-       
-       public String getServerId() {
-               return serverId;
-       }
-       
-       public void setServerId(String serverId) {
-               this.serverId = serverId;
-       }
-       
-       /**
-        * 
-        * @return the current server
-        */
-       public Server getCurrentServer() {
-               if (serverId == null) {
-                       return null;
-               }
-               if (currentServer != null && 
serverId.equals(currentServer.getId().toString())) {
-                       return currentServer;
-               }
-               currentServer = serverDao.get(Long.parseLong(serverId));
-               if (currentServer == null) {
-                       log.warn("You have configured a serverId that does not 
exist in your list of servers, serverId: "+serverId);
-               }
-               return currentServer;
-       }
-}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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 ef53bfb..c9546e6 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
@@ -19,23 +19,23 @@
 package org.apache.openmeetings.core.session;
 
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicationName;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.List;
-import java.util.Map.Entry;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
-import org.apache.openmeetings.core.session.store.IClientPersistenceStore;
+import org.apache.openmeetings.IApplication;
 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.StreamClient;
-import org.apache.openmeetings.db.entity.server.Server;
+import org.apache.wicket.Application;
 import org.red5.logging.Red5LoggerFactory;
+import org.red5.server.Server;
 import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * Handle {@link StreamClient} objects.
@@ -48,224 +48,96 @@ import 
org.springframework.beans.factory.annotation.Autowired;
 public class SessionManager implements ISessionManager {
        protected static final Logger log = 
Red5LoggerFactory.getLogger(SessionManager.class, webAppRootKey);
 
-       @Autowired
-       private ServerUtil serverUtil;
-
-       /**
-        * Injected via Spring, needs a getter/setter because it can be 
configured
-        * Autowired will not suit here as there are multiple implementations 
of the
-        * {@link IClientPersistenceStore}
-        */
-       private IClientPersistenceStore cache;
-
-       public IClientPersistenceStore getCache() {
-               return cache;
-       }
-
-       public void setCache(IClientPersistenceStore cache) {
-               this.cache = cache;
-       }
-
-       @Override
-       public void clearCache() {
-               cache.clear();
+       private static Map<String, StreamClient> getClients() {
+               IApplication iapp = 
(IApplication)Application.get(wicketApplicationName);
+               return iapp.getStreamClients();
        }
 
        @Override
-       public StreamClient add(StreamClient c, Server server) {
+       public StreamClient add(StreamClient c) {
                if (c == null) {
                        return null;
                }
-               if (server == null) {
-                       server = serverUtil.getCurrentServer();
-               }
+               IApplication iapp = 
(IApplication)Application.get(wicketApplicationName);
+               c.setServerId(iapp.getServerId());
                c.setConnectedSince(new Date());
                c.setRoomEnter(new Date());
-               c.setServer(server);
-
-               return cache.put(c);
+               return iapp.update(c);
        }
 
        @Override
-       public Collection<StreamClient> getClients() {
-               return cache.getClients();
+       public Collection<StreamClient> list() {
+               return getClients().values();
        }
 
        @Override
-       public Collection<StreamClient> getClientsWithServer() {
-               return cache.getClientsWithServer();
+       public StreamClient get(String uid) {
+               return getClients().get(uid);
        }
 
        @Override
-       public StreamClient get(Long id) {
-               try {
-                       if (!cache.containsKey(id)) {
-                               log.debug("Tried to get a non existing Client 
{}", id);
-                               return null;
-                       }
-                       return cache.get(id);
-               } catch (Exception err) {
-                       log.error("[getClientByStreamId]", err);
-               }
-               return null;
+       public StreamClient update(StreamClient rcm) {
+               IApplication iapp = 
(IApplication)Application.get(wicketApplicationName);
+               return iapp.update(rcm);
        }
 
        @Override
-       public StreamClient getClientByUid(String publicSID, Server server) {
-               if (server == null) {
-                       server = serverUtil.getCurrentServer();
-               }
-               try {
-                       List<StreamClient> list = cache.getClientsByUid(server, 
publicSID);
-                       return list == null || list.isEmpty() ? null : 
list.get(0);
-               } catch (Exception err) {
-                       log.error("[getClientByPublicSID]", err);
-               }
-               return null;
-       }
-
-       @Override
-       public ClientSessionInfo getClientByUidAnyServer(String publicSID) {
-               try {
-                       for (Entry<Long,List<StreamClient>> entry : 
cache.getClientsByUid(publicSID).entrySet()) {
-                               for (StreamClient rcl : entry.getValue()) {
-                                       return new ClientSessionInfo(rcl, 
entry.getKey());
-                               }
-                       }
-               } catch (Exception err) {
-                       log.error("[getClientByPublicSIDAnyServer]", err);
-               }
-               return null;
-       }
-
-       @Override
-       public boolean updateAVClient(StreamClient rcm) {
-               try {
-                       // get the corresponding user session object and update 
the settings
-                       StreamClient rclUsual = get(rcm.getId());
-                       if (rclUsual != null) {
-                               rclUsual.setBroadCastId(rcm.getBroadCastId());
-                               rclUsual.setAvsettings(rcm.getAvsettings());
-                               rclUsual.setHeight(rcm.getHeight());
-                               rclUsual.setWidth(rcm.getWidth());
-                               cache.put(rclUsual);
-                       } else {
-                               log.debug("Tried to update a non existing 
Client {}", rclUsual);
-                       }
-
-                       update(rcm);
-                       return true;
-               } catch (Exception err) {
-                       log.error("[updateAVClient]", err);
-               }
-               return false;
+       public boolean remove(String uid) {
+               StreamClient c = getClients().remove(uid);
+               return c != null;
        }
 
        @Override
-       public boolean update(StreamClient rcm) {
-               try {
-                       if (cache.containsKey(rcm.getId())) {
-                               cache.put(rcm);
-                               return true;
-                       } else {
-                               log.debug("Tried to update a non existing 
Client {}", rcm.getId());
-                       }
-               } catch (Exception err) {
-                       log.error("[updateClient]", err);
-               }
-               return false;
+       public List<StreamClient> listByRoom(Long roomId) {
+               return list().stream()
+                               .filter(c -> roomId.equals(c.getRoomId()) && 
!c.isSharing())
+                               .collect(Collectors.toList());
        }
 
        @Override
-       public boolean remove(Long id) {
-               try {
-                       if (cache.containsKey(id)) {
-                               cache.remove(id);
-                               return true;
-                       } else {
-                               log.debug("Tried to remove a non existing 
Client {}", id);
-                       }
-               } catch (Exception err) {
-                       log.error("[removeClient]", err);
-               }
-               return false;
+       public Collection<StreamClient> listByRoomAll(Long roomId) {
+               return list().stream()
+                               .filter(c -> roomId.equals(c.getRoomId()))
+                               .collect(Collectors.toList());
        }
 
        @Override
-       public List<StreamClient> getClientListByRoom(Long roomId) {
-               List<StreamClient> roomClientList = new ArrayList<>();
-               try {
-                       for (StreamClient rcl : 
cache.getClientsByRoomId(roomId)) {
-                               if (rcl.isSharing()) {
-                                       continue;
-                               }
-
-                               // Only parse really those users out that are 
really a full session object
-                               // and no pseudo session object like the 
audio/video or screen
-                               // sharing connection
-                               roomClientList.add(rcl);
-                       }
-               } catch (Exception err) {
-                       log.error("[getClientListByRoom]", err);
-               }
-               return roomClientList;
+       public List<StreamClient> listModeratorByRoom(Long roomId) {
+               return list().stream()
+                               .filter(c -> roomId.equals(c.getRoomId()) && 
c.isMod())
+                               .collect(Collectors.toList());
        }
 
        @Override
-       public Collection<StreamClient> getClientListByRoomAll(Long roomId) {
-               try {
-                       return cache.getClientsByRoomId(roomId);
-               } catch (Exception err) {
-                       log.error("[getClientListByRoomAll]", err);
-               }
-               return null;
+       public long getRecordingCount(Long roomId) {
+               return list().stream()
+                               .filter(c -> roomId.equals(c.getRoomId()) && 
c.isRecordingStarted())
+                               .collect(Collectors.toList()).size();
        }
 
        @Override
-       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;
+       public long getPublishingCount(Long roomId) {
+               return list().stream()
+                               .filter(c -> roomId.equals(c.getRoomId()) && 
c.isPublishStarted())
+                               .collect(Collectors.toList()).size();
        }
 
        @Override
-       public long getRecordingCount(long roomId) {
-               List<StreamClient> currentClients = 
this.getClientListByRoom(roomId);
-               int numberOfRecordingUsers = 0;
-               for (StreamClient rcl : currentClients) {
-                       if (rcl.isRecordingStarted()) {
-                               numberOfRecordingUsers++;
-                       }
-               }
-               return numberOfRecordingUsers;
+       public Set<Long> getActiveRoomIds() {
+               IApplication iapp = 
(IApplication)Application.get(wicketApplicationName);
+               return iapp.getActiveRoomIds();
        }
 
        @Override
-       public long getPublishingCount(long roomId) {
-               List<StreamClient> currentClients = 
this.getClientListByRoom(roomId);
-               int numberOfPublishingUsers = 0;
-               for (StreamClient rcl : currentClients) {
-                       if (rcl.isPublishStarted()) {
-                               numberOfPublishingUsers++;
+       public Set<Long> getActiveRoomIds(String serverId) {
+               Set<Long> ids = new HashSet<>();
+               if (serverId != null) {
+                       for (Map.Entry<String, StreamClient> e : 
getClients().entrySet()) {
+                               if 
(serverId.equals(e.getValue().getServerId())) {
+                                       ids.add(e.getValue().getRoomId());
+                               }
                        }
                }
-               return numberOfPublishingUsers;
-       }
-
-       @Override
-       public List<Long> getActiveRoomIdsByServer(Server server) {
-               return cache.getRoomsIdsByServer(server == null ? 
serverUtil.getCurrentServer() : server);
-       }
-
-       @Override
-       public String getSessionStatistics() {
-               return 
cache.getDebugInformation(Arrays.asList(IClientPersistenceStore.DEBUG_DETAILS.SIZE));
-       }
-
-       @Override
-       public void sessionStart() {
-               // TODO Auto-generated method stub
+               return ids;
        }
 }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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
deleted file mode 100644
index 7319ecf..0000000
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/DatabaseStore.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.session.store;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.openmeetings.db.dao.room.ClientDao;
-import org.apache.openmeetings.db.entity.room.StreamClient;
-import org.apache.openmeetings.db.entity.server.Server;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class DatabaseStore implements IClientPersistenceStore {
-
-       @Autowired
-       private ClientDao clientDao;
-
-       @Override
-       public void clear() {
-               clientDao.cleanAllClients();
-       }
-
-       @Override
-       public StreamClient put(StreamClient rcl) {
-               return rcl.getId() == null ? clientDao.add(rcl) : 
clientDao.update(rcl);
-       }
-
-       @Override
-       public boolean containsKey(Long id) {
-               return clientDao.get(id) != null;
-       }
-
-       @Override
-       public StreamClient get(Long id) {
-               return clientDao.get(id);
-       }
-
-       @Override
-       public List<StreamClient> getClientsByUid(Server server, String 
publicSID) {
-               return clientDao.getClientsByUidAndServer(server, publicSID);
-       }
-
-       @Override
-       public Map<Long, List<StreamClient>> getClientsByUid(String publicSID) {
-               Map<Long, List<StreamClient>> returnMap = new HashMap<>();
-               List<StreamClient> clientList = 
clientDao.getClientsByUid(publicSID);
-               for (StreamClient cl : clientList) {
-                       if (cl.getServer() == null) {
-                               List<StreamClient> clList = returnMap.get(null);
-                               if (clList == null) {
-                                       clList = new ArrayList<>();
-                               }
-                               clList.add(cl);
-                               returnMap.put(null, clList);
-                       } else {
-                               List<StreamClient> clList = 
returnMap.get(cl.getServer().getId());
-                               if (clList == null) {
-                                       clList = new ArrayList<>();
-                               }
-                               clList.add(cl);
-                               returnMap.put(cl.getServer().getId(), clList);
-                       }
-               }
-               return returnMap;
-       }
-
-       @Override
-       public Collection<StreamClient> getClients() {
-               return clientDao.getClients();
-       }
-
-       @Override
-       public Collection<StreamClient> getClientsWithServer() {
-               return clientDao.getClientsWithServer();
-       }
-
-       @Override
-       public Collection<StreamClient> getClientsByServer(Server server) {
-               return clientDao.getClientsByServer(server);
-       }
-
-       @Override
-       public List<StreamClient> getClientsByUserId(Server server, Long 
userId) {
-               return clientDao.getClientsByUserId(server, userId);
-       }
-
-       @Override
-       public List<StreamClient> getClientsByRoomId(Long roomId) {
-               return clientDao.getClientsByRoomId(roomId);
-       }
-
-       @Override
-       public void remove(Long id) {
-               clientDao.remove(id);
-       }
-
-       @Override
-       public int size() {
-               return clientDao.countClients();
-       }
-
-       @Override
-       public int sizeByServer(Server server) {
-               return clientDao.countClientsByServer(server);
-       }
-
-       @Override
-       public Collection<StreamClient> values() {
-               return clientDao.getClients();
-       }
-
-       @Override
-       public String getDebugInformation(List<DEBUG_DETAILS> detailLevel) {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       @Override
-       public List<Long> getRoomsIdsByServer(Server server) {
-               return clientDao.getRoomsIdsByServer(server);
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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
deleted file mode 100644
index f62e3fd..0000000
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/HashMapStore.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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.session.store;
-
-import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-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;
-
-/**
- * Stores the session in the memory.
- * Is NOT designed to be clustered across multiple servers.
- *
- * <ul>
- * <li>client by streamid</li>
- * <li>client by publicSID</li>
- * <li>client by userId</li>
- * <li>clients by roomId</li>
- * <li>roomIds by server</li>
- * </ul>
- *
- * @author sebawagner
- *
- */
-public class HashMapStore implements IClientPersistenceStore {
-       protected static final Logger log = 
Red5LoggerFactory.getLogger(HashMapStore.class, webAppRootKey);
-
-       private volatile AtomicLong nextId = new AtomicLong(1);
-       private Map<Long, StreamClient> clientsById = new ConcurrentHashMap<>();
-
-       @Override
-       public void clear() {
-               clientsById = new ConcurrentHashMap<>();
-       }
-
-       @Override
-       public StreamClient put(StreamClient rcl) {
-               if (rcl.getId() == null) {
-                       rcl.setId(nextId.getAndIncrement());
-               }
-               if (clientsById.containsKey(rcl.getId())) {
-                       log.debug("Updating Client {}", rcl.getId());
-               }
-               clientsById.put(rcl.getId(), rcl);
-               return rcl;
-       }
-
-       @Override
-       public boolean containsKey(Long id) {
-               return id != null && clientsById.containsKey(id);
-       }
-
-       @Override
-       public StreamClient get(Long id) {
-               return id == null ? null : clientsById.get(id);
-       }
-
-       @Override
-       public List<StreamClient> getClientsByUid(Server server, String uid) {
-               List<StreamClient> clientList = new ArrayList<>();
-               for (Map.Entry<Long, StreamClient> e: clientsById.entrySet()) {
-                       StreamClient cl = e.getValue();
-                       if (cl.getUid().equals(uid)) {
-                               clientList.add(cl);
-                       }
-               }
-               return clientList;
-       }
-
-       @Override
-       public Map<Long,List<StreamClient>> getClientsByUid(String uid) {
-               Map<Long,List<StreamClient>> clientMapList = new HashMap<>();
-               List<StreamClient> clientList = new ArrayList<>();
-               for (Map.Entry<Long, StreamClient> e: clientsById.entrySet()) {
-                       StreamClient cl = e.getValue();
-                       if (cl.getUid().equals(uid)) {
-                               clientList.add(cl);
-                       }
-               }
-               clientMapList.put(null, clientList);
-               return clientMapList;
-       }
-
-       @Override
-       public Collection<StreamClient> getClients() {
-               return clientsById.values();
-       }
-
-       @Override
-       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<StreamClient> getClientsByServer(Server server) {
-               return clientsById.values();
-       }
-
-       @Override
-       public List<StreamClient> getClientsByUserId(Server server, Long 
userId) {
-               List<StreamClient> clientList = new ArrayList<>();
-               for (Map.Entry<Long, StreamClient> e: clientsById.entrySet()) {
-                       StreamClient cl = e.getValue();
-                       if (cl.getUserId().equals(userId)) {
-                               clientList.add(cl);
-                       }
-               }
-               return clientList;
-       }
-
-       @Override
-       public  List<StreamClient> getClientsByRoomId(Long roomId) {
-               List<StreamClient> clientList = new ArrayList<>();
-               for (Map.Entry<Long, StreamClient> e: clientsById.entrySet()) {
-                       StreamClient cl = e.getValue();
-                       if (cl.getRoomId() != null && 
cl.getRoomId().equals(roomId)) {
-                               clientList.add(cl);
-                       }
-               }
-               return clientList;
-       }
-
-       @Override
-       public void remove(Long id) {
-               clientsById.remove(id);
-       }
-
-       @Override
-       public int size() {
-               return clientsById.size();
-       }
-
-       @Override
-       public int sizeByServer(Server server) {
-               return clientsById.size();
-       }
-
-       @Override
-       public Collection<StreamClient> values() {
-               return clientsById.values();
-       }
-
-       public int getTotalNumberOfSessions() {
-               return clientsById.size();
-       }
-
-       /**
-        * Print some session statistics to the debug out
-        *
-        * @param detailLevel
-        */
-       public void printDebugInformation(List<DEBUG_DETAILS> detailLevel) {
-               log.debug("Session Statistics Start ################## ");
-               log.debug(getDebugInformation(detailLevel));
-               log.debug("Session Statistics End ################## ");
-       }
-
-       @Override
-       public String getDebugInformation(List<DEBUG_DETAILS> detailLevel) {
-               StringBuilder statistics = new StringBuilder();
-
-               if (detailLevel.contains(DEBUG_DETAILS.SIZE)) {
-                       addNewLine(statistics, "Number of sessions Total " + 
getTotalNumberOfSessions());
-               }
-
-               return statistics.toString();
-       }
-
-       private static void addNewLine(StringBuilder strBuilder, String 
message) {
-               strBuilder.append(message + "\n\r");
-       }
-
-       @Override
-       public List<Long> getRoomsIdsByServer(Server server) {
-               Set<Long> rooms = new HashSet<>();
-               for (Map.Entry<Long, StreamClient> e: clientsById.entrySet()) {
-                       StreamClient cl = e.getValue();
-                       Long roomId = cl.getRoomId();
-                       if (roomId != null && roomId.longValue() > 0 && 
!rooms.contains(roomId)) {
-                               rooms.add(roomId);
-                       }
-               }
-               return new ArrayList<>(rooms);
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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
deleted file mode 100644
index 329c578..0000000
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/store/IClientPersistenceStore.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.session.store;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.openmeetings.db.entity.room.StreamClient;
-import org.apache.openmeetings.db.entity.server.Server;
-
-public interface IClientPersistenceStore {
-
-       public enum DEBUG_DETAILS {
-               SIZE
-       }
-
-       /**
-        * called upon start of the session cache
-        */
-       void clear();
-
-       /**
-        *
-        * @param rcl
-        */
-       StreamClient put(StreamClient rcl);
-
-       /**
-        *
-        * @param id
-        * @return
-        */
-       boolean containsKey(Long id);
-
-       /**
-        * by server and publicSID
-        *
-        * @param id
-        * @return will return null if the client does not exist in the list
-        */
-       StreamClient get(Long id);
-
-       /**
-        *
-        * @param server
-        * @param uid
-        * @return will return an empty list if nothing available
-        */
-       List<StreamClient> getClientsByUid(Server server, String uid);
-
-       /**
-        * Searches for the publicSID across all servers
-        *
-        * @param uid
-        * @return will return a map with the serverId as key and the 
RoomClients as list in the value
-        */
-       Map<Long, List<StreamClient>> getClientsByUid(String uid);
-
-       Collection<StreamClient> getClients();
-
-       /**
-        * get all clients by a specific {@link Server}
-        *
-        * @param server
-        * @return will return an empty map if nothing available
-        */
-       Collection<StreamClient> getClientsByServer(Server server);
-
-       /**
-        *
-        * @param server
-        * @param userId
-        * @return will return an empty list if nothing available
-        */
-       Collection<StreamClient> getClientsByUserId(Server server, Long userId);
-
-       /**
-        *
-        * We ignore the server here, cause ONE room can only be on ONE server 
and often we don't know where.
-        *
-        * @param roomId
-        * @return will return an empty map if nothing available
-        */
-       List<StreamClient> getClientsByRoomId(Long roomId);
-
-       void remove(Long id);
-
-       int size();
-
-       int sizeByServer(Server server);
-
-       Collection<StreamClient> values();
-
-       /**
-        * Get some session statistics
-        *
-        * @param detailLevel
-        * @return
-        */
-       String getDebugInformation(List<DEBUG_DETAILS> detailLevel);
-
-       /**
-        * returns a list of roomIds (unique) that are currently active on the 
given server
-        * In case the session is stored in the memory (no-cluster setup) it 
will always
-        * return simply all active roomIds
-        *
-        * @param server
-        * @return
-        */
-       List<Long> getRoomsIdsByServer(Server server);
-
-       /**
-        * if database cache + cluster is enabled, the server object will be 
loaded
-        * into the client
-        *
-        * @return
-        */
-       Collection<StreamClient> getClientsWithServer();
-}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/openmeetings-core/src/main/java/org/apache/openmeetings/core/util/IClientUtil.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/util/IClientUtil.java
 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/util/IClientUtil.java
index 665afd33..a025eb8 100644
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/util/IClientUtil.java
+++ 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/util/IClientUtil.java
@@ -27,8 +27,8 @@ public class IClientUtil {
                , sharing
        }
 
-       public static void init(IClient client, Long id, boolean sharing) {
-               client.setAttribute(ConAttrs.omId.name(), id);
+       public static void init(IClient client, String uid, boolean sharing) {
+               client.setAttribute(ConAttrs.omId.name(), uid);
                client.setAttribute(ConAttrs.sharing.name(), sharing);
        }
 
@@ -38,9 +38,9 @@ public class IClientUtil {
         * @param conn
         * @return - Id of {@link StreamClient} for this IConnection, or 
<code>null</code>
         */
-       public static Long getId(IClient client) {
+       public static String getId(IClient client) {
                Object o = client.getAttribute(ConAttrs.omId.name());
-               return o instanceof Long ? (Long)o : null;
+               return o instanceof String ? (String)o : null;
        }
 
        public static boolean isSharing(IClient client) {

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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
index 8423097..307823b 100644
--- 
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
@@ -25,8 +25,8 @@ 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, Long streamClientId) {
-               StreamClient sc = mgr.get(streamClientId);
+       public static JSONObject videoJson(Client c, boolean self, String sid, 
ISessionManager mgr, String uid) {
+               StreamClient sc = mgr.get(uid);
                return c.toJson(self)
                                .put("sid", sid)
                                .put("uid", sc.getUid())

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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 76e7efe..26a126f 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/IApplication.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/IApplication.java
@@ -20,6 +20,8 @@ package org.apache.openmeetings;
 
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
 import java.util.function.Supplier;
 
 import javax.servlet.ServletContext;
@@ -43,9 +45,7 @@ public interface IApplication {
        String getOmString(String key, final Locale loc, String... params);
        Client getOmClient(String uid);
        Client getOmClientBySid(String sid);
-       StreamClient updateClient(StreamClient rcl, boolean forceSize);
        Client getOmOnlineClient(String uid);
-       List<Long> getActiveRooms();
        List<Client> getOmRoomClients(Long roomId);
        List<Client> getOmClients(Long userId);
        String getOmContactsLink();
@@ -55,4 +55,11 @@ public interface IApplication {
        void exit(String uid);
        void setXFrameOptions(String xFrameOptions);
        void setContentSecurityPolicy(String contentSecurityPolicy);
+
+       // stream client
+       StreamClient updateClient(StreamClient rcl, boolean forceSize);
+       String getServerId();
+       Map<String, StreamClient> getStreamClients();
+       StreamClient update(StreamClient c);
+       Set<Long> getActiveRoomIds();
 }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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
deleted file mode 100644
index f7e61af..0000000
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/ClientDao.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.db.dao.room;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
-
-import org.apache.openmeetings.db.entity.room.StreamClient;
-import org.apache.openmeetings.db.entity.server.Server;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Persistence of client objects to database is only available if so 
configured!
- *
- * @author sebawagner
- *
- */
-@Transactional
-public class ClientDao {
-       @PersistenceContext
-       private EntityManager em;
-
-       public void cleanAllClients() {
-               em.createNamedQuery("deleteClientAll").executeUpdate();
-       }
-
-       public void cleanClientsByServer(Server server) {
-               em.createNamedQuery("deleteClientsByServer").
-                       setParameter("server", server).
-                       executeUpdate();
-       }
-
-       public StreamClient get(Long id) {
-               List<StreamClient> list = em.createNamedQuery("getClientById", 
StreamClient.class)
-                               .setParameter("id", id)
-                               .getResultList();
-               return list == null || list.isEmpty() ? null : list.get(0);
-       }
-
-       public StreamClient add(StreamClient entity) {
-               em.persist(entity);
-               return entity;
-       }
-
-       public StreamClient update(StreamClient entity) {
-               em.merge(entity);
-               return entity;
-       }
-
-       public void delete(StreamClient entity) {
-               remove(entity.getId());
-       }
-
-       public void remove(Long id) {
-               Query q = em.createNamedQuery("deleteClientById");
-               q.setParameter("id", id);
-               q.executeUpdate();
-       }
-
-       public int countClients() {
-               return em.createNamedQuery("countClients", 
Long.class).getSingleResult().intValue();
-       }
-
-       public int countClientsByServer(Server server) {
-               TypedQuery<Long> q = 
em.createNamedQuery("countClientsByServer", Long.class);
-               q.setParameter("server", server);
-               return q.getSingleResult().intValue();
-       }
-
-       public List<StreamClient> getClientsByUidAndServer(Server server, 
String uid) {
-               TypedQuery<StreamClient> q = 
em.createNamedQuery("getClientsByUidAndServer", StreamClient.class);
-               q.setParameter("server", server);
-               q.setParameter("uid", uid);
-               return q.getResultList();
-       }
-
-       public List<StreamClient> getClientsByUid(String uid) {
-               TypedQuery<StreamClient> q = 
em.createNamedQuery("getClientsByUid", StreamClient.class);
-               q.setParameter("uid", uid);
-               return q.getResultList();
-       }
-
-       public List<StreamClient> getClientsByServer(Server server) {
-               TypedQuery<StreamClient> q = 
em.createNamedQuery("getClientsByServer", StreamClient.class);
-               q.setParameter("server", server);
-               return q.getResultList();
-       }
-
-       public List<StreamClient> getClients() {
-               return em.createNamedQuery("getClients", 
StreamClient.class).getResultList();
-       }
-
-       public List<StreamClient> getClientsWithServer() {
-               return em.createNamedQuery("getClientsWithServer", 
StreamClient.class).getResultList();
-       }
-
-       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<StreamClient> getClientsByRoomId(Long roomId) {
-               TypedQuery<StreamClient> q = 
em.createNamedQuery("getClientsByScope", StreamClient.class);
-               q.setParameter("scope", "" + roomId);
-               return q.getResultList();
-       }
-
-       /**
-        * returns a list of servers or an empty list in case no roomIds are 
found
-        *
-        * @param server
-        * @return
-        */
-       public List<Long> getRoomsIdsByServer(Server server) {
-               return em.createNamedQuery("getRoomsIdsByServer", String.class)
-                               .setParameter("server", server).getResultList()
-                               
.stream().map(Long::valueOf).collect(Collectors.toList());
-       }
-}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/RoomDao.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/RoomDao.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/RoomDao.java
index b82925d..0ea7a43 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/RoomDao.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/RoomDao.java
@@ -23,6 +23,7 @@ import static 
org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
 
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Collection;
 import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
@@ -202,7 +203,7 @@ public class RoomDao implements 
IGroupAdminDataProviderDao<Room> {
                                .getResultList();
        }
 
-       public long getRoomsCapacityByIds(List<Long> ids) {
+       public long getRoomsCapacityByIds(Collection<Long> ids) {
                return ids == null || ids.isEmpty() ? 0L
                        : em.createNamedQuery("getRoomsCapacityByIds", 
Long.class).setParameter("ids", ids).getSingleResult();
        }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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 ce9efb1..7b9b361 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
@@ -20,11 +20,9 @@ package org.apache.openmeetings.db.dao.server;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Set;
 
-import org.apache.openmeetings.db.dto.basic.SearchResult;
-import org.apache.openmeetings.db.dto.server.ClientSessionInfo;
 import org.apache.openmeetings.db.entity.room.StreamClient;
-import org.apache.openmeetings.db.entity.server.Server;
 
 /**
  * Methods to add/get/remove {@link StreamClient}s to the session
@@ -34,87 +32,38 @@ import org.apache.openmeetings.db.entity.server.Server;
  *
  */
 public interface ISessionManager {
-       void clearCache();
-
-       /**
-        * Notified on server start, when the session manager should be started 
and
-        * eventually caches cleared/setup
-        */
-       void sessionStart();
-
-       StreamClient add(StreamClient c, Server server);
-
-       Collection<StreamClient> getClients();
+       StreamClient add(StreamClient c);
 
        /**
         * loads the server into the client (only if database cache is used)
         *
         * @return
         */
-       Collection<StreamClient> getClientsWithServer();
-
-       /**
-        * Get a client by its id
-        *
-        * @param id
-        * @return
-        */
-       StreamClient get(Long id);
-
-       /**
-        * get a client by its publicSID and the server,
-        *
-        * @param uid
-        * @param server
-        * @return
-        */
-       StreamClient getClientByUid(String uid, Server server);
+       Collection<StreamClient> list();
 
        /**
-        * same as {@link #getClientByPublicSID(String, boolean, Server)} but 
it ignores
-        * if the server part, so it will deliver any client just by its 
publicSID.<br/>
-        * <br/>
-        * <b>Note:</b>
-        * This method requires more time to find the user, so under normal 
circumstances
-        * you should use {@link #getClientByPublicSID(String, boolean, 
Server)}!
+        * Get a client by its UID
         *
         * @param uid
         * @return
         */
-       ClientSessionInfo getClientByUidAnyServer(String uid);
-
-       /**
-        * Update the session object of the audio/video-connection and 
additionally
-        * swap the values to the session object of the user that holds the full
-        * session object
-        *
-        * @param id
-        * @return
-        */
-       boolean updateAVClient(StreamClient rcm);
+       StreamClient get(String uid);
 
        /**
-        * Update the session object
-        *
-        * updateRoomCount is only <i>one</i> time true, in
-        * ScopeApplicationAdapter#setRoomValues(Long, Boolean, Boolean, String)
-        * .
+        * Updates {@link StreamClient} in the cache
         *
         * @param rcm
-        * @param updateRoomCount
-        *            true means the count for the room has to be updated
-        * @param server
-        * @return
+        * @return updated client
         */
-       boolean update(StreamClient rcm);
+       StreamClient update(StreamClient rcm);
 
        /**
         * Remove a client from the session store
         *
-        * @param id
-        * @return
+        * @param uid
+        * @return true if client was removed
         */
-       boolean remove(Long id);
+       boolean remove(String uid);
 
        /**
         * Get all ClientList Objects of that room and domain This Function is
@@ -124,20 +73,17 @@ public interface ISessionManager {
         * @param roomId
         * @return
         */
-       List<StreamClient> getClientListByRoom(Long roomId);
+       List<StreamClient> listByRoom(Long roomId);
 
-       Collection<StreamClient> getClientListByRoomAll(Long roomId);
+       Collection<StreamClient> listByRoomAll(Long roomId);
 
        /**
-        * Get list of current client sessions
+        * get the current Moderator in this room
         *
-        * @param start
-        * @param max
-        * @param orderby
-        * @param asc
+        * @param roomId
         * @return
         */
-       SearchResult<StreamClient> getListByStartAndMax(int start, int max, 
String orderby, boolean asc);
+       List<StreamClient> listModeratorByRoom(Long roomId);
 
        /**
         * returns number of current users recording
@@ -145,7 +91,7 @@ public interface ISessionManager {
         * @param roomId
         * @return
         */
-       long getRecordingCount(long roomId);
+       long getRecordingCount(Long roomId);
 
        /**
         * returns a number of current users publishing screensharing
@@ -153,21 +99,20 @@ public interface ISessionManager {
         * @param roomId
         * @return
         */
-       long getPublishingCount(long roomId);
+       long getPublishingCount(Long roomId);
 
        /**
-        * Get a list of all servers of all rooms on that server, serverId = 
null
-        * means it is a local session on the master.
+        * Get a list of all rooms with users in the system.
         *
-        * @param server
         * @return a set, a roomId can be only one time in this list
         */
-       List<Long> getActiveRoomIdsByServer(Server server);
+       Set<Long> getActiveRoomIds();
 
        /**
-        * Get some statistics about the current sessions
+        * Get a list of rooms with users on particular cluster node.
         *
-        * @return
+        * @param server
+        * @return a set, a roomId can be only one time in this list
         */
-       String getSessionStatistics();
+       Set<Long> getActiveRoomIds(String serverId);
 }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/ServerDao.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/ServerDao.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/ServerDao.java
deleted file mode 100644
index dad22cf..0000000
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/ServerDao.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * 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.db.dao.server;
-
-import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
-
-import java.util.Date;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import javax.persistence.PersistenceContext;
-import javax.persistence.TypedQuery;
-
-import org.apache.openmeetings.db.dao.IDataProviderDao;
-import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.entity.server.Server;
-import org.apache.openmeetings.util.DaoHelper;
-import org.red5.logging.Red5LoggerFactory;
-import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * 
- * CRUD for {@link Server}
- * 
- * @author solomax, sebawagner
- * 
- */
-@Transactional
-public class ServerDao implements IDataProviderDao<Server> {
-       private static final Logger log = 
Red5LoggerFactory.getLogger(ServerDao.class, webAppRootKey);
-       public final static String[] searchFields = { "name", "address", 
"comment" };
-
-       @PersistenceContext
-       private EntityManager em;
-
-       @Autowired
-       private UserDao userDao;
-       
-       /**
-        * Get a list of all available servers
-        * 
-        * @return
-        */
-       public List<Server> getServerList() {
-               log.debug("getServerList enter");
-               TypedQuery<Server> q = em.createNamedQuery("getAllServers",
-                               Server.class);
-               return q.getResultList();
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.apache.openmeetings.data.OmDAO#get(int, int)
-        */
-       @Override
-       public List<Server> get(int start, int max) {
-               TypedQuery<Server> q = em.createNamedQuery("getAllServers", 
Server.class);
-               q.setFirstResult(start);
-               q.setMaxResults(max);
-               return q.getResultList();
-       }
-
-       @Override
-       public List<Server> get(String search, int start, int count, String 
order) {
-               TypedQuery<Server> q = em.createQuery(DaoHelper.getSearchQuery(
-                               "Server", "s", search, true, false, order, 
searchFields),
-                               Server.class);
-               q.setFirstResult(start);
-               q.setMaxResults(count);
-               return q.getResultList();
-       }
-
-       /**
-        * get the list of all servers in the cluster that are ready to receive 
a
-        * ping (active = true)
-        * 
-        * @return
-        */
-       public List<Server> getActiveServers() {
-               return em.createNamedQuery("getActiveServers", Server.class)
-                               .getResultList();
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.apache.openmeetings.data.OmDAO#count()
-        */
-       @Override
-       public long count() {
-               log.debug("getServerCount enter");
-               TypedQuery<Long> q = em.createNamedQuery("getServerCount", 
Long.class);
-
-               return q.getSingleResult();
-       }
-
-       @Override
-       public long count(String search) {
-               TypedQuery<Long> q = 
em.createQuery(DaoHelper.getSearchQuery("Server",
-                               "s", search, true, true, null, searchFields), 
Long.class);
-               return q.getSingleResult();
-       }
-
-       @Override
-       public Server get(long id) {
-               return get(Long.valueOf(id));
-       }
-       
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.apache.openmeetings.data.OmDAO#get(long)
-        */
-       @Override
-       public Server get(Long id) {
-               Server result = null;
-               log.debug("getServer enter, id = " + id);
-               TypedQuery<Server> q = em.createNamedQuery("getServerById",
-                               Server.class);
-               q.setParameter("id", id);
-               try {
-                       result = q.getSingleResult();
-               } catch (NoResultException e) {
-                       // noop
-               }
-               return result;
-       }
-
-       /**
-        * Get server by its address
-        * 
-        * @param address
-        * @return
-        */
-       public Server getServerByAddress(String address) {
-               log.debug("getServer enter, address = " + address);
-               TypedQuery<Server> q = em.createNamedQuery("getServerByAddress",
-                               Server.class);
-               q.setParameter("address", address);
-               List<Server> list = q.getResultList();
-               return list.size() > 0 ? list.get(0) : null;
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * 
org.apache.openmeetings.data.OmDAO#update(org.apache.openmeetings.persistence
-        * .beans.OmEntity, long)
-        */
-       @Override
-       public Server update(Server entity, Long userId) {
-               entity.setDeleted(false);
-               if (entity.getId() == null) {
-                       entity.setInserted(new Date());
-                       if (userId != null) {
-                               entity.setInsertedby(userDao.get(userId));
-                       }
-                       em.persist(entity);
-               } else {
-                       entity.setUpdated(new Date());
-                       if (userId != null) {
-                               entity.setUpdatedby(userDao.get(userId));
-                       }
-                       em.merge(entity);
-               }
-               return entity;
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * 
org.apache.openmeetings.data.OmDAO#delete(org.apache.openmeetings.persistence
-        * .beans.OmEntity, long)
-        */
-       @Override
-       public void delete(Server entity, Long userId) {
-               if (entity.getId() != null) {
-                       entity.setUpdated(new Date());
-                       if (userId != null) {
-                               entity.setUpdatedby(userDao.get(userId));
-                       }
-                       entity.setDeleted(true);
-                       em.merge(entity);
-               }
-       }
-
-       /**
-        * get {@link Server} by name
-        * 
-        * @param name
-        * @return
-        */
-       public List<Server> getServersByName(String name) {
-               TypedQuery<Server> q = em.createNamedQuery("getServerByName",
-                               Server.class);
-               q.setParameter("name", name);
-               return q.getResultList();
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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 a79be64..96f3cad 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
@@ -205,7 +205,7 @@ public class SessiondataDao {
         */
        public void clearSessionByRoomId(Long roomId) {
                try {
-                       for (StreamClient rcl : 
sessionManager.getClientListByRoom(roomId)) {
+                       for (StreamClient rcl : 
sessionManager.listByRoom(roomId)) {
                                String aux = rcl.getSwfurl();
 
                                //FIXME TODO this need to be refactored !

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/IUserManager.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/IUserManager.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/IUserManager.java
index a9f76e8..2a80802 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/IUserManager.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/IUserManager.java
@@ -52,9 +52,8 @@ public interface IUserManager {
        Long getLanguage(Locale loc);
        User loginOAuth(Map<String, String> params, long serverId) throws 
IOException, NoSuchAlgorithmException;
 
-       boolean kickUsersByRoomId(Long roomId);
-
-       boolean kickById(Long id);
+       boolean kickById(String uid);
+       boolean kickUsersByRoomId(Long room_id);
 
        List<Userdata> getUserdataDashBoard(Long userId);
 }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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
deleted file mode 100644
index d257d8c..0000000
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/server/ClientSessionInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.db.dto.server;
-
-import org.apache.openmeetings.db.entity.room.StreamClient;
-
-
-public class ClientSessionInfo {
-       
-       private StreamClient rcl;
-       public Long serverId;
-       
-       public ClientSessionInfo() {}
-       
-       public ClientSessionInfo(StreamClient rcl, Long serverId) {
-               super();
-               this.rcl = rcl;
-               this.serverId = serverId;
-       }
-       
-       public StreamClient getRcl() {
-               return rcl;
-       }
-       public void setRcl(StreamClient rcl) {
-               this.rcl = rcl;
-       }
-       public Long getServerId() {
-               return serverId;
-       }
-       public void setServerId(Long serverId) {
-               this.serverId = serverId;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/server/ServerDTO.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/server/ServerDTO.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/server/ServerDTO.java
deleted file mode 100644
index cc8e933..0000000
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/server/ServerDTO.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.db.dto.server;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.openmeetings.db.entity.server.Server;
-
-/**
- * 
- * Bean send to the client about the server he is going to use for the 
conference 
- * session
- * 
- * @author sebawagner
- *
- */
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class ServerDTO implements Serializable {
-       private static final long serialVersionUID = 1L;
-       private Long id;
-       private String name;
-       private String address;
-       private int port;
-       private String user;
-       private String password;
-       private String webapp;
-       private String protocol;
-       private boolean active;
-       private String comment;
-
-       public ServerDTO() {}
-       
-       public ServerDTO(Server s) {
-               if (s == null) {
-                       return;
-               }
-               id = s.getId();
-               name = s.getName();
-               address = s.getAddress();
-               port = s.getPort();
-               user = s.getUser();
-               password = s.getPass();
-               webapp = s.getWebapp();
-               protocol = s.getProtocol();
-               active = s.isActive();
-               comment = s.getComment();
-       }
-
-       public Server get() {
-               Server s = new Server();
-               s.setId(id);
-               s.setName(name);
-               s.setAddress(address);
-               s.setPort(port);
-               s.setUser(user);
-               s.setPass(password);
-               s.setWebapp(webapp);
-               s.setProtocol(protocol);
-               s.setActive(active);
-               s.setComment(comment);
-               return s;
-       }
-       
-       public Long getId() {
-               return id;
-       }
-
-       public void setId(Long id) {
-               this.id = id;
-       }
-
-       public String getAddress() {
-               return address;
-       }
-
-       public void setAddress(String address) {
-               this.address = address;
-       }
-
-       public int getPort() {
-               return port;
-       }
-
-       public void setPort(int port) {
-               this.port = port;
-       }
-
-       public String getProtocol() {
-               return protocol;
-       }
-
-       public void setProtocol(String protocol) {
-               this.protocol = protocol;
-       }
-
-       public String getWebapp() {
-               return webapp;
-       }
-
-       public void setWebapp(String webapp) {
-               this.webapp = webapp;
-       }
-
-       public String getName() {
-               return name;
-       }
-
-       public void setName(String name) {
-               this.name = name;
-       }
-
-       public String getUser() {
-               return user;
-       }
-
-       public void setUser(String user) {
-               this.user = user;
-       }
-
-       public String getPassword() {
-               return password;
-       }
-
-       public void setPassword(String password) {
-               this.password = password;
-       }
-
-       public boolean isActive() {
-               return active;
-       }
-
-       public void setActive(boolean active) {
-               this.active = active;
-       }
-
-       public String getComment() {
-               return comment;
-       }
-
-       public void setComment(String comment) {
-               this.comment = comment;
-       }
-       
-       @Override
-       public String toString() {
-               return "id "+id+" address "+address+" port "+port+" protocol 
"+protocol;
-       }
-
-       public static List<ServerDTO> list(List<Server> l) {
-               List<ServerDTO> list = new ArrayList<>();
-               if (l != null) {
-                       for (Server s : l) {
-                               list.add(new ServerDTO(s));
-                       }
-               }
-               return list;
-       }
-}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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 ed5424d..e42a467 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
@@ -60,38 +60,32 @@ public class Client implements IClient {
        }
        public static class Stream implements Serializable {
                private static final long serialVersionUID = 1L;
-               private Long streamClientId = null;
-               private String broadcastId = null;
-               private boolean sharing;
+               private final Long streamId;
+               private final String uid;
+               private final String broadcastId;
+               private final boolean sharing;
 
-               public Stream(Long streamClientId, String broadcastId, boolean 
sharing) {
-                       this.streamClientId = streamClientId;
+               public Stream(String uid, Long streamId, String broadcastId, 
boolean sharing) {
+                       this.streamId = streamId;
                        this.broadcastId = broadcastId;
+                       this.uid = uid;
                        this.sharing= sharing;
                }
 
-               public Long getStreamClientId() {
-                       return streamClientId;
-               }
-
-               public void setStreamClientId(Long streamClientId) {
-                       this.streamClientId = streamClientId;
+               public Long getStreamId() {
+                       return streamId;
                }
 
                public String getBroadcastId() {
                        return broadcastId;
                }
 
-               public void setBroadcastId(String broadcastId) {
-                       this.broadcastId = broadcastId;
-               }
-
                public boolean isSharing() {
                        return sharing;
                }
 
-               public void setSharing(boolean sharing) {
-                       this.sharing = sharing;
+               public String getUid() {
+                       return uid;
                }
 
                @Override
@@ -121,7 +115,7 @@ public class Client implements IClient {
 
                @Override
                public String toString() {
-                       return "Stream [id=" + streamClientId + ", 
broadcastId=" + broadcastId + ", sharing=" + sharing + "]";
+                       return "Stream [id=" + streamId + ", broadcastId=" + 
broadcastId + ", sharing=" + sharing + "]";
                }
        }
        private final String sessionId;
@@ -140,6 +134,7 @@ public class Client implements IClient {
        private int mic = -1;
        private int width = 0;
        private int height = 0;
+       private String serverId = null;
 
        public Client(String sessionId, int pageId, Long userId, UserDao dao) {
                this.sessionId = sessionId;
@@ -182,14 +177,16 @@ public class Client implements IClient {
                return user;
        }
 
-       public void updateUser(UserDao dao) {
+       public Client updateUser(UserDao dao) {
                user = dao.get(user.getId());
+               return this;
        }
 
        public Long getUserId() {
                return user.getId();
        }
 
+       @Override
        public String getUid() {
                return uid;
        }
@@ -230,8 +227,8 @@ public class Client implements IClient {
                }
        }
 
-       public Set<Activity> getActivities() {
-               return activities;
+       public void clearActivities() {
+               activities.clear();
        }
 
        public boolean hasAnyActivity(Activity... aa) {
@@ -256,7 +253,7 @@ public class Client implements IClient {
                }
        }
 
-       public void set(Activity a) {
+       public Client set(Activity a) {
                activities.add(a);
                switch (a) {
                        case broadcastV:
@@ -271,9 +268,10 @@ public class Client implements IClient {
                                break;
                        default:
                }
+               return this;
        }
 
-       public void remove(Activity a) {
+       public Client remove(Activity a) {
                activities.remove(a);
                switch (a) {
                        case broadcastV:
@@ -294,17 +292,18 @@ public class Client implements IClient {
                                break;
                        default:
                }
+               return this;
        }
 
-       public void addStream(Long streamClientId, String broadcastId, boolean 
sharing) {
-               streams.add(new Stream(streamClientId, broadcastId, sharing));
+       public void addStream(String uid, Long streamId, String broadcastId, 
boolean sharing) {
+               streams.add(new Stream(uid, streamId, broadcastId, sharing));
        }
 
        public void removeStream(String broadcastId) {
                if (broadcastId == null) {
                        return;
                }
-               streams.remove(new Stream(1L, broadcastId, false));
+               streams.remove(new Stream(null, 1L, broadcastId, false));
        }
 
        public List<Stream> getStreams() {
@@ -399,6 +398,15 @@ public class Client implements IClient {
        }
 
        @Override
+       public String getServerId() {
+               return serverId;
+       }
+
+       public void setServerId(String serverId) {
+               this.serverId = serverId;
+       }
+
+       @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/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 d052a8b..9d1cdc1 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
@@ -28,4 +28,6 @@ import org.apache.openmeetings.db.entity.IDataProviderEntity;
  *
  */
 public interface IClient extends IDataProviderEntity {
+       String getUid();
+       String getServerId();
 }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bbcdbf7e/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/StreamClient.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/StreamClient.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/StreamClient.java
index 9e661e7..635a8ee 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/StreamClient.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/StreamClient.java
@@ -20,25 +20,7 @@ package org.apache.openmeetings.db.entity.room;
 
 import java.util.Date;
 
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.openmeetings.db.entity.basic.Client;
 import org.apache.openmeetings.db.entity.basic.IClient;
-import org.apache.openmeetings.db.entity.server.Server;
 import org.apache.wicket.util.string.StringValue;
 
 /**
@@ -46,229 +28,61 @@ import org.apache.wicket.util.string.StringValue;
  *
  * @author sebawagner
  */
-@Entity
-@NamedQueries({
-       @NamedQuery(name = "deleteClientAll", query = "DELETE FROM 
StreamClient"),
-       @NamedQuery(name = "deleteClientById", query = "DELETE FROM 
StreamClient c WHERE c.id = :id"),
-       @NamedQuery(name = "getClientById", query = "SELECT c FROM StreamClient 
c WHERE c.id = :id"),
-       @NamedQuery(name = "deleteClientsByServer", query = "DELETE FROM 
StreamClient c WHERE c.server = :server"),
-       @NamedQuery(name = "countClients", query = "SELECT count(c) FROM 
StreamClient c"),
-       @NamedQuery(name = "countClientsByServer", query = "SELECT count(c) 
FROM StreamClient c WHERE c.server = :server"),
-       @NamedQuery(name = "getClientsByUidAndServer", query = "SELECT c FROM 
StreamClient c WHERE c.uid = :uid AND c.server = :server"),
-       @NamedQuery(name = "getClientsByUid", query = "SELECT c FROM 
StreamClient c WHERE c.uid = :uid"),
-       @NamedQuery(name = "getClientsByServer", query = "SELECT c FROM 
StreamClient c WHERE c.server = :server"),
-       @NamedQuery(name = "getClients", query = "SELECT c FROM StreamClient 
c"),
-       @NamedQuery(name = "getClientsWithServer", query = "SELECT c FROM 
StreamClient c LEFT JOIN FETCH c.server"),
-       @NamedQuery(name = "getClientsByUserId", query = "SELECT c FROM 
StreamClient c WHERE c.server = :server AND c.userId = :userId"),
-       @NamedQuery(name = "getClientsByScope", query = "SELECT c FROM 
StreamClient c WHERE c.scope = :scope"),
-       @NamedQuery(name = "getRoomsIdsByServer", query = "SELECT c.scope FROM 
StreamClient c WHERE c.server = :server GROUP BY c.scope")
-})
-@Table(name = "client")
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
 public class StreamClient implements IClient {
        private static final long serialVersionUID = 1L;
 
-       @Id
-       @GeneratedValue(strategy = GenerationType.IDENTITY)
-       @Column(name = "id")
-       private Long id;
-
-       /**
-        * Red5 scope, can be roomId or 'hibernate'
-        */
-       @Column(name = "scope")
        private String scope = "";
-
-       /**
-        * The width of the video
-        */
-       @Column(name = "width")
        private int width = 0;
-
-       /**
-        * The height of the video
-        */
-       @Column(name = "height")
        private int height = 0;
-
-       /**
-        * {@link Client#getUid()} of the client this stream is originated from
-        *
-        */
-       @Column(name = "uid")
        private String uid = null;
-
-       /**
-        * {@link Client#getSid()} of the client who initiated the connection
-        */
-       @Column(name = "owner_sid")
        private String ownerSid = null;
-
-       /**
-        * Is this user moderator
-        */
-       @Column(name = "is_mod", nullable = false)
        private boolean mod = false;
-
-       /**
-        * Is this user "super moderator"
-        */
-       @Column(name = "super_mod", nullable = false)
        private boolean superMod = false;
-
-       /**
-        * @see StreamClient#getCanGiveAudio()
-        */
-       @Column(name = "can_giveaudio", nullable = false)
        private boolean canGiveAudio = false;
-
-       @Column(name = "can_video", nullable = false)
        private boolean canVideo = false;
-
-       /**
-        * @see StreamClient#getConnectedSince()
-        */
-       @Column(name = "connected_since")
        private Date connectedSince;
-
-       /**
-        * @see StreamClient#getUserip()
-        */
-       @Column(name = "userip")
        private String userip;
-
-       /**
-        * @see StreamClient#getUserport()
-        */
-       @Column(name = "userport")
        private int userport;
-
-       /**
-        * @see StreamClient#getRoomEnter()
-        */
-       @Column(name = "room_enter")
        private Date roomEnter = null;
-
-       /**
-        * @see StreamClient#getBroadCastID()
-        */
-       @Column(name = "broadcast_id")
        private String broadCastId = null;
-
-       @Column(name = "username")
        private String username = "";
-
-       @Column(name = "user_id")
        private Long userId = null;
-
-       @Column(name = "firstname")
        private String firstname = "";
-
-       @Column(name = "lastname")
        private String lastname = "";
-
-       @Column(name = "email")
        private String email;
-
-       @Column(name = "last_login")
        private String lastLogin;
-
-       @Column(name = "picture_uri")
        private String picture_uri;
-
-       @Column(name = "language")
        private String language = "";
-
-       @Column(name = "avsettings")
        private String avsettings = "";
-
-       @Column(name = "swfurl", length=2048)
        private String swfurl;
-
-       @Column(name = "tcurl", length=2048)
        private String tcUrl;
-
-       @Column(name = "nativeSsl", nullable = false)
        private boolean nativeSsl = false;
-
-       /**
-        * Is this client connect via mobile application
-        */
-       @Column(name = "mobile", nullable = false)
        private boolean mobile = false;
-
-       /**
-        * Is this client performs screen sharing
-        */
-       @Column(name = "sharing", nullable = false)
        private boolean sharing = false;
-
-       @Column(name = "recording_started", nullable = false)
        private boolean recordingStarted = false;
-
-       @Column(name = "sharing_started", nullable = false)
        private boolean sharingStarted = false;
-
-       @Column(name = "publish_started", nullable = false)
        private boolean publishStarted = false;
-
-       @Column(name = "broadcasting", nullable = false)
        private boolean broadcasting = false;
-
-       @Column(name = "recording_id")
        private Long recordingId;
-
-       @Column(name = "meta_id")
        private Long metaId;
-
-       @Column(name = "external_user_id")
        private String externalUserId;
-
-       @Column(name = "external_user_type")
        private String externalUserType;
-
-       /**
-        * @see StreamClient#getInterviewPodId()
-        */
-       @Column(name = "interview_pod_id")
        private Integer interviewPodId = null;
-
-       /**
-        * @see StreamClient#isAllowRecording()
-        */
-       @Column(name = "allow_recording", nullable = false)
        private boolean allowRecording = true;
-
-       /**
-        * @see StreamClient#getMicMuted()
-        */
-       @Column(name = "mic_muted", nullable = false)
        private boolean micMuted = false;
-
-       /**
-        * @see StreamClient#isSipTransport()
-        */
-       @Column(name = "sip_transport", nullable = false)
        private boolean sipTransport = false;
-
-       @ManyToOne(fetch = FetchType.LAZY)
-       @JoinColumn(name = "server_id")
-       private Server server;
-
-       @Transient
+       private String serverId;
        private Long roomId;
 
        public StreamClient() {}
 
        @Override
        public Long getId() {
-               return id;
+               return null;
        }
 
        @Override
        public void setId(Long id) {
-               this.id = id;
        }
 
        public String getScope() {
@@ -300,6 +114,7 @@ public class StreamClient implements IClient {
                this.height = height;
        }
 
+       @Override
        public String getUid() {
                return uid;
        }
@@ -596,12 +411,13 @@ public class StreamClient implements IClient {
                this.sipTransport = sipTransport;
        }
 
-       public Server getServer() {
-               return server;
+       @Override
+       public String getServerId() {
+               return serverId;
        }
 
-       public void setServer(Server server) {
-               this.server = server;
+       public void setServerId(String serverId) {
+               this.serverId = serverId;
        }
 
        public Long getRoomId() {
@@ -614,5 +430,4 @@ public class StreamClient implements IClient {
                                + broadCastId + ", username=" + username + ", 
userId=" + userId + ", avsettings=" + avsettings + ", sharing=" + sharing
                                + ", isBroadcasting=" + broadcasting + "]";
        }
-
 }

Reply via email to