org.springframework.osgi.context.support
Class OsgiBundleXmlApplicationContext

java.lang.Object
  extended by org.springframework.core.io.DefaultResourceLoader
      extended by org.springframework.context.support.AbstractApplicationContext
          extended by org.springframework.context.support.AbstractRefreshableApplicationContext
              extended by org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext
                  extended by org.springframework.osgi.internal.context.support.AbstractDelegatedExecutionApplicationContext
                      extended by org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext
All Implemented Interfaces:
BeanFactory, DisposableBean, HierarchicalBeanFactory, ListableBeanFactory, ApplicationContext, ApplicationEventPublisher, ConfigurableApplicationContext, Lifecycle, MessageSource, ResourceLoader, ResourcePatternResolver, ConfigurableOsgiBundleApplicationContext, org.springframework.osgi.internal.context.DelegatedExecutionOsgiBundleApplicationContext

public class OsgiBundleXmlApplicationContext
extends org.springframework.osgi.internal.context.support.AbstractDelegatedExecutionApplicationContext

XML specific application context backed by an OSGi bundle.

Author:
Adrian Colyer, Costin Leau, Andy Piper, Hal Hildebrand

Field Summary
 
Fields inherited from class org.springframework.context.support.AbstractApplicationContext
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME
 
Fields inherited from interface org.springframework.osgi.context.ConfigurableOsgiBundleApplicationContext
APPLICATION_CONTEXT_SERVICE_PROPERTY_NAME, BUNDLE_CONTEXT_BEAN_NAME
 
Fields inherited from interface org.springframework.context.ConfigurableApplicationContext
LOAD_TIME_WEAVER_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
OsgiBundleXmlApplicationContext(String[] configLocations)
           
 
Method Summary
protected  String[] getDefaultConfigLocations()
          Return the default config locations to use, for the case where no explicit config locations have been specified.
protected  void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader)
          Allows subclasses to do custom initialization here.
protected  void loadBeanDefinitions(DefaultListableBeanFactory beanFactory)
          Loads the bean definitions via an XmlBeanDefinitionReader.
protected  void loadBeanDefinitions(XmlBeanDefinitionReader reader)
          Load the bean definitions with the given XmlBeanDefinitionReader.
 
Methods inherited from class org.springframework.osgi.internal.context.support.AbstractDelegatedExecutionApplicationContext
doClose, finishRefresh, getMonitor, isAvailable, normalClose, normalRefresh, postRefresh, preRefresh, refresh, setExecutor
 
Methods inherited from class org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext
cleanOsgiBundleScope, createBundleClassLoader, destroyBeans, getBundle, getBundleContext, getBundleSymbolicName, getClassLoader, getConfigLocations, getResource, getResourceByPath, getResourcePatternResolver, getResources, obtainFreshBeanFactory, postProcessBeanFactory, publishContextAsOsgiServiceIfNecessary, setBundleContext, setClassLoader, setConfigLocations, setPublishContextAsService
 
Methods inherited from class org.springframework.context.support.AbstractRefreshableApplicationContext
closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, refreshBeanFactory
 
Methods inherited from class org.springframework.context.support.AbstractApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, addListener, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, finishBeanFactoryInitialization, getAliases, getApplicationListeners, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getDisplayName, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleDependentBeans, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, onClose, onRefresh, prepareBeanFactory, prepareRefresh, publishEvent, registerBeanPostProcessors, registerListeners, registerShutdownHook, setDisplayName, 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.springframework.osgi.context.ConfigurableOsgiBundleApplicationContext
getBundle, getBundleContext, setBundleContext, setConfigLocations, setPublishContextAsService
 
Methods inherited from interface org.springframework.context.ConfigurableApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, close, getBeanFactory, isActive, registerShutdownHook, setParent
 
Methods inherited from interface org.springframework.context.ApplicationContext
getAutowireCapableBeanFactory, getDisplayName, getParent, getStartupDate
 
Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType
 
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, 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

OsgiBundleXmlApplicationContext

public OsgiBundleXmlApplicationContext(String[] configLocations)
Method Detail

getDefaultConfigLocations

protected String[] getDefaultConfigLocations()
Description copied from class: AbstractOsgiBundleApplicationContext
Return the default config locations to use, for the case where no explicit config locations have been specified.

Default implementation returns null, requiring explicit config locations.

Overrides:
getDefaultConfigLocations in class AbstractOsgiBundleApplicationContext
See Also:
AbstractOsgiBundleApplicationContext.setConfigLocations(java.lang.String[])

loadBeanDefinitions

protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory)
                            throws IOException
Loads the bean definitions via an XmlBeanDefinitionReader.

Specified by:
loadBeanDefinitions in class AbstractRefreshableApplicationContext
Throws:
IOException
See Also:
XmlBeanDefinitionReader, initBeanDefinitionReader(org.springframework.beans.factory.xml.XmlBeanDefinitionReader), loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory)

initBeanDefinitionReader

protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader)
Allows subclasses to do custom initialization here.

Parameters:
beanDefinitionReader -

loadBeanDefinitions

protected void loadBeanDefinitions(XmlBeanDefinitionReader reader)
                            throws BeansException,
                                   IOException
Load the bean definitions with the given XmlBeanDefinitionReader.

The lifecycle of the bean factory is handled by the refreshBeanFactory method; therefore this method is just supposed to load and/or register bean definitions.

Delegates to a ResourcePatternResolver for resolving location patterns into Resource instances.

Throws:
BeansException - in case of bean registration errors
IOException - if the required XML document isn't found
See Also:
AbstractRefreshableApplicationContext.refreshBeanFactory(), AbstractOsgiBundleApplicationContext.getConfigLocations(), AbstractOsgiBundleApplicationContext.getResources(java.lang.String), AbstractOsgiBundleApplicationContext.getResourcePatternResolver()


Copyright © 2006-2007 Spring Framework. All Rights Reserved.