Package org.red5.server
Class ContextLoader
java.lang.Object
org.red5.server.ContextLoader
- All Implemented Interfaces:
ContextLoaderMXBean,ShutdownMXBean,org.springframework.beans.factory.Aware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
@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
Red5 applications loader
- Author:
- The Red5 Project, Tiago Jacobs (tiago@imdt.com.br), Paul Gregoire (mondain@gmail.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextSpring Application contextprotected ConcurrentMap<String, org.springframework.context.ApplicationContext> Context mapprotected StringContext location filesprotected static org.slf4j.Loggerprotected org.springframework.context.ApplicationContextSpring parent app context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters with JMX and registers a shutdown hook.voiddestroy()Un-loads or un-initializes the contexts; this is a shutdown method for this loader.org.springframework.context.ApplicationContextgetContext(String name) Return context by nameorg.springframework.context.ApplicationContextReturn parent contextvoidinit()Loads context settings from ResourceBundle (.properties file)voidloadContext(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 voidvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetContextsConfig(String contextsConfig) Setter for context config namevoidsetParentContext(String parentContextKey, String appContextId) Sets a parent context for child context based on a given key.voidsetParentContext(org.springframework.context.ApplicationContext parentContext) Setter for parent application contextvoidshutdown()Shut server down.voidunloadContext(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
-
Field Details
-
log
protected static org.slf4j.Logger log -
applicationContext
protected org.springframework.context.ApplicationContext applicationContextSpring Application context -
parentContext
protected org.springframework.context.ApplicationContext parentContextSpring parent app context -
contextsConfig
Context location files -
contextMap
Context map
-
-
Constructor Details
-
ContextLoader
public ContextLoader()
-
-
Method Details
-
afterPropertiesSet
Registers with JMX and registers a shutdown hook.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception- I/O exception, casting exception and others
-
destroy
Un-loads or un-initializes the contexts; this is a shutdown method for this loader.- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Specified by:
destroyin interfaceShutdownMXBean- Throws:
Exception
-
init
Loads context settings from ResourceBundle (.properties file)- Specified by:
initin interfaceContextLoaderMXBean- Throws:
IOException
-
loadContext
Loads a context (Red5 application) and stores it in a context map, then adds it's beans to parent (that is, Red5)- Specified by:
loadContextin interfaceContextLoaderMXBean- Parameters:
name- Context nameconfig- Filename
-
unloadContext
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:
unloadContextin interfaceContextLoaderMXBean- Parameters:
name- Context name
-
shutdown
public void shutdown()Shut server down.- Specified by:
shutdownin interfaceContextLoaderMXBean
-
getContext
Return context by name- Parameters:
name- Context name- Returns:
- Application context for given name
-
setParentContext
Sets a parent context for child context based on a given key.- Specified by:
setParentContextin interfaceContextLoaderMXBean- Parameters:
parentContextKey- key for the parent contextappContextId- id of the child context
-
registerJMX
protected void registerJMX() -
unregisterJMX
protected void unregisterJMX() -
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Parameters:
applicationContext- Spring application context- Throws:
org.springframework.beans.BeansException- Top level exception for app context (that is, in fact, beans factory)
-
setParentContext
public void setParentContext(org.springframework.context.ApplicationContext parentContext) Setter for parent application context- Parameters:
parentContext- Parent Spring application context
-
getParentContext
public org.springframework.context.ApplicationContext getParentContext()Return parent context- Returns:
- parent application context
-
setContextsConfig
Setter for context config name- Specified by:
setContextsConfigin interfaceContextLoaderMXBean- Parameters:
contextsConfig- Context config name
-
getContextsConfig
- Specified by:
getContextsConfigin interfaceContextLoaderMXBean
-