Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.gemini.blueprint.context.support
Class AbstractDelegatedExecutionApplicationContext

    java.lang.Object
      org.springframework.core.io.DefaultResourceLoader
          org.springframework.context.support.AbstractApplicationContext
              org.springframework.context.support.AbstractRefreshableApplicationContext
                  org.eclipse.gemini.blueprint.context.support.AbstractOsgiBundleApplicationContext
                      org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext

All Implemented Interfaces:
  ConfigurableOsgiBundleApplicationContext, DelegatedExecutionOsgiBundleApplicationContext, org.springframework.beans.factory.BeanFactory, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.HierarchicalBeanFactory, org.springframework.beans.factory.ListableBeanFactory, org.springframework.context.ApplicationContext, org.springframework.context.ApplicationEventPublisher, org.springframework.context.ConfigurableApplicationContext, org.springframework.context.Lifecycle, org.springframework.context.MessageSource, org.springframework.core.env.EnvironmentCapable, org.springframework.core.io.ResourceLoader, org.springframework.core.io.support.ResourcePatternResolver

Direct Known Subclasses:
  OsgiBundleXmlApplicationContext

    public abstract class AbstractDelegatedExecutionApplicationContext

extends AbstractOsgiBundleApplicationContext
implements DelegatedExecutionOsgiBundleApplicationContext

OSGi-specific application context that delegates the execution of its life cycle methods to a different class. The main reason behind this is to break the startup of the application context in steps that can be executed asynchronously.

The `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()`.

Author:
  Costin Leau
See Also:
  `DelegatedExecutionOsgiBundleApplicationContext`

Field Summary

Fields inherited from class org.springframework.context.support.AbstractApplicationContext
`APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME`

Fields inherited from interface org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext
`APPLICATION_CONTEXT_SERVICE_PROPERTY_NAME, BUNDLE_BEAN_NAME, BUNDLE_CONTEXT_BEAN_NAME, SPRING_DM_APPLICATION_CONTEXT_SERVICE_PROPERTY_NAME`

Fields inherited from interface org.springframework.context.ConfigurableApplicationContext
`CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME`

Fields inherited from interface org.springframework.beans.factory.BeanFactory
`FACTORY_BEAN_PREFIX`

Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
`CLASSPATH_ALL_URL_PREFIX`

Fields inherited from interface org.springframework.core.io.ResourceLoader
`CLASSPATH_URL_PREFIX`

Constructor Summary
`AbstractDelegatedExecutionApplicationContext()` Constructs a new `AbstractDelegatedExecutionApplicationContext` instance.
`AbstractDelegatedExecutionApplicationContext(org.springframework.context.ApplicationContext parent)` Constructs a new `AbstractDelegatedExecutionApplicationContext` instance.

Method Summary
`void` | `completeRefresh()` The second, last phase of the refresh.
`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)`
`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, Class<?> type, Class<?> exclude, boolean check)` Instantiate and invoke all registered BeanPostProcessor beans, respecting explicit order if given.
`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.

Methods inherited from class org.eclipse.gemini.blueprint.context.support.AbstractOsgiBundleApplicationContext
`createResourcePatternResolver, customizeApplicationContextServiceProperties, destroyBeans, finishRefresh, getBundle, getBundleContext, getClassLoader, getConfigLocations, getDefaultConfigLocations, getResource, getResourceByPath, getResourcePatternResolver, getResources, postProcessBeanFactory, prepareRefresh, setBundleContext, setClassLoader, setConfigLocations, setPublishContextAsService`

Methods inherited from class org.springframework.context.support.AbstractRefreshableApplicationContext
`cancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferences`

Methods inherited from class org.springframework.context.support.AbstractApplicationContext
`addApplicationListener, addBeanFactoryPostProcessor, addListener, close, containsBean, containsBeanDefinition, containsLocalBean, createEnvironment, destroy, findAnnotationOnBean, finishBeanFactoryInitialization, getAliases, getApplicationListeners, 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, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext
`getBundle, getBundleContext, setBundleContext, setConfigLocations, setPublishContextAsService`

Methods inherited from interface org.springframework.context.ConfigurableApplicationContext
`addApplicationListener, addBeanFactoryPostProcessor, close, getBeanFactory, getEnvironment, isActive, registerShutdownHook, setEnvironment, setId, setParent`

Methods inherited from interface org.springframework.context.ApplicationContext
`getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate`

Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory
`containsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation`

Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory
`containsLocalBean, getParentBeanFactory`

Methods inherited from interface org.springframework.beans.factory.BeanFactory
`containsBean, getAliases, getBean, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch`

Methods inherited from interface org.springframework.context.MessageSource
`getMessage, getMessage, getMessage`

Methods inherited from interface org.springframework.context.ApplicationEventPublisher
`publishEvent`

Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver
`getResources`

Methods inherited from interface org.springframework.core.io.ResourceLoader
`getClassLoader, getResource`

Methods inherited from interface org.springframework.context.Lifecycle
`isRunning, start, stop`

Constructor Detail

### AbstractDelegatedExecutionApplicationContext

    public AbstractDelegatedExecutionApplicationContext()

  Constructs a new `AbstractDelegatedExecutionApplicationContext` instance.

### AbstractDelegatedExecutionApplicationContext

    public AbstractDelegatedExecutionApplicationContext(org.springframework.context.ApplicationContext parent)

  Constructs a new `AbstractDelegatedExecutionApplicationContext` instance.

  Parameters:
    `parent` - parent application context

Method Detail

### refresh

    public void refresh()
                 throws org.springframework.beans.BeansException,
                        IllegalStateException

  Delegate execution of refresh method to a third party. This allows breaking the refresh process into several small pieces providing continuation-like behaviour or completion of the refresh method on several threads, in a asynch manner.

  By default, the refresh method in executed in one go (normal behaviour).

  Specified by:
    `refresh` in interface `org.springframework.context.ConfigurableApplicationContext`
  Overrides:
    `refresh` in class `org.springframework.context.support.AbstractApplicationContext`
  Throws:
    `org.springframework.beans.BeansException`
    `IllegalStateException`

### normalRefresh

    public void normalRefresh()

  Description copied from interface: `DelegatedExecutionOsgiBundleApplicationContext`
  Non-delegated refresh operation (execute `ConfigurableApplicationContext.refresh()` in the traditional way).

  Specified by:
    `normalRefresh` in interface `DelegatedExecutionOsgiBundleApplicationContext`
  See Also:
    `ConfigurableApplicationContext.refresh()`

### normalClose

    public void normalClose()

  Description copied from interface: `DelegatedExecutionOsgiBundleApplicationContext`
  Non-delegated close operation (execute `ConfigurableApplicationContext.close()` in the traditional way).

  Specified by:
    `normalClose` in interface `DelegatedExecutionOsgiBundleApplicationContext`
  See Also:
    `ConfigurableApplicationContext.close()`

### doClose

    protected void doClose()

  Description copied from class: `AbstractOsgiBundleApplicationContext`
  Unregister the ApplicationContext OSGi service (in case there is any).

  Overrides:
    `doClose` in class `AbstractOsgiBundleApplicationContext`

### startRefresh

    public void startRefresh()

  Description copied from interface: `DelegatedExecutionOsgiBundleApplicationContext`
  First phase of the refresh. Normally, this just prepares the `beanFactory` but does not instantiates any beans.

  Specified by:
    `startRefresh` in interface `DelegatedExecutionOsgiBundleApplicationContext`

### completeRefresh

    public void completeRefresh()

  Description copied from interface: `DelegatedExecutionOsgiBundleApplicationContext`
  The second, last phase of the refresh. Executes after a certain condition, imposed by the executor, has been met. Finishes the rest of the `refresh` operation. Normally, this operations performs most of the `refresh work`, such as instantiating singletons.

  Specified by:
    `completeRefresh` in interface `DelegatedExecutionOsgiBundleApplicationContext`

### invokeBeanFactoryPostProcessors

    protected void invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

  Overrides:
    `invokeBeanFactoryPostProcessors` in class `org.springframework.context.support.AbstractApplicationContext`

### registerBeanPostProcessors

    protected void registerBeanPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

  Overrides:
    `registerBeanPostProcessors` in class `org.springframework.context.support.AbstractApplicationContext`

### registerBeanPostProcessors

    protected void registerBeanPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
                                              Class<?> type,
                                              Class<?> exclude,
                                              boolean check)

  Instantiate and invoke all registered BeanPostProcessor beans, respecting explicit order if given.

  Must be called before any instantiation of application beans. Very similar to `AbstractApplicationContext.invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)` but allowing exclusion of a certain type.

### setExecutor

    public void setExecutor(OsgiBundleApplicationContextExecutor executor)

  Description copied from interface: `DelegatedExecutionOsgiBundleApplicationContext`
  Assigns the `OsgiBundleApplicationContextExecutor` for this delegated context.

  Specified by:
    `setExecutor` in interface `DelegatedExecutionOsgiBundleApplicationContext`
  Parameters:
    `executor` - the executor of this application context, to which the `refresh` method is delegated to

### loadBeanDefinitions

    protected void loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
                                throws IOException,
                                       org.springframework.beans.BeansException

  Specified by:
    `loadBeanDefinitions` in class `org.springframework.context.support.AbstractRefreshableApplicationContext`
  Throws:
    `IOException`
    `org.springframework.beans.BeansException`

### setDelegatedEventMulticaster

    public void setDelegatedEventMulticaster(OsgiBundleApplicationContextEventMulticaster multicaster)

  Description copied from interface: `DelegatedExecutionOsgiBundleApplicationContext`
  Allows a delegated `OsgiBundleApplicationContextEventMulticaster`, 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.

  Specified by:
    `setDelegatedEventMulticaster` in interface `DelegatedExecutionOsgiBundleApplicationContext`
  Parameters:
    `multicaster` - the application multicaster used for sending events triggered by the delegated execution.
  See Also:
    `OsgiBundleApplicationContextEvent`

### setDelegatedEventMulticaster

    public void setDelegatedEventMulticaster(org.springframework.context.event.ApplicationEventMulticaster multicaster)

  Sets the OSGi multicaster by using a Spring `ApplicationEventMulticaster`. This method is added as a covenience.

  Parameters:
    `multicaster` - Spring multi-caster used for propagating OSGi specific events
  See Also:
    `OsgiBundleApplicationContextEventMulticasterAdapter`

### getDelegatedEventMulticaster

    public OsgiBundleApplicationContextEventMulticaster getDelegatedEventMulticaster()

  Description copied from interface: `DelegatedExecutionOsgiBundleApplicationContext`
  Returns the OSGi event multicaster (if any) associated with this application context.

  Specified by:
    `getDelegatedEventMulticaster` in interface `DelegatedExecutionOsgiBundleApplicationContext`
  Returns:
    the OSGi event multicaster associated with this context

### setContextClassLoaderProvider

    public void setContextClassLoaderProvider(ContextClassLoaderProvider contextClassLoaderProvider)

  Sets the `ContextClassLoaderProvider` used by this OSGi application context instance. By default, `DefaultContextClassLoaderProvider` is used.

  Parameters:
    `contextClassLoaderProvider` - context class loader provider to use
  See Also:
    `ContextClassLoaderProvider`, `DefaultContextClassLoaderProvider`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2012. All Rights Reserved.