org.apache.xbean.server.spring.loader
Class SpringLoader

java.lang.Object
  extended by org.apache.xbean.server.spring.loader.SpringLoader
All Implemented Interfaces:
Loader
Direct Known Subclasses:
PureSpringLoader

public class SpringLoader
extends Object
implements Loader

SpringLoader loads Spring xml configurations into a Kernel. This service uses the XBean version of FileSystemXmlApplicationContext so custom XML extensions are available. This loader also support the specification of SpringXmlPreprocessors and BeanFactoryPostProcessors to apply to the configuration.

Since:
2.0
Author:
Dain Sundstrom

Constructor Summary
SpringLoader()
          Creates an empty SpringLoader.
 
Method Summary
protected  org.springframework.context.support.AbstractXmlApplicationContext createXmlApplicationContext(String configLocation)
          A factory method for creating the application context
 org.springframework.context.support.AbstractXmlApplicationContext getApplicationContext()
          Returns the last Spring application context that was read via the call to load(String)
 File getBaseDir()
          Gets the base directory from which configuration locations are resolved.
 List getBeanFactoryPostProcessors()
          Gets the BeanFactoryPostProcessors to apply to the configuration.
 org.apache.xbean.kernel.Kernel getKernel()
          Gets the kernel in which configuraitons are loaded.
 List getXmlPreprocessors()
          Gets the SpringXmlPreprocessors applied to the configuration.
 org.apache.xbean.kernel.ServiceName load(String location)
          Loads the specified configuration into the kernel.
 void setBaseDir(File baseDir)
          Sets the base directory from which configuration locations are resolved.
 void setBeanFactoryPostProcessors(List beanFactoryPostProcessors)
          Sets the BeanFactoryPostProcessors to apply to the configuration.
 void setKernel(org.apache.xbean.kernel.Kernel kernel)
          Sets the kernel in which configurations are loaded.
 void setXmlPreprocessors(List xmlPreprocessors)
          Sets the SpringXmlPreprocessors applied to the configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringLoader

public SpringLoader()
Creates an empty SpringLoader. Note this loader is not usable until a kernel is specified.

Method Detail

getKernel

public org.apache.xbean.kernel.Kernel getKernel()
Gets the kernel in which configuraitons are loaded.

Specified by:
getKernel in interface Loader
Returns:
the kernel in which configurations are loaded

setKernel

public void setKernel(org.apache.xbean.kernel.Kernel kernel)
Sets the kernel in which configurations are loaded.

Parameters:
kernel - the kernel in which configurations are loaded

getBeanFactoryPostProcessors

public List getBeanFactoryPostProcessors()
Gets the BeanFactoryPostProcessors to apply to the configuration.

Returns:
the BeanFactoryPostProcessors to apply to the configuration

setBeanFactoryPostProcessors

public void setBeanFactoryPostProcessors(List beanFactoryPostProcessors)
Sets the BeanFactoryPostProcessors to apply to the configuration.

Parameters:
beanFactoryPostProcessors - the BeanFactoryPostProcessors to apply to the configuration

getBaseDir

public File getBaseDir()
Gets the base directory from which configuration locations are resolved.

Returns:
the base directory from which configuration locations are resolved

setBaseDir

public void setBaseDir(File baseDir)
Sets the base directory from which configuration locations are resolved.

Parameters:
baseDir - the base directory from which configuration locations are resolved

getXmlPreprocessors

public List getXmlPreprocessors()
Gets the SpringXmlPreprocessors applied to the configuration.

Returns:
the SpringXmlPreprocessors applied to the configuration

setXmlPreprocessors

public void setXmlPreprocessors(List xmlPreprocessors)
Sets the SpringXmlPreprocessors applied to the configuration.

Parameters:
xmlPreprocessors - the SpringXmlPreprocessors applied to the configuration

load

public org.apache.xbean.kernel.ServiceName load(String location)
                                         throws Exception
Loads the specified configuration into the kernel. The location specifies a file relative to the baseDir using baseDir.toURI().resolve(location).getPath() + ".xml". This service uses the XBean version of FileSystemXmlApplicationContext so custom XML extensions are available.

Specified by:
load in interface Loader
Parameters:
location - the location of the configuration file relative to the base directory without the .xml extension
Returns:
the name of the SpringConfiguration service for this location
Throws:
Exception - if a problem occurs while loading the Spring configuration file

getApplicationContext

public org.springframework.context.support.AbstractXmlApplicationContext getApplicationContext()
Returns the last Spring application context that was read via the call to load(String)


createXmlApplicationContext

protected org.springframework.context.support.AbstractXmlApplicationContext createXmlApplicationContext(String configLocation)
A factory method for creating the application context



Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.