org.red5.server.api.scope

## Interface IScope

All Superinterfaces:
  IBasicScope, ICoreObject, IEventDispatcher, IEventHandler, IEventListener, IEventObservable, IServiceHandlerProvider, org.springframework.core.io.ResourceLoader, org.springframework.core.io.support.ResourcePatternResolver

All Known Subinterfaces:
  IGlobalScope

All Known Implementing Classes:
  GlobalScope, RoomScope, Scope, WebScope

    public interface IScope
    extends IBasicScope, org.springframework.core.io.support.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

Fields
`static String` `SEPARATOR` Scope separator

### 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

Methods
`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.
`Object` `getAttribute(String name)` Get attribute by name
`Set<String>` `getAttributeNames()` Return attribute names
`Map<String,Object>` `getAttributes()` Return scope attributes
`IBasicScope` `getBasicScope(ScopeType type, String name)` Get a child scope by type and name.
`Set<String>` `getBasicScopeNames(ScopeType type)`
`IBroadcastScope` `getBroadcastScope(String name)` Return the broadcast scope for a given name
`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
`Set<String>` `getScopeNames()` Get a set of the child scope names.
`IScopeStatistics` `getStatistics()` Return statistics informations about the scope.
`boolean` `hasAttribute(String name)` Whether or not an attribute exists, keyed by the given name
`boolean` `hasChildScope(ScopeType type, String name)` Checks whether scope has a child scope with given name and type
`boolean` `hasChildScope(String name)` Check to see if this scope has a child scope matching a given name.
`boolean` `hasHandler()` Checks whether scope has handler or not.
`Set<IConnection>` `lookupConnections(IClient client)` Lookup connections.
`boolean` `removeAttribute(String name)` Remove attribute by name
`void` `removeChildren()` Removes all the child scopes
`void` `removeChildScope(IBasicScope scope)` Removes scope from the children scope list.
`boolean` `setAttribute(String name, Object value)` Set attribute by name

### Methods inherited from interface org.red5.server.api.scope.IBasicScope

`getDepth, getName, getParent, getPath, getStore, getType, hasParent, isValid, setKeepDelay`

### 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 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

#### 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(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, `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.

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` -
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:
  `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:
  statistics

#### setAttribute

    boolean setAttribute(String name,
                       Object value)

Set attribute by name

Parameters:
  `name` -
  `value` -
Returns:
  true if added, false if not added

#### getAttribute

    Object getAttribute(String name)

Get attribute by name

Parameters:
  `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` -
Returns:
  true if it exists, false otherwise

#### removeAttribute

    boolean removeAttribute(String name)

Remove attribute by name

Parameters:
  `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