org.red5.server
public class Context extends Object implements IContext, org.springframework.context.ApplicationContextAware, ContextMXBean
This is basic context implementation used by Red5.
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
logger |
Constructor and Description |
---|
Context()
Initializes core context bean factory using red5.core bean factory from
red5.xml context
|
Context(org.springframework.context.ApplicationContext context,
String contextPath)
Initializes app context and context path from given parameters
|
Modifier and Type | Method and Description |
---|---|
static Context |
from(CompositeData cd)
Allows for reconstruction via CompositeData.
|
org.springframework.context.ApplicationContext |
getApplicationContext()
Return application context
|
Object |
getBean(String beanId)
Return bean instantiated by bean factory
|
ClassLoader |
getClassLoader()
Return current thread's context classloader
|
IClientRegistry |
getClientRegistry()
Return client registry
|
Object |
getCoreService(String beanId)
Return core Red5 service instantiated by core context bean factory
|
IGlobalScope |
getGlobalScope()
Return global scope
|
IMappingStrategy |
getMappingStrategy()
Return mapping strategy used by this context.
|
IPersistenceStore |
getPersistanceStore()
Return persistence store
|
org.springframework.core.io.Resource |
getResource(String path)
Return resouce by path
|
org.springframework.core.io.Resource[] |
getResources(String pattern)
Return array or resournce that match given pattern
|
IScope |
getScope()
Return scope
|
IScopeResolver |
getScopeResolver()
Return scope resolver
|
IServiceInvoker |
getServiceInvoker()
Return service invoker
|
boolean |
hasBean(String beanId)
Returns true if the context contains a certain bean,
false otherwise.
|
IScopeHandler |
lookupScopeHandler(String contextPath)
Look up scope handler for context path
|
Object |
lookupService(String serviceName)
Look up service by name
|
IScope |
resolveScope(IScope root,
String path)
Resolves scope from given root using scope resolver.
|
IScope |
resolveScope(String path)
Resolves scope using scope resolver collaborator
|
IScope |
resolveScope(String host,
String path)
Resolve scope from host and path
|
void |
setApplicationContext(org.springframework.context.ApplicationContext context)
Setter for application context
|
void |
setClientRegistry(IClientRegistry clientRegistry)
Setter for client registry
|
void |
setContextPath(String contextPath)
Setter for context path.
|
void |
setCoreBeanFactory(org.springframework.beans.factory.BeanFactory core) |
void |
setMappingStrategy(IMappingStrategy mappingStrategy)
Setter for mapping strategy
|
void |
setPersistanceStore(IPersistenceStore persistanceStore)
Setter for persistence store
|
void |
setScopeResolver(IScopeResolver scopeResolver)
Setter for scope resolver
|
void |
setServiceInvoker(IServiceInvoker serviceInvoker)
Setter for service invoker
|
@ConstructorProperties(value="") public Context()
@ConstructorProperties(value={"context","contextPath"}) public Context(org.springframework.context.ApplicationContext context, String contextPath)
context
- Application contextcontextPath
- Context pathpublic IGlobalScope getGlobalScope()
getGlobalScope
in interface IContext
getGlobalScope
in interface ContextMXBean
public IScopeResolver getScopeResolver()
public IScope resolveScope(String path)
resolveScope
in interface IContext
resolveScope
in interface ContextMXBean
path
- Path to resolvepublic IScope resolveScope(IScope root, String path)
resolveScope
in interface IContext
resolveScope
in interface ContextMXBean
root
- Scope to start from.path
- Path to resolve.public void setClientRegistry(IClientRegistry clientRegistry)
clientRegistry
- Client registrypublic void setMappingStrategy(IMappingStrategy mappingStrategy)
mappingStrategy
- Mapping strategypublic void setScopeResolver(IScopeResolver scopeResolver)
scopeResolver
- Scope resolver used to resolve scopespublic void setServiceInvoker(IServiceInvoker serviceInvoker)
serviceInvoker
- Service invoker objectpublic IPersistenceStore getPersistanceStore()
getPersistanceStore
in interface IContext
getPersistanceStore
in interface ContextMXBean
public void setPersistanceStore(IPersistenceStore persistanceStore)
persistanceStore
- Persistence storepublic void setApplicationContext(org.springframework.context.ApplicationContext context)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
context
- App contextpublic org.springframework.context.ApplicationContext getApplicationContext()
getApplicationContext
in interface IContext
getApplicationContext
in interface ContextMXBean
public void setContextPath(String contextPath)
setContextPath
in interface ContextMXBean
contextPath
- Context pathpublic IClientRegistry getClientRegistry()
getClientRegistry
in interface IContext
getClientRegistry
in interface ContextMXBean
public IScope getScope()
getScope
in interface ContextMXBean
public IServiceInvoker getServiceInvoker()
getServiceInvoker
in interface IContext
getServiceInvoker
in interface ContextMXBean
public Object lookupService(String serviceName)
lookupService
in interface IContext
lookupService
in interface ContextMXBean
serviceName
- Service nameServiceNotFoundException
- When service found but nullorg.springframework.beans.factory.NoSuchBeanDefinitionException
- When bean with given name doesn't existpublic IScopeHandler lookupScopeHandler(String contextPath)
lookupScopeHandler
in interface IContext
lookupScopeHandler
in interface ContextMXBean
contextPath
- Context pathScopeHandlerNotFoundException
- If there's no handler for given context pathpublic IMappingStrategy getMappingStrategy()
getMappingStrategy
in interface IContext
getMappingStrategy
in interface ContextMXBean
public org.springframework.core.io.Resource[] getResources(String pattern) throws IOException
getResources
in interface ContextMXBean
getResources
in interface org.springframework.core.io.support.ResourcePatternResolver
pattern
- Pattern to check againstIOException
- On I/O exceptionResource
public org.springframework.core.io.Resource getResource(String path)
getResource
in interface ContextMXBean
getResource
in interface org.springframework.core.io.ResourceLoader
path
- Resource pathResource
public IScope resolveScope(String host, String path)
resolveScope
in interface ContextMXBean
host
- Hostpath
- PathIScope
,
Scope
public boolean hasBean(String beanId)
public Object getBean(String beanId)
getBean
in interface IContext
getBean
in interface ContextMXBean
beanId
- Bean nameBeanFactory
public Object getCoreService(String beanId)
getCoreService
in interface IContext
getCoreService
in interface ContextMXBean
beanId
- Bean nameBeanFactory
public void setCoreBeanFactory(org.springframework.beans.factory.BeanFactory core)
public ClassLoader getClassLoader()
getClassLoader
in interface org.springframework.core.io.ResourceLoader
public static Context from(CompositeData cd)
cd
- composite dataCopyright © 2006-2012 The Red5 Project