Package org.red5.server.api.so

Examples of org.red5.server.api.so.ISharedObject


   *       unique id of the user that disconnected
   * @return the username of the disconnected user
   */
  @SuppressWarnings("unchecked")
  public String removeClient(IScope scope, String uid) {
    ISharedObject so = getSharedObject(scope);
    if (!so.hasAttribute(uid)) {
      // SharedObject is empty. This happes when the last client
      // disconnects.
      return null;
    }

    String username = so.getStringAttribute(uid);
    so.removeAttribute(uid);
    return username;
  }
View Full Code Here


      return new Hashtable<String, Object>();
    }

    Map<String, Object> result = new Hashtable<String, Object>();
    for (String name : service.getSharedObjectNames(scope)) {
      ISharedObject so = service.getSharedObject(scope, name);
      try {
        result.put(name, new Object[] { so.isPersistentObject(),
            getXMLRPCValue(so.getData()) });
      } catch (RuntimeException err) {
        // Could not convert attribute for XML-RPC serialization.
        result.put(name, "--- Error while serializing \""
            + so.getData().toString() + "\" ---");
      }
    }
    return result;
  }
View Full Code Here

  public Set<ISharedObjectStatistics> getSharedObjects(String path) {
    IScope scope = getScope(path);
    ISharedObjectService soService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false);
    Set<ISharedObjectStatistics> result = new HashSet<ISharedObjectStatistics>();
    for (String name: soService.getSharedObjectNames(scope)) {
      ISharedObject so = soService.getSharedObject(scope, name);
      result.add(so.getStatistics());
    }
    return result;
  }
View Full Code Here

  }

  public void updateScopeStatistics(String path)
      throws ScopeNotFoundException {
    IScope scope = getScope(path);
    ISharedObject so = getScopeStatisticsSO(Red5.getConnectionLocal().getScope());
    so.setAttribute(path, scope.getAttributes());
  }
View Full Code Here

  public void updateSharedObjectStatistics(String path, String name)
      throws ScopeNotFoundException, SharedObjectException {
    IScope scope = getScope(path);
    ISharedObjectService soService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false);
    ISharedObject sourceSO = soService.getSharedObject(scope, name);
    if (sourceSO == null)
      throw new SharedObjectException();
   
    ISharedObject so = getSharedObjectStatisticsSO(Red5.getConnectionLocal().getScope());
    so.setAttribute(path+'|'+name, sourceSO.getData());
  }
View Full Code Here

  /** {@inheritDoc} */
  @Override
  protected void onSharedObject(RTMPConnection conn, Channel channel,
      Header source, SharedObjectMessage object) {
    final ISharedObject so;
    final String name = object.getName();
    final boolean persistent = object.isPersistent();
    final IScope scope = conn.getScope();
    if (scope == null) {
      // The scope already has been deleted.
      sendSOCreationFailed(conn, name, persistent);
      return;
    }

    ISharedObjectService sharedObjectService = (ISharedObjectService) getScopeService(
        scope, ISharedObjectService.class, SharedObjectService.class,
        false);
    if (!sharedObjectService.hasSharedObject(scope, name)) {
      ISharedObjectSecurityService security = (ISharedObjectSecurityService) ScopeUtils
          .getScopeService(scope, ISharedObjectSecurityService.class);
      if (security != null) {
        // Check handlers to see if creation is allowed
        for (ISharedObjectSecurity handler : security
            .getSharedObjectSecurity()) {
          if (!handler.isCreationAllowed(scope, name, persistent)) {
            sendSOCreationFailed(conn, name, persistent);
            return;
          }
        }
      }

      if (!sharedObjectService
          .createSharedObject(scope, name, persistent)) {
        sendSOCreationFailed(conn, name, persistent);
        return;
      }
    }
    so = sharedObjectService.getSharedObject(scope, name);
    if (so.isPersistentObject() != persistent) {
      SharedObjectMessage msg = new SharedObjectMessage(name, 0,
          persistent);
      msg.addEvent(new SharedObjectEvent(
          ISharedObjectEvent.Type.CLIENT_STATUS, "error",
          SO_PERSISTENCE_MISMATCH));
      conn.getChannel((byte) 3).write(msg);
    }
    so.dispatchEvent(object);
  }
View Full Code Here

    System.out.println("*********** Request to send [" + msg.getMessageName() + "] using shared object.");
   
    IScope meetingScope = getScope(msg.getMeetingID());
    if (meetingScope != null) {
      if (meetingScope.hasChildScope(ScopeType.SHARED_OBJECT, msg.getSharedObjectName())) {
        ISharedObject so = getSharedObject(meetingScope, msg.getSharedObjectName());
        if (so != null) {
          System.out.println("*********** Sending [" + msg.getMessageName() + "] using shared object.");
          so.sendMessage(msg.getMessageName(), msg.getMessage());
        } else {
          System.out.println("**** Cannot get SO for [" + msg.getSharedObjectName() + "]");
        }
      } else {
        System.out.println("**** No SO scope for [" + msg.getSharedObjectName() + "]");
View Full Code Here

 
  @Override
  public boolean roomConnect(IConnection connection, Object[] params) {
    log.debug("***** " + APP + " [ " + " roomConnect [ " + connection.getScope().getName() + "] *********");
           
    ISharedObject so = getSharedObject(connection.getScope(), VOICE_SO, false);
         
      String voiceBridge = getBbbSession().getVoiceBridge();
      String meetingid = getBbbSession().getRoom();
      Boolean record = getBbbSession().getRecord();
      Boolean muted = getBbbSession().getStartAsMuted();
View Full Code Here

      if (stream.getStreamListeners() != null) {
       
        for (Iterator<IStreamListener> iter = stream.getStreamListeners().iterator();iter.hasNext();) {
         
          IStreamListener iStreamListener = iter.next();
         
          ListenerAdapter listenerAdapter = (ListenerAdapter) iStreamListener;
         
          log.debug("Stream Closing ?? "+listenerAdapter.getFlvRecordingMetaDataId()+ " " +flvRecordingMetaDataId);
         
View Full Code Here

            if ( !( event instanceof IRTMPEvent ) ) {
                logger.debug( "skipping non rtmp event: " + event );
                return;
            }

            IRTMPEvent rtmpEvent = (IRTMPEvent) event;

            if ( logger.isDebugEnabled() ) {
                // logger.debug("rtmp event: " + rtmpEvent.getHeader() + ", " +
                // rtmpEvent.getClass().getSimpleName());
            }

            if ( !( rtmpEvent instanceof IStreamData ) ) {
                logger.debug( "skipping non stream data" );
                return;
            }

            if ( rtmpEvent.getHeader().getSize() == 0 ) {
                logger.debug( "skipping event where size == 0" );
                return;
            }

            if ( rtmpEvent instanceof VideoData ) {
View Full Code Here

TOP

Related Classes of org.red5.server.api.so.ISharedObject

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.