Author: sebawagner
Date: Fri Jan 20 14:20:15 2012
New Revision: 1233919

URL: http://svn.apache.org/viewvc?rev=1233919&view=rev
Log:
Clean Up some of the code for message syncing between clients in the 
ScopeApplicationAdapter

Modified:
    incubator/openmeetings/trunk/singlewebapp/docs/RoomService.html
    
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/persistence/beans/rooms/Rooms.java
    
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/WhiteBoardService.java
    
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java

Modified: incubator/openmeetings/trunk/singlewebapp/docs/RoomService.html
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/docs/RoomService.html?rev=1233919&r1=1233918&r2=1233919&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/docs/RoomService.html (original)
+++ incubator/openmeetings/trunk/singlewebapp/docs/RoomService.html Fri Jan 20 
14:20:15 2012
@@ -130,6 +130,10 @@ limitations under the License.
                 <div class="navigation_comment"><i >adds a new room with 
options for user questions and audio only</i></div>
                 </div>
                                                <div>
+                <a 
href="#addRoomWithModerationQuestionsAudioTypeAndHideOptions"><b>addRoomWithModerationQuestionsAudioTypeAndHideOptions</b></a><br/>
+                <div class="navigation_comment"><i >adds a new room with 
options for user questions, audio only and hide</i></div>
+                </div>
+                                               <div>
                 <a 
href="#getRoomIdByExternalId"><b>getRoomIdByExternalId</b></a><br/>
                 <div class="navigation_comment"><i >Checks if a room with this 
exteralRoomId + externalRoomType does exist,
  if yes it returns the room id if not, it will create the room and then
@@ -148,6 +152,12 @@ limitations under the License.
                 <div class="navigation_comment"><i ></i></div>
                 </div>
                                                <div>
+                <a 
href="#updateRoomWithModerationQuestionsAudioTypeAndHideOptions"><b>updateRoomWithModerationQuestionsAudioTypeAndHideOptions</b></a><br/>
+                <div class="navigation_comment"><i >update room with options 
for user questions, audio only and hide
+ 
+ * @param SID The SID of the User. This SID must be marked as 
Loggedin</i></div>
+                </div>
+                                               <div>
                 <a href="#deleteRoom"><b>deleteRoom</b></a><br/>
                 <div class="navigation_comment"><i >Delete a room by its room 
id</i></div>
                 </div>
@@ -1826,6 +1836,235 @@ limitations under the License.
                                                              <div 
class="method">
                        <div class="method_header">
                        <div style="margin-left:10px">
+                       <a 
name="addRoomWithModerationQuestionsAudioTypeAndHideOptions" 
><b>addRoomWithModerationQuestionsAudioTypeAndHideOptions</b></a>
+                       </div>
+                       </div>
+                       
+                       Method: 
<i>addRoomWithModerationQuestionsAudioTypeAndHideOptions (
+                                                                               
                   String SID
+                                                                               
                     , 
+                                                  String name
+                                                                               
                     , 
+                                                  Long roomtypes_id
+                                                                               
                     , 
+                                                  String comment
+                                                                               
                     , 
+                                                  Long numberOfPartizipants
+                                                                               
                     , 
+                                                  Boolean ispublic
+                                                                               
                     , 
+                                                  Boolean appointment
+                                                                               
                     , 
+                                                  Boolean isDemoRoom
+                                                                               
                     , 
+                                                  Integer demoTime
+                                                                               
                     , 
+                                                  Boolean isModeratedRoom
+                                                                               
                     , 
+                                                  Boolean allowUserQuestions
+                                                                               
                     , 
+                                                  Boolean isAudioOnly
+                                                                               
                     , 
+                                                  Boolean hideTopBar
+                                                                               
                     , 
+                                                  Boolean hideChat
+                                                                               
                     , 
+                                                  Boolean 
hideActivitiesAndActions
+                                                                               
                     , 
+                                                  Boolean hideFilesExplorer
+                                                                               
                     , 
+                                                  Boolean hideActionsMenu
+                                                                               
                     , 
+                                                  Boolean hideScreenSharing
+                                                                               
                     , 
+                                                  Boolean hideWhiteboard
+                                                                       )
+                       </i><br/>
+                       <p>
+                         adds a new room with options for user questions, 
audio only and hide
+                       </p>
+                       <p>
+                  Return Type: java.lang.Long
+                </p>
+                       <p>Params:</p>
+                                               
+                                                       <table rules="all" 
border="1">
+                                  <thead>
+                                  <tr>
+                                    <th width="200" align="left">Type</th>
+                                    <th width="200" align="left">Fieldname</th>
+                                    <th width="400" 
align="left">Description</th>
+                                  </tr>
+                                  </thead>
+                                  <tbody>
+                                                                               
                   <tr>
+                            <td valign="top">
+                                                                       String
+                                                            </td>
+                            <td valign="top">SID</td>
+                            <td valign="top">The SID of the User. This SID 
must be marked as Loggedin</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       String
+                                                            </td>
+                            <td valign="top">name</td>
+                            <td valign="top">Name of the Room</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Long
+                                                            </td>
+                            <td valign="top">roomtypes_id</td>
+                            <td valign="top">Type of that room (1 = 
Conference, 2 = Audience, 3 =
+            Restricted, 4 = Interview)</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       String
+                                                            </td>
+                            <td valign="top">comment</td>
+                            <td valign="top">any comment</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Long
+                                                            </td>
+                            <td valign="top">numberOfPartizipants</td>
+                            <td valign="top">the maximum users allowed in this 
room</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">ispublic</td>
+                            <td valign="top">If this room is public (use true 
if you don't deal with
+            different Organizations)</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">appointment</td>
+                            <td valign="top">is it a Calendar Room (use false 
by default)</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">isDemoRoom</td>
+                            <td valign="top">is it a Demo Room with limited 
time (use false by default)</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Integer
+                                                            </td>
+                            <td valign="top">demoTime</td>
+                            <td valign="top">time in seconds after the user 
will be logged out (only
+            enabled if isDemoRoom is true)</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">isModeratedRoom</td>
+                            <td valign="top">Users have to wait until a 
Moderator arrives. Use the
+            becomeModerator param in setUserObjectAndGenerateRoomHash to
+            set a user as default Moderator</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">allowUserQuestions</td>
+                            <td valign="top">enable or disable the button to 
allow users to apply for
+            moderation</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">isAudioOnly</td>
+                            <td valign="top">enable or disable the video / or 
audio-only</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideTopBar</td>
+                            <td valign="top">hide or show TopBar</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideChat</td>
+                            <td valign="top">hide or show Chat</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideActivitiesAndActions</td>
+                            <td valign="top">hide or show Activities And 
Actions</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideFilesExplorer</td>
+                            <td valign="top">hide or show Files Explorer</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideActionsMenu</td>
+                            <td valign="top">hide or show Actions Menu</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideScreenSharing</td>
+                            <td valign="top">hide or show Screen Sharing</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideWhiteboard</td>
+                            <td valign="top">hide or show Whiteboard. If 
whitboard is hidden, video pods and scrollbar  appear instead.</td>
+                          </tr>
+                          
+                                                                          
</tbody>
+                               </table>
+                                               <br/>
+                       REST Sample Call/URL:<br/>
+                                                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                <a 
href="http://localhost:5080/openmeetings/services/RoomService/addRoomWithModerationQuestionsAudioTypeAndHideOptions?SID=VALUE&name=VALUE&roomtypes_id=VALUE&comment=VALUE&numberOfPartizipants=VALUE&ispublic=VALUE&appointment=VALUE&isDemoRoom=VALUE&demoTime=VALUE&isModeratedRoom=VALUE&allowUserQuestions=VALUE&isAudioOnly=VALUE&hideTopBar=VALUE&hideChat=VALUE&hideActivitiesAndActions=VALUE&hideFilesExplorer=VALUE&hideActionsMenu=VALUE&hideScreenSharing=VALUE&hideWhiteboard=VALUE";>http://localhost:5080/openmeetings/services/RoomService/addRoomWithModerationQuestionsAudioTypeAndHideOpti
 
ons?SID=VALUE&name=VALUE&roomtypes_id=VALUE&comment=VALUE&numberOfPartizipants=VALUE&ispublic=VALUE&appointment=VALUE&isDemoRoom=VALUE&demoTime=VALUE&isModeratedRoom=VALUE&allowUserQuestions=VALUE&isAudioOnly=VALUE&hideTopBar=VALUE&hideChat=VALUE&hideActivitiesAndActions=VALUE&hideFilesExplorer=VALUE&hideActionsMenu=VALUE&hideScreenSharing=VALUE&hideWhiteboard=VALUE</a>
+                       </a>
+                 </div>
+                                                             <div 
class="method">
+                       <div class="method_header">
+                       <div style="margin-left:10px">
                        <a name="getRoomIdByExternalId" 
><b>getRoomIdByExternalId</b></a>
                        </div>
                        </div>
@@ -2552,6 +2791,241 @@ limitations under the License.
                                                              <div 
class="method">
                        <div class="method_header">
                        <div style="margin-left:10px">
+                       <a 
name="updateRoomWithModerationQuestionsAudioTypeAndHideOptions" 
><b>updateRoomWithModerationQuestionsAudioTypeAndHideOptions</b></a>
+                       </div>
+                       </div>
+                       
+                       Method: 
<i>updateRoomWithModerationQuestionsAudioTypeAndHideOptions (
+                                                                               
                   String SID
+                                                                               
                     , 
+                                                  Long room_id
+                                                                               
                     , 
+                                                  String name
+                                                                               
                     , 
+                                                  Long roomtypes_id
+                                                                               
                     , 
+                                                  String comment
+                                                                               
                     , 
+                                                  Long numberOfPartizipants
+                                                                               
                     , 
+                                                  Boolean ispublic
+                                                                               
                     , 
+                                                  Boolean appointment
+                                                                               
                     , 
+                                                  Boolean isDemoRoom
+                                                                               
                     , 
+                                                  Integer demoTime
+                                                                               
                     , 
+                                                  Boolean isModeratedRoom
+                                                                               
                     , 
+                                                  Boolean allowUserQuestions
+                                                                               
                     , 
+                                                  Boolean isAudioOnly
+                                                                               
                     , 
+                                                  Boolean hideTopBar
+                                                                               
                     , 
+                                                  Boolean hideChat
+                                                                               
                     , 
+                                                  Boolean 
hideActivitiesAndActions
+                                                                               
                     , 
+                                                  Boolean hideFilesExplorer
+                                                                               
                     , 
+                                                  Boolean hideActionsMenu
+                                                                               
                     , 
+                                                  Boolean hideScreenSharing
+                                                                               
                     , 
+                                                  Boolean hideWhiteboard
+                                                                       )
+                       </i><br/>
+                       <p>
+                         update room with options for user questions, audio 
only and hide
+ 
+ * @param SID The SID of the User. This SID must be marked as Loggedin
+                       </p>
+                       <p>
+                  Return Type: java.lang.Long
+                </p>
+                       <p>Params:</p>
+                                                       <b>Warning:</b><i> 
Params in this method do not seem to be correctly documentated</i>
+                               <br/><br/>
+                                               
+                                                       <table rules="all" 
border="1">
+                                  <thead>
+                                  <tr>
+                                    <th width="200" align="left">Type</th>
+                                    <th width="200" align="left">Fieldname</th>
+                                    <th width="400" 
align="left">Description</th>
+                                  </tr>
+                                  </thead>
+                                  <tbody>
+                                                                               
                   <tr>
+                            <td valign="top">
+                                                                       String
+                                                            </td>
+                            <td valign="top">room_id</td>
+                            <td valign="top">the room id to update</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Long
+                                                            </td>
+                            <td valign="top">name</td>
+                            <td valign="top">new name of the room</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       String
+                                                            </td>
+                            <td valign="top">roomtypes_id</td>
+                            <td valign="top">new type of room (1 = Conference, 
2 = Audience, 3 =
+            Restricted, 4 = Interview)</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Long
+                                                            </td>
+                            <td valign="top">comment</td>
+                            <td valign="top">new comment</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       String
+                                                            </td>
+                            <td valign="top">numberOfPartizipants</td>
+                            <td valign="top">new numberOfParticipants</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Long
+                                                            </td>
+                            <td valign="top">ispublic</td>
+                            <td valign="top">is public</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">appointment</td>
+                            <td valign="top">if the room is an appointment</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">isDemoRoom</td>
+                            <td valign="top">is it a Demo Room with limited 
time? (use false if not sure
+            what that means)</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">demoTime</td>
+                            <td valign="top">time in seconds after the user 
will be logged out (only
+            enabled if isDemoRoom is true)</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Integer
+                                                            </td>
+                            <td valign="top">isModeratedRoom</td>
+                            <td valign="top">Users have to wait until a 
Moderator arrives. Use the
+            becomeModerator parameter in setUserObjectAndGenerateRoomHash
+            to set a user as default Moderator</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">allowUserQuestions</td>
+                            <td valign="top">enable or disable the button to 
allow users to apply for
+            moderation</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">isAudioOnly</td>
+                            <td valign="top">enable or disable the video / or 
audio-only</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideTopBar</td>
+                            <td valign="top">hide or show TopBar</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideChat</td>
+                            <td valign="top">hide or show Chat</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideActivitiesAndActions</td>
+                            <td valign="top">hide or show Activities And 
Actions</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideFilesExplorer</td>
+                            <td valign="top">hide or show Files Explorer</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideActionsMenu</td>
+                            <td valign="top">hide or show Actions Menu</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideScreenSharing</td>
+                            <td valign="top">hide or show Screen Sharing</td>
+                          </tr>
+                          
+                                                                               
   <tr>
+                            <td valign="top">
+                                                                       Boolean
+                                                            </td>
+                            <td valign="top">hideWhiteboard</td>
+                            <td valign="top">hide or show Whiteboard. If 
whitboard is hidden, video pods and scrollbar  appear instead.</td>
+                          </tr>
+                          
+                                                                          
</tbody>
+                               </table>
+                                               <br/>
+                       REST Sample Call/URL:<br/>
+                                                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
<a 
href="http://localhost:5080/openmeetings/services/RoomService/updateRoomWithModerationQuestionsAudioTypeAndHideOptions?SID=VALUE&room_id=VALUE&name=VALUE&roomtypes_id=VALUE&comment=VALUE&numberOfPartizipants=VALUE&ispublic=VALUE&appointment=VALUE&isDemoRoom=VALUE&demoTime=VALUE&isModeratedRoom=VALUE&allowUserQuestions=VALUE&isAudioOnly=VALUE&hideTopBar=VALUE&hideChat=VALUE&hideActivitiesAndActions=VALUE&hideFilesExplorer=VALUE&hideActionsMenu=VALUE&hideScreenSharing=VALUE&hideWhiteboard=VALUE";>http://localhost:5080/openmeetings/services/RoomService/updateRoomWit
 
hModerationQuestionsAudioTypeAndHideOptions?SID=VALUE&room_id=VALUE&name=VALUE&roomtypes_id=VALUE&comment=VALUE&numberOfPartizipants=VALUE&ispublic=VALUE&appointment=VALUE&isDemoRoom=VALUE&demoTime=VALUE&isModeratedRoom=VALUE&allowUserQuestions=VALUE&isAudioOnly=VALUE&hideTopBar=VALUE&hideChat=VALUE&hideActivitiesAndActions=VALUE&hideFilesExplorer=VALUE&hideActionsMenu=VALUE&hideScreenSharing=VALUE&hideWhiteboard=VALUE</a>
+                       </a>
+                 </div>
+                                                             <div 
class="method">
+                       <div class="method_header">
+                       <div style="margin-left:10px">
                        <a name="deleteRoom" ><b>deleteRoom</b></a>
                        </div>
                        </div>

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/persistence/beans/rooms/Rooms.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/persistence/beans/rooms/Rooms.java?rev=1233919&r1=1233918&r2=1233919&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/persistence/beans/rooms/Rooms.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/persistence/beans/rooms/Rooms.java
 Fri Jan 20 14:20:15 2012
@@ -57,28 +57,12 @@ public class Rooms implements Serializab
        @Column(name = "externalRoomType")
        private String externalRoomType;
        
+       @Column(name = "is_microphone_exclusive")
+       private Boolean isMicrophoneExclusive;
+       
        /**
         * Layout of Room
         */
-//     private Integer videoPodWidth = new Integer(290);
-//     private Integer videoPodHeight = new Integer(280);
-//     private Integer videoPodXPosition = new Integer(2);
-//     private Integer videoPodYPosition = new Integer(2);
-//     
-//     private Integer moderationPanelXPosition = new Integer(400);
-//     
-//     private Boolean showWhiteBoard = new Boolean(true);
-//     private Integer whiteBoardPanelXPosition = new Integer(296);
-//     private Integer whiteBoardPanelYPosition = new Integer(2);
-//     private Integer whiteBoardPanelHeight = new Integer(592);
-//     private Integer whiteBoardPanelWidth = new Integer(660);
-//     
-//     private Boolean showFilesPanel = new Boolean(true);
-//     private Integer filesPanelXPosition = new Integer(2);
-//     private Integer filesPanelYPosition = new Integer(284);
-//     private Integer filesPanelHeight = new Integer(310);
-//     private Integer filesPanelWidth = new Integer(290);     
-       
        @Transient
        private List<RoomClient> currentusers;
        

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/WhiteBoardService.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/WhiteBoardService.java?rev=1233919&r1=1233918&r2=1233919&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/WhiteBoardService.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/WhiteBoardService.java
 Fri Jan 20 14:20:15 2012
@@ -339,7 +339,15 @@ public class WhiteBoardService implement
                                                        
.getClientByPublicSID(publicSID);
 
                                        if (rcl != null) {
-                        setCanGiveAudio(rcl, canGiveAudio);
+                                               
rcl.setCanGiveAudio(canGiveAudio);
+                                       
this.clientListManager.updateClientByStreamId(
+                                               rcl.getStreamid(), rcl);
+
+                                       HashMap<Integer, Object> newMessage = 
new HashMap<Integer, Object>();
+                                       newMessage.put(0, 
"updateGiveAudioStatus");
+                                       newMessage.put(1, rcl);
+                                       this.scopeApplicationAdapter
+                                               
.sendMessageWithClient(newMessage);
                                        } else {
                                                return false;
                                        }
@@ -354,18 +362,6 @@ public class WhiteBoardService implement
                return null;
        }
 
-    public void setCanGiveAudio(RoomClient rcl, boolean canGiveAudio) {
-        rcl.setCanGiveAudio(canGiveAudio);
-        this.clientListManager.updateClientByStreamId(
-                rcl.getStreamid(), rcl);
-
-        HashMap<Integer, Object> newMessage = new HashMap<Integer, Object>();
-        newMessage.put(0, "updateGiveAudioStatus");
-        newMessage.put(1, rcl);
-        this.scopeApplicationAdapter
-                .sendMessageWithClient(newMessage);
-    }
-
        public WhiteboardSyncLockObject startNewSyncprocess() {
                try {
 

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java?rev=1233919&r1=1233918&r2=1233919&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java
 Fri Jan 20 14:20:15 2012
@@ -1592,23 +1592,30 @@ public class ScopeApplicationAdapter ext
                return false;
        }
 
-       /*
-        * //Return Object RoomStatus roomStatus = new RoomStatus();
-        * 
-        * //Check for Moderation //LogicalRoom ENTER HashMap<String,RoomClient>
-        * clientListRoom = this.getRoomClients(room_id);
-        * 
-        * // appointed meeting or moderated Room? Rooms room =
-        * roommanagement.getRoomById(room_id);
-        * 
-        * //Check Max Users first if (room.getNumberOfPartizipants() != null &&
-        * clientListRoom.size() >= room.getNumberOfPartizipants()) {
-        * roomStatus.setRoomFull(true); return roomStatus; }
-        */
-
        /**
         * This function is called once a User enters a Room
         * 
+        * It contains several different mechanism depending on what roomtype 
and
+        * what options are available for the room to find out if the current 
user
+        * will be a moderator of that room or not<br/>
+        * <br/>
+        * Some rules:<br/>
+        * <ul>
+        * <li>If it is a room that was created through the calendar, the user 
that
+        * organized the room will be moderator, the param Boolean 
becomeModerator
+        * will be ignored then</li>
+        * <li>In regular rooms you can use the param Boolean becomeModerator 
to set
+        * any user to become a moderator of the room</li>
+        * </ul>
+        * <br/>
+        * If a new moderator is detected a Push Call to all current users of 
the
+        * room is invoked "setNewModeratorByList" to notify them of the new
+        * moderator<br/>
+        * <br/>
+        * And the end of the mechanism a push call with the new client-object
+        * and all the informations about the new user is send to every user of 
the
+        * current conference room<br/>
+        * <br/>
         * @param room_id
         * @param colorObj
         * @return
@@ -1648,8 +1655,8 @@ public class ScopeApplicationAdapter ext
 
             Rooms room = roommanagement.getRoomById(room_id);
             RoomTypes type = room.getRoomtype();
-            if (type.getMicrophones().equals( Boolean.TRUE.toString() )) {
-                whiteBoardService.setCanGiveAudio(currentClient, true);
+            if (type.getMicrophones().equals( "true" )) {
+               currentClient.setCanGiveAudio(true);
             }
 
                        // Log the User
@@ -1665,20 +1672,18 @@ public class ScopeApplicationAdapter ext
                                        + " " + currentClient.getStreamid()); 
// just a unique
                                                                                
                                        // number
 
-                       // Check for Moderation
-                       // LogicalRoom ENTER
+                       // Check for Moderation LogicalRoom ENTER
                        HashMap<String, RoomClient> clientListRoom = this
                                        .getRoomClients(room_id);
 
-                       // appointed meeting or moderated Room?
-                       // Check Max Users first
+                       // appointed meeting or moderated Room? => Check Max 
Users first
                        if (room.getNumberOfPartizipants() != null
                                        && clientListRoom.size() > 
room.getNumberOfPartizipants()) {
                                roomStatus.setRoomFull(true);
                                return roomStatus;
                        }
 
-                       // not really - default logic
+                       // default logic for non regular rooms
                        if (room.getAppointment() == null || 
room.getAppointment() == false) {
 
                                if (room.getIsModeratedRoom()) {
@@ -1704,44 +1709,10 @@ public class ScopeApplicationAdapter ext
                                                                currentClient);
 
                                                List<RoomClient> modRoomList = 
this.clientListManager
-                                                               
.getCurrentModeratorByRoom(currentClient
-                                                                               
.getRoom_id());
-
-                                               // Notify all clients of the 
same scope (room)
-                                               Collection<Set<IConnection>> 
conCollection = current
-                                                               
.getScope().getConnections();
-                                               for (Set<IConnection> conset : 
conCollection) {
-                                                       for (IConnection conn : 
conset) {
-                                                               if (conn != 
null) {
-                                                                       
RoomClient rcl = this.clientListManager
-                                                                               
        .getClientByStreamId(conn
-                                                                               
                        .getClient().getId());
-                                                                       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("setNewModeratorByList",
-                                                                               
                                                new Object[] { modRoomList },
-                                                                               
                                                this);
-                                                                               
                log.debug("sending setNewModeratorByList to "
-                                                                               
                                + conn);
-                                                                               
        }
-                                                                               
}
-                                                                       }
-                                                               }
-                                                       }
-                                               }
+                                                               
.getCurrentModeratorByRoom(currentClient.getRoom_id());
+                                               
+                                               //Sync message to everybody
+                                               
syncMessageToCurrentScope("setNewModeratorByList", modRoomList);
 
                                        } else {
                                                // The current User is not a 
Teacher/Admin or whatever
@@ -1776,50 +1747,14 @@ public class ScopeApplicationAdapter ext
 
                                                        // There is a need to 
send an extra Event here,
                                                        // cause at this moment 
there could be
-                                                       // already somebody in 
the Room waiting
-
-                                                       // Notify all clients 
of the same scope (room)
-                                                       
Collection<Set<IConnection>> conCollection = current
-                                                                       
.getScope().getConnections();
-                                                       for (Set<IConnection> 
conset : conCollection) {
-                                                               for 
(IConnection conn : conset) {
-                                                                       if 
(conn != null) {
-                                                                               
RoomClient rcl = this.clientListManager
-                                                                               
                .getClientByStreamId(conn
-                                                                               
                                .getClient().getId());
-                                                                               
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 actual
-                                                                               
                // Moderator
-                                                                               
                // as it will be already
-                                                                               
                // triggered in the result of
-                                                                               
                // this Function
-                                                                               
                // in the Client
-                                                                               
                if (conn instanceof IServiceCapableConnection) {
-                                                                               
                        ((IServiceCapableConnection) conn)
-                                                                               
                                        .invoke("setNewModeratorByList",
-                                                                               
                                                        new Object[] { 
modRoomList },
-                                                                               
                                                        this);
-                                                                               
                        log.debug("sending setNewModeratorByList to "
-                                                                               
                                        + conn);
-                                                                               
                }
-                                                                               
        }
-                                                                               
}
-                                                                       }
-                                                               }
-                                                       }
+                                                       // already somebody in 
the Room waiting -swagner check this comment, 20.01.2012
+                                                       
+                                                       //Sync message to 
everybody
+                                                       
syncMessageToCurrentScope("setNewModeratorByList", modRoomList);
 
                                                } else {
                                                        // The current User is 
not a Teacher/Admin or
-                                                       // whatever Role that 
should get the
-                                                       // Moderation
+                                                       // whatever Role that 
should get the Moderation
                                                        
currentClient.setIsMod(false);
                                                }
 
@@ -1853,7 +1788,7 @@ public class ScopeApplicationAdapter ext
                                        MeetingMember member = members.get(i);
 
                                        // only persistent users can schedule a 
meeting
-                                       // userid is only set for registered 
users
+                                       // user-id is only set for registered 
users
                                        if (member.getUserid() != null) {
                                                log.debug("checking user " + 
member.getFirstname()
                                                                + " for 
moderator role - ID : "
@@ -1877,48 +1812,11 @@ public class ScopeApplicationAdapter ext
                                                                                
.getCurrentModeratorByRoom(currentClient
                                                                                
                .getRoom_id());
 
-                                                               // There is a 
need to send an extra Event here,
-                                                               // cause at 
this moment there could be
-                                                               // already 
somebody in the Room waiting
-
-                                                               // Notify all 
clients of the same scope (room)
-                                                               
Collection<Set<IConnection>> conCollection = current
-                                                                               
.getScope().getConnections();
-                                                               for 
(Set<IConnection> conset : conCollection) {
-                                                                       for 
(IConnection conn : conset) {
-                                                                               
if (conn != null) {
-                                                                               
        RoomClient rcl = this.clientListManager
-                                                                               
                        .getClientByStreamId(conn
-                                                                               
                                        .getClient()
-                                                                               
                                        .getId());
-                                                                               
        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
-                                                                               
                        // actual Moderator
-                                                                               
                        // as it will be already
-                                                                               
                        // triggered in the result
-                                                                               
                        // of this Function
-                                                                               
                        // in the Client
-                                                                               
                        if (conn instanceof IServiceCapableConnection) {
-                                                                               
                                ((IServiceCapableConnection) conn)
-                                                                               
                                                .invoke("setNewModeratorByList",
-                                                                               
                                                                new Object[] { 
modRoomList },
-                                                                               
                                                                this);
-                                                                               
                                log.debug("sending setNewModeratorByList to "
-                                                                               
                                                + conn);
-                                                                               
                        }
-                                                                               
                }
-                                                                               
        }
-                                                                               
}
-                                                                       }
-                                                               }
+                                                               // There is a 
need to send an extra Event here, cause at this moment 
+                                                               // there could 
be already somebody in the Room waiting
+
+                                                               //Sync message 
to everybody
+                                                               
syncMessageToCurrentScope("setNewModeratorByList", modRoomList);
 
                                                                moderator_set = 
true;
                                                                
this.clientListManager.updateClientByStreamId(
@@ -1947,12 +1845,12 @@ public class ScopeApplicationAdapter ext
                                if (!found) {
                                        log.debug("User "
                                                        + userIdInRoomClient
-                                                       + " could not be found 
as MeetingMember -> definiteley no moderator");
+                                                       + " could not be found 
as MeetingMember -> definitely no moderator");
                                        currentClient.setIsMod(false);
                                        
this.clientListManager.updateClientByStreamId(streamid,
                                                        currentClient);
                                } else {
-                                       // if current user is part of the 
memberlist, but moderator
+                                       // if current user is part of the 
member list, but moderator
                                        // couldn't be retrieved : first come, 
first draw!
                                        if (clientListRoom.size() == 1 && 
moderator_set == false) {
                                                log.debug("");
@@ -1970,87 +1868,21 @@ public class ScopeApplicationAdapter ext
                                                // this moment there could be
                                                // already somebody in the Room 
waiting
 
-                                               // Notify all clients of the 
same scope (room)
-                                               Collection<Set<IConnection>> 
conCollection = current
-                                                               
.getScope().getConnections();
-                                               for (Set<IConnection> conset : 
conCollection) {
-                                                       for (IConnection conn : 
conset) {
-                                                               if (conn != 
null) {
-                                                                       
RoomClient rcl = this.clientListManager
-                                                                               
        .getClientByStreamId(conn
-                                                                               
                        .getClient().getId());
-                                                                       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 actual
-                                                                               
        // Moderator
-                                                                               
        // as it will be already triggered
-                                                                               
        // in the result of this Function
-                                                                               
        // in the Client
-                                                                               
        if (conn instanceof IServiceCapableConnection) {
-                                                                               
                ((IServiceCapableConnection) conn)
-                                                                               
                                .invoke("setNewModeratorByList",
-                                                                               
                                                new Object[] { modRoomList },
-                                                                               
                                                this);
-                                                                               
                log.debug("sending setNewModeratorByList to "
-                                                                               
                                + conn);
-                                                                               
        }
-                                                                               
}
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-
+                                               //Sync message to everybody
+                                               
syncMessageToCurrentScope("setNewModeratorByList", modRoomList);
+                                               
                                                
this.clientListManager.updateClientByStreamId(streamid,
                                                                currentClient);
                                        }
                                }
 
                        }
+                       
+                       
+                       //Sync message to everybody
+                       syncMessageToCurrentScope("addNewUser", currentClient);
 
-                       // Notify all clients of the same scope (room)
-                       Collection<Set<IConnection>> conCollection = 
current.getScope()
-                                       .getConnections();
-                       for (Set<IConnection> conset : conCollection) {
-                               for (IConnection conn : conset) {
-                                       if (conn != null) {
-                                               if (conn instanceof 
IServiceCapableConnection) {
-                                                       if 
(conn.equals(current)) {
-                                                               continue;
-                                                       } else {
-                                                               RoomClient rcl 
= this.clientListManager
-                                                                               
.getClientByStreamId(conn.getClient()
-                                                                               
                .getId());
-                                                               if (rcl == 
null) {
-                                                                       // 
continue;
-                                                               } else if 
(rcl.getIsScreenClient() != null
-                                                                               
&& rcl.getIsScreenClient()) {
-                                                                       // 
continue;
-                                                               } else {
-                                                                       // 
log.debug("*** setAudienceModus Found Client to "
-                                                                       // + 
conn);
-                                                                       // 
log.debug("*** setAudienceModus Found Client to "
-                                                                       // + 
conn.getClient());
-                                                                       if 
(conn instanceof IServiceCapableConnection) {
-                                                                               
((IServiceCapableConnection) conn)
-                                                                               
                .invoke("addNewUser",
-                                                                               
                                new Object[] { currentClient },
-                                                                               
                                this);
-                                                                               
log.debug("sending addNewUser to "
-                                                                               
                + conn);
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-
+                       //Status object for Shared Browsing
                        BrowserStatus browserStatus = (BrowserStatus) 
current.getScope()
                                        .getAttribute("browserStatus");
 
@@ -2429,29 +2261,6 @@ public class ScopeApplicationAdapter ext
                return roomClientList;
        }
 
-       // /**
-       // * @deprecated
-       // *
-       // * @return
-       // */
-       // public synchronized RoomClient getCurrentModerator(){
-       // try {
-       // log.debug("*..*getCurrentModerator id: ");
-       //
-       // IConnection current = Red5.getConnectionLocal();
-       // RoomClient currentClient =
-       // 
this.clientListManager.getClientByStreamId(current.getClient().getId());
-       // 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);
-       // }
-       // return null;
-       // }
-
        public synchronized List<RoomClient> getCurrentModeratorList() {
                try {
                        log.debug("*..*getCurrentModerator id: ");
@@ -2765,39 +2574,9 @@ public class ScopeApplicationAdapter ext
 
        public synchronized int sendMessage(Object newMessage) {
                try {
-                       IConnection current = Red5.getConnectionLocal();
-                       // RoomClient currentClient =
-                       // 
this.clientListManager.getClientByStreamId(current.getClient().getId());
-
-                       // Send to all Clients of that Scope(Room)
-                       Collection<Set<IConnection>> conCollection = 
current.getScope()
-                                       .getConnections();
-                       for (Set<IConnection> conset : conCollection) {
-                               for (IConnection conn : conset) {
-                                       if (conn != null) {
-                                               if (conn instanceof 
IServiceCapableConnection) {
-                                                       RoomClient rcl = 
this.clientListManager
-                                                                       
.getClientByStreamId(conn.getClient()
-                                                                               
        .getId());
-                                                       if (rcl == null
-                                                                       || 
(rcl.getIsScreenClient() != null && rcl
-                                                                               
        .getIsScreenClient())) {
-                                                               // continue;
-                                                       } else {
-                                                               // 
log.debug("*..*idremote: " +
-                                                               // 
rcl.getStreamid());
-                                                               // 
log.debug("*..*my idstreamid: " +
-                                                               // 
currentClient.getStreamid());
-                                                               
((IServiceCapableConnection) conn).invoke(
-                                                                               
"sendVarsToMessage",
-                                                                               
new Object[] { newMessage }, this);
-                                                               // 
log.debug("sending sendVarsToMessage to " +
-                                                               // conn);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
+                       
+                       syncMessageToCurrentScope("sendVarsToMessage", 
newMessage);
+                       
                } catch (Exception err) {
                        log.error("[sendMessage]", err);
                }
@@ -2808,17 +2587,11 @@ public class ScopeApplicationAdapter ext
        public synchronized int sendBrowserMessageToMembers(Object newMessage) {
                try {
                        IConnection current = Red5.getConnectionLocal();
-                       RoomClient currentClient = this.clientListManager
-                                       
.getClientByStreamId(current.getClient().getId());
 
                        List newMessageList = (List) newMessage;
 
                        String action = newMessageList.get(0).toString();
 
-                       // "closeBrowserURL"
-                       // "initBrowser"
-                       // newBrowserURL
-
                        BrowserStatus browserStatus = (BrowserStatus) 
current.getScope()
                                        .getAttribute("browserStatus");
 
@@ -2834,39 +2607,9 @@ public class ScopeApplicationAdapter ext
                        }
 
                        current.getScope().setAttribute("browserStatus", 
browserStatus);
+                       
+                       syncMessageToCurrentScope("sendVarsToMessage", 
newMessage);
 
-                       // Send to all Clients of that Scope(Room)
-                       Collection<Set<IConnection>> conCollection = 
current.getScope()
-                                       .getConnections();
-                       for (Set<IConnection> conset : conCollection) {
-                               for (IConnection conn : conset) {
-                                       if (conn != null) {
-                                               if (conn instanceof 
IServiceCapableConnection) {
-                                                       RoomClient rcl = 
this.clientListManager
-                                                                       
.getClientByStreamId(conn.getClient()
-                                                                               
        .getId());
-                                                       if (rcl == null
-                                                                       || 
(rcl.getIsScreenClient() != null && rcl
-                                                                               
        .getIsScreenClient())) {
-                                                               // continue;
-                                                       } else {
-                                                               if 
(!currentClient.getStreamid().equals(
-                                                                               
rcl.getStreamid())) {
-                                                                       // 
log.debug("*..*idremote: " +
-                                                                       // 
rcl.getStreamid());
-                                                                       // 
log.debug("*..*my idstreamid: " +
-                                                                       // 
currentClient.getStreamid());
-                                                                       
((IServiceCapableConnection) conn).invoke(
-                                                                               
        "sendVarsToMessage",
-                                                                               
        new Object[] { newMessage }, this);
-                                                                       // 
log.debug("sending sendVarsToMessage to "
-                                                                       // + 
conn);
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
                } catch (Exception err) {
                        log.error("[sendMessage]", err);
                }
@@ -2875,9 +2618,26 @@ public class ScopeApplicationAdapter ext
 
        public synchronized int sendMessageToMembers(Object newMessage) {
                try {
+                       
+                       syncMessageToCurrentScope("sendVarsToMessage", 
newMessage);
+                       
+               } catch (Exception err) {
+                       log.error("[sendMessage]", err);
+               }
+               return 1;
+       }
+       
+       /**
+        * General sync mechanism for all messages that are send from within 
the 
+        * scope of the current client, but do not send to self
+        *  
+        * @param remoteMethodName
+        * @param newMessage
+        * @return
+        */
+       private synchronized int syncMessageToCurrentScope(String 
remoteMethodName, Object newMessage) {
+               try {
                        IConnection current = Red5.getConnectionLocal();
-                       RoomClient currentClient = this.clientListManager
-                                       
.getClientByStreamId(current.getClient().getId());
 
                        // Send to all Clients of that Scope(Room)
                        Collection<Set<IConnection>> conCollection = 
current.getScope()
@@ -2887,24 +2647,19 @@ public class ScopeApplicationAdapter ext
                                        if (conn != null) {
                                                if (conn instanceof 
IServiceCapableConnection) {
                                                        RoomClient rcl = 
this.clientListManager
-                                                                       
.getClientByStreamId(conn.getClient()
-                                                                               
        .getId());
+                                                                       
.getClientByStreamId(conn.getClient().getId());
                                                        if (rcl == null
                                                                        || 
(rcl.getIsScreenClient() != null && rcl
                                                                                
        .getIsScreenClient())) {
-                                                               // continue;
+                                                               // rcl can be 
null if there are network problems
+                                                               // 
screensharing clients do not receive events
+                                                               continue;
                                                        } else {
-                                                               if 
(!currentClient.getStreamid().equals(
-                                                                               
rcl.getStreamid())) {
-                                                                       // 
log.debug("*..*idremote: " +
-                                                                       // 
rcl.getStreamid());
-                                                                       // 
log.debug("*..*my idstreamid: " +
-                                                                       // 
currentClient.getStreamid());
+                                                               if 
(!current.getClient().getId().equals(
+                                                                               
conn.getClient().getId())) {
                                                                        
((IServiceCapableConnection) conn).invoke(
-                                                                               
        "sendVarsToMessage",
+                                                                               
        remoteMethodName,
                                                                                
        new Object[] { newMessage }, this);
-                                                                       // 
log.debug("sending sendVarsToMessage to "
-                                                                       // + 
conn);
                                                                }
                                                        }
                                                }
@@ -2912,7 +2667,7 @@ public class ScopeApplicationAdapter ext
                                }
                        }
                } catch (Exception err) {
-                       log.error("[sendMessage]", err);
+                       log.error("[syncMessageToCurrentScope]", err);
                }
                return 1;
        }


Reply via email to