Package org.openmeetings.server.beans

Examples of org.openmeetings.server.beans.ServerSharingSessionBean


      ServerViewerRegisterBean message) {
   
    ServerSharingViewersList.addNewViewerClient(sessionId,message);
   
    //Initial Screens loading
    ServerSharingSessionBean serverSharingSessionBean = ServerSharingSessionList.getServerSharingSessionBeanByPublicSID(message.getPublicSID());
   
    IoSession session = ServerSocketMinaProcess.getSessionById(sessionId);
   
    for (ServerFrameBean serverFrameBean : serverSharingSessionBean.getServerFrameBeans()) {
      session.write(serverFrameBean);
    }
   
  }
View Full Code Here


  public static void startSession (Long sessionId, ServerStatusBean serverStatusBean) {
    try {
     
      log.debug(" -- startSession");
     
      ServerSharingSessionBean serverSharingSessionBean;
     
      if (sharingSessions.containsKey(serverStatusBean.getPublicSID())) {
       
        serverSharingSessionBean = sharingSessions.get(serverStatusBean.getPublicSID());
     
      } else {
       
        serverSharingSessionBean = new ServerSharingSessionBean();
      }
     
      serverSharingSessionBean.setSessionId(sessionId);
     
      serverSharingSessionBean.setDeleted(false);
     
      serverSharingSessionBean.setHeight(serverStatusBean.getHeight());
      serverSharingSessionBean.setWidth(serverStatusBean.getWidth());
      serverSharingSessionBean.setXValue(serverStatusBean.getXValue());
      serverSharingSessionBean.setYValue(serverStatusBean.getYValue());
     
      serverSharingSessionBean.setTileWidth(serverStatusBean.getTileWidth());
      serverSharingSessionBean.setTileHeight(serverStatusBean.getTileHeight());
     
      log.debug("NEw Session with Tile W,H "+serverStatusBean.getTileWidth()+","+serverStatusBean.getTileHeight());
     
      //Duplicated info ;) I Know but it makes the object look more clean
      serverSharingSessionBean.setPublicSID(serverStatusBean.getPublicSID());
     
      serverSharingSessionBean.setSessionStarted(new Date());
      serverSharingSessionBean.setLastUpdate(new Date());
     
      if (serverStatusBean.getMode() == 1) {
        serverSharingSessionBean.setSharing(true);
        serverSharingSessionBean.setRecording(false);
      } else if (serverStatusBean.getMode() == 2) {
        serverSharingSessionBean.setSharing(false);
        serverSharingSessionBean.setRecording(true);
      } else if (serverStatusBean.getMode() == 3) {
        serverSharingSessionBean.setSharing(true);
        serverSharingSessionBean.setRecording(true);
      }
     
      int tileNumberWidth = Double.valueOf(Math.floor(serverStatusBean.getWidth() / serverStatusBean.getTileWidth())).intValue();
      int tileNumberHeight = Double.valueOf(Math.floor(serverStatusBean.getHeight() / serverStatusBean.getTileHeight())).intValue();
     
      int number = 0;
     
      for (int x=0;x<=tileNumberWidth;x++) {
       
        for (int y=0;y<=tileNumberHeight;y++) {
         
          int rect_x = ( x * serverStatusBean.getTileWidth() );
          int rect_y = ( y * serverStatusBean.getTileHeight() );
         
          log.debug("rect_x,rect_y,tileWidth,tileHeight "+rect_x+","+rect_y+","+serverStatusBean.getTileWidth()+","+serverStatusBean.getTileHeight());
         
          int rectWidth = serverStatusBean.getTileWidth();
          int rectHeight = serverStatusBean.getTileHeight();
         
          log.debug("-1- rectWidth,rectHeight"+rectWidth+","+rectHeight);
         
          if (rect_x + rectWidth > serverStatusBean.getWidth()) {
            rectWidth = serverStatusBean.getWidth() - rect_x;
          }
          if (rect_y + rectHeight > serverStatusBean.getHeight()) {
            rectHeight = serverStatusBean.getHeight() - rect_y;
          }
         
          log.debug("-2- rectWidth,rectHeight"+rectWidth+","+rectHeight);
         
          if (rectWidth == 0 || rectHeight == 0) {
            continue;
          }
          number++;
         
        }
      }
     
      log.debug("tileNumberWidth :: tileNumberHeight "+tileNumberWidth+" :: "+tileNumberHeight);
     
      //Reset the Images List to make the Buffer get filled again
      serverSharingSessionBean.setServerFrameBeans(new LinkedList<ServerFrameBean>());
     
      //[[Don't forget to count the leading 0]] outdated comment
      serverSharingSessionBean.setNumberOfImages(number);
      serverSharingSessionBean.setSendCompleteFlag(false);
     
      sharingSessions.put(serverStatusBean.getPublicSID(), serverSharingSessionBean);
       
     
     
View Full Code Here

     
      if (sharingSessions.containsKey(cPosition.getPublicSID())) {
       
        //log.debug("found sharingSessions");
       
        ServerSharingSessionBean serverSharingSessionBean = sharingSessions.get(cPosition.getPublicSID());
       
        serverSharingSessionBean.setServerFrameCursorStatus(cPosition);
       
       
        /* #################################
         * Send Cursor Position to ODSP-Connections
         *
 
View Full Code Here

  public static Boolean addFrameToSession(ServerFrameBean serverFrameBean) {
    try {
     
      if (sharingSessions.containsKey(serverFrameBean.getPublicSID())) {
       
        ServerSharingSessionBean serverSharingSessionBean = sharingSessions.get(serverFrameBean.getPublicSID());
       
        if (serverSharingSessionBean.isDeleted()) {
          //This happens because packets arrive later then the status message
          //this is quite usual
          log.debug("Session already Stopped");
          return false;
        }
       
        if (serverFrameBean.getMode() == 1) {
          serverSharingSessionBean.setSharing(true);
          serverSharingSessionBean.setRecording(false);
        } else if (serverFrameBean.getMode() == 2) {
          serverSharingSessionBean.setSharing(false);
          serverSharingSessionBean.setRecording(true);
        } else if (serverFrameBean.getMode() == 3) {
          serverSharingSessionBean.setSharing(true);
          serverSharingSessionBean.setRecording(true);
        }
       
        if (serverSharingSessionBean.getServerFrameBeans().size() < serverSharingSessionBean.getNumberOfImages()) {
         
          log.debug("Server Frame Buffer Not yet Full ");
         
          //Check for duplicates
          boolean foundDuplicate = false;
         
          //log.debug("Check :: "+serverFrameBean.getXValue()+"||"+serverFrameBean.getYValue());
         
          //log.debug("Check :: SIZE "+serverSharingSessionBean.getServerFrameBeans().size());
         
          for (ServerFrameBean serverFrameBeanStored : serverSharingSessionBean.getServerFrameBeans()) {
           
            if (serverFrameBeanStored.getXValue().equals(serverFrameBean.getXValue()) &&
                serverFrameBeanStored.getYValue().equals(serverFrameBean.getYValue())) {
              //log.debug("Found Duplicate Before Buffer is NOT full "+serverFrameBeanStored.getXValue()+"||"+serverFrameBeanStored.getYValue());
              foundDuplicate = true;
              serverFrameBeanStored.setImageBytesAsJPEG(serverFrameBean.getImageBytesAsJPEG());
              serverFrameBeanStored.setImageBytes(serverFrameBean.getImageBytes());
              break;
            }
          }
         
          if (!foundDuplicate) {
            //log.debug("Add to Cache "+serverFrameBean.getXValue()+"||"+serverFrameBean.getYValue());
            serverSharingSessionBean.getServerFrameBeans().add(serverFrameBean);
          }
         
         
        } else {
         
          /* ##################################
           * Buffer Full, there is a complete Screen available
           *
           */
         
          //log.debug("Check :: SIZE -1- "+serverSharingSessionBean.getServerFrameBeans().size());
          //log.debug("Check :: SIZE -2- "+serverSharingSessionBean.getNumberOfImages());
         
          if (!serverSharingSessionBean.isSendCompleteFlag()) {
           
            log.debug("SEND Buffer Full Message -1- Start ScreenSharing or Recording for all Clients "+serverSharingSessionBean.getPublicSID());
           
            Date d = new Date();
           
            log.debug("SEND Buffer Full Message -2- Start ScreenSharing or Recording for all Clients "+(d.getTime() - serverSharingSessionBean.getSessionStarted().getTime()));
           
            ScopeApplicationAdapter scopeApplicationAdapter = ScopeApplicationAdapter.getInstance();
            if (scopeApplicationAdapter != null) {
              scopeApplicationAdapter.sendScreenSharingMessage(serverSharingSessionBean);
            }
           
            if (serverSharingSessionBean.isSharing()) {
             
             
           
            }
           
            if (serverSharingSessionBean.isRecording()) {
             
              //TODO: Add Scheduler to produce Frame capture
             
              //For Testing Write all Images to a standard dir
              //writeImagesToStandardDirectory(serverSharingSessionBean);
             
             
            }
           
            serverSharingSessionBean.setSendCompleteFlag(true);
           
           
          } else {
           
            /* #################################
             * Send Screen to ODSP-Connections
             *
             */
            ServerSocketMinaProcess.sendMessageToSession(serverFrameBean);
           
            /* #################################
             * Send Screen to trigger HTTP-Connections
             *
             */
            ScopeApplicationAdapter scopeApplicationAdapter = ScopeApplicationAdapter.getInstance();
            if (scopeApplicationAdapter != null) {
              ScopeApplicationAdapter.getInstance().sendScreenSharingFrame(serverFrameBean);
            }
           
          }
         
          //Check for duplicates
          boolean foundDuplicate = false;
         
          //log.debug("SEARCH getXValue(),getYValue()"+serverFrameBean.getXValue()+","+serverFrameBean.getYValue());
         
          for (ServerFrameBean serverFrameBeanStored : serverSharingSessionBean.getServerFrameBeans()) {
           
            //log.debug("serverFrameBeanStored.getXValue(),serverFrameBeanStored.getYValue()"+serverFrameBeanStored.getXValue()+","+serverFrameBeanStored.getYValue());
           
            if (serverFrameBeanStored.getXValue().equals(serverFrameBean.getXValue()) &&
                serverFrameBeanStored.getYValue().equals(serverFrameBean.getYValue())) {
View Full Code Here

  public static synchronized ServerFrameBean getFrameByPublicSID(String publicSID, Integer x, Integer y) {
    try {
     
      if (sharingSessions.containsKey(publicSID)) {
        ServerSharingSessionBean serverSharingSessionBean = sharingSessions.get(publicSID);
       
        boolean found = false;
       
        for (ServerFrameBean serverFrameBean : serverSharingSessionBean.getServerFrameBeans()) {
         
          if (serverFrameBean.getXValue().equals(x) && serverFrameBean.getYValue().equals(y)) {
           
            found = true;
            return serverFrameBean;
View Full Code Here

  public static synchronized void stopSession(Long sessionId) {
    try {
     
      for (Iterator<String> iter = sharingSessions.keySet().iterator();iter.hasNext();) {
        String publicSID = iter.next();
        ServerSharingSessionBean serverSharingSessionBean = sharingSessions.get(publicSID);
       
        if (serverSharingSessionBean.getSessionId().equals(sessionId)) {
         
          /* #################################
           * Send Screen to ODSP-Connections
           *
           */
          ServerStatusBean serverStatusBean = new ServerStatusBean();
          serverStatusBean.setMode(4);
          serverStatusBean.setHeight(0);
          serverStatusBean.setWidth(0);
          serverStatusBean.setPublicSID(publicSID);
          serverStatusBean.setSequenceNumber(0);
          serverStatusBean.setTileHeight(0);
          serverStatusBean.setTileWidth(0);
          serverStatusBean.setXValue(0);
          serverStatusBean.setYValue(0);
          ServerSocketMinaProcess.sendStatusToSession(serverStatusBean);
         
          /* #################################
           * Send Screen to trigger HTTP-Connections
           *
           */
          ScopeApplicationAdapter scopeApplicationAdapter = ScopeApplicationAdapter.getInstance();
          if (scopeApplicationAdapter != null) {
            serverSharingSessionBean.setDeleted(true);
            ScopeApplicationAdapter.getInstance().sendScreenSharingMessage(serverSharingSessionBean);
          }
         
          log.debug("Mark session as Deleted");
         
View Full Code Here

  public static synchronized void removeSession(Long sessionId) {
    try {
     
      for (Iterator<String> iter = sharingSessions.keySet().iterator();iter.hasNext();) {
        String publicSID = iter.next();
        ServerSharingSessionBean serverSharingSessionBean = sharingSessions.get(publicSID);
       
        if (serverSharingSessionBean.getSessionId().equals(sessionId)) {
         
          /* #################################
           * Send Screen to ODSP-Connections
           *
           */
          ServerStatusBean serverStatusBean = new ServerStatusBean();
          serverStatusBean.setMode(4);
          serverStatusBean.setHeight(0);
          serverStatusBean.setWidth(0);
          serverStatusBean.setPublicSID(publicSID);
          serverStatusBean.setSequenceNumber(0);
          serverStatusBean.setTileHeight(0);
          serverStatusBean.setTileWidth(0);
          serverStatusBean.setXValue(0);
          serverStatusBean.setYValue(0);
          ServerSocketMinaProcess.sendStatusToSession(serverStatusBean);
         
          /* #################################
           * Send Screen to trigger HTTP-Connections
           *
           */
          ScopeApplicationAdapter scopeApplicationAdapter = ScopeApplicationAdapter.getInstance();
          if (scopeApplicationAdapter != null) {
            serverSharingSessionBean.setDeleted(true);
            ScopeApplicationAdapter.getInstance().sendScreenSharingMessage(serverSharingSessionBean);
          }
         
          log.debug("Session Found To Be removed");
         
View Full Code Here

     
      for (Iterator<String> iter = roomClientList.keySet().iterator();iter.hasNext();) {
       
        RoomClient rcl = roomClientList.get(iter.next());
       
        ServerSharingSessionBean serverSharingSessionBean = ServerSharingSessionList.getServerSharingSessionBeanByPublicSID(rcl.getPublicSID());
       
        if (serverSharingSessionBean != null) {
          ScreenSharingMessage screenSharingMessage = new ScreenSharingMessage();
          screenSharingMessage.setS(serverSharingSessionBean.getPublicSID());
          screenSharingMessage.setW(serverSharingSessionBean.getWidth());
         
          screenSharingMessage.setDeleted(serverSharingSessionBean.isDeleted());
         
          screenSharingMessage.setL(new LinkedList<ScreenSharingNewFrame>());
         
          for (ServerFrameBean serverFrameBean : serverSharingSessionBean.getServerFrameBeans()) {
           
            ScreenSharingNewFrame screenSharingNewFrame = new ScreenSharingNewFrame();
            screenSharingNewFrame.setX(serverFrameBean.getXValue());
            screenSharingNewFrame.setY(serverFrameBean.getYValue());
            screenSharingNewFrame.setH(serverFrameBean.getHeight());
View Full Code Here

  public boolean checkSharerSession() {
    try {
      IConnection current = Red5.getConnectionLocal();
      RoomClient currentClient = this.clientListManager.getClientByStreamId(current.getClient().getId());
     
      ServerSharingSessionBean serverSharingSessionBean = ServerSharingSessionList.getServerSharingSessionBeanByPublicSID(currentClient.getPublicSID());
     
      if (serverSharingSessionBean == null) {
        return true;
      } else if (serverSharingSessionBean.isDeleted()) {
        return true;
      } else {
        return false;
      }
     
View Full Code Here

TOP

Related Classes of org.openmeetings.server.beans.ServerSharingSessionBean

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.