Package org.red5.server.api.scope
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 Summary
Fields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addChildScope
(IBasicScope scope) Adds scope as a child scope.boolean
connect
(IConnection conn) Adds given connection to the scopeboolean
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.getAttribute
(String name) Get attribute by nameReturn attribute namesReturn scope attributesgetBasicScope
(ScopeType type, String name) Get a child scope by type and name.getBasicScopeNames
(ScopeType type) getBroadcastScope
(String name) Return the broadcast scope for a given name.Get all current connections.Get a set of connected clients.Deprecated.Returns scope contextReturn context path.Return handler of the scopeReturn scope by nameGet a set of the child scope names.Return statistics informations about the scope.boolean
hasAttribute
(String name) Whether or not an attribute exists, keyed by the given nameboolean
hasChildScope
(String name) Check to see if this scope has a child scope matching a given name.boolean
hasChildScope
(ScopeType type, String name) Checks whether scope has a child scope with given name and typeboolean
Checks whether scope has handler or not.lookupConnection
(IClient client) Lookup connection for a given client.lookupConnections
(IClient client) Deprecated.UselookupConnection(IClient)
insteadboolean
removeAttribute
(String name) Remove attribute by namevoid
Removes all the child scopesvoid
removeChildScope
(IBasicScope scope) Removes scope from the children scope list.boolean
setAttribute
(String name, Object value) Set attribute by nameMethods inherited from interface org.red5.server.api.scope.IBasicScope
getDepth, getName, getParent, getPath, getStore, getType, hasParent, isConnectionAllowed, isScopeAllowed, isValid, setKeepDelay, setSecurityHandlers
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.red5.server.api.service.IServiceHandlerProvider
getServiceHandler, getServiceHandlerNames, registerServiceHandler, unregisterServiceHandler
Methods inherited from interface org.springframework.core.io.ResourceLoader
getClassLoader, getResource
Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver
getResources
-
Field Details
-
SEPARATOR
Scope separator- See Also:
-
-
Method Details
-
hasChildScope
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
Checks whether scope has a child scope with given name and type- Parameters:
type
- Child scope typename
- Child scope name- Returns:
- true if a child scope exists, otherwise false
-
createChildScope
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
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
Removes scope from the children scope list.- Parameters:
scope
- Scope given
-
removeChildren
void removeChildren()Removes all the child scopes -
getScopeNames
Get a set of the child scope names.- Returns:
- set containing child scope names
-
getBasicScopeNames
-
getBroadcastScope
Return the broadcast scope for a given name.- Parameters:
name
- name- Returns:
- broadcast scope or null if not found
-
getBasicScope
Get a child scope by type and name.- Parameters:
type
- Child scope typename
- Name of the child scope- Returns:
- the child scope, or null if no scope is found
-
getScope
Return scope by name- Parameters:
name
- Scope name- Returns:
- Scope with given name
-
getClients
Get a set of connected clients. You can get the connections by passing the scope to the clientsIClient.getConnections()
method.- Returns:
- Set containing all connected clients
- See Also:
-
getConnections
Deprecated.UsegetClientConnections()
insteadGet 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.UselookupConnection(IClient)
insteadLookup connections.- Parameters:
client
- object- Returns:
- Set of connection objects (read-only)
-
lookupConnection
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
Adds given connection to the scope- Parameters:
conn
- Given connection- Returns:
- true on success, false if given connection already belongs to this scope
-
connect
Add given connection to the scope, overloaded for parameters pass case.- Parameters:
conn
- Given connectionparams
- Parameters passed- Returns:
- true on success, false if given connection already belongs to this scope
-
disconnect
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
Set attribute by name- Parameters:
name
- namevalue
- value- Returns:
- true if added, false if not added
-
getAttribute
Get attribute by name- Parameters:
name
- name- Returns:
- value for the given name in the attributes or null if not found
-
hasAttribute
Whether or not an attribute exists, keyed by the given name- Parameters:
name
- name- Returns:
- true if it exists, false otherwise
-
removeAttribute
Remove attribute by name- Parameters:
name
- name- Returns:
- true if removed, false otherwise
-
getAttributeNames
Return attribute names- Returns:
- attribute names
-
getAttributes
Return scope attributes- Returns:
- attributes
-
getClientConnections()
instead