public class

ConfigurationManager

extends Object
java.lang.Object
   ↳ org.ops4j.pax.exam.ConfigurationManager

Class Overview

Reads configuration settings from a properties file exam.properties at the root of the classpath. System properties take precedence over properties in the configuration file.

Also allows setting system properties from a properties URL.

Summary

Public Constructors
ConfigurationManager()
Creates a configuration manager.
Public Methods
String getProperty(String key, String defaultValue)
Returns the configuration property for the given key, or the given default value.
String getProperty(String key)
Returns the configuration property for the given key.
void loadSystemProperties(String configurationKey)
Loads system properties from the given configuration key.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ConfigurationManager ()

Creates a configuration manager.

Public Methods

public String getProperty (String key, String defaultValue)

Returns the configuration property for the given key, or the given default value.

Parameters
key configuration key
Returns
  • configuration value, or the default value if the key is not defined

public String getProperty (String key)

Returns the configuration property for the given key.

Parameters
key configuration key
Returns
  • configuration value, or null

public void loadSystemProperties (String configurationKey)

Loads system properties from the given configuration key.

If this configuration key has no value, then this method has no effect.

If the value starts with env:, this prefix is stripped and the remainder is taken to be an environment variable. The value is then replaced by the value of the environment variable.

This value is now interpreted as a classpath resource and converted to a URL. If the value has no matching classpath resource, the value itself is interpreted as a URL.

Finally, properties are loaded from this URL and merged into the current system properties.

Parameters
configurationKey configuration key, the value defining a property source