@ManagedResource(objectName="org.red5.server:type=Scope", description="Scope") public class Scope extends BasicScope implements IScope, IScopeStatistics, ScopeMXBean
/Global scope - Contains application scopes
/Application scope - Contains room, shared object, and stream scopes
/Room scope - Contains other room, shared object, and / or stream scopes
/Shared object scope - Contains shared object
/Broadcast stream scope - Contains a broadcast stream
| Modifier and Type | Class and Description |
|---|---|
static class |
Scope.Builder
Builder pattern
|
| Modifier and Type | Field and Description |
|---|---|
protected AttributeStore |
attributes
Storage for scope attributes
|
protected StatisticsCounter |
connectionStats
Statistics about connections to the scope.
|
protected static org.slf4j.Logger |
log |
protected ObjectName |
oName
Mbean object name.
|
protected StatisticsCounter |
subscopeStats
Statistics about sub-scopes.
|
creation, keepDelay, keepOnDisconnect, listeners, name, parent, persistenceClass, persistent, securityHandlers, store, typeCLASSPATH_ALL_URL_PREFIXCLASSPATH_URL_PREFIX| Constructor and Description |
|---|
Scope()
Creates a scope
|
Scope(Scope.Builder builder)
Creates scope using a Builder
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addChildScope(IBasicScope scope)
Add child scope to this scope
|
boolean |
connect(IConnection conn)
Connect to scope
|
boolean |
connect(IConnection conn,
Object[] params)
Connect to scope with parameters.
|
boolean |
createChildScope(String name)
Create child scope of room type, with the given name.
|
void |
destroy()
Destroys scope
|
void |
disconnect(IConnection conn)
Disconnect connection from scope
|
void |
dispatchEvent(IEvent event)
Dispatches event (notifies all listeners)
|
void |
dump() |
boolean |
equals(Object obj)
Equality is based on the scope's name and type.
|
static Scope |
from(CompositeData cd)
Allows for reconstruction via CompositeData.
|
int |
getActiveClients()
Return current number of clients connected to the scope.
|
int |
getActiveConnections()
Return current number of connections to the scope.
|
int |
getActiveSubscopes()
Return number of currently existing subscopes.
|
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)
Return base scope of given type with given name
|
Set<String> |
getBasicScopeNames(ScopeType type)
Return basic scope names matching given type
|
IBroadcastScope |
getBroadcastScope(String name)
Return the broadcast scope for a given name
|
ClassLoader |
getClassLoader()
Return current thread context classloader
|
Set<IConnection> |
getClientConnections()
Get all current connections.
|
Set<IClient> |
getClients()
Return set of clients
|
Collection<Set<IConnection>> |
getConnections()
Deprecated.
|
IContext |
getContext()
Return scope context.
|
String |
getContextPath()
Return scope context path
|
long |
getCreationTime()
Return the timestamp the object was created.
|
int |
getDepth()
return scope depth
|
boolean |
getEnabled()
Here for JMX only, uses isEnabled()
|
IScopeHandler |
getHandler()
Return scope handler or parent's scope handler if this scope doesn't have one.
|
int |
getMaxClients()
Deprecated.
|
int |
getMaxConnections()
Return maximum number of concurrent connections to the scope.
|
int |
getMaxSubscopes()
Return maximum number of concurrently existing subscopes.
|
IScope |
getParent()
Return parent scope
|
String |
getPath()
Return scope path calculated from parent path and parent scope name
|
Resource |
getResource(String path)
Return resource located at given path
|
Resource[] |
getResources(String path)
Return array of resources from path string, usually used with pattern path
|
boolean |
getRunning()
Here for JMX only, uses isEnabled()
|
IScope |
getScope(String name)
Return child scope by name
|
Set<String> |
getScopeNames()
Return child scope names iterator
|
IServer |
getServer()
Return the server instance connected to this scope.
|
Object |
getServiceHandler(String name)
Return service handler by name
|
Set<String> |
getServiceHandlerNames()
Return set of service handler names.
|
protected Map<String,Object> |
getServiceHandlers()
Return map of service handlers.
|
protected Map<String,Object> |
getServiceHandlers(boolean allowCreate)
Return map of service handlers and optionally created it if it doesn't exist.
|
IScopeStatistics |
getStatistics()
Return statistics informations about the scope.
|
int |
getTotalClients()
Deprecated.
|
int |
getTotalConnections()
Return total number of connections to the scope.
|
int |
getTotalSubscopes()
Return total number of subscopes created.
|
boolean |
handleEvent(IEvent event)
Handles event.
|
boolean |
hasAttribute(String name)
Whether or not an attribute exists, keyed by the given name
|
boolean |
hasChildScope(ScopeType type,
String name)
Check whether scope has child scope with given name and type
|
boolean |
hasChildScope(String name)
Check whether scope has child scope with given name
|
boolean |
hasContext()
Check if scope has a context
|
boolean |
hasHandler()
Check if scope or it's parent has handler
|
int |
hashCode()
Hash code is based on the scope's name and type
|
boolean |
hasParent()
Check if scope has parent scope
|
void |
init()
Initialization actions, start if autostart is set to true.
|
boolean |
isEnabled()
Check if scope is enabled
|
boolean |
isRunning()
Check if scope is in running state
|
IConnection |
lookupConnection(IClient client)
Lookup connection for a given client.
|
Set<IConnection> |
lookupConnections(IClient client)
Deprecated.
|
protected void |
registerJMX() |
void |
registerServiceHandler(String name,
Object handler)
Register service handler by name
|
boolean |
removeAttribute(String name)
Remove attribute by name
|
void |
removeChildren()
Removes all the child scopes
|
void |
removeChildScope(IBasicScope scope)
Removes child scope
|
boolean |
setAttribute(String name,
Object value)
Set attribute by name
|
void |
setAutoStart(boolean autoStart)
Setter for autostart flag
|
void |
setChildLoadPath(String pattern)
Setter for child load path.
|
void |
setContext(IContext context)
Setter for context
|
void |
setDepth(int depth)
Set scope depth
|
void |
setEnabled(boolean enabled)
Enable or disable scope by setting enable flag
|
void |
setHandler(IScopeHandler handler)
Setter for scope event handler
|
void |
setName(String name)
Setter for scope name
|
void |
setParent(IScope parent)
Setter for parent scope
|
void |
setPersistenceClass(String persistenceClass)
Set scope persistence class
|
boolean |
start()
Starts scope
|
void |
stop()
Stops scope
|
String |
toString() |
void |
uninit()
Uninitialize scope and unregister from parent.
|
protected void |
unregisterJMX() |
void |
unregisterServiceHandler(String name)
Unregisters service handler by name
|
addEventListener, compareTo, getEventListeners, getName, getStore, getType, hasEventListeners, isConnectionAllowed, isScopeAllowed, isValid, notifyEvent, removeEventListener, setKeepDelay, setSecurityHandlersclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetName, getStore, getType, isConnectionAllowed, isScopeAllowed, isValid, setKeepDelay, setSecurityHandlersnotifyEventaddEventListener, getEventListeners, removeEventListenergetNameprotected static org.slf4j.Logger log
protected final transient StatisticsCounter connectionStats
protected final transient StatisticsCounter subscopeStats
protected final AttributeStore attributes
protected ObjectName oName
@ConstructorProperties(value="") public Scope()
@ConstructorProperties(value="builder") public Scope(Scope.Builder builder)
builder - Builderpublic boolean addChildScope(IBasicScope scope)
addChildScope in interface IScopescope - Child scopepublic boolean connect(IConnection conn)
public boolean connect(IConnection conn, Object[] params)
public boolean createChildScope(String name)
createChildScope in interface IScopecreateChildScope in interface ScopeMXBeanname - child scope namepublic void destroy()
throws Exception
destroy in interface ScopeMXBeanException - on errorpublic void disconnect(IConnection conn)
disconnect in interface IScopeconn - Connection objectpublic void dispatchEvent(IEvent event)
dispatchEvent in interface IEventDispatcherdispatchEvent in class BasicScopeevent - Event to dispatchpublic Object getAttribute(String name)
getAttribute in interface IScopename - namepublic boolean setAttribute(String name, Object value)
setAttribute in interface IScopename - namevalue - valuepublic boolean hasAttribute(String name)
hasAttribute in interface IScopename - namepublic boolean removeAttribute(String name)
removeAttribute in interface IScopename - namepublic Set<String> getAttributeNames()
getAttributeNames in interface IScopepublic Map<String,Object> getAttributes()
getAttributes in interface IScopepublic int getActiveClients()
getActiveClients in interface IScopeStatisticsgetActiveClients in interface ScopeMXBeanpublic int getActiveConnections()
getActiveConnections in interface IScopeStatisticsgetActiveConnections in interface ScopeMXBeanpublic int getActiveSubscopes()
getActiveSubscopes in interface IScopeStatisticsgetActiveSubscopes in interface ScopeMXBeanpublic IBroadcastScope getBroadcastScope(String name)
getBroadcastScope in interface IScopename - namepublic IBasicScope getBasicScope(ScopeType type, String name)
getBasicScope in interface IScopetype - Scope typename - Scope namepublic Set<String> getBasicScopeNames(ScopeType type)
getBasicScopeNames in interface IScopetype - Scope typepublic ClassLoader getClassLoader()
getClassLoader in interface ResourceLoaderpublic Set<IClient> getClients()
getClients in interface IScopeIClient.getConnections(IScope)@Deprecated public Collection<Set<IConnection>> getConnections()
getConnections in interface IScopepublic Set<IConnection> getClientConnections()
getClientConnections in interface IScope@Deprecated public Set<IConnection> lookupConnections(IClient client)
lookupConnections in interface IScopeclient - objectpublic IConnection lookupConnection(IClient client)
lookupConnection in interface IScopeclient - objectpublic IContext getContext()
getContext in interface IScopepublic String getContextPath()
getContextPath in interface IScopegetContextPath in interface ScopeMXBeanpublic long getCreationTime()
getCreationTime in interface IStatisticsBasepublic int getDepth()
getDepth in interface IBasicScopegetDepth in interface IScopeStatisticsgetDepth in interface ScopeMXBeangetDepth in class BasicScopepublic IScopeHandler getHandler()
getHandler in interface IScope@Deprecated public int getMaxClients()
getMaxClients in interface IScopeStatisticsgetMaxClients in interface ScopeMXBeanpublic int getMaxConnections()
getMaxConnections in interface IScopeStatisticsgetMaxConnections in interface ScopeMXBeanpublic int getMaxSubscopes()
getMaxSubscopes in interface IScopeStatisticsgetMaxSubscopes in interface ScopeMXBeanpublic IScope getParent()
getParent in interface IBasicScopegetParent in class BasicScopepublic String getPath()
getPath in interface IBasicScopegetPath in interface IScopeStatisticsgetPath in interface ScopeMXBeangetPath in class BasicScopepublic Resource getResource(String path)
getResource in interface ResourceLoaderpath - Resource pathpublic Resource[] getResources(String path) throws IOException
getResources in interface ResourcePatternResolverpath - Resources pathIOException - I/O exceptionpublic Set<String> getScopeNames()
getScopeNames in interface IScopepublic Object getServiceHandler(String name)
getServiceHandler in interface IServiceHandlerProvidername - Handler namepublic Set<String> getServiceHandlerNames()
getServiceHandlerNames in interface IServiceHandlerProvidergetServiceHandlerNames in interface ScopeMXBeanprotected Map<String,Object> getServiceHandlers()
protected Map<String,Object> getServiceHandlers(boolean allowCreate)
allowCreate - Should the map be created if it doesn't exist?public IScopeStatistics getStatistics()
getStatistics in interface IScope@Deprecated public int getTotalClients()
getTotalClients in interface IScopeStatisticsgetTotalClients in interface ScopeMXBeanpublic int getTotalConnections()
getTotalConnections in interface IScopeStatisticsgetTotalConnections in interface ScopeMXBeanpublic int getTotalSubscopes()
getTotalSubscopes in interface IScopeStatisticsgetTotalSubscopes in interface ScopeMXBeanpublic boolean handleEvent(IEvent event)
handleEvent in interface IEventHandlerhandleEvent in class BasicScopeevent - Event to handlepublic boolean hasChildScope(String name)
hasChildScope in interface IScopehasChildScope in interface ScopeMXBeanname - Child scope namepublic boolean hasChildScope(ScopeType type, String name)
hasChildScope in interface IScopehasChildScope in interface ScopeMXBeantype - Child scope typename - Child scope namepublic boolean hasContext()
hasContext in interface ScopeMXBeanpublic boolean hasHandler()
hasHandler in interface IScopehasHandler in interface ScopeMXBeanpublic boolean hasParent()
hasParent in interface IBasicScopehasParent in interface ScopeMXBeanhasParent in class BasicScopepublic void init()
init in interface ScopeMXBeanpublic void uninit()
public boolean isEnabled()
public boolean getEnabled()
getEnabled in interface ScopeMXBeantrueif scope is enabled,
falseotherwise
public boolean isRunning()
public boolean getRunning()
getRunning in interface ScopeMXBeantrueif scope is in running state,
falseotherwise
public void registerServiceHandler(String name, Object handler)
registerServiceHandler in interface IServiceHandlerProvidername - Service handler namehandler - Service handlerpublic void removeChildScope(IBasicScope scope)
removeChildScope in interface IScopescope - Child scope to removepublic void removeChildren()
removeChildren in interface IScopepublic void setAutoStart(boolean autoStart)
setAutoStart in interface ScopeMXBeanautoStart - Autostart flag valuepublic void setChildLoadPath(String pattern)
setChildLoadPath in interface ScopeMXBeanpattern - Load path patternpublic void setContext(IContext context)
context - Context objectpublic void setDepth(int depth)
setDepth in interface ScopeMXBeandepth - Scope depthpublic void setEnabled(boolean enabled)
setEnabled in interface ScopeMXBeanenabled - Enable flag valuepublic void setHandler(IScopeHandler handler)
handler - Event handlerpublic final void setName(String name)
setName in interface ScopeMXBeanname - Scope namepublic void setParent(IScope parent)
parent - Parent scopepublic void setPersistenceClass(String persistenceClass) throws Exception
setPersistenceClass in interface ScopeMXBeanpersistenceClass - Scope's persistence classException - Exceptionpublic boolean start()
start in interface ScopeMXBeanpublic void stop()
stop in interface ScopeMXBeanpublic void unregisterServiceHandler(String name)
unregisterServiceHandler in interface IServiceHandlerProviderunregisterServiceHandler in interface ScopeMXBeanname - Service handler namepublic IServer getServer()
public void dump()
protected void registerJMX()
protected void unregisterJMX()
public static Scope from(CompositeData cd)
cd - composite datapublic int hashCode()
BasicScopehashCode in class BasicScopepublic boolean equals(Object obj)
BasicScopeequals in class BasicScopeobj - objectCopyright © 2005–2017 Red5. All rights reserved.