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.
  • Field Details

  • Constructor Details

    • Server

      public Server()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(ApplicationContext applicationContext)
      Setter for Spring application context
      Specified by:
      setApplicationContext in interface ApplicationContextAware
      Parameters:
      applicationContext - Application context
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Initialization section.
      Specified by:
      afterPropertiesSet in interface InitializingBean
      Throws:
      Exception
    • destroy

      public void destroy() throws Exception
      Destruction section.
      Specified by:
      destroy in interface DisposableBean
      Throws:
      Exception
    • getKey

      protected String getKey(String hostName, String contextPath)
      Return scope key. Scope key consists of host name concatenated with context path by slash symbol
      Parameters:
      hostName - Host name
      contextPath - Context path
      Returns:
      Scope key as string
    • lookupGlobal

      public IGlobalScope lookupGlobal(String hostName, String contextPath)
      Does global scope lookup for host name and context path
      Specified by:
      lookupGlobal in interface IServer
      Parameters:
      hostName - Host name
      contextPath - Context path
      Returns:
      Global scope
    • getGlobal

      public IGlobalScope getGlobal(String name)
      Return global scope by name
      Specified by:
      getGlobal in interface IServer
      Parameters:
      name - Global scope name
      Returns:
      Global scope
    • registerGlobal

      public void registerGlobal(IGlobalScope scope)
      Register global scope
      Specified by:
      registerGlobal in interface IServer
      Parameters:
      scope - Global scope to register
    • addMapping

      public boolean addMapping(String hostName, String contextPath, String globalName)
      Map key (host + / + context path) and global scope name
      Specified by:
      addMapping in interface IServer
      Parameters:
      hostName - Host name
      contextPath - Context path
      globalName - Global scope name
      Returns:
      true if mapping was added, false if already exist
    • removeMapping

      public boolean removeMapping(String hostName, String contextPath)
      Remove mapping with given key
      Specified by:
      removeMapping in interface IServer
      Parameters:
      hostName - Host name
      contextPath - Context path
      Returns:
      true if mapping was removed, false if key doesn't exist
    • removeMapping

      public boolean removeMapping(String contextPath)
      Remove all mappings with given context path
      Parameters:
      contextPath - Context path
      Returns:
      true if mapping was removed, false if key doesn't exist
    • getMappingTable

      public Map<String,String> getMappingTable()
      Return mapping
      Specified by:
      getMappingTable in interface IServer
      Returns:
      Map of "scope key / scope name" pairs
    • getGlobalNames

      public Iterator<String> getGlobalNames()
      Return global scope names set iterator
      Specified by:
      getGlobalNames in interface IServer
      Returns:
      Iterator
    • getGlobalScopes

      public Iterator<IGlobalScope> getGlobalScopes()
      Return global scopes set iterator
      Specified by:
      getGlobalScopes in interface IServer
      Returns:
      Iterator
    • toString

      public String toString()
      String representation of server
      Overrides:
      toString in class Object
      Returns:
      String representation of server
    • addListener

      public void addListener(IScopeListener listener)
      Add listener to get notified about scope events.
      Specified by:
      addListener in interface IServer
      Parameters:
      listener - the listener to add
    • addListener

      public void addListener(IConnectionListener listener)
      Add listener to get notified about connection events.
      Specified by:
      addListener in interface IServer
      Parameters:
      listener - the listener to add
    • removeListener

      public void removeListener(IScopeListener listener)
      Remove listener that got notified about scope events.
      Specified by:
      removeListener in interface IServer
      Parameters:
      listener - the listener to remove
    • removeListener

      public void removeListener(IConnectionListener listener)
      Remove listener that got notified about connection events.
      Specified by:
      removeListener in interface IServer
      Parameters:
      listener - the listener to remove
    • notifyScopeCreated

      public void notifyScopeCreated(IScope scope)
      Notify listeners about a newly created scope.
      Parameters:
      scope - the scope that was created
    • notifyScopeRemoved

      public void notifyScopeRemoved(IScope scope)
      Notify listeners that a scope was removed.
      Parameters:
      scope - the scope that was removed
    • notifyConnected

      public void notifyConnected(IConnection conn)
      Notify listeners that a new connection was established.
      Parameters:
      conn - the new connection
    • notifyDisconnected

      public void notifyDisconnected(IConnection conn)
      Notify listeners that a connection was disconnected.
      Parameters:
      conn - the disconnected connection