@ManagedResource(objectName="org.red5.server:name=contextLoader,type=ContextLoader",
description="ContextLoader")
public class ContextLoader
extends Object
implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, ContextLoaderMXBean
| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.context.ApplicationContext |
applicationContext
Spring Application context
|
protected ConcurrentMap<String,org.springframework.context.ApplicationContext> |
contextMap
Context map
|
protected String |
contextsConfig
Context location files
|
protected static org.slf4j.Logger |
log |
protected org.springframework.context.ApplicationContext |
parentContext
Spring parent app context
|
| Constructor and Description |
|---|
ContextLoader() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Registers with JMX and registers a shutdown hook.
|
void |
destroy()
Un-loads or un-initializes the contexts; this is a shutdown method for this loader.
|
org.springframework.context.ApplicationContext |
getContext(String name)
Return context by name
|
String |
getContextsConfig() |
org.springframework.context.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)
|
protected void |
registerJMX() |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setContextsConfig(String contextsConfig)
Setter for context config name
|
void |
setParentContext(org.springframework.context.ApplicationContext parentContext)
Setter for parent application context
|
void |
setParentContext(String parentContextKey,
String appContextId)
Sets a parent context for child context based on a given key.
|
void |
setUseShutdownHook(boolean useShutdownHook)
Enables or disables the shutdown hook.
|
void |
shutdown()
Shut server down.
|
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)
|
protected void |
unregisterJMX() |
protected static org.slf4j.Logger log
protected org.springframework.context.ApplicationContext applicationContext
protected org.springframework.context.ApplicationContext parentContext
protected String contextsConfig
protected ConcurrentMap<String,org.springframework.context.ApplicationContext> contextMap
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanException - I/O exception, casting exception and otherspublic void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionpublic void init()
throws IOException
init in interface ContextLoaderMXBeanIOExceptionpublic void loadContext(String name, String config)
loadContext in interface ContextLoaderMXBeanname - Context nameconfig - Filenamepublic void unloadContext(String name)
unloadContext in interface ContextLoaderMXBeanname - Context namepublic void shutdown()
shutdown in interface ContextLoaderMXBeanshutdown in interface ShutdownMXBeanpublic org.springframework.context.ApplicationContext getContext(String name)
name - Context namepublic void setParentContext(String parentContextKey, String appContextId)
setParentContext in interface ContextLoaderMXBeanparentContextKey - key for the parent contextappContextId - id of the child contextprotected void registerJMX()
protected void unregisterJMX()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareapplicationContext - Spring application contextorg.springframework.beans.BeansException - Top level exception for app context (that is, in fact, beans
factory)public void setParentContext(org.springframework.context.ApplicationContext parentContext)
parentContext - Parent Spring application contextpublic org.springframework.context.ApplicationContext getParentContext()
public void setContextsConfig(String contextsConfig)
setContextsConfig in interface ContextLoaderMXBeancontextsConfig - Context config namepublic String getContextsConfig()
getContextsConfig in interface ContextLoaderMXBeanpublic boolean isUseShutdownHook()
public void setUseShutdownHook(boolean useShutdownHook)
useShutdownHook - true to enable, false to disableCopyright © 2006-2012 The Red5 Project