Package org.openmeetings.app.conference.session

Examples of org.openmeetings.app.conference.session.RoomClient


   *         Moderation, 3 => wait for Moderator
   */
  public synchronized Long applyForModeration(String publicSID) {
    try {

      RoomClient currentClient = this.clientListManager
          .getClientByPublicSID(publicSID, false);

      List<RoomClient> currentModList = this.clientListManager
          .getCurrentModeratorByRoom(currentClient.getRoom_id());

      if (currentModList.size() > 0) {
        return 2L;
      } else {
        // No moderator in this room at the moment
        Rooms room = roommanagement.getRoomById(currentClient
            .getRoom_id());

        if (room.getIsModeratedRoom()) {
          return 3L;
        } else {
View Full Code Here


   */
  public synchronized long getBroadCastId() {
    try {
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      RoomClient currentClient = this.clientListManager
          .getClientByStreamId(streamid);
      currentClient.setBroadCastID(broadCastCounter++);
      this.clientListManager.updateClientByStreamId(streamid,
          currentClient);
      return currentClient.getBroadCastID();
    } catch (Exception err) {
      log.error("[getBroadCastId]", err);
    }
    return -1;
  }
View Full Code Here

      long room_id, String publicSID, Integer interviewPodId) {
    try {

      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      RoomClient currentClient = this.clientListManager
          .getClientByStreamId(streamid);
      currentClient.setAvsettings(avsettings);
      currentClient.setRoom_id(room_id);
      currentClient.setPublicSID(publicSID);
      currentClient.setIsAVClient(true);
      currentClient.setVWidth(vWidth);
      currentClient.setVHeight(vHeight);
      currentClient.setInterviewPodId(interviewPodId);
      // Long room_id = currentClient.getRoom_id();
      this.clientListManager.updateAVClientByStreamId(streamid,
          currentClient);

      HashMap<String, Object> hsm = new HashMap<String, Object>();
      hsm.put("client", currentClient);
      hsm.put("message", newMessage);

      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) {
                // continue;
              } else if (rcl.getIsScreenClient() != null
                  && rcl.getIsScreenClient()) {
                // continue;
              } else {
                ((IServiceCapableConnection) conn).invoke(
                    "sendVarsToMessageWithClient",
                    new Object[] { hsm }, this);
View Full Code Here

      // Return Object
      RoomStatus roomStatus = new RoomStatus();

      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      RoomClient currentClient = this.clientListManager
          .getClientByStreamId(streamid);
      currentClient.setRoom_id(room_id);
      currentClient.setIsAVClient(false);
      currentClient.setRoomEnter(new Date());
      currentClient.setOrganization_id(organization_id);

      currentClient.setUsercolor(colorObj);

      // Inject externalUserId if nothing is set yet
      if (currentClient.getExternalUserId() == null) {
        Users us = usersDao.getUser(currentClient.getUser_id());
        if (us != null) {
          currentClient.setExternalUserId(us.getExternalUserId());
          currentClient.setExternalUserType(us.getExternalUserType());
        }
      }

      // This can be set without checking for Moderation Flag
      currentClient.setIsSuperModerator(isSuperModerator);

      this.clientListManager.updateClientByStreamId(streamid,
          currentClient);

            Rooms room = roommanagement.getRoomById(room_id);
            if (room.getShowMicrophoneStatus()) {
              currentClient.setCanGiveAudio(true);
            }

      // Log the User
      conferenceLogDao.addConferenceLog("roomEnter",
          currentClient.getUser_id(), streamid, room_id,
          currentClient.getUserip(), "",
          currentClient.getExternalUserId(),
          currentClient.getExternalUserType(),
          currentClient.getMail(), currentClient.getFirstname(),
          currentClient.getLastname());

      log.debug("##### setRoomValues : " + currentClient);
     
      // Check for Moderation LogicalRoom ENTER
      HashMap<String, RoomClient> clientListRoom = this.clientListManager
          .getRoomClients(room_id);

      // appointed meeting or moderated Room? => Check Max Users first
      if (room.getNumberOfPartizipants() != null
          && clientListRoom.size() > room.getNumberOfPartizipants()) {
        roomStatus.setRoomFull(true);
        return roomStatus;
      }

      // default logic for non regular rooms
      if (room.getAppointment() == null || room.getAppointment() == false) {

        if (room.getIsModeratedRoom()) {

          // if this is a Moderated Room then the Room can be only
          // locked off by the Moderator Bit
          // List<RoomClient> clientModeratorListRoom =
          // this.clientListManager.getCurrentModeratorByRoom(room_id);

          // If there is no Moderator yet we have to check if the
          // current User has the Bit set to true to
          // become one, otherwise he won't get Moderation and has to
          // wait
          if (becomeModerator) {
            currentClient.setIsMod(true);

            // There is a need to send an extra Event here, cause at
            // this moment there could be
            // already somebody in the Room waiting

            // Update the Client List
            this.clientListManager.updateClientByStreamId(streamid,
                currentClient);

            List<RoomClient> modRoomList = this.clientListManager
                .getCurrentModeratorByRoom(currentClient.getRoom_id());
           
            //Sync message to everybody
            syncMessageToCurrentScope("setNewModeratorByList", modRoomList, false);

          } else {
            // The current User is not a Teacher/Admin or whatever
            // Role that should get the
            // Moderation
            currentClient.setIsMod(false);
          }

        } else {

          // If this is a normal Room Moderator rules : first come,
          // first draw ;-)
          log.debug("setRoomValues : Room"
              + room_id
              + " not appointed! Moderator rules : first come, first draw ;-)");
          if (clientListRoom.size() == 1) {
            log.debug("Room is empty so set this user to be moderation role");
            currentClient.setIsMod(true);
          } else {
            log.debug("Room is already somebody so set this user not to be moderation role");

            if (becomeModerator) {
              currentClient.setIsMod(true);

              // Update the Client List
              this.clientListManager.updateClientByStreamId(
                  streamid, currentClient);

              List<RoomClient> modRoomList = this.clientListManager
                  .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 -swagner check this comment, 20.01.2012
             
              //Sync message to everybody
              syncMessageToCurrentScope("setNewModeratorByList", modRoomList, false);

            } else {
              // The current User is not a Teacher/Admin or
              // whatever Role that should get the Moderation
              currentClient.setIsMod(false);
            }

          }

        }

        // Update the Client List
        this.clientListManager.updateClientByStreamId(streamid,
            currentClient);

      } else {

        // If this is an Appointment then the Moderator will be set to
        // the Invitor

        Appointment ment = appointmentLogic
            .getAppointmentByRoom(room_id);

        List<MeetingMember> members = meetingMemberDao
            .getMeetingMemberByAppointmentId(ment
                .getAppointmentId());

        Long userIdInRoomClient = currentClient.getUser_id();

        boolean found = false;
        boolean moderator_set = false;

        // Check if current user is set to moderator
        for (int i = 0; i < members.size(); i++) {
          MeetingMember member = members.get(i);

          // only persistent users can schedule a meeting
          // user-id is only set for registered users
          if (member.getUserid() != null) {
            log.debug("checking user " + member.getFirstname()
                + " for moderator role - ID : "
                + member.getUserid().getUser_id());

            if (member.getUserid().getUser_id()
                .equals(userIdInRoomClient)) {
              found = true;

              if (member.getInvitor()) {
                log.debug("User "
                    + userIdInRoomClient
                    + " is moderator due to flag in MeetingMember record");
                currentClient.setIsMod(true);

                // Update the Client List
                this.clientListManager.updateClientByStreamId(
                    streamid, currentClient);

                List<RoomClient> modRoomList = this.clientListManager
                    .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

                //Sync message to everybody
                syncMessageToCurrentScope("setNewModeratorByList", modRoomList, false);

                moderator_set = true;
                this.clientListManager.updateClientByStreamId(
                    streamid, currentClient);
                break;
              } else {
                log.debug("User "
                    + userIdInRoomClient
                    + " is NOT moderator due to flag in MeetingMember record");
                currentClient.setIsMod(false);
                this.clientListManager.updateClientByStreamId(
                    streamid, currentClient);
                break;
              }
            } else {
              if (member.getInvitor())
                moderator_set = true;
            }
          } else {
            if (member.getInvitor())
              moderator_set = true;
          }

        }

        if (!found) {
          log.debug("User "
              + userIdInRoomClient
              + " 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 member list, but moderator
          // couldn't be retrieved : first come, first draw!
          if (clientListRoom.size() == 1 && moderator_set == false) {
            log.debug("");
            currentClient.setIsMod(true);

            // Update the Client List
            this.clientListManager.updateClientByStreamId(streamid,
                currentClient);

            List<RoomClient> modRoomList = this.clientListManager
                .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
View Full Code Here

      HashMap<String, RoomClient> roomClientList = new HashMap<String, RoomClient>();
      HashMap<String, RoomClient> clientListRoom = this.getClientListByRoom(room_id);
      for (Iterator<String> iter = clientListRoom.keySet().iterator(); iter
          .hasNext();) {
        String key = iter.next();
        RoomClient rcl = this.getClientByStreamId(key);
       
        if (rcl.getIsAVClient()) {
          continue;
        }
       
        // Add user to List
        roomClientList.put(key, rcl);
View Full Code Here

      String scopeName, Integer remotePort, String remoteAddress,
      String swfUrl, boolean isAVClient) {
    try {

      // Store the Connection into a bean and add it to the HashMap
      RoomClient rcm = new RoomClient();
      rcm.setConnectedSince(new Date());
      rcm.setStreamid(streamId);
      rcm.setScope(scopeName);
      long thistime = new Date().getTime();
      rcm.setPublicSID(manageCryptStyle.getInstanceOfCrypt()
          .createPassPhrase(String.valueOf(thistime).toString()));

      rcm.setUserport(remotePort);
      rcm.setUserip(remoteAddress);
      rcm.setSwfurl(swfUrl);
      rcm.setIsMod(new Boolean(false));
      rcm.setCanDraw(new Boolean(false));
      rcm.setIsAVClient(isAVClient);

      if (clientList.containsKey(streamId)) {
        log.error("Tried to add an existing Client " + streamId);
        return null;
      }

      clientList.put(rcm.getStreamid(), rcm);

      log.debug(" :: addClientListItem :: " + rcm.getRoomClientId());

      return rcm;
    } catch (Exception err) {
      log.error("[addClientListItem]", err);
    }
View Full Code Here

      if (!clientList.containsKey(streamId)) {
        log.debug("Tried to get a non existing Client " + streamId);
        return null;
      }
     
      RoomClient rcl = clientList.get(streamId);
     
      if (rcl == null) {
        return null;
      }
     
      if (rcl.getIsScreenClient() != null && rcl.getIsScreenClient()) {
        return null;
      }
     
      return clientList.get(streamId);
    } catch (Exception err) {
View Full Code Here

  public synchronized RoomClient getClientByPublicSID(String publicSID, Boolean isAVClient) {
    try {
      for (Iterator<String> iter = clientList.keySet().iterator(); iter
          .hasNext();) {
        RoomClient rcl = clientList.get(iter.next());
       
        if (!rcl.getPublicSID().equals(publicSID)) {
          continue;
        }
        if (rcl.getIsAVClient() != isAVClient) {
          continue;
        }
       
        return rcl;
      }
View Full Code Here

  public synchronized RoomClient getClientByUserId(Long userId) {
    try {
      for (Iterator<String> iter = clientList.keySet().iterator(); iter
          .hasNext();) {
        RoomClient rcl = clientList.get(iter.next());
        if (rcl.getUser_id().equals(userId)) {
          return rcl;
        }
      }
    } catch (Exception err) {
      log.error("[getClientByPublicSID]", err);
View Full Code Here

  public synchronized Boolean updateAVClientByStreamId(String streamId,
      RoomClient rcm) {
    try {
     
      //get the corresponding user session object and update the settings
      RoomClient rclUsual = getClientByPublicSID(rcm.getPublicSID(), false);
      if (rclUsual != null) {
        rclUsual.setBroadCastID(rcm.getBroadCastID());
        rclUsual.setAvsettings(rcm.getAvsettings());
        rclUsual.setVHeight(rcm.getVHeight());
        rclUsual.setVWidth(rcm.getVWidth());
        rclUsual.setVX(rcm.getVX());
        rclUsual.setVY(rcm.getVY());
        if (clientList.containsKey(rclUsual.getStreamid())) {
          clientList.put(rclUsual.getStreamid(), rclUsual);
        } else {
           log.debug("Tried to update a non existing Client " + rclUsual.getStreamid());
        }
      }
     
      updateClientByStreamId(streamId, rcm);
    } catch (Exception err) {
View Full Code Here

TOP

Related Classes of org.openmeetings.app.conference.session.RoomClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.