Package com.hybris.cockpitng.core.spring
Class DefaultDelegatingCockpitApplicationContext
- java.lang.Object
-
- com.hybris.cockpitng.core.spring.DefaultDelegatingCockpitApplicationContext
-
- All Implemented Interfaces:
CockpitApplicationContext,org.springframework.beans.factory.BeanFactory,org.springframework.beans.factory.HierarchicalBeanFactory,org.springframework.beans.factory.ListableBeanFactory,org.springframework.context.ApplicationContext,org.springframework.context.ApplicationEventPublisher,org.springframework.context.MessageSource,org.springframework.core.env.EnvironmentCapable,org.springframework.core.io.ResourceLoader,org.springframework.core.io.support.ResourcePatternResolver
public class DefaultDelegatingCockpitApplicationContext extends java.lang.Object implements CockpitApplicationContext
A fallbackCockpitApplicationContextthat delegates all calls to methods known to specified standardApplicationContextand tries to figure out the result of call to methods unknown to standard one.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsBean(java.lang.String s)booleancontainsBeanDefinition(java.lang.String s)booleancontainsLocalBean(java.lang.String s)<A extends java.lang.annotation.Annotation>
AfindAnnotationOnBean(java.lang.String s, java.lang.Class<A> aClass)java.lang.String[]getAliases(java.lang.String s)java.lang.StringgetApplicationName()org.springframework.beans.factory.config.AutowireCapableBeanFactorygetAutowireCapableBeanFactory()<T> TgetBean(java.lang.Class<T> aClass)<T> TgetBean(java.lang.Class<T> aClass, java.lang.Object... objects)java.lang.ObjectgetBean(java.lang.String s)<T> TgetBean(java.lang.String s, java.lang.Class<T> aClass)java.lang.ObjectgetBean(java.lang.String s, java.lang.Object... objects)intgetBeanDefinitionCount()java.lang.String[]getBeanDefinitionNames()java.lang.String[]getBeanNamesForAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> aClass)java.lang.String[]getBeanNamesForType(java.lang.Class<?> aClass)java.lang.String[]getBeanNamesForType(java.lang.Class<?> aClass, boolean b, boolean b1)java.lang.String[]getBeanNamesForType(org.springframework.core.ResolvableType resolvableType)java.lang.String[]getBeanNamesForType(org.springframework.core.ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit)<T> org.springframework.beans.factory.ObjectProvider<T>getBeanProvider(java.lang.Class<T> aClass)<T> org.springframework.beans.factory.ObjectProvider<T>getBeanProvider(org.springframework.core.ResolvableType resolvableType)<T> java.util.Map<java.lang.String,T>getBeansOfType(java.lang.Class<T> aClass)<T> java.util.Map<java.lang.String,T>getBeansOfType(java.lang.Class<T> aClass, boolean b, boolean b1)java.util.Map<java.lang.String,java.lang.Object>getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> aClass)CockpitClassLoadergetClassLoader()Retrieves a class loader aware of all fetched modulesjava.io.FilegetDataRootDir()Retrieves a root directory for all the application datajava.lang.StringgetDisplayName()org.springframework.core.env.EnvironmentgetEnvironment()java.lang.StringgetId()static DefaultDelegatingCockpitApplicationContextgetInstance(org.springframework.context.ApplicationContext applicationContext)Wraps provided application context with delegating one if needed.java.util.List<java.lang.String>getLoadedModulesNames()Retrieves a collection of names all the loaded modules.java.lang.StringgetMessage(java.lang.String s, java.lang.Object[] objects, java.lang.String s1, java.util.Locale locale)java.lang.StringgetMessage(java.lang.String s, java.lang.Object[] objects, java.util.Locale locale)java.lang.StringgetMessage(org.springframework.context.MessageSourceResolvable messageSourceResolvable, java.util.Locale locale)java.util.Optional<ModuleInfo>getModuleInfo(java.lang.String moduleName)Retrieves information about modulejava.util.Optional<java.lang.String>getModuleName(java.net.URI moduleURI)Returns a fetched module namejava.util.Optional<java.net.URI>getModuleURI(java.lang.String moduleName)Retrieves a URI to source of moduleorg.springframework.context.ApplicationContextgetParent()org.springframework.beans.factory.BeanFactorygetParentBeanFactory()org.springframework.core.io.ResourcegetResource(java.lang.String s)org.springframework.core.io.Resource[]getResources(java.lang.String s)longgetStartupDate()java.lang.Class<?>getType(java.lang.String s)java.lang.Class<?>getType(java.lang.String name, boolean allowFactoryBeanInit)booleanisPrototype(java.lang.String s)booleanisReady()booleanisSingleton(java.lang.String s)booleanisTypeMatch(java.lang.String s, java.lang.Class<?> aClass)booleanisTypeMatch(java.lang.String s, org.springframework.core.ResolvableType resolvableType)voidpublishEvent(java.lang.Object o)voidpublishEvent(org.springframework.context.ApplicationEvent applicationEvent)voidrefresh()Reloads all modules and beansvoidregisterNewModule(java.lang.String moduleName, ModuleContentProvider contentsProvider)Creates a new module library, if it does not exist already.voidunregisterModule(java.lang.String moduleName)Removes a module library if such exists.
-
-
-
Method Detail
-
getInstance
public static DefaultDelegatingCockpitApplicationContext getInstance(org.springframework.context.ApplicationContext applicationContext)
Wraps provided application context with delegating one if needed.- Parameters:
applicationContext- application context to be wrapped- Returns:
- wrapped application context
-
getId
public java.lang.String getId()
- Specified by:
getIdin interfaceorg.springframework.context.ApplicationContext
-
getApplicationName
public java.lang.String getApplicationName()
- Specified by:
getApplicationNamein interfaceorg.springframework.context.ApplicationContext
-
getDisplayName
public java.lang.String getDisplayName()
- Specified by:
getDisplayNamein interfaceorg.springframework.context.ApplicationContext
-
getStartupDate
public long getStartupDate()
- Specified by:
getStartupDatein interfaceorg.springframework.context.ApplicationContext
-
getParent
public org.springframework.context.ApplicationContext getParent()
- Specified by:
getParentin interfaceorg.springframework.context.ApplicationContext
-
getAutowireCapableBeanFactory
public org.springframework.beans.factory.config.AutowireCapableBeanFactory getAutowireCapableBeanFactory()
- Specified by:
getAutowireCapableBeanFactoryin interfaceorg.springframework.context.ApplicationContext
-
getEnvironment
public org.springframework.core.env.Environment getEnvironment()
- Specified by:
getEnvironmentin interfaceorg.springframework.core.env.EnvironmentCapable
-
containsBeanDefinition
public boolean containsBeanDefinition(java.lang.String s)
- Specified by:
containsBeanDefinitionin interfaceorg.springframework.beans.factory.ListableBeanFactory
-
getBeanDefinitionCount
public int getBeanDefinitionCount()
- Specified by:
getBeanDefinitionCountin interfaceorg.springframework.beans.factory.ListableBeanFactory
-
getBeanDefinitionNames
public java.lang.String[] getBeanDefinitionNames()
- Specified by:
getBeanDefinitionNamesin interfaceorg.springframework.beans.factory.ListableBeanFactory
-
getBeanNamesForType
public java.lang.String[] getBeanNamesForType(org.springframework.core.ResolvableType resolvableType)
- Specified by:
getBeanNamesForTypein interfaceorg.springframework.beans.factory.ListableBeanFactory
-
getBeanNamesForType
public java.lang.String[] getBeanNamesForType(org.springframework.core.ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit)- Specified by:
getBeanNamesForTypein interfaceorg.springframework.beans.factory.ListableBeanFactory
-
getBeanNamesForType
public java.lang.String[] getBeanNamesForType(java.lang.Class<?> aClass)
- Specified by:
getBeanNamesForTypein interfaceorg.springframework.beans.factory.ListableBeanFactory
-
getBeanNamesForType
public java.lang.String[] getBeanNamesForType(java.lang.Class<?> aClass, boolean b, boolean b1)- Specified by:
getBeanNamesForTypein interfaceorg.springframework.beans.factory.ListableBeanFactory
-
getBeansOfType
public <T> java.util.Map<java.lang.String,T> getBeansOfType(java.lang.Class<T> aClass)
- Specified by:
getBeansOfTypein interfaceorg.springframework.beans.factory.ListableBeanFactory
-
getBeansOfType
public <T> java.util.Map<java.lang.String,T> getBeansOfType(java.lang.Class<T> aClass, boolean b, boolean b1)- Specified by:
getBeansOfTypein interfaceorg.springframework.beans.factory.ListableBeanFactory
-
getBeanNamesForAnnotation
public java.lang.String[] getBeanNamesForAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> aClass)
- Specified by:
getBeanNamesForAnnotationin interfaceorg.springframework.beans.factory.ListableBeanFactory
-
getBeansWithAnnotation
public java.util.Map<java.lang.String,java.lang.Object> getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> aClass)
- Specified by:
getBeansWithAnnotationin interfaceorg.springframework.beans.factory.ListableBeanFactory
-
findAnnotationOnBean
public <A extends java.lang.annotation.Annotation> A findAnnotationOnBean(java.lang.String s, java.lang.Class<A> aClass) throws org.springframework.beans.factory.NoSuchBeanDefinitionException- Specified by:
findAnnotationOnBeanin interfaceorg.springframework.beans.factory.ListableBeanFactory- Throws:
org.springframework.beans.factory.NoSuchBeanDefinitionException
-
getBean
public java.lang.Object getBean(java.lang.String s)
- Specified by:
getBeanin interfaceorg.springframework.beans.factory.BeanFactory
-
getBean
public <T> T getBean(java.lang.String s, java.lang.Class<T> aClass)- Specified by:
getBeanin interfaceorg.springframework.beans.factory.BeanFactory
-
getBean
public java.lang.Object getBean(java.lang.String s, java.lang.Object... objects)- Specified by:
getBeanin interfaceorg.springframework.beans.factory.BeanFactory
-
getBean
public <T> T getBean(java.lang.Class<T> aClass)
- Specified by:
getBeanin interfaceorg.springframework.beans.factory.BeanFactory
-
getBean
public <T> T getBean(java.lang.Class<T> aClass, java.lang.Object... objects)- Specified by:
getBeanin interfaceorg.springframework.beans.factory.BeanFactory
-
getBeanProvider
public <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProvider(java.lang.Class<T> aClass)
- Specified by:
getBeanProviderin interfaceorg.springframework.beans.factory.BeanFactory
-
getBeanProvider
public <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProvider(org.springframework.core.ResolvableType resolvableType)
- Specified by:
getBeanProviderin interfaceorg.springframework.beans.factory.BeanFactory
-
containsBean
public boolean containsBean(java.lang.String s)
- Specified by:
containsBeanin interfaceorg.springframework.beans.factory.BeanFactory
-
isSingleton
public boolean isSingleton(java.lang.String s)
- Specified by:
isSingletonin interfaceorg.springframework.beans.factory.BeanFactory
-
isPrototype
public boolean isPrototype(java.lang.String s)
- Specified by:
isPrototypein interfaceorg.springframework.beans.factory.BeanFactory
-
isTypeMatch
public boolean isTypeMatch(java.lang.String s, org.springframework.core.ResolvableType resolvableType)- Specified by:
isTypeMatchin interfaceorg.springframework.beans.factory.BeanFactory
-
isTypeMatch
public boolean isTypeMatch(java.lang.String s, java.lang.Class<?> aClass)- Specified by:
isTypeMatchin interfaceorg.springframework.beans.factory.BeanFactory
-
getType
public java.lang.Class<?> getType(java.lang.String s)
- Specified by:
getTypein interfaceorg.springframework.beans.factory.BeanFactory
-
getType
public java.lang.Class<?> getType(java.lang.String name, boolean allowFactoryBeanInit) throws org.springframework.beans.factory.NoSuchBeanDefinitionException- Specified by:
getTypein interfaceorg.springframework.beans.factory.BeanFactory- Throws:
org.springframework.beans.factory.NoSuchBeanDefinitionException
-
getAliases
public java.lang.String[] getAliases(java.lang.String s)
- Specified by:
getAliasesin interfaceorg.springframework.beans.factory.BeanFactory
-
getParentBeanFactory
public org.springframework.beans.factory.BeanFactory getParentBeanFactory()
- Specified by:
getParentBeanFactoryin interfaceorg.springframework.beans.factory.HierarchicalBeanFactory
-
containsLocalBean
public boolean containsLocalBean(java.lang.String s)
- Specified by:
containsLocalBeanin interfaceorg.springframework.beans.factory.HierarchicalBeanFactory
-
getMessage
public java.lang.String getMessage(java.lang.String s, java.lang.Object[] objects, java.lang.String s1, java.util.Locale locale)- Specified by:
getMessagein interfaceorg.springframework.context.MessageSource
-
getMessage
public java.lang.String getMessage(java.lang.String s, java.lang.Object[] objects, java.util.Locale locale)- Specified by:
getMessagein interfaceorg.springframework.context.MessageSource
-
getMessage
public java.lang.String getMessage(org.springframework.context.MessageSourceResolvable messageSourceResolvable, java.util.Locale locale)- Specified by:
getMessagein interfaceorg.springframework.context.MessageSource
-
publishEvent
public void publishEvent(org.springframework.context.ApplicationEvent applicationEvent)
- Specified by:
publishEventin interfaceorg.springframework.context.ApplicationEventPublisher
-
publishEvent
public void publishEvent(java.lang.Object o)
- Specified by:
publishEventin interfaceorg.springframework.context.ApplicationEventPublisher
-
getResources
public org.springframework.core.io.Resource[] getResources(java.lang.String s) throws java.io.IOException- Specified by:
getResourcesin interfaceorg.springframework.core.io.support.ResourcePatternResolver- Throws:
java.io.IOException
-
getResource
public org.springframework.core.io.Resource getResource(java.lang.String s)
- Specified by:
getResourcein interfaceorg.springframework.core.io.ResourceLoader
-
getClassLoader
public CockpitClassLoader getClassLoader()
Description copied from interface:CockpitApplicationContextRetrieves a class loader aware of all fetched modules- Specified by:
getClassLoaderin interfaceCockpitApplicationContext- Specified by:
getClassLoaderin interfaceorg.springframework.core.io.ResourceLoader- Returns:
- class loader
-
refresh
public void refresh() throws org.springframework.beans.BeansExceptionDescription copied from interface:CockpitApplicationContextReloads all modules and beans- Specified by:
refreshin interfaceCockpitApplicationContext- Throws:
org.springframework.beans.BeansException- if any problems with context refresh has occurred
-
getDataRootDir
public java.io.File getDataRootDir()
Description copied from interface:CockpitApplicationContextRetrieves a root directory for all the application data- Specified by:
getDataRootDirin interfaceCockpitApplicationContext- Returns:
- root directory for application data
-
getLoadedModulesNames
public java.util.List<java.lang.String> getLoadedModulesNames()
Description copied from interface:CockpitApplicationContextRetrieves a collection of names all the loaded modules.List should contain only unique values in same order that modules has been loaded.
- Specified by:
getLoadedModulesNamesin interfaceCockpitApplicationContext- Returns:
- names of modules
-
getModuleName
public java.util.Optional<java.lang.String> getModuleName(java.net.URI moduleURI)
Description copied from interface:CockpitApplicationContextReturns a fetched module name- Specified by:
getModuleNamein interfaceCockpitApplicationContext- Parameters:
moduleURI- URI to module source- Returns:
- module name
-
getModuleURI
public java.util.Optional<java.net.URI> getModuleURI(java.lang.String moduleName)
Description copied from interface:CockpitApplicationContextRetrieves a URI to source of module- Specified by:
getModuleURIin interfaceCockpitApplicationContext- Parameters:
moduleName- name of module- Returns:
- source URI
-
getModuleInfo
public java.util.Optional<ModuleInfo> getModuleInfo(java.lang.String moduleName)
Description copied from interface:CockpitApplicationContextRetrieves information about module- Specified by:
getModuleInfoin interfaceCockpitApplicationContext- Parameters:
moduleName- module name- Returns:
- information about module
- See Also:
CockpitApplicationContext.getLoadedModulesNames()
-
registerNewModule
public void registerNewModule(java.lang.String moduleName, ModuleContentProvider contentsProvider) throws CockpitApplicationExceptionDescription copied from interface:CockpitApplicationContextCreates a new module library, if it does not exist already. The library is automatically added to application context after consumed.- Specified by:
registerNewModulein interfaceCockpitApplicationContext- Parameters:
moduleName- name of the module for which a library will be registeredcontentsProvider- functional object capable of providing contents for the library- Throws:
CockpitApplicationException
-
unregisterModule
public void unregisterModule(java.lang.String moduleName) throws CockpitApplicationExceptionDescription copied from interface:CockpitApplicationContextRemoves a module library if such exists. The library is automatically removed from application context.- Specified by:
unregisterModulein interfaceCockpitApplicationContext- Parameters:
moduleName- name of the module for which the library will be unregistered- Throws:
CockpitApplicationException
-
isReady
public boolean isReady()
- Specified by:
isReadyin interfaceCockpitApplicationContext- Returns:
-
-