Interface IScope

All Superinterfaces:
IBasicScope, ICoreObject, IEventDispatcher, IEventHandler, IEventListener, IEventObservable, IServiceHandlerProvider, ResourceLoader, ResourcePatternResolver
All Known Subinterfaces:
IGlobalScope
All Known Implementing Classes:
GlobalScope, RoomScope, Scope, WebScope

The scope object. A stateful object shared between a group of clients connected to the same context path. Scopes are arranged in hierarchical way, so its possible for a scope to have a parent and children scopes. If a client connects to a scope then they are also connected to its parent scope. The scope object is used to access resources, shared object, streams, etc. Scope is a general option for grouping things in an application. The following are all names for scopes: application, room, place, lobby.
Author:
The Red5 Project, Luke Hubbard (luke@codegent.com), Paul Gregoire (mondain@gmail.com)
  • Field Details

  • Method Details

    • hasChildScope

      boolean hasChildScope(String name)
      Check to see if this scope has a child scope matching a given name.
      Parameters:
      name - the name of the child scope
      Returns:
      true if a child scope exists, otherwise false
    • hasChildScope

      boolean hasChildScope(ScopeType type, String name)
      Checks whether scope has a child scope with given name and type
      Parameters:
      type - Child scope type
      name - Child scope name
      Returns:
      true if a child scope exists, otherwise false
    • createChildScope

      boolean createChildScope(String name)
      Creates child scope with name given and returns success value. Returns true on success and false if given scope already exists among children.
      Parameters:
      name - New child scope name
      Returns:
      true if child scope was successfully created, false otherwise
    • addChildScope

      boolean addChildScope(IBasicScope scope)
      Adds scope as a child scope. Returns true on success and false if given scope is already a child of current.
      Parameters:
      scope - Scope given
      Returns:
      true if child scope was successfully added, false otherwise
    • removeChildScope

      void removeChildScope(IBasicScope scope)
      Removes scope from the children scope list.
      Parameters:
      scope - Scope given
    • removeChildren

      void removeChildren()
      Removes all the child scopes
    • getScopeNames

      Set<String> getScopeNames()
      Get a set of the child scope names.
      Returns:
      set containing child scope names
    • getBasicScopeNames

      Set<String> getBasicScopeNames(ScopeType type)
    • getBroadcastScope

      IBroadcastScope getBroadcastScope(String name)
      Return the broadcast scope for a given name.
      Parameters:
      name - name
      Returns:
      broadcast scope or null if not found
    • getBasicScope

      IBasicScope getBasicScope(ScopeType type, String name)
      Get a child scope by type and name.
      Parameters:
      type - Child scope type
      name - Name of the child scope
      Returns:
      the child scope, or null if no scope is found
    • getScope

      IScope getScope(String name)
      Return scope by name
      Parameters:
      name - Scope name
      Returns:
      Scope with given name
    • getClients

      Set<IClient> getClients()
      Get a set of connected clients. You can get the connections by passing the scope to the clients IClient.getConnections() method.
      Returns:
      Set containing all connected clients
      See Also:
    • getConnections

      Deprecated.
      Get a connection iterator. You can call remove, and the connection will be closed.
      Returns:
      Iterator holding all connections
    • getClientConnections

      Set<IConnection> getClientConnections()
      Get all current connections. You can call remove, and the connection will be closed.
      Returns:
      Set containing all connections
    • lookupConnections

      @Deprecated Set<IConnection> lookupConnections(IClient client)
      Deprecated.
      Lookup connections.
      Parameters:
      client - object
      Returns:
      Set of connection objects (read-only)
    • lookupConnection

      IConnection lookupConnection(IClient client)
      Lookup connection for a given client.
      Parameters:
      client - object
      Returns:
      connection object
    • getContext

      IContext getContext()
      Returns scope context
      Returns:
      Scope context
    • hasHandler

      boolean hasHandler()
      Checks whether scope has handler or not.
      Returns:
      true if scope has a handler, false otherwise
    • getHandler

      IScopeHandler getHandler()
      Return handler of the scope
      Returns:
      Scope handler
    • getContextPath

      String getContextPath()
      Return context path.
      Returns:
      Context path
    • connect

      boolean connect(IConnection conn)
      Adds given connection to the scope
      Parameters:
      conn - Given connection
      Returns:
      true on success, false if given connection already belongs to this scope
    • connect

      boolean connect(IConnection conn, Object[] params)
      Add given connection to the scope, overloaded for parameters pass case.
      Parameters:
      conn - Given connection
      params - Parameters passed
      Returns:
      true on success, false if given connection already belongs to this scope
    • disconnect

      void disconnect(IConnection conn)
      Removes given connection from list of scope connections. This disconnects all clients of given connection from the scope.
      Parameters:
      conn - Connection given
    • getStatistics

      IScopeStatistics getStatistics()
      Return statistics informations about the scope.
      Returns:
      statistics
    • setAttribute

      boolean setAttribute(String name, Object value)
      Set attribute by name
      Parameters:
      name - name
      value - value
      Returns:
      true if added, false if not added
    • getAttribute

      Object getAttribute(String name)
      Get attribute by name
      Parameters:
      name - name
      Returns:
      value for the given name in the attributes or null if not found
    • hasAttribute

      boolean hasAttribute(String name)
      Whether or not an attribute exists, keyed by the given name
      Parameters:
      name - name
      Returns:
      true if it exists, false otherwise
    • removeAttribute

      boolean removeAttribute(String name)
      Remove attribute by name
      Parameters:
      name - name
      Returns:
      true if removed, false otherwise
    • getAttributeNames

      Set<String> getAttributeNames()
      Return attribute names
      Returns:
      attribute names
    • getAttributes

      Map<String,Object> getAttributes()
      Return scope attributes
      Returns:
      attributes