org.springframework.extensions.config.xml
Class XMLConfigService

java.lang.Object
  extended by org.springframework.extensions.surf.util.AbstractLifecycleBean
      extended by org.springframework.extensions.config.BaseConfigService
          extended by org.springframework.extensions.config.xml.XMLConfigService
All Implemented Interfaces:
EventListener, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener, ConfigService, XMLConfigConstants

public class XMLConfigService
extends BaseConfigService
implements XMLConfigConstants

XML based configuration service.

The sytem properties can be used; to override entries in the properties files, act as fallback values or be ignored.

Author:
gavinc

Nested Class Summary
static class XMLConfigService.PlaceholderResolvingStringValueResolver
          BeanDefinitionVisitor that resolves placeholders in String values, delegating to the parseStringValue method of the containing class.
static class XMLConfigService.PropertyConfigurer
          Provides access to property values
 
Field Summary
 
Fields inherited from class org.springframework.extensions.config.BaseConfigService
configDeployers, configSource
 
Fields inherited from class org.springframework.extensions.surf.util.AbstractLifecycleBean
log
 
Fields inherited from interface org.springframework.extensions.config.xml.XMLConfigConstants
ATTR_CLASS, ATTR_CONDITION, ATTR_ELEMENT_NAME, ATTR_EVALUATOR, ATTR_ID, ATTR_NAME, ATTR_REPLACE, ATTR_VALUE, ELEMENT_CONFIG, ELEMENT_ELEMENT_READER, ELEMENT_ELEMENT_READERS, ELEMENT_EVALUATOR, ELEMENT_EVALUATORS, ELEMENT_PLUG_INS
 
Constructor Summary
XMLConfigService(ConfigSource configSource)
          Constructs an XMLConfigService using the given config source
 
Method Summary
 void destroy()
          Cleans up all the resources used by the config service
protected  Map<String,ConfigElementReader> getElementReaders()
          Get the elementReaders from the in-memory 'cache'
 List<ConfigDeployment> initConfig()
          Initialises the config service - via bootstrap
protected  void parse(InputStream stream)
          Parses the given config stream
protected  void putElementReaders(Map<String,ConfigElementReader> elementReaders)
          Put the elementReaders into the in-memory 'cache'
protected  void removeElementReaders()
          Remove the elementReaders from the in-memory 'cache'
 void setProperties(org.springframework.core.io.Resource[] locations)
          Set locations of properties files to be loaded.
 void setSystemPropertiesModeName(String constantName)
          Set the system property mode by the name of the corresponding constant, e.g.
 
Methods inherited from class org.springframework.extensions.config.BaseConfigService
addConfigSection, addDeployer, addEvaluator, appendConfig, createEvaluator, getConfig, getConfig, getEvaluator, getEvaluators, getGlobalConfig, getGlobalConfigImpl, getSections, getSectionsByArea, init, onBootstrap, onShutdown, parse, processSection, putEvaluators, putGlobalConfig, putSections, putSectionsByArea, removeEvaluators, removeGlobalConfig, removeSections, removeSectionsByArea, reset
 
Methods inherited from class org.springframework.extensions.surf.util.AbstractLifecycleBean
getApplicationContext, onApplicationEvent, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLConfigService

public XMLConfigService(ConfigSource configSource)
Constructs an XMLConfigService using the given config source

Parameters:
configSource - A ConfigSource
Method Detail

setProperties

public void setProperties(org.springframework.core.io.Resource[] locations)
Set locations of properties files to be loaded.

Can point to classic properties files or to XML files that follow JDK 1.5's properties XML format.


setSystemPropertiesModeName

public void setSystemPropertiesModeName(String constantName)
                                 throws IllegalArgumentException
Set the system property mode by the name of the corresponding constant, e.g. "SYSTEM_PROPERTIES_MODE_OVERRIDE".

Parameters:
constantName - name of the constant
Throws:
IllegalArgumentException - if an invalid constant was specified
See Also:
#setSystemPropertiesMode

initConfig

public List<ConfigDeployment> initConfig()
Description copied from class: BaseConfigService
Initialises the config service - via bootstrap

Overrides:
initConfig in class BaseConfigService

destroy

public void destroy()
Description copied from class: BaseConfigService
Cleans up all the resources used by the config service

Overrides:
destroy in class BaseConfigService

parse

protected void parse(InputStream stream)
Description copied from class: BaseConfigService
Parses the given config stream

Specified by:
parse in class BaseConfigService
Parameters:
stream - The input stream representing the config data

getElementReaders

protected Map<String,ConfigElementReader> getElementReaders()
Get the elementReaders from the in-memory 'cache'

Returns:
elementReaders

putElementReaders

protected void putElementReaders(Map<String,ConfigElementReader> elementReaders)
Put the elementReaders into the in-memory 'cache'

Parameters:
elementReaders -

removeElementReaders

protected void removeElementReaders()
Remove the elementReaders from the in-memory 'cache'



Copyright © 2009 SpringSource, Inc. All Rights Reserved.