com.netflix.config
Class ClasspathPropertiesConfiguration

java.lang.Object
  extended by org.apache.commons.configuration.event.EventSource
      extended by org.apache.commons.configuration.AbstractConfiguration
          extended by com.netflix.config.ConcurrentMapConfiguration
              extended by com.netflix.config.ClasspathPropertiesConfiguration
All Implemented Interfaces:
org.apache.commons.configuration.Configuration

public class ClasspathPropertiesConfiguration
extends ConcurrentMapConfiguration

A Conventional Standard based approach to modular configuration Assuming your application utilizes many modules (.jar files) and need Properties support, this class provides a convention based approach to scanning and loading properties from every jar in a classpath from a specific location. All modules are assumed to have properties in a location such as META-INF/conf/configuration.properties. Such resources may be anywhere in the classpath; for example in directories for a unit test or application. Parameters from such resources are contained in a Configuration whose name is usually the name of the .jar; for example "com.netflix.movieserviceclient.jar". For a resource not in a .jar, the Configuration name is the URL of the directory that contains the resource. However, if the resource contains a property named conf.configName, its value will be used as the Configuration name.

Such properties are often used in Spring, by defining a PropertyPlaceholderConfigurer that gets parameter values from ClasspathConfiguration.getProperties().


Field Summary
 
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN
 
Method Summary
 java.lang.String getConfigNameProperty()
           
 java.util.Properties getProperties()
          Returns properties from this configuration
 java.lang.String getPropertiesResourceRelativePath()
           
static void initialize(ConcurrentCompositeConfiguration containerConfig)
           
static void setConfigNameProperty(java.lang.String configNameProperty)
          Sets the name for the property name that defines the name for a bag of properties loaded from a properties resources Default if not set is config.configName
static void setPropertiesResourceRelativePath(java.lang.String propertiesResourceRelativePath)
           
 
Methods inherited from class com.netflix.config.ConcurrentMapConfiguration
addConfigurationListener, addErrorListener, addProperty, addPropertyDirect, clear, clearConfigurationListeners, clearErrorListeners, clearPropertyDirect, containsKey, copy, fireError, fireEvent, getConfigurationListeners, getErrorListeners, getKeys, getProperty, isEmpty, loadProperties, removeConfigurationListener, removeErrorListener, setProperty
 
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
addErrorLogListener, append, clearProperty, createInterpolator, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDefaultListDelimiter, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getList, getList, getListDelimiter, getLogger, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, getSubstitutor, interpolate, interpolate, interpolatedConfiguration, interpolateHelper, isDelimiterParsingDisabled, isScalarValue, isThrowExceptionOnMissing, resolveContainerStore, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, setLogger, setThrowExceptionOnMissing, subset
 
Methods inherited from class org.apache.commons.configuration.event.EventSource
clone, createErrorEvent, createEvent, isDetailEvents, setDetailEvents
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConfigNameProperty

public java.lang.String getConfigNameProperty()

setConfigNameProperty

public static void setConfigNameProperty(java.lang.String configNameProperty)
Sets the name for the property name that defines the name for a bag of properties loaded from a properties resources Default if not set is config.configName

Parameters:
configNameProperty -

getPropertiesResourceRelativePath

public java.lang.String getPropertiesResourceRelativePath()

setPropertiesResourceRelativePath

public static void setPropertiesResourceRelativePath(java.lang.String propertiesResourceRelativePath)
Parameters:
propertiesResourceRelativePath -

getProperties

public java.util.Properties getProperties()
Returns properties from this configuration

Overrides:
getProperties in class ConcurrentMapConfiguration

initialize

public static void initialize(ConcurrentCompositeConfiguration containerConfig)