Package org.red5.server
Class Context
java.lang.Object
org.red5.server.Context
- All Implemented Interfaces:
IContext,ContextMXBean,Aware,ApplicationContextAware,ResourceLoader,ResourcePatternResolver
This is basic context implementation used by Red5.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ApplicationContextSpring application contextprivate IClientRegistryClient registryprivate StringContext pathprivate BeanFactoryCore contextstatic final org.slf4j.Loggerprivate IMappingStrategyMapping strategy collaboratorprivate IPersistenceStorePersistence storeprivate IScopeResolverScope resolver collaboratorprivate IServiceInvokerService invoker collaboratorFields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIXFields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionContext()Initializes core context bean factory using red5.core bean factory from red5.xml contextContext(ApplicationContext context, String contextPath) Initializes app context and context path from given parameters -
Method Summary
Modifier and TypeMethodDescriptionstatic Contextfrom(CompositeData cd) Allows for reconstruction via CompositeData.Return application contextReturn bean instantiated by bean factoryReturn current thread's context classloaderReturn client registrygetCoreService(String beanId) Return core Red5 service instantiated by core context bean factoryReturn global scopeReturn mapping strategy used by this context.Return persistence storegetResource(String path) Return resource by pathResource[]getResources(String pattern) Return array or resource that match given patterngetScope()Return scopeReturn scope resolverReturn service invokerbooleanReturns true if the context contains a certain bean, false otherwise.lookupScopeHandler(String contextPath) Look up scope handler for context pathlookupService(String serviceName) Look up service by nameresolveScope(String path) Resolves scope using scope resolver collaboratorresolveScope(String host, String path) Resolve scope from host and pathresolveScope(IScope root, String path) Resolves scope from given root using scope resolver.voidsetApplicationContext(ApplicationContext context) Setter for application contextvoidsetClientRegistry(IClientRegistry clientRegistry) Setter for client registryvoidsetContextPath(String contextPath) Setter for context path.voidvoidsetMappingStrategy(IMappingStrategy mappingStrategy) Setter for mapping strategyvoidsetPersistanceStore(IPersistenceStore persistanceStore) Setter for persistence storevoidsetScopeResolver(IScopeResolver scopeResolver) Setter for scope resolvervoidsetServiceInvoker(IServiceInvoker serviceInvoker) Setter for service invoker
-
Field Details
-
logger
public static final org.slf4j.Logger logger -
applicationContext
Spring application context -
coreContext
Core context -
contextPath
Context path -
scopeResolver
Scope resolver collaborator -
clientRegistry
Client registry -
serviceInvoker
Service invoker collaborator -
mappingStrategy
Mapping strategy collaborator -
persistanceStore
Persistence store
-
-
Constructor Details
-
Context
Initializes core context bean factory using red5.core bean factory from red5.xml context -
Context
@ConstructorProperties({"context","contextPath"}) public Context(ApplicationContext context, String contextPath) Initializes app context and context path from given parameters- Parameters:
context- Application contextcontextPath- Context path
-
-
Method Details
-
getGlobalScope
Return global scope- Specified by:
getGlobalScopein interfaceContextMXBean- Specified by:
getGlobalScopein interfaceIContext- Returns:
- Global scope
-
getScopeResolver
Return scope resolver- Returns:
- scope resolver
-
resolveScope
Resolves scope using scope resolver collaborator- Specified by:
resolveScopein interfaceContextMXBean- Specified by:
resolveScopein interfaceIContext- Parameters:
path- Path to resolve- Returns:
- Scope resolution result
-
resolveScope
Resolves scope from given root using scope resolver.- Specified by:
resolveScopein interfaceContextMXBean- Specified by:
resolveScopein interfaceIContext- Parameters:
root- Scope to start from.path- Path to resolve.- Returns:
- Scope resolution result.
-
setClientRegistry
Setter for client registry- Parameters:
clientRegistry- Client registry
-
setMappingStrategy
Setter for mapping strategy- Parameters:
mappingStrategy- Mapping strategy
-
setScopeResolver
Setter for scope resolver- Parameters:
scopeResolver- Scope resolver used to resolve scopes
-
setServiceInvoker
Setter for service invoker- Parameters:
serviceInvoker- Service invoker object
-
getPersistanceStore
Return persistence store- Specified by:
getPersistanceStorein interfaceContextMXBean- Specified by:
getPersistanceStorein interfaceIContext- Returns:
- Persistence store
-
setPersistanceStore
Setter for persistence store- Parameters:
persistanceStore- Persistence store
-
setApplicationContext
Setter for application context- Specified by:
setApplicationContextin interfaceApplicationContextAware- Parameters:
context- App context
-
getApplicationContext
Return application context- Specified by:
getApplicationContextin interfaceContextMXBean- Specified by:
getApplicationContextin interfaceIContext- Returns:
- App context
-
setContextPath
Setter for context path. Adds a slash at the end of path if there isn't one- Specified by:
setContextPathin interfaceContextMXBean- Parameters:
contextPath- Context path
-
getClientRegistry
Return client registry- Specified by:
getClientRegistryin interfaceContextMXBean- Specified by:
getClientRegistryin interfaceIContext- Returns:
- Client registry
-
getScope
Return scope- Specified by:
getScopein interfaceContextMXBean- Returns:
- null
-
getServiceInvoker
Return service invoker- Specified by:
getServiceInvokerin interfaceContextMXBean- Specified by:
getServiceInvokerin interfaceIContext- Returns:
- Service invoker
-
lookupService
Look up service by name- Specified by:
lookupServicein interfaceContextMXBean- Specified by:
lookupServicein interfaceIContext- Parameters:
serviceName- Service name- Returns:
- Service object
- Throws:
ServiceNotFoundException- When service found but nullNoSuchBeanDefinitionException- When bean with given name doesn't exist
-
lookupScopeHandler
Look up scope handler for context path- Specified by:
lookupScopeHandlerin interfaceContextMXBean- Specified by:
lookupScopeHandlerin interfaceIContext- Parameters:
contextPath- Context path- Returns:
- Scope handler
- Throws:
ScopeHandlerNotFoundException- If there's no handler for given context path
-
getMappingStrategy
Return mapping strategy used by this context. Mapping strategy define naming rules (prefixes, postfixes, default application name, etc) for all named objects in context.- Specified by:
getMappingStrategyin interfaceContextMXBean- Specified by:
getMappingStrategyin interfaceIContext- Returns:
- Mapping strategy
-
getResources
Return array or resource that match given pattern- Specified by:
getResourcesin interfaceContextMXBean- Specified by:
getResourcesin interfaceResourcePatternResolver- Parameters:
pattern- Pattern to check against- Returns:
- Array of Resource objects
- Throws:
IOException- On I/O exception- See Also:
-
getResource
Return resource by path- Specified by:
getResourcein interfaceContextMXBean- Specified by:
getResourcein interfaceResourceLoader- Parameters:
path- Resource path- Returns:
- Resource
- See Also:
-
resolveScope
Resolve scope from host and path- Specified by:
resolveScopein interfaceContextMXBean- Parameters:
host- Hostpath- Path- Returns:
- Scope
- See Also:
-
hasBean
Returns true if the context contains a certain bean, false otherwise. -
getBean
Return bean instantiated by bean factory- Specified by:
getBeanin interfaceContextMXBean- Specified by:
getBeanin interfaceIContext- Parameters:
beanId- Bean name- Returns:
- Instantiated bean
- See Also:
-
getCoreService
Return core Red5 service instantiated by core context bean factory- Specified by:
getCoreServicein interfaceContextMXBean- Specified by:
getCoreServicein interfaceIContext- Parameters:
beanId- Bean name- Returns:
- Core Red5 service instantiated
- See Also:
-
setCoreBeanFactory
-
getClassLoader
Return current thread's context classloader- Specified by:
getClassLoaderin interfaceResourceLoader- Returns:
- Classloder context of current thread
-
from
Allows for reconstruction via CompositeData.- Parameters:
cd- composite data- Returns:
- Context class instance
-