Package org.red5.server.util
Class ScopeUtils
java.lang.Object
org.red5.server.util.ScopeUtils
Collection of utilities for working with scopes
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic IScope
findApplication
(IScope from) Returns the application scope for specified scope.static IScope
Finds root scope for specified scope object.static Object
getScopeService
(IScope scope, Class<?> intf) Returns scope service that implements a given interface.static Object
getScopeService
(IScope scope, Class<?> intf, boolean checkHandler) static Object
getScopeService
(IScope scope, Class<?> intf, Class<?> defaultClass) Returns scope service that implements a given interface.static Object
getScopeService
(IScope scope, Class<?> intf, Class<?> defaultClass, boolean checkHandler) protected static Object
getScopeService
(IScope scope, String name) Returns scope service by bean name.protected static Object
getScopeService
(IScope scope, String name, Class<?> defaultClass) Returns scope services (e.g.static boolean
isAncestor
(IBasicScope from, IBasicScope ancestor) Check whether one scope is an ancestor of anotherstatic boolean
isApp
(IBasicScope scope) Check whether scope is an application scope (level 1 leaf in scope tree) or notstatic boolean
isGlobal
(IBasicScope scope) Check whether scope is the global scope (level 0 leaf in scope tree) or not When user connects the following URL: rtmp://localhost/myapp/foo/bar then / is the global level scope, myapp is app level, foo is room level and bar is room level as well (but with higher depth level)static boolean
isRoom
(IBasicScope scope) Check whether scope is a room scope (level 2 leaf in scope tree or lower, e.g.static boolean
isRoot
(IBasicScope scope) Checks whether scope is root or notstatic IScope
resolveScope
(IScope from, String path) Resolves scope for specified scope and path.
-
Field Details
-
log
private static final org.slf4j.Logger log -
SERVICE_CACHE_PREFIX
- See Also:
-
SLASH
Constant for slash symbol- See Also:
-
-
Constructor Details
-
ScopeUtils
public ScopeUtils()
-
-
Method Details
-
resolveScope
Resolves scope for specified scope and path.- Parameters:
from
- Scope to use as context (to start from)path
- Path to resolve- Returns:
- Resolved scope
-
findRoot
Finds root scope for specified scope object. Root scope is the top level scope among scope's parents.- Parameters:
from
- Scope to find root for- Returns:
- Root scope object
-
findApplication
Returns the application scope for specified scope. Application scope has depth of 1 and has no parent. SeeisApp
method for details.- Parameters:
from
- Scope to find application for- Returns:
- Application scope.
-
isAncestor
Check whether one scope is an ancestor of another- Parameters:
from
- Scopeancestor
- Scope to check- Returns:
true
if ancestor scope is really an ancestor of scope passed as from parameter,false
otherwise.
-
isRoot
Checks whether scope is root or not- Parameters:
scope
- Scope to check- Returns:
true
if scope is root scope (top level scope),false
otherwise.
-
isGlobal
Check whether scope is the global scope (level 0 leaf in scope tree) or not When user connects the following URL: rtmp://localhost/myapp/foo/bar then / is the global level scope, myapp is app level, foo is room level and bar is room level as well (but with higher depth level)- Parameters:
scope
- Scope to check- Returns:
true
if scope is the global scope,false
otherwise.
-
isApp
Check whether scope is an application scope (level 1 leaf in scope tree) or not- Parameters:
scope
- Scope to check- Returns:
true
if scope is an application scope,false
otherwise.
-
isRoom
Check whether scope is a room scope (level 2 leaf in scope tree or lower, e.g. 3, 4, ...) or not- Parameters:
scope
- Scope to check- Returns:
true
if scope is a room scope,false
otherwise.
-
getScopeService
Returns scope service by bean name. See overloaded method for details.- Parameters:
scope
- scopename
- name- Returns:
- object
-
getScopeService
Returns scope services (e.g. SharedObject, etc) for the scope. Method uses either bean name passes as a string or class object.- Parameters:
scope
- The scope service belongs toname
- Bean namedefaultClass
- Class of service- Returns:
- Service object
-
getScopeService
Returns scope service that implements a given interface.- Parameters:
scope
- The scope service belongs tointf
- The interface the service must implement- Returns:
- Service object
-
getScopeService
-
getScopeService
Returns scope service that implements a given interface.- Parameters:
scope
- The scope service belongs tointf
- The interface the service must implementdefaultClass
- Class that should be used to create a new service if no service was found.- Returns:
- Service object
-
getScopeService
-