Package org.powertac.server
Class ServerPropertiesService
- java.lang.Object
-
- org.powertac.server.ServerPropertiesService
-
- All Implemented Interfaces:
ServerConfiguration,ServerProperties,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
@Service public class ServerPropertiesService extends Object implements ServerProperties, ServerConfiguration, org.springframework.context.ApplicationContextAware
Implementation of the ServerProperties and ServerConfiguration interfaces.- Author:
- jcollins
-
-
Constructor Summary
Constructors Constructor Description ServerPropertiesService()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProperties(Properties props)Adds the properties in props to the current configuration.Collection<?>configureInstances(Class<?> target)voidconfigureMe(Object target)Collection<?>configureNamedInstances(List<?> instances)voidfinishConfigOutput()PropertiesgetBootstrapState()DoublegetDoubleProperty(String name, Double defaultValue)IntegergetIntegerProperty(String name, Integer defaultValue)StringgetProperty(String name)StringgetProperty(String name, String defaultValue)PropertiesgetPublishedConfiguration()Returns the published configuration as a Properties instancevoidpublishConfiguration(Object target)voidrecycle()Come here to re-configure from scratch.voidsaveBootstrapState(Object thing)voidsetApplicationContext(org.springframework.context.ApplicationContext context)voidsetConfigOutput(String filename)voidsetProperty(String key, Object value)Changes the value of a property (or adds a property).voidsetUserConfig(URL userConfigURL)
-
-
-
Method Detail
-
recycle
public void recycle()
Come here to re-configure from scratch. This is not done as an InitializationService because it has to happen before module initialization happens.
-
setUserConfig
public void setUserConfig(URL userConfigURL) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
- Throws:
org.apache.commons.configuration2.ex.ConfigurationExceptionIOException
-
setConfigOutput
public void setConfigOutput(String filename)
-
finishConfigOutput
public void finishConfigOutput()
-
addProperties
public void addProperties(Properties props)
Adds the properties in props to the current configuration. Note that it's not enough to just add the props as an additional configuration, because configurations are handled in FIFO order with respect to individual properties. Therefore, it's necessary to iterate through the properties and set them individually.
-
configureMe
public void configureMe(Object target)
- Specified by:
configureMein interfaceServerConfiguration
-
configureInstances
public Collection<?> configureInstances(Class<?> target)
- Specified by:
configureInstancesin interfaceServerConfiguration
-
configureNamedInstances
public Collection<?> configureNamedInstances(List<?> instances)
- Specified by:
configureNamedInstancesin interfaceServerConfiguration
-
publishConfiguration
public void publishConfiguration(Object target)
- Specified by:
publishConfigurationin interfaceServerConfiguration
-
getPublishedConfiguration
public Properties getPublishedConfiguration()
Returns the published configuration as a Properties instance
-
saveBootstrapState
public void saveBootstrapState(Object thing)
- Specified by:
saveBootstrapStatein interfaceServerConfiguration
-
getBootstrapState
public Properties getBootstrapState()
-
getProperty
public String getProperty(String name)
- Specified by:
getPropertyin interfaceServerProperties
-
getProperty
public String getProperty(String name, String defaultValue)
- Specified by:
getPropertyin interfaceServerProperties
-
getIntegerProperty
public Integer getIntegerProperty(String name, Integer defaultValue)
- Specified by:
getIntegerPropertyin interfaceServerProperties
-
getDoubleProperty
public Double getDoubleProperty(String name, Double defaultValue)
- Specified by:
getDoublePropertyin interfaceServerProperties
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext context) throws org.springframework.beans.BeansException- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
-