Package org.apache.openmeetings.persistence.beans.room

Examples of org.apache.openmeetings.persistence.beans.room.Client


        String streamid = current.getClient().getId();
        Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
        for (Set<IConnection> conset : conCollection) {
            for (IConnection conn : conset) {
                if (conn != null) {
                    Client rcl = this.sessionManager
                            .getClientByStreamId(conn
                                    .getClient().getId(), null);
                    if (rcl == null) {
                        // continue;
                    } else if (rcl.getIsScreenClient() != null
                            && rcl.getIsScreenClient()) {
                        // continue;
                    } else {
                        if (!streamid.equals(rcl.getStreamid())) {
                            // It is not needed to send back
                            // that event to the actuall
                            // Moderator
                            // as it will be already triggered
                            // in the result of this Function
                            // in the Client
                          Long id = Long.valueOf(rcl.getBroadCastID());
                          if (id != null && !broadcastList.contains(id)) {
                            broadcastList.add(id.intValue());
                          }
                        }
                    }
View Full Code Here


   * @return publicSID of current client
   */
  public synchronized String getPublicSID() {
    log.debug("-----------  getPublicSID");
    IConnection current = Red5.getConnectionLocal();
    Client currentClient = this.sessionManager
        .getClientByStreamId(current.getClient().getId(), null);
    sessionManager.updateClientByStreamId(current.getClient().getId(),
        currentClient, false, null);
    return currentClient.getPublicSID();
  }
View Full Code Here

  public synchronized Boolean overwritePublicSID(String newPublicSID) {
    try {
      log.debug("-----------  overwritePublicSID");
      IConnection current = Red5.getConnectionLocal();
      IClient c = current.getClient();
      Client currentClient = sessionManager.getClientByStreamId(c.getId(), null);
      if (currentClient == null) {
        return false;
      }
      SessionVariablesUtil.initClient(c, SessionVariablesUtil.isAVClient(c), newPublicSID);
      currentClient.setPublicSID(newPublicSID);
      sessionManager.updateClientByStreamId(c.getId(), currentClient, false, null);
      return true;
    } catch (Exception err) {
      log.error("[overwritePublicSID]", err);
    }
View Full Code Here

      log.debug("roomLeave " + client.getId() + " "
          + room.getClients().size() + " " + room.getContextPath()
          + " " + room.getName());

      Client currentClient = this.sessionManager
          .getClientByStreamId(client.getId(), null);

      // The Room Client can be null if the Client left the room by using
      // logicalRoomLeave
      if (currentClient != null) {
View Full Code Here

      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();

      log.debug(streamid + " is leaving");

      Client currentClient = this.sessionManager
          .getClientByStreamId(streamid, null);

      this.roomLeaveByScope(currentClient, current.getScope(), true);

    } catch (Exception err) {
View Full Code Here

              log.debug("sending roomDisconnect to " + cons
                  + " client id "
                  + cons.getClient().getId());

              Client rcl = this.sessionManager
                  .getClientByStreamId(cons.getClient()
                      .getId(), null);

              /*
               * Check if the Client does still exist on the
               * list
               */
              if (rcl != null) {

                /*
                 * Do not send back to sender, but actually
                 * all other clients should receive this
                 * message swagner 01.10.2009
                 */
                if (!currentClient.getStreamid().equals(
                    rcl.getStreamid())) {
                 
                  // add Notification if another user isrecording
                  log.debug("###########[roomLeave]");
                  if (rcl.getIsRecording()) {
                    log.debug("*** roomLeave Any Client is Recording - stop that");
                    this.flvRecorderService
                        .stopRecordingShowForClient(
                            cons, currentClient);
                  }
                 
                  //If the user was a avclient, we do not broadcast a message about that to everybody
                  if (currentClient.getIsAVClient()) {
                    continue;
                  }
                 
                  boolean isScreen = rcl.getIsScreenClient() != null && rcl.getIsScreenClient();
                  if (isScreen && currentClient.getPublicSID().equals(rcl.getStreamPublishName())) {
                    //going to terminate screen sharing started by this client
                    ((IServiceCapableConnection) cons).invoke("stopStream", new Object[] { },this);
                    continue;
                  } else if (isScreen) {
                    // screen sharing clients do not receive events
                    continue;
                  } else if (rcl.getIsAVClient()) {
                    // AVClients or potential AVClients do not receive events
                    continue;
                  }
                 
                  // Send to all connected users
View Full Code Here

  public synchronized void streamPublishStart(IBroadcastStream stream) {
    try {
      log.debug("-----------  streamPublishStart");
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      Client currentClient = this.sessionManager
          .getClientByStreamId(streamid, null);

      //We make a second object the has the reference to the object
      //that we will use to send to all participents
      Client clientObjectSendToSync = currentClient;
     
      // Notify all the clients that the stream had been started
      log.debug("start streamPublishStart broadcast start: "
          + stream.getPublishedName() + " CONN " + current);

      // In case its a screen sharing we start a new Video for that
      if (currentClient.getIsScreenClient()) {

        currentClient.setScreenPublishStarted(true);

        this.sessionManager.updateClientByStreamId(current
            .getClient().getId(), currentClient, false, null);
      }
      //If its an audio/video client then send the session object with the full
      //data to everybody
      else if (currentClient.getIsAVClient()) {
        clientObjectSendToSync = this.sessionManager.getClientByPublicSID(
                      currentClient.getPublicSID(), false, null);
      }
     
      log.debug("newStream SEND: "+currentClient);

      // Notify all users of the same Scope
      // We need to iterate through the streams to catch if anybody is recording
      Collection<Set<IConnection>> conCollection = current.getScope()
          .getConnections();
      for (Set<IConnection> conset : conCollection) {
        for (IConnection conn : conset) {
          if (conn != null) {
            if (conn instanceof IServiceCapableConnection) {
             
              Client rcl = this.sessionManager
                  .getClientByStreamId(conn.getClient()
                      .getId(), null);
             
              if (rcl == null) {
                log.debug("RCL IS NULL newStream SEND");
                continue;
              }
             
              log.debug("check send to "+rcl);
             
              if (rcl.getPublicSID() == "") {
                log.debug("publicSID IS NULL newStream SEND");
                continue;
              }
              if (rcl.getIsRecording()) {
                log.debug("RCL getIsRecording newStream SEND");
                this.flvRecorderService
                    .addRecordingByStreamId(current,
                        streamid, currentClient,
                        rcl.getFlvRecordingId());
              }
              if (rcl.getIsAVClient()) {
                log.debug("RCL getIsAVClient newStream SEND");
                continue;
              }
              if (rcl.getIsScreenClient() == null || rcl.getIsScreenClient()) {
                log.debug("RCL getIsScreenClient newStream SEND");
                continue;
              }
             
              if (rcl.getPublicSID().equals(currentClient.getPublicSID())) {
                log.debug("RCL publicSID is equal newStream SEND");
                continue;
              }
             
              log.debug("RCL SEND is equal newStream SEND "+rcl.getPublicSID()+" || "+rcl.getUserport());
               
              IServiceCapableConnection iStream = (IServiceCapableConnection) conn;
              iStream.invoke("newStream",
                  new Object[] { clientObjectSendToSync },
                  this);
View Full Code Here

    // Notify all the clients that the stream had been closed
    log.debug("start streamBroadcastClose broadcast close: "
        + stream.getPublishedName());
    try {
      IConnection current = Red5.getConnectionLocal();
      Client rcl = sessionManager.getClientByStreamId(current.getClient().getId(), null);
      sendClientBroadcastNotifications(stream, "closeStream", rcl);
    } catch (Exception e) {
      log.error("[streamBroadcastClose]", e);
    }
  }
View Full Code Here

      // Store the local so that we do not send notification to ourself
      // back
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      Client currentClient = this.sessionManager
          .getClientByStreamId(streamid, null);

      if (currentClient == null) {

        // In case the client has already left(kicked) this message
        // might be thrown later then the RoomLeave
        // event and the currentClient is already gone
        // The second Use-Case where the currentClient is maybe null is
        // if we remove the client because its a Zombie/Ghost

        return;

      }
      // Notify all the clients that the stream had been started
      log.debug("sendClientBroadcastNotifications: "
          + stream.getPublishedName());
      log.debug("sendClientBroadcastNotifications : " + currentClient
          + " " + currentClient.getStreamid());

      // 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)) {
                // there is a Bug in the current implementation
                // of the appDisconnect
                if (clientFunction.equals("closeStream")) {
                  Client rcl = this.sessionManager
                      .getClientByStreamId(conn
                          .getClient().getId(), null);
                  if (clientFunction.equals("closeStream")
                      && rcl.getIsRecording()) {
                    log.debug("*** stopRecordingShowForClient Any Client is Recording - stop that");
                    // StreamService.stopRecordingShowForClient(conn,
                    // currentClient,
                    // rcl.getRoomRecordingName(), false);
                    this.flvRecorderService
                        .stopRecordingShowForClient(
                            conn, currentClient);
                  }
                  // Don't notify current client
                  current.ping();
                }
                continue;
              } else {
                Client rcl = this.sessionManager
                    .getClientByStreamId(conn.getClient()
                        .getId(), null);
                if (rcl != null) {
                  if (rcl.getIsScreenClient() != null
                      && rcl.getIsScreenClient()) {
                    // continue;
                  } else {
                    log.debug("is this users still alive? :"
                        + rcl);
                    IServiceCapableConnection iStream = (IServiceCapableConnection) conn;
                    iStream.invoke(clientFunction,
                        new Object[] { rc }, this);
                  }

                  log.debug("sending notification to " + conn
                      + " ID: ");

                  // if this close stream event then stop the
                  // recording of this stream
                  if (clientFunction.equals("closeStream")
                      && rcl.getIsRecording()) {
                    log.debug("***  +++++++ ######## sendClientBroadcastNotifications Any Client is Recording - stop that");
                    this.flvRecorderService
                        .stopRecordingShowForClient(
                            conn, currentClient);
                  }
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  public int sendMessageWithClient(Object newMessage) {
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager.getClientByStreamId(current.getClient().getId(), null);
      Long room_id = currentClient.getRoom_id();     
      log.debug("room_id: " + room_id);
     
      if (room_id == null) {
        return 1; //TODO weird
      }
      Long user_level = userManager.getUserLevelByID(currentClient.getUser_id());
      Room room = roomManager.getRoomById(user_level, room_id);
      @SuppressWarnings("rawtypes")
      ArrayList messageMap = (ArrayList) newMessage;
      // adding delimiter space, cause otherwise an emoticon in the last
      // string would not be found
      String messageText = messageMap.get(4) + " ";
      LinkedList<String[]> parsedStringObjects = ChatString.parseChatString(messageText, emoticonsManager.getEmotfilesList(), room.getAllowFontStyles());
      // log.error("parsedStringObjects"+parsedStringObjects.size());
      log.debug("size:" + messageMap.size());
      messageMap.add(parsedStringObjects);
      newMessage = messageMap;     

      boolean needModeration = Boolean.valueOf("" + messageMap.get(9));
      List<HashMap<String, Object>> myChatList = myChats.get(room_id);
      if (myChatList == null) myChatList = new LinkedList<HashMap<String, Object>>();
     
      HashMap<String, Object> hsm = new HashMap<String, Object>();
      hsm.put("message", newMessage);
      String publicSID = "" + messageMap.get(6);
      if (!publicSID.equals(currentClient.getPublicSID())) {
        hsm.put("client", sessionManager.getClientByPublicSID("" + messageMap.get(6), false, null));
        //need to remove unconfirmed chat message if any
        for (int i = myChatList.size() - 1; i > -1; --i) {
          Client msgClient = (Client)myChatList.get(i).get("client");
          @SuppressWarnings("rawtypes")
          List msgList = (List)myChatList.get(i).get("message");
          if (publicSID.equals(msgClient.getPublicSID())
            && ("" + msgList.get(4)).equals(messageMap.get(4))
            && ("" + msgList.get(1)).equals(messageMap.get(1))
            && Boolean.valueOf("" + msgList.get(9))) {
            myChatList.remove(i);
            break;
          }
        }
       
      } else {
        // add server time
        messageMap.set(1, parseDateAsTimeString());
        hsm.put("client", currentClient);
      }

      if (myChatList.size() == chatRoomHistory) myChatList.remove(0);
      myChatList.add(hsm);
      myChats.put(room_id, myChatList);
      log.debug("SET CHATROOM: " + room_id);

      //broadcast to everybody in the room/domain
      Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
      for (Set<IConnection> conset : conCollection) {
          for (IConnection conn : conset) {
            if (conn != null) {
              if (conn instanceof IServiceCapableConnection) {
               
                Client rcl = this.sessionManager.getClientByStreamId(conn.getClient().getId(), null);
               
                if (rcl == null) {
                  continue;
                }
                if (rcl.getIsAVClient()) {
                  continue;
                }
                if (rcl.getIsScreenClient() != null && rcl.getIsScreenClient()) {
                  continue;
                }
                if (needModeration && Boolean.TRUE != rcl.getIsMod() && Boolean.TRUE != rcl.getIsSuperModerator()) {
                  continue;
                }
              ((IServiceCapableConnection) conn).invoke("sendVarsToMessageWithClient",new Object[] { hsm }, this);
               }
            }
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.persistence.beans.room.Client

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.