openmeetings-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebawag...@apache.org
Subject svn commit: r1435029 - in /incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings: axis/services/ data/user/ ldap/ remote/ remote/red5/ remote/util/ test/userdata/ web/app/
Date Fri, 18 Jan 2013 05:02:34 GMT
Author: sebawagner
Date: Fri Jan 18 05:02:33 2013
New Revision: 1435029

URL: http://svn.apache.org/viewvc?rev=1435029&view=rev
Log:
OPENMEETINGS-460 Move Session variables needed during sync process into IClient

Added:
    incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/util/
    incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/util/SessionVariablesUtil.java
Modified:
    incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/UserWebService.java
    incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java
    incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
    incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/ChatService.java
    incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
    incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
    incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/test/userdata/TestLogin.java
    incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/WebSession.java

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/UserWebService.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/UserWebService.java?rev=1435029&r1=1435028&r2=1435029&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/UserWebService.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/UserWebService.java Fri Jan 18 05:02:33 2013
@@ -110,7 +110,7 @@ public class UserWebService {
 			throws AxisFault {
 		try {
 			Object obj = userManagement.loginUser(SID, username, userpass,
-					null, false);
+					null, null, false);
 			if (obj == null) {
 				return new Long(-1);
 			}

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java?rev=1435029&r1=1435028&r2=1435029&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java Fri Jan 18 05:02:33 2013
@@ -57,6 +57,7 @@ import org.apache.openmeetings.persisten
 import org.apache.openmeetings.persistence.beans.user.Userlevel;
 import org.apache.openmeetings.persistence.beans.user.Users;
 import org.apache.openmeetings.remote.red5.ScopeApplicationAdapter;
+import org.apache.openmeetings.remote.util.SessionVariablesUtil;
 import org.apache.openmeetings.templates.ResetPasswordTemplate;
 import org.apache.openmeetings.utils.DaoHelper;
 import org.apache.openmeetings.utils.crypt.ManageCryptStyle;
@@ -64,6 +65,7 @@ import org.apache.openmeetings.utils.mai
 import org.apache.openmeetings.utils.math.CalendarPatterns;
 import org.red5.io.utils.ObjectMap;
 import org.red5.logging.Red5LoggerFactory;
+import org.red5.server.api.IClient;
 import org.red5.server.api.scope.IScope;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -226,7 +228,7 @@ public class Usermanagement {
 	 * @return
 	 */
 	public Object loginUser(String SID, String userOrEmail, String userpass,
-			RoomClient currentClient, Boolean storePermanent) {
+			RoomClient currentClient, IClient client, Boolean storePermanent) {
 		try {
 			log.debug("Login user SID : " + SID + " Stored Permanent :"
 					+ storePermanent);
@@ -275,6 +277,7 @@ public class Usermanagement {
 					// If invoked via SOAP this is NULL
 					if (currentClient != null) {
 						currentClient.setUser_id(users.getUser_id());
+						SessionVariablesUtil.setUserId(client, users.getUser_id());
 					}
 
 					log.debug("loginUser " + users.getOrganisation_users());

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java?rev=1435029&r1=1435028&r2=1435029&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java Fri Jan 18 05:02:33 2013
@@ -39,9 +39,11 @@ import org.apache.openmeetings.ldap.conf
 import org.apache.openmeetings.persistence.beans.adresses.States;
 import org.apache.openmeetings.persistence.beans.basic.LdapConfig;
 import org.apache.openmeetings.persistence.beans.user.Users;
+import org.apache.openmeetings.remote.util.SessionVariablesUtil;
 import org.apache.openmeetings.utils.OmFileHelper;
 import org.apache.openmeetings.utils.crypt.ManageCryptStyle;
 import org.red5.logging.Red5LoggerFactory;
+import org.red5.server.api.IClient;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -234,7 +236,7 @@ public class LdapLoginManagement {
 	 */
 	// ----------------------------------------------------------------------------------------
 	public Object doLdapLogin(String user, String passwd,
-			RoomClient currentClient, String SID, String domain) {
+			RoomClient currentClient, IClient client, String SID, String domain) {
 		log.debug("LdapLoginmanagement.doLdapLogin");
 
 		// Retrieve Configuration Data
@@ -500,6 +502,7 @@ public class LdapLoginManagement {
 				// If invoked via SOAP this is NULL
 				if (currentClient != null) {
 					currentClient.setUser_id(userid);
+					SessionVariablesUtil.setUserId(client, userid);
 				}
 
 				// Update Session

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/ChatService.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/ChatService.java?rev=1435029&r1=1435028&r2=1435029&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/ChatService.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/ChatService.java Fri Jan 18 05:02:33 2013
@@ -37,8 +37,10 @@ import org.apache.openmeetings.data.user
 import org.apache.openmeetings.persistence.beans.rooms.Rooms;
 import org.apache.openmeetings.remote.red5.EmoticonsManager;
 import org.apache.openmeetings.remote.red5.ScopeApplicationAdapter;
+import org.apache.openmeetings.remote.util.SessionVariablesUtil;
 import org.apache.openmeetings.utils.stringhandlers.ChatString;
 import org.red5.logging.Red5LoggerFactory;
+import org.red5.server.api.IClient;
 import org.red5.server.api.IConnection;
 import org.red5.server.api.Red5;
 import org.red5.server.api.service.IPendingServiceCall;
@@ -181,12 +183,7 @@ public class ChatService implements IPen
     						if (needModeration && Boolean.TRUE != rcl.getIsMod() && Boolean.TRUE != rcl.getIsSuperModerator()) {
     							continue;
     						}
-    						log.debug("*..*idremote room_id: " + room_id);
-    						log.debug("*..*my idstreamid room_id: " + rcl.getRoom_id());
-    						if (room_id.equals(rcl.getRoom_id())) {
-    							((IServiceCapableConnection) conn).invoke("sendVarsToMessageWithClient",new Object[] { hsm }, this);
-    							log.debug("sending sendVarsToMessageWithClient to " + conn);
-    						}
+							((IServiceCapableConnection) conn).invoke("sendVarsToMessageWithClient",new Object[] { hsm }, this);
 	    			 	}
 	    			}
     			}
@@ -232,27 +229,22 @@ public class ChatService implements IPen
 				for (IConnection conn : conset) {
 					if (conn != null) {
 						if (conn instanceof IServiceCapableConnection) {
+    						IClient client = conn.getClient();
+							if (SessionVariablesUtil.isScreenClient(client)) {
+								// screen sharing clients do not receive events
+								continue;
+							} else if (SessionVariablesUtil.isAVClient(client)) {
+								// AVClients or potential AVClients do not receive events
+								continue;
+							}
 
-							RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId(), null);
-
-    						if (rcl == null) {
-    							continue;
-    						}
-    						if (rcl.getIsAVClient()) {
-    							continue;
-    						}
-    						if (rcl.getIsScreenClient() != null && rcl.getIsScreenClient()) {
-	    						continue;
-	    					}
-
-							if (rcl.getPublicSID().equals(publicSID)
-									|| rcl.getPublicSID().equals(
+							if (SessionVariablesUtil.getPublicSID(client).equals(publicSID)
+									|| SessionVariablesUtil.getPublicSID(client).equals(
 											currentClient.getPublicSID())) {
 								((IServiceCapableConnection) conn).invoke(
-										"sendVarsToMessageWithClient",
+									"sendVarsToMessageWithClient",
 										new Object[] { hsm }, this);
 							}
-
 						}
 					}
 				}

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java?rev=1435029&r1=1435028&r2=1435029&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java Fri Jan 18 05:02:33 2013
@@ -56,6 +56,7 @@ import org.apache.openmeetings.persisten
 import org.apache.openmeetings.persistence.beans.user.Userdata;
 import org.apache.openmeetings.persistence.beans.user.Users;
 import org.apache.openmeetings.remote.red5.ScopeApplicationAdapter;
+import org.apache.openmeetings.remote.util.SessionVariablesUtil;
 import org.apache.openmeetings.rss.LoadAtomRssFeed;
 import org.red5.logging.Red5LoggerFactory;
 import org.red5.server.api.IConnection;
@@ -237,6 +238,7 @@ public class MainService implements IPen
 
 			o.setSessionData(sessionManagement.getSessionByHash(remoteHashId));
 			currentClient.setUser_id(o.getUser_id());
+			SessionVariablesUtil.setUserId(current.getClient(), o.getUser_id());
 			
 			if (currentClient.getUser_id() != null
 					&& currentClient.getUser_id() > 0) {
@@ -329,14 +331,14 @@ public class MainService implements IPen
 				}
 
 				o = ldapLoginManagement.doLdapLogin(ldapLogin,
-						Userpass, currentClient, SID,
+						Userpass, currentClient, current.getClient(), SID,
 						ldapConfig.getConfigFileName());
 			} else {
 
 				currentClient = clientListManager.getClientByStreamId(current.getClient().getId(), null);
 
 				o = userManagement.loginUser(SID, usernameOrEmail, Userpass,
-						currentClient, storePermanent);
+						currentClient, current.getClient(), storePermanent);
 			}
 
 			if (o == null)
@@ -624,6 +626,7 @@ public class MainService implements IPen
 											userObject.getPictureUrl());
 
 							currentClient.setUser_id(userId);
+							SessionVariablesUtil.setUserId(current.getClient(), userId);
 						} else {
 
 							user.setPictureuri(userObject.getPictureUrl());
@@ -631,6 +634,7 @@ public class MainService implements IPen
 							userManagement.updateUser(user);
 
 							currentClient.setUser_id(user.getUser_id());
+							SessionVariablesUtil.setUserId(current.getClient(), user.getUser_id());
 						}
 					}
 

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java?rev=1435029&r1=1435028&r2=1435029&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java Fri Jan 18 05:02:33 2013
@@ -53,6 +53,7 @@ import org.apache.openmeetings.persisten
 import org.apache.openmeetings.persistence.beans.user.Users;
 import org.apache.openmeetings.remote.FLVRecorderService;
 import org.apache.openmeetings.remote.WhiteBoardService;
+import org.apache.openmeetings.remote.util.SessionVariablesUtil;
 import org.apache.openmeetings.utils.OmFileHelper;
 import org.apache.openmeetings.utils.math.CalendarPatterns;
 import org.red5.logging.Red5LoggerFactory;
@@ -186,6 +187,8 @@ public class ScopeApplicationAdapter ext
 			RoomClient rcm = this.clientListManager.addClientListItem(streamId,
 					conn.getScope().getName(), conn.getRemotePort(),
 					conn.getRemoteAddress(), swfURL, isAVClient);
+			
+			SessionVariablesUtil.initClient(conn.getClient(), isAVClient, rcm.getPublicSID());
 
 			// Log the User
 			conferenceLogDao.addConferenceLog("ClientConnect",
@@ -306,8 +309,13 @@ public class ScopeApplicationAdapter ext
 
 				// Set this connection to be a RTMP-Java Client
 				currentClient.setIsScreenClient(true);
+				
+				SessionVariablesUtil.setIsScreenClient(current.getClient());
+				
 				currentClient.setUser_id(Long.parseLong(map.get("user_id")
 						.toString()));
+				SessionVariablesUtil.setUserId(current.getClient(), Long.parseLong(map.get("user_id")
+						.toString()));
 
 				if (startStreaming) {
 					currentClient.setStartStreaming(true);
@@ -442,7 +450,6 @@ public class ScopeApplicationAdapter ext
 		IConnection current = Red5.getConnectionLocal();
 		RoomClient currentClient = this.clientListManager
 				.getClientByStreamId(current.getClient().getId(), null);
-		currentClient.setIsAVClient(false);
 		clientListManager.updateClientByStreamId(current.getClient().getId(),
 				currentClient, false);
 		return currentClient.getPublicSID();
@@ -870,10 +877,7 @@ public class ScopeApplicationAdapter ext
 									} else {
 										log.debug("is this users still alive? :"
 												+ rcl);
-										// conn.ping();
 										IServiceCapableConnection iStream = (IServiceCapableConnection) conn;
-										// log.info("IServiceCapableConnection ID "
-										// + iStream.getClient().getId());
 										iStream.invoke(clientFunction,
 												new Object[] { rc }, this);
 									}
@@ -886,9 +890,6 @@ public class ScopeApplicationAdapter ext
 									if (clientFunction.equals("closeStream")
 											&& rcl.getIsRecording()) {
 										log.debug("***  +++++++ ######## sendClientBroadcastNotifications Any Client is Recording - stop that");
-										// StreamService.stopRecordingShowForClient(conn,
-										// currentClient,
-										// rcl.getRoomRecordingName(), false);
 										this.flvRecorderService
 												.stopRecordingShowForClient(
 														conn, currentClient);
@@ -951,17 +952,11 @@ public class ScopeApplicationAdapter ext
 			RoomClient currentClient = this.clientListManager
 					.getClientByStreamId(streamid, null);
 
-			// log.debug("[setNewCursorPosition]"+item);
-
 			@SuppressWarnings("rawtypes")
 			Map cursor = (Map) item;
 			cursor.put("streamPublishName",
 					currentClient.getStreamPublishName());
 
-			// log.debug("[setNewCursorPosition x]"+cursor.get("cursor_x"));
-			// log.debug("[setNewCursorPosition y]"+cursor.get("cursor_y"));
-			// log.debug("[setNewCursorPosition publicSID]"+cursor.get("publicSID"));
-
 			// Notify all users of the same Scope
 			Collection<Set<IConnection>> conCollection = current.getScope()
 					.getConnections();
@@ -969,29 +964,21 @@ public class ScopeApplicationAdapter ext
 				for (IConnection conn : conset) {
 					if (conn != null) {
 						if (conn instanceof IServiceCapableConnection) {
-							if (conn.equals(current)) {
+							IClient client = conn.getClient();
+							if (SessionVariablesUtil.isScreenClient(client)) {
+								// screen sharing clients do not receive events
+								continue;
+							} else if (SessionVariablesUtil.isAVClient(client)) {
+								// AVClients or potential AVClients do not receive events
+								continue;
+							} if (client.getId().equals(
+										current.getClient().getId())) {
+								// don't send back to same user
 								continue;
-							} else {
-								RoomClient rcl = this.clientListManager
-										.getClientByStreamId(conn.getClient()
-												.getId(), null);
-								if (rcl == null) {
-									// continue;
-								} else if (rcl.getIsScreenClient() != null
-										&& rcl.getIsScreenClient()) {
-									// continue;
-								} else {
-									// log.debug("is this users still alive? :"+rcl);
-									// Check if the Client is in the same room
-									// and same domain
-									IServiceCapableConnection iStream = (IServiceCapableConnection) conn;
-									// log.info("IServiceCapableConnection ID "
-									// + iStream.getClient().getId());
-									iStream.invoke("newRed5ScreenCursor",
-											new Object[] { cursor }, this);
-									// log.debug("send Notification to");
-								}
 							}
+							IServiceCapableConnection iStream = (IServiceCapableConnection) conn;
+							iStream.invoke("newRed5ScreenCursor",
+									new Object[] { cursor }, this);
 						}
 					}
 				}
@@ -1032,23 +1019,18 @@ public class ScopeApplicationAdapter ext
 			for (Set<IConnection> conset : conCollection) {
 				for (IConnection conn : conset) {
 					if (conn != null) {
-						RoomClient rcl = this.clientListManager
-								.getClientByStreamId(conn.getClient().getId(), null);
-						if (rcl == null) {
-							// continue;
-						} else if (rcl.getIsScreenClient() != null
-								&& rcl.getIsScreenClient()) {
-							// continue;
-						} else {
-							log.debug("Send Flag to Client: "
-									+ rcl.getUsername());
-							if (conn instanceof IServiceCapableConnection) {
-								((IServiceCapableConnection) conn).invoke(
-										"setNewModeratorByList",
-										new Object[] { currentMods }, this);
-								log.debug("sending setNewModeratorByList to "
-										+ conn);
+						if (conn instanceof IServiceCapableConnection) {
+							IClient client = conn.getClient();
+							if (SessionVariablesUtil.isScreenClient(client)) {
+								// screen sharing clients do not receive events
+								continue;
+							} else if (SessionVariablesUtil.isAVClient(client)) {
+								// AVClients or potential AVClients do not receive events
+								continue;
 							}
+							((IServiceCapableConnection) conn).invoke(
+								"setNewModeratorByList",
+									new Object[] { currentMods }, this);
 						}
 					}
 				}
@@ -1089,25 +1071,19 @@ public class ScopeApplicationAdapter ext
 			for (Set<IConnection> conset : conCollection) {
 				for (IConnection conn : conset) {
 					if (conn != null) {
-						RoomClient rcl = this.clientListManager
-								.getClientByStreamId(conn.getClient().getId(), null);
-						if (rcl == null) {
-							continue;
-						} else if (rcl.getIsScreenClient() != null
-								&& rcl.getIsScreenClient()) {
-							continue;
-						} else if (rcl.getIsAVClient()) {
-							continue;
-						}
-						
-						log.debug("Send Flag to Client: "
-								+ rcl.getUsername());
 						if (conn instanceof IServiceCapableConnection) {
+							IClient client = conn.getClient();
+							if (SessionVariablesUtil.isScreenClient(client)) {
+								// screen sharing clients do not receive events
+								continue;
+							} else if (SessionVariablesUtil.isAVClient(client)) {
+								// AVClients or potential AVClients do not receive events
+								continue;
+							}
+						
 							((IServiceCapableConnection) conn).invoke(
-									"setNewBroadCastingFlag",
+								"setNewBroadCastingFlag",
 									new Object[] { currentClient }, this);
-							log.debug("sending setNewBroadCastingFlag to "
-									+ conn);
 						}
 					}
 				}
@@ -1310,7 +1286,6 @@ public class ScopeApplicationAdapter ext
 			currentClient.setAvsettings(avsettings);
 			currentClient.setRoom_id(room_id);
 			currentClient.setPublicSID(publicSID);
-			currentClient.setIsAVClient(true);
 			currentClient.setVWidth(vWidth);
 			currentClient.setVHeight(vHeight);
 			currentClient.setInterviewPodId(interviewPodId);
@@ -1328,19 +1303,17 @@ public class ScopeApplicationAdapter ext
 				for (IConnection conn : conset) {
 					if (conn != null) {
 						if (conn instanceof IServiceCapableConnection) {
-							RoomClient rcl = this.clientListManager
-									.getClientByStreamId(conn.getClient()
-											.getId(), null);
-							if (rcl == null) {
-								// continue;
-							} else if (rcl.getIsScreenClient() != null
-									&& rcl.getIsScreenClient()) {
-								// continue;
-							} else {
-								((IServiceCapableConnection) conn).invoke(
-										"sendVarsToMessageWithClient",
-										new Object[] { hsm }, this);
+							IClient client = conn.getClient();
+							if (SessionVariablesUtil.isScreenClient(client)) {
+								// screen sharing clients do not receive events
+								continue;
+							} else if (SessionVariablesUtil.isAVClient(client)) {
+								// AVClients or potential AVClients do not receive events
+								continue;
 							}
+							((IServiceCapableConnection) conn).invoke(
+								"sendVarsToMessageWithClient",
+									new Object[] { hsm }, this);
 						}
 					}
 				}
@@ -1446,7 +1419,6 @@ public class ScopeApplicationAdapter ext
 			RoomClient currentClient = this.clientListManager
 					.getClientByStreamId(streamid, null);
 			currentClient.setRoom_id(room_id);
-			currentClient.setIsAVClient(false);
 			currentClient.setRoomEnter(new Date());
 			currentClient.setOrganization_id(organization_id);
 
@@ -1690,7 +1662,6 @@ public class ScopeApplicationAdapter ext
 
 			}
 			
-			
 			//Sync message to everybody
 			syncMessageToCurrentScope("addNewUser", currentClient, false);
 
@@ -1738,6 +1709,7 @@ public class ScopeApplicationAdapter ext
 
 			currentClient.setUsername(username);
 			currentClient.setUser_id(userId);
+			SessionVariablesUtil.setUserId(current.getClient(), userId);
 			currentClient.setPicture_uri(picture_uri);
 			currentClient.setUserObject(userId, username, firstname, lastname);
 
@@ -1788,6 +1760,7 @@ public class ScopeApplicationAdapter ext
 
 			currentClient.setUsername(username);
 			currentClient.setUser_id(userId);
+			SessionVariablesUtil.setUserId(current.getClient(), userId);
 			currentClient.setUserObject(userId, username, firstname, lastname);
 
 			// Update Session Data
@@ -1833,14 +1806,12 @@ public class ScopeApplicationAdapter ext
 			log.debug("sendMessageByRoomAndDomain " + room_id);
 
 			IScope globalScope = getContext().getGlobalScope();
-
 			IScope webAppKeyScope = globalScope
 					.getScope(OpenmeetingsVariables.webAppRootKey);
 
 			log.debug("webAppKeyScope " + webAppKeyScope);
 
 			IScope scopeHibernate = webAppKeyScope.getScope(room_id.toString());
-			// IScope scopeHibernate = webAppKeyScope.getScope("hibernate");
 
 			if (scopeHibernate != null) {
 
@@ -1849,25 +1820,18 @@ public class ScopeApplicationAdapter ext
 				for (Set<IConnection> conset : conCollection) {
 					for (IConnection conn : conset) {
 						if (conn != null) {
-							RoomClient rcl = this.clientListManager
-									.getClientByStreamId(conn.getClient()
-											.getId(), null);
-							if (rcl == null) {
-								// continue;
-							} else if (rcl.getIsScreenClient() != null
-									&& rcl.getIsScreenClient()) {
-								// continue;
-							} else {
-								if (conn instanceof IServiceCapableConnection) {
-									// RoomClient rcl =
-									// this.clientListManager.getClientByStreamId(conn.getClient().getId());
-									((IServiceCapableConnection) conn).invoke(
-											"newMessageByRoomAndDomain",
-											new Object[] { message }, this);
-
-									// log.debug("sending newMessageByRoomAndDomain to "
-									// + conn);
+							if (conn instanceof IServiceCapableConnection) {
+								IClient client = conn.getClient();
+								if (SessionVariablesUtil.isScreenClient(client)) {
+									// screen sharing clients do not receive events
+									continue;
+								} else if (SessionVariablesUtil.isAVClient(client)) {
+									// AVClients or potential AVClients do not receive events
+									continue;
 								}
+								((IServiceCapableConnection) conn).invoke(
+										"newMessageByRoomAndDomain",
+										new Object[] { message }, this);
 							}
 						}
 					}
@@ -1886,15 +1850,10 @@ public class ScopeApplicationAdapter ext
 
 	public synchronized List<RoomClient> getCurrentModeratorList() {
 		try {
-			log.debug("*..*getCurrentModerator id: ");
-
 			IConnection current = Red5.getConnectionLocal();
 			RoomClient currentClient = this.clientListManager
 					.getClientByStreamId(current.getClient().getId(), null);
 			Long room_id = currentClient.getRoom_id();
-
-			// log.debug("Who is this moderator? "+currentMod);
-
 			return this.clientListManager.getCurrentModeratorByRoom(room_id);
 		} catch (Exception err) {
 			log.error("[getCurrentModerator]", err);
@@ -1911,26 +1870,14 @@ public class ScopeApplicationAdapter ext
 	public synchronized void sendVars(ArrayList whiteboardObjParam) {
 		//
 		try {
-
-			// In previous version this has been always a Map, now its a List
-			// so I re-wrapp that class to be a Map again.
-			// swagner 13.02.2009
-			// log.debug("*..*sendVars1: " + whiteboardObjParam);
-			// log.debug("*..*sendVars2: " + whiteboardObjParam.getClass());
-			// log.debug("*..*sendVars3: " +
-			// whiteboardObjParam.getClass().getName());
-
 			Map whiteboardObj = new HashMap();
 			int i = 0;
 			for (Iterator iter = whiteboardObjParam.iterator(); iter.hasNext();) {
 				Object obj = iter.next();
-				// log.debug("obj"+obj);
 				whiteboardObj.put(i, obj);
 				i++;
 			}
 
-			// Map whiteboardObj = (Map) whiteboardObjParam;
-
 			// Check if this User is the Mod:
 			IConnection current = Red5.getConnectionLocal();
 			RoomClient currentClient = this.clientListManager
@@ -1939,13 +1886,9 @@ public class ScopeApplicationAdapter ext
 			if (currentClient == null) {
 				return;
 			}
-
 			Long room_id = currentClient.getRoom_id();
-
 			String action = whiteboardObj.get(2).toString();
 
-			// log.debug("***** sendVars: " + actionObject.get(0));
-
 			if (action != null && action.equals("whiteboardObj")) {
 				// Update Whiteboard Object
 				List actionObject = (List) whiteboardObj.get(3);
@@ -1971,29 +1914,22 @@ public class ScopeApplicationAdapter ext
 				for (IConnection conn : conset) {
 					if (conn != null) {
 						if (conn instanceof IServiceCapableConnection) {
-
-							if (conn.getClient().getId()
-									.equals(current.getClient().getId())) {
+							IClient client = conn.getClient();
+							if (SessionVariablesUtil.isScreenClient(client)) {
+								// screen sharing clients do not receive events
 								continue;
-							}
-
-							RoomClient rcl = this.clientListManager
-									.getSyncClientByStreamId(conn.getClient()
-											.getId());
-
-							if (rcl == null) {
+							} else if (SessionVariablesUtil.isAVClient(client)) {
+								// AVClients or potential AVClients do not receive events
+								continue;
+							} if (client.getId().equals(
+									current.getClient().getId())) {
+								// don't send back to same user
 								continue;
 							}
-
-							if (!currentClient.getStreamid().equals(
-									rcl.getStreamid())) {
-								((IServiceCapableConnection) conn)
-										.invoke("sendVarsToWhiteboard",
-												new Object[] {
-														(showDrawStatus ? currentClient
-																: null),
-														whiteboardObj }, this);
-							}
+							((IServiceCapableConnection) conn)
+								.invoke("sendVarsToWhiteboard",
+									new Object[] { (showDrawStatus ? currentClient : null), whiteboardObj }, 
+										this);
 						}
 					}
 				}
@@ -2078,13 +2014,6 @@ public class ScopeApplicationAdapter ext
 
 			}
 
-			// This is no longer necessary
-			// boolean ismod = currentClient.getIsMod();
-
-			// log.debug("*..*ismod: " + ismod);
-
-			// if (ismod) {
-
 			Map<String, Object> sendObject = new HashMap<String, Object>();
 			sendObject.put("id", whiteboardId);
 			sendObject.put("param", whiteboardObjParam);
@@ -2098,38 +2027,27 @@ public class ScopeApplicationAdapter ext
 				for (IConnection conn : conset) {
 					if (conn != null) {
 						if (conn instanceof IServiceCapableConnection) {
-							if (conn.getClient().getId()
-									.equals(current.getClient().getId())) {
+							IClient client = conn.getClient();
+							if (SessionVariablesUtil.isScreenClient(client)) {
+								// screen sharing clients do not receive events
 								continue;
-							}
-
-							RoomClient rcl = this.clientListManager
-									.getSyncClientByStreamId(conn.getClient()
-											.getId());
-
-							if (rcl == null) {
+							} else if (SessionVariablesUtil.isAVClient(client)) {
+								// AVClients or potential AVClients do not receive events
+								continue;
+							} if (client.getId().equals(
+									current.getClient().getId())) {
+								// don't send back to same user
 								continue;
 							}
-
-							if (!currentClient.getStreamid().equals(
-									rcl.getStreamid())) {
-								((IServiceCapableConnection) conn).invoke(
-										"sendVarsToWhiteboardById",
-										new Object[] {
-												showDrawStatus ? currentClient
-														: null, sendObject },
+							((IServiceCapableConnection) conn).invoke(
+								"sendVarsToWhiteboardById",
+									new Object[] { showDrawStatus ? currentClient : null, sendObject }, 
 										this);
-							}
 						}
 					}
 				}
 			}
 
-			// return numberOfUsers;
-			// } else {
-			// // log.debug("*..*you are not allowed to send: "+ismod);
-			// return -1;
-			// }
 		} catch (Exception err) {
 			log.error("[sendVarsByWhiteboardId]", err);
 		}
@@ -2156,29 +2074,21 @@ public class ScopeApplicationAdapter ext
 					for (IConnection conn : conset) {
 						if (conn != null) {
 							if (conn instanceof IServiceCapableConnection) {
-								RoomClient rcl = this.clientListManager
-										.getClientByStreamId(conn.getClient()
-												.getId(), null);
-								if (rcl == null) {
-									// continue;
-								} else if (rcl.getIsScreenClient() != null
-										&& rcl.getIsScreenClient()) {
-									// continue;
-								} else {
-									// log.debug("*..*idremote: " +
-									// rcl.getStreamid());
-									// log.debug("*..*my idstreamid: " +
-									// currentClient.getStreamid());
-									if (!currentClient.getStreamid().equals(
-											rcl.getStreamid())) {
-										((IServiceCapableConnection) conn)
-												.invoke("sendVarsToModeratorGeneral",
-														new Object[] { vars },
-														this);
-										// log.debug("sending sendVarsToModeratorGeneral to "
-										// + conn);
-									}
+								IClient client = conn.getClient();
+								if (SessionVariablesUtil.isScreenClient(client)) {
+									// screen sharing clients do not receive events
+									continue;
+								} else if (SessionVariablesUtil.isAVClient(client)) {
+									// AVClients or potential AVClients do not receive events
+									continue;
+								} if (client.getId().equals(
+										current.getClient().getId())) {
+									// don't send back to same user
+									continue;
 								}
+								((IServiceCapableConnection) conn)
+										.invoke("sendVarsToModeratorGeneral",
+												new Object[] { vars },this);
 							}
 						}
 					}
@@ -2322,25 +2232,18 @@ public class ScopeApplicationAdapter ext
 				for (IConnection conn : conset) {
 					if (conn != null) {
 						if (conn instanceof IServiceCapableConnection) {
-							RoomClient rcl = this.clientListManager
-									.getClientByStreamId(conn.getClient().getId(), null);
-							
-							if (rcl == null) {
-								// RoomClient can be null if there are network problems
-								continue;
-							} else if (!sendScreen && rcl.getIsScreenClient() != null && rcl
-											.getIsScreenClient()) {
+							IClient client = conn.getClient();
+							if (!sendScreen && SessionVariablesUtil.isScreenClient(client)) {
 								// screen sharing clients do not receive events
 								continue;
-							} else if (rcl.getIsAVClient()) {
+							} else if (SessionVariablesUtil.isAVClient(client)) {
 								// AVClients or potential AVClients do not receive events
 								continue;
-							} else if (current.getClient().getId().equals(
-										conn.getClient().getId()) && !sendSelf) {
+							} else if (!sendSelf && client.getId().equals(
+									current.getClient().getId())) {
 								//Do not send back to self
 								continue;
 							}
-							
 							((IServiceCapableConnection) conn).invoke(
 									remoteMethodName, new Object[] { newMessage }, this);
 							
@@ -2418,24 +2321,10 @@ public class ScopeApplicationAdapter ext
 				for (IConnection conn : conset) {
 					if (conn != null) {
 						if (conn instanceof IServiceCapableConnection) {
-							RoomClient rcl = this.clientListManager
-									.getClientByStreamId(conn.getClient()
-											.getId(), null);
-							if (rcl == null) {
-								// continue;
-							} else if (rcl.getIsScreenClient() != null
-									&& rcl.getIsScreenClient()) {
-								// continue;
-							} else {
-								// log.debug("### sendMessageById 1 ###"+clientId);
-								// log.debug("### sendMessageById 2 ###"+conn.getClient().getId());
-								if (conn.getClient().getId().equals(clientId)) {
-									((IServiceCapableConnection) conn).invoke(
-											"sendVarsToMessageWithClient",
-											new Object[] { hsm }, this);
-									// log.debug("sendingsendVarsToMessageWithClient ByID to "
-									// + conn);
-								}
+							if (conn.getClient().getId().equals(clientId)) {
+								((IServiceCapableConnection) conn).invoke(
+										"sendVarsToMessageWithClient",
+										new Object[] { hsm }, this);
 							}
 						}
 					}
@@ -2462,8 +2351,6 @@ public class ScopeApplicationAdapter ext
 			RoomClient currentClient = this.clientListManager
 					.getClientByStreamId(current.getClient().getId(), null);
 
-			log.debug("### sendMessageWithClientById ###" + clientId);
-
 			HashMap<String, Object> hsm = new HashMap<String, Object>();
 			hsm.put("client", currentClient);
 			hsm.put("message", newMessage);
@@ -2473,27 +2360,10 @@ public class ScopeApplicationAdapter ext
 					.getConnections();
 			for (Set<IConnection> conset : conCollection) {
 				for (IConnection conn : conset) {
-					if (conn != null) {
-						RoomClient rcl = this.clientListManager
-								.getClientByStreamId(conn.getClient().getId(), null);
-						if (rcl == null) {
-							// continue;
-						} else if (rcl.getIsScreenClient() != null
-								&& rcl.getIsScreenClient()) {
-							// continue;
-						} else {
-							if (conn instanceof IServiceCapableConnection) {
-								// log.debug("### sendMessageWithClientById 1 ###"+clientId);
-								// log.debug("### sendMessageWithClientById 2 ###"+conn.getClient().getId());
-								if (conn.getClient().getId().equals(clientId)) {
-									((IServiceCapableConnection) conn).invoke(
-											"sendVarsToMessageWithClient",
-											new Object[] { hsm }, this);
-									// log.debug("sendingsendVarsToMessageWithClient ByID to "
-									// + conn);
-								}
-							}
-						}
+					if (conn.getClient().getId().equals(clientId)) {
+						((IServiceCapableConnection) conn).invoke(
+								"sendVarsToMessageWithClient",
+								new Object[] { hsm }, this);
 					}
 				}
 			}
@@ -2561,28 +2431,20 @@ public class ScopeApplicationAdapter ext
 						.getScope(scopeName).getConnections();
 				for (Set<IConnection> conset : conCollection) {
 					for (IConnection conn : conset) {
-						if (conn != null) {
-							RoomClient rcl = this.clientListManager
-									.getClientByStreamId(conn.getClient()
-											.getId(), null);
-							if (rcl != null) {
-								if (rcl.getIsScreenClient() != null
-										&& rcl.getIsScreenClient()) {
-									// continue;
-								} else {
-									// log.debug("rcl "+rcl+" rcl.getUser_id(): "+rcl.getPublicSID()+" publicSID: "+publicSID+
-									// " IS EQUAL? "+rcl.getPublicSID().equals(publicSID));
-									if (rcl.getPublicSID().equals(publicSID)) {
-										// log.debug("IS EQUAL ");
-										((IServiceCapableConnection) conn)
-												.invoke("newMessageByRoomAndDomain",
-														new Object[] { message },
-														this);
-										log.debug("newMessageByRoomAndDomain RPC:newMessageByRoomAndDomain"
-												+ message);
-									}
-								}
-							}
+						IClient client = conn.getClient();
+						if (SessionVariablesUtil.isScreenClient(client)) {
+							// screen sharing clients do not receive events
+							continue;
+						} else if (SessionVariablesUtil.isAVClient(client)) {
+							// AVClients or potential AVClients do not receive events
+							continue;
+						}
+						
+						if (SessionVariablesUtil.getPublicSID(client).equals(publicSID)) {
+							// log.debug("IS EQUAL ");
+							((IServiceCapableConnection) conn)
+									.invoke("newMessageByRoomAndDomain",
+										new Object[] { message }, this);
 						}
 					}
 				}
@@ -2645,32 +2507,30 @@ public class ScopeApplicationAdapter ext
 			for (Set<IConnection> conset : conCollection) {
 				for (IConnection conn : conset) {
 					if (conn != null) {
-						RoomClient rcl = this.clientListManager
-								.getClientByStreamId(conn.getClient().getId(), null);
-						if (rcl != null) {
-							if (rcl.getIsScreenClient() != null
-									&& rcl.getIsScreenClient()) {
-								// continue;
-							} else {
-								// log.debug("rcl "+rcl+" rcl.getUser_id(): "+rcl.getPublicSID()+" publicSID: "+publicSID+
-								// " IS EQUAL? "+rcl.getPublicSID().equals(publicSID));
-								if (rcl.getPublicSID().equals(publicSID)) {
-									// log.debug("IS EQUAL ");
-									((IServiceCapableConnection) conn).invoke(
-											"newMessageByRoomAndDomain",
-											new Object[] { message }, this);
-									log.debug("sendMessageWithClientByPublicSID RPC:newMessageByRoomAndDomain"
-											+ message);
-								} else if (user_id != 0
-										&& rcl.getUser_id() != null
-										&& rcl.getUser_id().equals(user_id)) {
-									((IServiceCapableConnection) conn).invoke(
-											"newMessageByRoomAndDomain",
-											new Object[] { message }, this);
-									log.debug("sendMessageWithClientByPublicSID RPC:newMessageByRoomAndDomain"
-											+ message);
-								}
-							}
+						
+						IClient client = conn.getClient();
+						if (SessionVariablesUtil.isScreenClient(client)) {
+							// screen sharing clients do not receive events
+							continue;
+						} else if (SessionVariablesUtil.isAVClient(client)) {
+							// AVClients or potential AVClients do not receive events
+							continue;
+						}
+						
+						if (SessionVariablesUtil.getPublicSID(client).equals(publicSID)) {
+							// log.debug("IS EQUAL ");
+							((IServiceCapableConnection) conn).invoke(
+									"newMessageByRoomAndDomain",
+									new Object[] { message }, this);
+							log.debug("sendMessageWithClientByPublicSID RPC:newMessageByRoomAndDomain"
+									+ message);
+						} else if (user_id != 0
+								&& SessionVariablesUtil.getUserId(client).equals(user_id)) {
+							((IServiceCapableConnection) conn).invoke(
+									"newMessageByRoomAndDomain",
+									new Object[] { message }, this);
+							log.debug("sendMessageWithClientByPublicSID RPC:newMessageByRoomAndDomain"
+									+ message);
 						}
 					}
 				}
@@ -2681,6 +2541,12 @@ public class ScopeApplicationAdapter ext
 		}
 	}
 
+	/**
+	 * @deprecated this method should be reworked to use a single SQL query in
+	 *             the cache to get any client in the current room that is
+	 *             recording instead of iterating through connections!
+	 * @return
+	 */
 	public synchronized Boolean getInterviewRecordingStatus() {
 		try {
 
@@ -2693,7 +2559,8 @@ public class ScopeApplicationAdapter ext
 					if (conn != null) {
 
 						RoomClient rcl = this.clientListManager
-								.getClientByStreamId(conn.getClient().getId(), null);
+								.getClientByStreamId(conn.getClient().getId(),
+										null);
 
 						if (rcl.getIsRecording() != null
 								&& rcl.getIsRecording()) {
@@ -2712,6 +2579,10 @@ public class ScopeApplicationAdapter ext
 		return null;
 	}
 
+	/**
+	 * @deprecated @see {@link ScopeApplicationAdapter#getInterviewRecordingStatus()}
+	 * @return
+	 */
 	public synchronized Boolean startInterviewRecording() {
 		try {
 
@@ -2751,14 +2622,12 @@ public class ScopeApplicationAdapter ext
 				for (IConnection conn : conset) {
 					if (conn != null) {
 						
-						RoomClient rcl = this.clientListManager
-								.getClientByStreamId(conn.getClient().getId(), null);
-						
-						if (rcl == null) {
-							continue;
-						} else if (rcl.getIsAVClient()) {
+						IClient client = conn.getClient();
+						if (SessionVariablesUtil.isScreenClient(client)) {
+							// screen sharing clients do not receive events
 							continue;
-						} else if (rcl.getIsScreenClient() != null && rcl.getIsScreenClient()) {
+						} else if (SessionVariablesUtil.isAVClient(client)) {
+							// AVClients or potential AVClients do not receive events
 							continue;
 						}
 
@@ -2797,26 +2666,14 @@ public class ScopeApplicationAdapter ext
 			for (Set<IConnection> conset : conCollection) {
 				for (IConnection conn : conset) {
 					if (conn != null) {
-
-						RoomClient rcl = this.clientListManager
-								.getClientByStreamId(conn.getClient().getId(), null);
-
-						if (rcl == null) {
-							// continue;
-						} else if (rcl.getIsScreenClient() != null
-								&& rcl.getIsScreenClient()) {
-
-							if (rcl.getStreamid() != null
-									&& rcl.getStreamid().equals(streamid)) {
+						IClient client = conn.getClient();
+						if (SessionVariablesUtil.isScreenClient(client)) {
+							if (conn.getClient().getId().equals(streamid)) {
 								((IServiceCapableConnection) conn).invoke(
 										"sendRemoteCursorEvent",
 										new Object[] { messageObj }, this);
-								log.debug("sendRemoteCursorEvent messageObj"
-										+ messageObj);
 							}
-
 						}
-
 					}
 				}
 			}
@@ -2885,12 +2742,17 @@ public class ScopeApplicationAdapter ext
 			for (Set<IConnection> conset : conCollection) {
 				for (IConnection conn : conset) {
 					if (conn != null) {
+						IClient client = conn.getClient();
+						if (SessionVariablesUtil.isScreenClient(client)) {
+							// screen sharing clients do not receive events
+							continue;
+						} else if (SessionVariablesUtil.isAVClient(client)) {
+							// AVClients or potential AVClients do not receive events
+							continue;
+						}
 						((IServiceCapableConnection) conn).invoke(
 								"interviewStatus",
 								new Object[] { interviewStatus }, this);
-						log.debug("sendMessageWithClientByPublicSID interviewStatus"
-								+ interviewStatus);
-
 					}
 				}
 			}
@@ -3065,25 +2927,26 @@ public class ScopeApplicationAdapter ext
         for (Set<IConnection> conset : conCollection) {
             for (IConnection conn : conset) {
                 if (conn != null) {
-                    RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId(), null);
-                    if (rcl == null) {
-                        // continue;
-                    } else if (rcl.getIsScreenClient() != null
-                            && rcl.getIsScreenClient()) {
-                        // continue;
-                    } else {
-                        if (!streamid.equals(rcl.getStreamid())) {
-                            // It is not needed to send back
-                            // that event to the actuall
-                            // Moderator
-                            // as it will be already triggered
-                            // in the result of this Function
-                            // in the Client
-                            if (conn instanceof IServiceCapableConnection) {
-                                ((IServiceCapableConnection) conn).invoke("addNewUser", new Object[]{currentClient}, this);
-                                ((IServiceCapableConnection) conn).invoke("newStream", new Object[]{currentClient}, this);
-                                log.debug("sending setSipTransport to " + conn);
-                            }
+                	IClient client = conn.getClient();
+					if (SessionVariablesUtil.isScreenClient(client)) {
+						// screen sharing clients do not receive events
+						continue;
+					} else if (SessionVariablesUtil.isAVClient(client)) {
+						// AVClients or potential AVClients do not receive events
+						continue;
+					}
+					
+                    if (!client.getId().equals(current.getClient().getId())) {
+                        // It is not needed to send back
+                        // that event to the actual
+                        // Moderator
+                        // as it will be already triggered
+                        // in the result of this Function
+                        // in the Client
+                        if (conn instanceof IServiceCapableConnection) {
+                            ((IServiceCapableConnection) conn).invoke("addNewUser", new Object[]{currentClient}, this);
+                            ((IServiceCapableConnection) conn).invoke("newStream", new Object[]{currentClient}, this);
+                            log.debug("sending setSipTransport to " + conn);
                         }
                     }
                 }

Added: incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/util/SessionVariablesUtil.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/util/SessionVariablesUtil.java?rev=1435029&view=auto
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/util/SessionVariablesUtil.java (added)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/util/SessionVariablesUtil.java Fri Jan 18 05:02:33 2013
@@ -0,0 +1,91 @@
+package org.apache.openmeetings.remote.util;
+
+import org.apache.openmeetings.OpenmeetingsVariables;
+import org.red5.logging.Red5LoggerFactory;
+import org.red5.server.api.IClient;
+import org.slf4j.Logger;
+
+public class SessionVariablesUtil {
+
+	private static final Logger log = Red5LoggerFactory.getLogger(
+			SessionVariablesUtil.class, OpenmeetingsVariables.webAppRootKey);
+
+	private enum SESSION_VARIABLES {
+		isAVClient, // if the client connection is a audio-video only connection
+		isScreenClient, // if the client connection is from a Java Web-Start application
+		PUBLIC_SID, // the public SID of the client
+		USER_ID, // the userId of the user that is using this connection (if there is any)
+	}
+
+	public static void initClient(IClient client, boolean isAVClient, String publicSID) {
+		client.setAttribute(SESSION_VARIABLES.isAVClient.toString(), isAVClient);
+		client.setAttribute(SESSION_VARIABLES.PUBLIC_SID.toString(), publicSID);
+	}
+	
+	public static boolean isAVClient(IClient client) {
+		try {
+			if (client.getAttribute(SESSION_VARIABLES.isAVClient.toString()) == null) {
+				throw new Exception("Connection has no publicSID client: "+client);
+			}
+			return (Boolean) client.getAttribute(SESSION_VARIABLES.isAVClient.toString());
+		} catch (Exception err) {
+			log.error("[isAVClient]", err);
+		}
+		return false;
+	}
+	
+	public static String getPublicSID(IClient client) {
+		try {
+			if (client.getAttribute(SESSION_VARIABLES.PUBLIC_SID.toString()) == null) {
+				throw new Exception("Connection has no publicSID client: "+client);
+			}
+			return (String) client.getAttribute(SESSION_VARIABLES.PUBLIC_SID.toString());
+		} catch (Exception err) {
+			log.error("[getPublicSID]", err);
+		}
+		return null;
+	}
+
+	public static void setIsScreenClient(IClient client) {
+		client.setAttribute(SESSION_VARIABLES.isScreenClient.toString(), true);
+	}
+
+	public static boolean isScreenClient(IClient client) {
+		try {
+			if (client
+					.getAttribute(SESSION_VARIABLES.isScreenClient.toString()) == null) {
+				return false;
+			}
+			if ((Boolean) client.getAttribute(SESSION_VARIABLES.isScreenClient
+					.toString())) {
+				return true;
+			}
+		} catch (Exception err) {
+			log.error("[isScreenClient]", err);
+		}
+		return false;
+	}
+	
+	public static void setUserId(IClient client, Long userId) {
+		client.setAttribute(SESSION_VARIABLES.USER_ID.toString(), userId);
+	}
+
+	/**
+	 * if there is no user id set, it will return Long.MIN_VALUE
+	 * @param client
+	 * @return
+	 */
+	public static Long getUserId(IClient client) {
+		try {
+			if (client.getAttribute(SESSION_VARIABLES.USER_ID.toString()) == null) {
+				return Long.MIN_VALUE;
+			}
+			return (Long) client.getAttribute(SESSION_VARIABLES.USER_ID
+					.toString());
+		} catch (Exception err) {
+			log.error("[getUserId]", err);
+		}
+		return null;
+	}
+	
+}

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/test/userdata/TestLogin.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/test/userdata/TestLogin.java?rev=1435029&r1=1435028&r2=1435029&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/test/userdata/TestLogin.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/test/userdata/TestLogin.java Fri Jan 18 05:02:33 2013
@@ -40,7 +40,7 @@ public class TestLogin extends AbstractO
 	public void testTestLogin(){
 		Sessiondata sessionData = mService.getsessiondata();
 		
-		Users us = (Users) userManagement.loginUser(sessionData.getSession_id(), username, userpass, null, false);
+		Users us = (Users) userManagement.loginUser(sessionData.getSession_id(), username, userpass, null, null, false);
 		
 		assertNotNull("User is unable to login", us);
 		

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/WebSession.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/WebSession.java?rev=1435029&r1=1435028&r2=1435029&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/WebSession.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/WebSession.java Fri Jan 18 05:02:33 2013
@@ -84,7 +84,7 @@ public class WebSession extends Abstract
 		Sessiondata sessData = Application.getBean(Sessionmanagement.class).startsession();
 		SID = sessData.getSession_id();
 		Object u = Application.getBean(Usermanagement.class).loginUser(SID, login, password,
-				null, false);
+				null, null, false);
 		
 		if (u instanceof Users) {
 			Users user = (Users)u;



Mime
View raw message