## org.red5.server.api
Interface IScope

All Superinterfaces:
  AttributeStoreMBean, IAttributeStore, IBasicScope, ICastingAttributeStore, ICoreObject, IEventDispatcher, IEventHandler, IEventListener, IEventObservable, IPersistable, IServiceHandlerProvider, Iterable<IBasicScope>, ResourceLoader, ResourcePatternResolver

All Known Subinterfaces:
  IGlobalScope

All Known Implementing Classes:
  GlobalScope, Scope, WebScope

    public interface IScope

extends IBasicScope, ResourcePatternResolver, IServiceHandlerProvider

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. That is, scope are general option for grouping things in application. The following are all names for scopes: application, room, place, lobby.

Author:
  The Red5 Project (red5@osflash.org), Luke Hubbard (luke@codegent.com)

Field Summary
`static String` `ID` ID constant
`static String` `SEPARATOR` Scope separator
`static String` `TYPE` Type constant

Fields inherited from interface org.red5.server.api.persistence.IPersistable
`TRANSIENT_PREFIX`

Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
`CLASSPATH_ALL_URL_PREFIX`

Fields inherited from interface org.springframework.core.io.ResourceLoader
`CLASSPATH_URL_PREFIX`

Method Summary
`boolean` `addChildScope(IBasicScope scope)` Adds scope as a child scope.
`boolean` `connect(IConnection conn)` Adds given connection to the scope
`boolean` `connect(IConnection conn, Object[] params)` Add given connection to the scope, overloaded for parameters pass case.
`boolean` `createChildScope(String name)` Creates child scope with name given and returns success value.
`void` `disconnect(IConnection conn)` Removes given connection from list of scope connections.
`IBasicScope` `getBasicScope(String type, String name)` Get a child scope by name.
`Iterator<String>` `getBasicScopeNames(String type)`
`Set<IClient>` `getClients()` Get a set of connected clients.
`Collection<Set<IConnection>>` `getConnections()` Get a connection iterator.
`IContext` `getContext()` Returns scope context
`String` `getContextPath()` Return context path.
`IScopeHandler` `getHandler()` Return handler of the scope
`IScope` `getScope(String name)` Return scope by name
`Iterator<String>` `getScopeNames()` Get a set of the child scope names.
`IScopeStatistics` `getStatistics()` Return statistics informations about the scope.
`boolean` `hasChildScope(String name)` Check to see if this scope has a child scope matching a given name.
`boolean` `hasChildScope(String type, String name)` Checks whether scope has a child scope with given name and type
`boolean` `hasHandler()` Checks whether scope has handler or not.
`Set<IConnection>` `lookupConnections(IClient client)` Lookup connections.
`void` `removeChildScope(IBasicScope scope)` Removes scope from the children scope list.

Methods inherited from interface org.red5.server.api.IBasicScope
`getDepth, getName, getParent, getPath, getType, hasParent, lock, setKeepDelay, unlock`

Methods inherited from interface org.red5.server.api.ICastingAttributeStore
`getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute`

Methods inherited from interface org.red5.server.api.IAttributeStore
`getAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes`

Methods inherited from interface org.red5.server.api.event.IEventDispatcher
`dispatchEvent`

Methods inherited from interface org.red5.server.api.event.IEventHandler
`handleEvent`

Methods inherited from interface org.red5.server.api.event.IEventListener
`notifyEvent`

Methods inherited from interface org.red5.server.api.event.IEventObservable
`addEventListener, getEventListeners, removeEventListener`

Methods inherited from interface java.lang.Iterable
`iterator`

Methods inherited from interface org.red5.server.api.persistence.IPersistable
`deserialize, getLastModified, getStore, isPersistent, serialize, setName, setPath, setPersistent, setStore`

Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver
`getResources`

Methods inherited from interface org.springframework.core.io.ResourceLoader
`getClassLoader, getResource`

Methods inherited from interface org.red5.server.api.service.IServiceHandlerProvider
`getServiceHandler, getServiceHandlerNames, registerServiceHandler, unregisterServiceHandler`

Field Detail

### ID

    static final String ID

  ID constant

  See Also:
    Constant Field Values

### TYPE

    static final String TYPE

  Type constant

  See Also:
    Constant Field Values

### SEPARATOR

    static final String SEPARATOR

  Scope separator

  See Also:
    Constant Field Values

Method Detail

### 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(String 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, `false` if given scope already exists among children.

  Parameters:
    `name` - New child scope name
  Returns:
    `true` if child scope was successfully creates, `false` otherwise

### addChildScope

    boolean addChildScope(IBasicScope scope)

  Adds scope as a child scope. Returns `true` on success, `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. Returns `false` if given scope isn't a child of the current scope.

  Parameters:
    `scope` - Scope given

### getScopeNames

    Iterator<String> getScopeNames()

  Get a set of the child scope names.

  Returns:
    set containing child scope names

### getBasicScopeNames

    Iterator<String> getBasicScopeNames(String type)

### getBasicScope

    IBasicScope getBasicScope(String type,
                              String name)

  Get a child scope by name.

  Parameters:
    `name` - Name of the child scope
    `type` - Child scope type
  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:
    `IClient.getConnections(IScope)`

### getConnections

    Collection<Set<IConnection>> getConnections()

  Get a connection iterator. You can call remove, and the connection will be closed.

  Returns:
    Iterator holding all connections

### lookupConnections

    Set<IConnection> lookupConnections(IClient client)

  Lookup connections.

  Parameters:
    `client` - object
  Returns:
    Set of connection objects (readonly)

### 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:
    the statistics

Copyright © 2006-2010 The Red5 Project