org.red5.server
Class ContextLoader

java.lang.Object
  extended by org.red5.server.ContextLoader
All Implemented Interfaces:
ContextLoaderMBean, ApplicationContextAware

public class ContextLoader
extends Object
implements ApplicationContextAware, ContextLoaderMBean

Red5 applications loader

Author:
The Red5 Project (red5@osflash.org), Tiago Jacobs (tiago@imdt.com.br), Paul Gregoire (mondain@gmail.com)

Field Summary
protected  ApplicationContext applicationContext
          Spring Application context
protected  ConcurrentMap<String,ApplicationContext> contextMap
          Context map
protected  String contextsConfig
          Context location files
protected static Logger log
           
protected  ApplicationContext parentContext
          Spring parent app context
 
Constructor Summary
ContextLoader()
           
 
Method Summary
 ApplicationContext getContext(String name)
          Return context by name
 String getContextsConfig()
           
 ApplicationContext getParentContext()
          Return parent context
 void init()
          Loads context settings from ResourceBundle (.properties file)
 boolean isUseShutdownHook()
          Whether or not the shutdown hook is enabled.
 void loadContext(String name, String config)
          Loads a context (Red5 application) and stores it in a context map, then adds it's beans to parent (that is, Red5)
 void setApplicationContext(ApplicationContext applicationContext)
           
 void setContextsConfig(String contextsConfig)
          Setter for context config name
 void setParentContext(ApplicationContext parentContext)
          Setter for parent application context
 void setUseShutdownHook(boolean useShutdownHook)
          Enables or disables the shutdown hook.
 void uninit()
          Un-loads or un-initializes the contexts; this is a shutdown method for this loader.
 void unloadContext(String name)
          Unloads a context (Red5 application) and removes it from the context map, then removes it's beans from the parent (that is, Red5)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Logger log

applicationContext

protected ApplicationContext applicationContext
Spring Application context


parentContext

protected ApplicationContext parentContext
Spring parent app context


contextsConfig

protected String contextsConfig
Context location files


contextMap

protected ConcurrentMap<String,ApplicationContext> contextMap
Context map

Constructor Detail

ContextLoader

public ContextLoader()
Method Detail

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException
Specified by:
setApplicationContext in interface ApplicationContextAware
Parameters:
applicationContext - Spring application context
Throws:
BeansException - Top level exception for app context (that is, in fact, beans factory)

setParentContext

public void setParentContext(ApplicationContext parentContext)
Setter for parent application context

Parameters:
parentContext - Parent Spring application context

setContextsConfig

public void setContextsConfig(String contextsConfig)
Setter for context config name

Specified by:
setContextsConfig in interface ContextLoaderMBean
Parameters:
contextsConfig - Context config name

isUseShutdownHook

public boolean isUseShutdownHook()
Whether or not the shutdown hook is enabled.

Returns:
true if enabled, false otherwise

setUseShutdownHook

public void setUseShutdownHook(boolean useShutdownHook)
Enables or disables the shutdown hook.

Parameters:
useShutdownHook - true to enable, false to disable

init

public void init()
          throws Exception
Loads context settings from ResourceBundle (.properties file)

Specified by:
init in interface ContextLoaderMBean
Throws:
Exception - I/O exception, casting exception and others

uninit

public void uninit()
Un-loads or un-initializes the contexts; this is a shutdown method for this loader.

Specified by:
uninit in interface ContextLoaderMBean

loadContext

public void loadContext(String name,
                        String config)
Loads a context (Red5 application) and stores it in a context map, then adds it's beans to parent (that is, Red5)

Specified by:
loadContext in interface ContextLoaderMBean
Parameters:
name - Context name
config - Filename

unloadContext

public void unloadContext(String name)
Unloads a context (Red5 application) and removes it from the context map, then removes it's beans from the parent (that is, Red5)

Specified by:
unloadContext in interface ContextLoaderMBean
Parameters:
name - Context name

getContext

public ApplicationContext getContext(String name)
Return context by name

Specified by:
getContext in interface ContextLoaderMBean
Parameters:
name - Context name
Returns:
Application context for given name

getParentContext

public ApplicationContext getParentContext()
Return parent context

Specified by:
getParentContext in interface ContextLoaderMBean
Returns:
parent application context

getContextsConfig

public String getContextsConfig()
Specified by:
getContextsConfig in interface ContextLoaderMBean


Copyright © 2006-2010 The Red5 Project