public abstract class AbstractDelegatedExecutionApplicationContext extends AbstractOsgiBundleApplicationContext implements DelegatedExecutionOsgiBundleApplicationContext
refresh() and AbstractApplicationContext.close() methods delegate their execution to an
OsgiBundleApplicationContextExecutor class that chooses how to call the lifecycle methods. One
can still call the 'traditional' lifecycle methods through normalRefresh() and normalClose().| Modifier and Type | Class and Description |
|---|---|
private class |
AbstractDelegatedExecutionApplicationContext.BeanPostProcessorChecker
BeanPostProcessor that logs an info message when a bean is created during BeanPostProcessor instantiation, i.e.
|
private static class |
AbstractDelegatedExecutionApplicationContext.NoDependenciesWaitRefreshExecutor
Executor that offers the traditional way of
refreshing/ closing of an
ApplicationContext (no conditions have to be met and the refresh happens in only one step). |
| Modifier and Type | Field and Description |
|---|---|
private ContextClassLoaderProvider |
cclProvider |
private OsgiBundleApplicationContextEventMulticaster |
delegatedMulticaster
Delegated multicaster
|
private OsgiBundleApplicationContextExecutor |
executor
Default executor
|
private java.lang.Object |
startupShutdownMonitor
monitor used during refresh/close
|
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAMEAPPLICATION_CONTEXT_SERVICE_PROPERTY_NAME, BUNDLE_BEAN_NAME, BUNDLE_CONTEXT_BEAN_NAME, SPRING_DM_APPLICATION_CONTEXT_SERVICE_PROPERTY_NAMECONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME| Constructor and Description |
|---|
AbstractDelegatedExecutionApplicationContext()
Constructs a new
AbstractDelegatedExecutionApplicationContext instance. |
AbstractDelegatedExecutionApplicationContext(org.springframework.context.ApplicationContext parent)
Constructs a new
AbstractDelegatedExecutionApplicationContext instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
completeRefresh()
The second, last phase of the refresh.
|
private ContextClassLoaderProvider |
contextClassLoaderProvider()
private method used for doing lazy-init-if-not-set for cclProvider
|
protected void |
doClose()
Unregister the ApplicationContext OSGi service (in case there is any).
|
OsgiBundleApplicationContextEventMulticaster |
getDelegatedEventMulticaster()
Returns the OSGi event multicaster (if any) associated with this
application context.
|
protected void |
invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
private void |
invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
java.lang.Class<?> type,
java.lang.Class<?> exclude)
Instantiate and invoke all registered BeanFactoryPostProcessor beans, respecting explicit order if given.
|
private void |
invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
java.util.List<org.springframework.beans.factory.config.BeanFactoryPostProcessor> postProcessors)
Invoke given post processors.
|
protected void |
loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory) |
void |
normalClose()
Non-delegated close operation (execute
ConfigurableApplicationContext.close() in the
traditional way). |
void |
normalRefresh()
Non-delegated refresh operation (execute
ConfigurableApplicationContext.refresh() in the
traditional way). |
void |
refresh()
Delegate execution of refresh method to a third party.
|
protected void |
registerBeanPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
protected void |
registerBeanPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
java.lang.Class<?> type,
java.lang.Class<?> exclude,
boolean check)
Instantiate and invoke all registered BeanPostProcessor beans, respecting explicit order if given.
|
private void |
registerBeanPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
java.util.List<org.springframework.beans.factory.config.BeanPostProcessor> postProcessors)
Register the given BeanPostProcessor beans.
|
private void |
sendClosedEvent() |
private void |
sendClosedEvent(java.lang.Throwable cause) |
private void |
sendFailedEvent(java.lang.Throwable cause) |
private void |
sendRefreshedEvent() |
void |
setContextClassLoaderProvider(ContextClassLoaderProvider contextClassLoaderProvider)
Sets the
ContextClassLoaderProvider used by this OSGi application context instance. |
void |
setDelegatedEventMulticaster(org.springframework.context.event.ApplicationEventMulticaster multicaster)
Sets the OSGi multicaster by using a Spring
ApplicationEventMulticaster. |
void |
setDelegatedEventMulticaster(OsgiBundleApplicationContextEventMulticaster multicaster)
Allows a delegated
OsgiBundleApplicationContextEventMulticaster,
external to the application context, to be used for sending OSGi
application context events regarding the application context life cycle. |
void |
setExecutor(OsgiBundleApplicationContextExecutor executor)
Assigns the
OsgiBundleApplicationContextExecutor for this
delegated context. |
void |
startRefresh()
First phase of the refresh.
|
createResourcePatternResolver, customizeApplicationContextServiceProperties, destroyBeans, finishRefresh, getBundle, getBundleContext, getClassLoader, getConfigLocations, getDefaultConfigLocations, getResource, getResourceByPath, getResourcePatternResolver, getResources, postProcessBeanFactory, prepareRefresh, setBundleContext, setClassLoader, setConfigLocations, setPublishContextAsServicecancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferencesaddApplicationListener, addBeanFactoryPostProcessor, addListener, close, containsBean, containsBeanDefinition, containsLocalBean, createEnvironment, destroy, findAnnotationOnBean, finishBeanFactoryInitialization, getAliases, getApplicationListeners, getApplicationName, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, initPropertySources, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, obtainFreshBeanFactory, onClose, onRefresh, prepareBeanFactory, publishEvent, registerListeners, registerShutdownHook, setDisplayName, setEnvironment, setId, setParent, start, stop, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBundle, getBundleContext, setBundleContext, setConfigLocations, setPublishContextAsServiceaddApplicationListener, addBeanFactoryPostProcessor, close, getBeanFactory, getEnvironment, isActive, registerShutdownHook, setEnvironment, setId, setParentgetApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDatecontainsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotationcontainsLocalBean, getParentBeanFactorycontainsBean, getAliases, getBean, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatchgetMessage, getMessage, getMessagegetResourcesprivate OsgiBundleApplicationContextExecutor executor
private final java.lang.Object startupShutdownMonitor
private OsgiBundleApplicationContextEventMulticaster delegatedMulticaster
private ContextClassLoaderProvider cclProvider
public AbstractDelegatedExecutionApplicationContext()
AbstractDelegatedExecutionApplicationContext instance.public AbstractDelegatedExecutionApplicationContext(org.springframework.context.ApplicationContext parent)
AbstractDelegatedExecutionApplicationContext instance.parent - parent application contextpublic void refresh()
throws org.springframework.beans.BeansException,
java.lang.IllegalStateException
refresh in interface org.springframework.context.ConfigurableApplicationContextrefresh in class org.springframework.context.support.AbstractApplicationContextorg.springframework.beans.BeansExceptionjava.lang.IllegalStateExceptionpublic void normalRefresh()
DelegatedExecutionOsgiBundleApplicationContextConfigurableApplicationContext.refresh() in the
traditional way).normalRefresh in interface DelegatedExecutionOsgiBundleApplicationContextConfigurableApplicationContext.refresh()public void normalClose()
DelegatedExecutionOsgiBundleApplicationContextConfigurableApplicationContext.close() in the
traditional way).normalClose in interface DelegatedExecutionOsgiBundleApplicationContextConfigurableApplicationContext.close()protected void doClose()
AbstractOsgiBundleApplicationContextdoClose in class AbstractOsgiBundleApplicationContextpublic void startRefresh()
DelegatedExecutionOsgiBundleApplicationContextbeanFactory but does not instantiates any beans.startRefresh in interface DelegatedExecutionOsgiBundleApplicationContextpublic void completeRefresh()
DelegatedExecutionOsgiBundleApplicationContextrefresh operation. Normally, this operations performs
most of the refresh work, such as instantiating
singletons.completeRefresh in interface DelegatedExecutionOsgiBundleApplicationContextprotected void invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
invokeBeanFactoryPostProcessors in class org.springframework.context.support.AbstractApplicationContextprivate void invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
java.lang.Class<?> type,
java.lang.Class<?> exclude)
AbstractApplicationContext.invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) but allowing exclusion of a certain type.beanFactory - type - exclude - private void invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
java.util.List<org.springframework.beans.factory.config.BeanFactoryPostProcessor> postProcessors)
beanFactory - postProcessors - protected void registerBeanPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
registerBeanPostProcessors in class org.springframework.context.support.AbstractApplicationContextprotected void registerBeanPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
java.lang.Class<?> type,
java.lang.Class<?> exclude,
boolean check)
AbstractApplicationContext.invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) but allowing exclusion of a certain type.private void registerBeanPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
java.util.List<org.springframework.beans.factory.config.BeanPostProcessor> postProcessors)
public void setExecutor(OsgiBundleApplicationContextExecutor executor)
DelegatedExecutionOsgiBundleApplicationContextOsgiBundleApplicationContextExecutor for this
delegated context.setExecutor in interface DelegatedExecutionOsgiBundleApplicationContextexecutor - the executor of this application context, to which the
refresh method is delegated toprotected void loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
throws java.io.IOException,
org.springframework.beans.BeansException
loadBeanDefinitions in class org.springframework.context.support.AbstractRefreshableApplicationContextjava.io.IOExceptionorg.springframework.beans.BeansExceptionpublic void setDelegatedEventMulticaster(OsgiBundleApplicationContextEventMulticaster multicaster)
DelegatedExecutionOsgiBundleApplicationContextOsgiBundleApplicationContextEventMulticaster,
external to the application context, to be used for sending OSGi
application context events regarding the application context life cycle.
This method is mainly intended for monitoring the context lifecycle by
third parties (such as the OSGi extender). It's up to the implementation
to decide whether this setter method is required or not.setDelegatedEventMulticaster in interface DelegatedExecutionOsgiBundleApplicationContextmulticaster - the application multicaster used for sending events
triggered by the delegated execution.OsgiBundleApplicationContextEventpublic void setDelegatedEventMulticaster(org.springframework.context.event.ApplicationEventMulticaster multicaster)
ApplicationEventMulticaster. This method is added as a
covenience.multicaster - Spring multi-caster used for propagating OSGi specific eventsOsgiBundleApplicationContextEventMulticasterAdapterpublic OsgiBundleApplicationContextEventMulticaster getDelegatedEventMulticaster()
DelegatedExecutionOsgiBundleApplicationContextgetDelegatedEventMulticaster in interface DelegatedExecutionOsgiBundleApplicationContextprivate void sendFailedEvent(java.lang.Throwable cause)
private void sendRefreshedEvent()
private void sendClosedEvent()
private void sendClosedEvent(java.lang.Throwable cause)
private ContextClassLoaderProvider contextClassLoaderProvider()
public void setContextClassLoaderProvider(ContextClassLoaderProvider contextClassLoaderProvider)
ContextClassLoaderProvider used by this OSGi application context instance. By default,
DefaultContextClassLoaderProvider is used.contextClassLoaderProvider - context class loader provider to useContextClassLoaderProvider,
DefaultContextClassLoaderProvider