public class Server extends Object implements IServer, ApplicationContextAware, InitializingBean, DisposableBean
| Modifier and Type | Field and Description |
|---|---|
protected ApplicationContext |
applicationContext
Spring application context
|
Set<IConnectionListener> |
connectionListeners |
protected static String |
EMPTY
Constant for empty string
|
protected ConcurrentMap<String,IGlobalScope> |
globals
List of global scopes
|
protected static org.slf4j.Logger |
log |
protected ConcurrentMap<String,String> |
mapping
Mappings
|
Set<IScopeListener> |
scopeListeners |
protected static String |
SLASH
Constant for slash
|
| Constructor and Description |
|---|
Server() |
| Modifier and Type | Method and Description |
|---|---|
void |
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 name
|
void |
afterPropertiesSet()
Initialization section.
|
void |
destroy()
Destruction section.
|
IGlobalScope |
getGlobal(String name)
Return global scope by name
|
Iterator<String> |
getGlobalNames()
Return global scope names set iterator
|
Iterator<IGlobalScope> |
getGlobalScopes()
Return global scopes set iterator
|
protected String |
getKey(String hostName,
String contextPath)
Return scope key.
|
Map<String,String> |
getMappingTable()
Return mapping
|
IGlobalScope |
lookupGlobal(String hostName,
String contextPath)
Does global scope lookup for host name and context path
|
void |
notifyConnected(IConnection conn)
Notify listeners that a new connection was established.
|
void |
notifyDisconnected(IConnection conn)
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 scope
|
void |
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 path
|
boolean |
removeMapping(String hostName,
String contextPath)
Remove mapping with given key
|
void |
setApplicationContext(ApplicationContext applicationContext)
Setter for Spring application context
|
String |
toString()
String representation of server
|
protected static org.slf4j.Logger log
protected ConcurrentMap<String,IGlobalScope> globals
protected ConcurrentMap<String,String> mapping
protected ApplicationContext applicationContext
protected static final String SLASH
protected static final String EMPTY
public Set<IScopeListener> scopeListeners
public Set<IConnectionListener> connectionListeners
public void setApplicationContext(ApplicationContext applicationContext)
setApplicationContext in interface ApplicationContextAwareapplicationContext - Application contextpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface InitializingBeanExceptionpublic void destroy()
throws Exception
destroy in interface DisposableBeanExceptionprotected String getKey(String hostName, String contextPath)
hostName - Host namecontextPath - Context pathpublic IGlobalScope lookupGlobal(String hostName, String contextPath)
lookupGlobal in interface IServerhostName - Host namecontextPath - Context pathpublic IGlobalScope getGlobal(String name)
public void registerGlobal(IGlobalScope scope)
registerGlobal in interface IServerscope - Global scope to registerpublic boolean addMapping(String hostName, String contextPath, String globalName)
addMapping in interface IServerhostName - Host namecontextPath - Context pathglobalName - Global scope namepublic boolean removeMapping(String hostName, String contextPath)
removeMapping in interface IServerhostName - Host namecontextPath - Context pathpublic boolean removeMapping(String contextPath)
contextPath - Context pathpublic Map<String,String> getMappingTable()
getMappingTable in interface IServerpublic Iterator<String> getGlobalNames()
getGlobalNames in interface IServerpublic Iterator<IGlobalScope> getGlobalScopes()
getGlobalScopes in interface IServerpublic String toString()
public void addListener(IScopeListener listener)
addListener in interface IServerlistener - the listener to addpublic void addListener(IConnectionListener listener)
addListener in interface IServerlistener - the listener to addpublic void removeListener(IScopeListener listener)
removeListener in interface IServerlistener - the listener to removepublic void removeListener(IConnectionListener listener)
removeListener in interface IServerlistener - the listener to removepublic void notifyScopeCreated(IScope scope)
scope - the scope that was createdpublic void notifyScopeRemoved(IScope scope)
scope - the scope that was removedpublic void notifyConnected(IConnection conn)
conn - the new connectionpublic void notifyDisconnected(IConnection conn)
conn - the disconnected connectionCopyright © 2005–2017 Red5. All rights reserved.