@Service public class ServerPropertiesService extends Object implements ServerProperties, ServerConfiguration, org.springframework.context.ApplicationContextAware
| Constructor and Description |
|---|
ServerPropertiesService()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addProperties(Properties props)
Adds the properties in props to the current configuration.
|
Collection<?> |
configureInstances(Class<?> target)
Creates and configures potentially multiple instances of a target class
annotated as
ConfigurableInstance. |
void |
configureMe(Object target)
Configures a target object by matching configuration clauses with
ConfigurableValue annotations on the
target object. |
Collection<?> |
configureNamedInstances(List<?> instances)
Configures a set of named instances that have already been created.
|
Properties |
getBootstrapState() |
Double |
getDoubleProperty(String name,
Double defaultValue)
Returns the value of the named property as a Double, or
defaultValue if no such property is found.
|
Integer |
getIntegerProperty(String name,
Integer defaultValue)
Returns the value of the named property as an Integer, or
defaultValue if no such property is found.
|
String |
getProperty(String name)
Returns the value of the property with the given name, or null if no
such property is found.
|
String |
getProperty(String name,
String defaultValue)
Returns the value of the named property, or the defaultValue if no
such property is found.
|
Properties |
getPublishedConfiguration()
Returns the published configuration as a Properties instance
|
void |
publishConfiguration(Object target)
Gathers public configuration data for publication to brokers.
|
void |
recycle()
Come here to re-configure from scratch.
|
void |
saveBootstrapState(Object thing)
Gathers state information at the end of a boot session to be restored in a
subsequent sim session.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext context) |
void |
setProperty(String key,
Object value)
Changes the value of a property (or adds a property).
|
void |
setUserConfig(URL userConfigURL) |
public void recycle()
public void setUserConfig(URL userConfigURL) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
org.apache.commons.configuration2.ex.ConfigurationExceptionIOExceptionpublic void addProperties(Properties props)
public void configureMe(Object target)
ServerConfigurationConfigurableValue annotations on the
target object. This is typically called in the initialize() method.configureMe in interface ServerConfigurationpublic Collection<?> configureInstances(Class<?> target)
ServerConfigurationConfigurableInstance.
Returns the created instances in a list in no particular order.configureInstances in interface ServerConfigurationpublic Collection<?> configureNamedInstances(List<?> instances)
ServerConfigurationconfigureNamedInstances in interface ServerConfigurationpublic void publishConfiguration(Object target)
ServerConfigurationConfigurableValue
properties with publish=true. Note that such properties must either be
fields, or have a "standard" getter, or must specify a getter that produces
the value as a String. This is typically called at the end of the
initialize() method.publishConfiguration in interface ServerConfigurationpublic Properties getPublishedConfiguration()
public void saveBootstrapState(Object thing)
ServerConfigurationConfigurableValue properties with
bootstrapState=true. Such properties can be fields, or may have "standard"
getters and setters. This method is called at the end of a bootstrap session
session by a component that wishes to have its state saved in the boot record.saveBootstrapState in interface ServerConfigurationpublic Properties getBootstrapState()
public String getProperty(String name)
ServerPropertiesgetProperty in interface ServerPropertiespublic String getProperty(String name, String defaultValue)
ServerPropertiesgetProperty in interface ServerPropertiespublic Integer getIntegerProperty(String name, Integer defaultValue)
ServerPropertiesgetIntegerProperty in interface ServerPropertiespublic Double getDoubleProperty(String name, Double defaultValue)
ServerPropertiesgetDoubleProperty in interface ServerPropertiespublic void setApplicationContext(org.springframework.context.ApplicationContext context)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionCopyright © 2017 Power TAC. All rights reserved.