public class Configurator extends Object
Configuration clauses are assumed to be of the form
pkg.class[.instance].property = value
where pkg is the package name without org.powertac
(or the full classname for classes outside the org.powertac hierarchy),
class is the classname (but the first character is lowercase),
instance is an optional instance name,
and property is the property name.
The target property must be annotated with ConfigurableValue
,
either on the property itself, or on a setter method.
For example, the following property will set the jmsBrokerUrl property
of the class JmsManagementService.
server.jmsManagementService.jmsBrokerUrl = tcp://localhost:61616
In the server, an instance of this class is typically created by a service that collects configuration data, creates and initializes a Configurator, then waits for each service to ask for its configuration. There are many examples of configuration settings in the server properties file.
When used in a broker, classes outside the org.powertac tree can be used if the full package prefix is specified. For example, the following property specification will set the foo property of class edu.umn.Bar:
edu.umn.bar.foo = 42
Constructor and Description |
---|
Configurator() |
Modifier and Type | Method and Description |
---|---|
Collection<?> |
configureInstances(Class<?> type)
Creates and configures instances of the given class.
|
Collection<?> |
configureNamedInstances(List<?> instances)
Configures a set of instances of some class.
|
void |
configureSingleton(Object thing)
Configures the given thing, using the pre-loaded Configuration.
|
void |
gatherBootstrapList(List<Object> things,
ConfigurationRecorder recorder)
Pulls "bootstrapState" ConfigurationValues out of objects in the given
list, adds them to config with their names.
|
void |
gatherBootstrapState(Object thing,
ConfigurationRecorder recorder)
Pulls the "bootstrapState" ConfigurableValues out of object thing, adds
them to config.
|
void |
gatherPublishedConfiguration(Object thing,
ConfigurationRecorder recorder)
Pulls the "published" ConfigurableValues out of object thing, adds them to
config.
|
static org.apache.commons.configuration2.PropertiesConfiguration |
readProperties(File file) |
static org.apache.commons.configuration2.PropertiesConfiguration |
readProperties(String path) |
static org.apache.commons.configuration2.PropertiesConfiguration |
readProperties(URL url) |
static org.apache.commons.configuration2.XMLConfiguration |
readXML(File file) |
static org.apache.commons.configuration2.XMLConfiguration |
readXML(String path) |
static org.apache.commons.configuration2.XMLConfiguration |
readXML(URL url) |
void |
setConfigOutput(ConfigurationRecorder configOutput)
Sets up an output stream for config dump.
|
void |
setConfiguration(org.apache.commons.configuration2.AbstractConfiguration config)
Loads a Configuration into this Configurator.
|
public static final org.apache.commons.configuration2.XMLConfiguration readXML(String path) throws org.apache.commons.configuration2.ex.ConfigurationException
org.apache.commons.configuration2.ex.ConfigurationException
public static final org.apache.commons.configuration2.XMLConfiguration readXML(File file) throws org.apache.commons.configuration2.ex.ConfigurationException
org.apache.commons.configuration2.ex.ConfigurationException
public static final org.apache.commons.configuration2.XMLConfiguration readXML(URL url) throws org.apache.commons.configuration2.ex.ConfigurationException
org.apache.commons.configuration2.ex.ConfigurationException
public static final org.apache.commons.configuration2.PropertiesConfiguration readProperties(String path) throws org.apache.commons.configuration2.ex.ConfigurationException
org.apache.commons.configuration2.ex.ConfigurationException
public static final org.apache.commons.configuration2.PropertiesConfiguration readProperties(URL url) throws org.apache.commons.configuration2.ex.ConfigurationException
org.apache.commons.configuration2.ex.ConfigurationException
public static final org.apache.commons.configuration2.PropertiesConfiguration readProperties(File file) throws org.apache.commons.configuration2.ex.ConfigurationException
org.apache.commons.configuration2.ex.ConfigurationException
public void setConfiguration(org.apache.commons.configuration2.AbstractConfiguration config)
public void setConfigOutput(ConfigurationRecorder configOutput)
public void configureSingleton(Object thing)
public Collection<?> configureInstances(Class<?> type)
public Collection<?> configureNamedInstances(List<?> instances)
public void gatherPublishedConfiguration(Object thing, ConfigurationRecorder recorder)
public void gatherBootstrapState(Object thing, ConfigurationRecorder recorder)
public void gatherBootstrapList(List<Object> things, ConfigurationRecorder recorder)
Copyright © 2019 Power TAC. All rights reserved.