Package org.red5.server
Class Server
java.lang.Object
org.red5.server.Server
- All Implemented Interfaces:
IServer
,Aware
,DisposableBean
,InitializingBean
,ApplicationContextAware
public class Server
extends Object
implements IServer, ApplicationContextAware, InitializingBean, DisposableBean
Red5 server core class implementation.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate final class
private final class
private final class
Used to indicate a scope was created.private final class
Used to indicate a scope was removed. -
Field Summary
Modifier and TypeFieldDescriptionprotected ApplicationContext
Spring application contextprotected static final String
Constant for empty stringprotected ConcurrentMap<String,
IGlobalScope> List of global scopesprotected static org.slf4j.Logger
protected ConcurrentMap<String,
String> Mappingsprivate static QuartzSchedulingService
Service used to provide notifications.protected static final String
Constant for slash -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(IConnectionListener listener) Add listener to get notified about connection events.void
addListener
(IScopeListener listener) Add listener to get notified about scope events.boolean
addMapping
(String hostName, String contextPath, String globalName) Map key (host + / + context path) and global scope namevoid
Initialization section.void
destroy()
Destruction section.Return global scope by nameReturn global scope names set iteratorReturn global scopes set iteratorprotected String
Return scope key.Return mappinglookupGlobal
(String hostName, String contextPath) Does global scope lookup for host name and context pathvoid
notifyConnected
(IConnection conn) Notify listeners that a new connection was established.void
Notify listeners that a connection was disconnected.void
notifyScopeCreated
(IScope scope) Notify listeners about a newly created scope.void
notifyScopeRemoved
(IScope scope) Notify listeners that a scope was removed.void
registerGlobal
(IGlobalScope scope) Register global scopevoid
removeListener
(IConnectionListener listener) Remove listener that got notified about connection events.void
removeListener
(IScopeListener listener) Remove listener that got notified about scope events.boolean
removeMapping
(String contextPath) Remove all mappings with given context pathboolean
removeMapping
(String hostName, String contextPath) Remove mapping with given keyvoid
setApplicationContext
(ApplicationContext applicationContext) Setter for Spring application contexttoString()
String representation of server
-
Field Details
-
log
protected static org.slf4j.Logger log -
schedulingService
Service used to provide notifications. -
globals
List of global scopes -
mapping
Mappings -
applicationContext
Spring application context -
SLASH
Constant for slash- See Also:
-
EMPTY
Constant for empty string- See Also:
-
scopeListeners
-
connectionListeners
-
-
Constructor Details
-
Server
public Server()
-
-
Method Details
-
setApplicationContext
Setter for Spring application context- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Parameters:
applicationContext
- Application context
-
afterPropertiesSet
Initialization section.- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Exception
-
destroy
Destruction section.- Specified by:
destroy
in interfaceDisposableBean
- Throws:
Exception
-
getKey
Return scope key. Scope key consists of host name concatenated with context path by slash symbol- Parameters:
hostName
- Host namecontextPath
- Context path- Returns:
- Scope key as string
-
lookupGlobal
Does global scope lookup for host name and context path- Specified by:
lookupGlobal
in interfaceIServer
- Parameters:
hostName
- Host namecontextPath
- Context path- Returns:
- Global scope
-
getGlobal
Return global scope by name -
registerGlobal
Register global scope- Specified by:
registerGlobal
in interfaceIServer
- Parameters:
scope
- Global scope to register
-
addMapping
Map key (host + / + context path) and global scope name- Specified by:
addMapping
in interfaceIServer
- Parameters:
hostName
- Host namecontextPath
- Context pathglobalName
- Global scope name- Returns:
- true if mapping was added, false if already exist
-
removeMapping
Remove mapping with given key- Specified by:
removeMapping
in interfaceIServer
- Parameters:
hostName
- Host namecontextPath
- Context path- Returns:
- true if mapping was removed, false if key doesn't exist
-
removeMapping
Remove all mappings with given context path- Parameters:
contextPath
- Context path- Returns:
- true if mapping was removed, false if key doesn't exist
-
getMappingTable
Return mapping- Specified by:
getMappingTable
in interfaceIServer
- Returns:
- Map of "scope key / scope name" pairs
-
getGlobalNames
Return global scope names set iterator- Specified by:
getGlobalNames
in interfaceIServer
- Returns:
- Iterator
-
getGlobalScopes
Return global scopes set iterator- Specified by:
getGlobalScopes
in interfaceIServer
- Returns:
- Iterator
-
toString
String representation of server -
addListener
Add listener to get notified about scope events.- Specified by:
addListener
in interfaceIServer
- Parameters:
listener
- the listener to add
-
addListener
Add listener to get notified about connection events.- Specified by:
addListener
in interfaceIServer
- Parameters:
listener
- the listener to add
-
removeListener
Remove listener that got notified about scope events.- Specified by:
removeListener
in interfaceIServer
- Parameters:
listener
- the listener to remove
-
removeListener
Remove listener that got notified about connection events.- Specified by:
removeListener
in interfaceIServer
- Parameters:
listener
- the listener to remove
-
notifyScopeCreated
Notify listeners about a newly created scope.- Parameters:
scope
- the scope that was created
-
notifyScopeRemoved
Notify listeners that a scope was removed.- Parameters:
scope
- the scope that was removed
-
notifyConnected
Notify listeners that a new connection was established.- Parameters:
conn
- the new connection
-
notifyDisconnected
Notify listeners that a connection was disconnected.- Parameters:
conn
- the disconnected connection
-