org.abstracthorizon.danube.http.spring
Class ResourceXmlApplicationContext

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.context.support.AbstractXmlApplicationContext
                  extended by org.springframework.context.support.FileSystemXmlApplicationContext
                      extended by org.abstracthorizon.danube.http.spring.ResourceXmlApplicationContext
All Implemented Interfaces:
BeanFactory, DisposableBean, HierarchicalBeanFactory, ListableBeanFactory, ApplicationContext, ApplicationContextAware, ApplicationEventPublisher, ConfigurableApplicationContext, Lifecycle, MessageSource, ResourceLoader, ResourcePatternResolver

public class ResourceXmlApplicationContext
extends FileSystemXmlApplicationContext
implements ApplicationContextAware

This application context extension allows resources to be created using supplied location (a resource).

Author:
Daniel Sendula

Field Summary
protected  Resource location
          Location to be used
protected  org.slf4j.Logger logger
          Logger
protected  ResourceLoader resourceLoader
          Resource loader
 
Fields inherited from class org.springframework.context.support.AbstractApplicationContext
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, MESSAGE_SOURCE_BEAN_NAME
 
Fields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX
 
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
ResourceXmlApplicationContext(String location, String configLocation)
          Consturctor
ResourceXmlApplicationContext(String location, String[] configLocations)
          Constructor
ResourceXmlApplicationContext(String location, String[] configLocations, ApplicationContext parent)
          Constructor
ResourceXmlApplicationContext(String location, String[] configLocations, boolean refresh)
          Constructor
ResourceXmlApplicationContext(String location, String[] configLocations, boolean refresh, ApplicationContext parent)
          Constructor
 
Method Summary
protected  Resource getResourceByPath(String path)
          Getting resource by given path
protected  Resource normaliseResource(Resource r)
          This method normalises the resource adding final "/" to paths (not files)
 void setApplicationContext(ApplicationContext applicationContext)
          Sets current application context bean is to be retrieved from
 
Methods inherited from class org.springframework.context.support.FileSystemXmlApplicationContext
getConfigLocations
 
Methods inherited from class org.springframework.context.support.AbstractXmlApplicationContext
getConfigResources, initBeanDefinitionReader, loadBeanDefinitions, loadBeanDefinitions
 
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, destroyBeans, doClose, getAliases, getApplicationListeners, getAutowireCapableBeanFactory, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getDisplayName, getInternalParentBeanFactory, getInternalParentMessageSource, getLifecycleBeans, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResourcePatternResolver, getResources, getStartupDate, getType, initApplicationEventMulticaster, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, obtainFreshBeanFactory, onClose, onRefresh, postProcessBeanFactory, prepareBeanFactory, prepareRefresh, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, setDisplayName, setParent, start, stop, toString
 
Methods inherited from class org.springframework.core.io.DefaultResourceLoader
getClassLoader, getResource, setClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.core.io.ResourceLoader
getClassLoader, getResource
 

Field Detail

logger

protected org.slf4j.Logger logger
Logger


location

protected Resource location
Location to be used


resourceLoader

protected ResourceLoader resourceLoader
Resource loader

Constructor Detail

ResourceXmlApplicationContext

public ResourceXmlApplicationContext(String location,
                                     String configLocation)
                              throws BeansException
Consturctor

Parameters:
location - location to be used for resources
configLocation - config locations
Throws:
BeansException

ResourceXmlApplicationContext

public ResourceXmlApplicationContext(String location,
                                     String[] configLocations)
                              throws BeansException
Constructor

Parameters:
location - location to be used for resources
configLocations - config locations
Throws:
BeansException

ResourceXmlApplicationContext

public ResourceXmlApplicationContext(String location,
                                     String[] configLocations,
                                     boolean refresh)
                              throws BeansException
Constructor

Parameters:
location - location to be used for resources
configLocations - config locations
Throws:
BeansException

ResourceXmlApplicationContext

public ResourceXmlApplicationContext(String location,
                                     String[] configLocations,
                                     ApplicationContext parent)
                              throws BeansException
Constructor

Parameters:
location - location to be used for resources
configLocations - config locations
parent - parent application context
Throws:
BeansException

ResourceXmlApplicationContext

public ResourceXmlApplicationContext(String location,
                                     String[] configLocations,
                                     boolean refresh,
                                     ApplicationContext parent)
                              throws BeansException
Constructor

Parameters:
location - location to be used for resources
configLocations - config locations
refresh - to refresh in constructor
parent - parent context
Throws:
BeansException
Method Detail

getResourceByPath

protected Resource getResourceByPath(String path)
Getting resource by given path

Overrides:
getResourceByPath in class FileSystemXmlApplicationContext
Parameters:
path - path
Returns:
new resource created of given location (if supplied)

normaliseResource

protected Resource normaliseResource(Resource r)
This method normalises the resource adding final "/" to paths (not files)

Parameters:
r - resource
Returns:
new resource

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
Sets current application context bean is to be retrieved from

Specified by:
setApplicationContext in interface ApplicationContextAware
Parameters:
applicationContext - application context bean is to be retrieved from


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.