Package org.red5.server.util
Class ScopeUtils
java.lang.Object
org.red5.server.util.ScopeUtils
Collection of utilities for working with scopes
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IScopefindApplication(IScope from) Returns the application scope for specified scope.static IScopeFinds root scope for specified scope object.static ObjectgetScopeService(IScope scope, Class<?> intf) Returns scope service that implements a given interface.static ObjectgetScopeService(IScope scope, Class<?> intf, boolean checkHandler) static ObjectgetScopeService(IScope scope, Class<?> intf, Class<?> defaultClass) Returns scope service that implements a given interface.static ObjectgetScopeService(IScope scope, Class<?> intf, Class<?> defaultClass, boolean checkHandler) protected static ObjectgetScopeService(IScope scope, String name) Returns scope service by bean name.protected static ObjectgetScopeService(IScope scope, String name, Class<?> defaultClass) Returns scope services (e.g.static booleanisAncestor(IBasicScope from, IBasicScope ancestor) Check whether one scope is an ancestor of anotherstatic booleanisApp(IBasicScope scope) Check whether scope is an application scope (level 1 leaf in scope tree) or notstatic booleanisGlobal(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 booleanisRoom(IBasicScope scope) Check whether scope is a room scope (level 2 leaf in scope tree or lower, e.g.static booleanisRoot(IBasicScope scope) Checks whether scope is root or notstatic IScoperesolveScope(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
-