Package org.red5.server.api.scope

Examples of org.red5.server.api.scope.IScope


  @Test
  public void testRemoveScope() throws Exception {
    log.debug("-----------------------------------------------------------------testRemoveScope");
    setupScopes();
    IScope room1 = ScopeUtils.resolveScope(appScope, "/junit/room1");
    IScope room4 = ScopeUtils.resolveScope(appScope, "/junit/room1/room4");
    log.debug("Room 4 scope: {}", room4);
    assertTrue(room4.getDepth() == 3);
    log.debug("Room 4 child scope exists: {}", room1.hasChildScope("room4"));
    room1.removeChildScope(room4);
    log.debug("Room 4 child scope exists: {}", room1.hasChildScope("room4"));
  }
View Full Code Here


    // change the handler
    appScope.setHandler(app);
    // start
    app.start(appScope);
    // get our room
    IScope room = ScopeUtils.resolveScope(appScope, "/junit/mt");
    if (room == null) {
      assertTrue(app.createChildScope("mt"));
      room = ScopeUtils.resolveScope(appScope, "/junit/mt");
    }
    // create the SO
View Full Code Here

    appScope.setHandler(app);
    // start
    app.start(appScope);
    // create our additional scopes
    assertTrue(appScope.hasHandler());
    IScope top = ScopeUtils.resolveScope(appScope, "/junit");
    assertTrue(top.hasHandler());
    IScope room = ScopeUtils.resolveScope(appScope, "/junit/room13");
    if (room == null) {
      assertTrue(top.createChildScope("room13"));
      room = ScopeUtils.resolveScope(appScope, "/junit/room13");
      assertNotNull(room);
    }
    assertTrue(room.hasHandler());
    // get rooms
    IScope room1 = ScopeUtils.resolveScope(appScope, "/junit/room13/subroomA");
    if (room1 == null) {
      assertTrue(room.createChildScope("subroomA"));
      room1 = ScopeUtils.resolveScope(appScope, "/junit/room13/subroomA");
      assertNotNull(room1);
    }
    Thread.sleep(10);
    IScope room2 = ScopeUtils.resolveScope(appScope, "/junit/room13/subroomB");
    if (room2 == null) {
      assertTrue(room.createChildScope("subroomB"));
      room2 = ScopeUtils.resolveScope(appScope, "/junit/room13/subroomB");
      assertNotNull(room2);
    }
View Full Code Here

    ISharedObjectService soService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false);
    return soService.getSharedObject(scope, SCOPE_STATS_SO_NAME, false);
  }

  private IScope getScope(String path) throws ScopeNotFoundException {
    IScope scope;
    if (path != null && !path.equals("")) {
      scope = ScopeUtils.resolveScope(globalScope, path);
    } else {
      scope = globalScope;
    }
View Full Code Here

  public Set<String> getScopes() {
    return getScopes(null);
  }

  public Set<String> getScopes(String path) throws ScopeNotFoundException {
    IScope scope = getScope(path);
    Set<String> result = scope.getScopeNames();
    return result;
  }
View Full Code Here

    ISharedObjectService soService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false);
    return soService.getSharedObject(scope, SO_STATS_SO_NAME, false);
  }

  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());
View Full Code Here

    }
    return result;
  }

  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

    ISharedObject so = getScopeStatisticsSO(Red5.getConnectionLocal().getScope());
    so.setAttribute(path, scope.getAttributes());
  }

  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();
View Full Code Here

   * @param conn         Connection object
   */
  protected void register(IConnection conn) {
    log.debug("Registering connection for this client {}", id);
    if (conn != null) {
      IScope scope = conn.getScope();
      if (scope != null) {
        log.debug("Registering for scope: {}", scope);
        connections.add(conn);
      } else {
        log.warn("Clients scope is null. Id: {}", id);
View Full Code Here

    boolean connect = false;
    // Get session id
    String id = conn.getSessionId();
    log.trace("Session id: {}", id);
    // Use client registry from scope the client connected to
    IScope connectionScope = conn.getScope();
    log.debug("Connection scope: {}", (connectionScope == null ? "is null" : "not null"));
    // when the scope is null bad things seem to happen, if a null scope is OK then
    // this block will need to be removed - Paul
    if (connectionScope != null) {
      // Get client registry for connection scope
      IClientRegistry clientRegistry = connectionScope.getContext().getClientRegistry();
      log.debug("Client registry: {}", (clientRegistry == null ? "is null" : "not null"));
      if (clientRegistry != null) {
        IClient client = conn.getClient();
        if (client == null) {
          if (!clientRegistry.hasClient(id)) {
View Full Code Here

TOP

Related Classes of org.red5.server.api.scope.IScope

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.