com.netflix.config
Class DynamicWatchedConfiguration

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.DynamicWatchedConfiguration
All Implemented Interfaces:
WatchedUpdateListener, org.apache.commons.configuration.Configuration

public class DynamicWatchedConfiguration
extends ConcurrentMapConfiguration
implements WatchedUpdateListener

A configuration that waits for a watcher event from the specified config source. The property values in this configuration will be changed dynamically at runtime if the value changes in the underlying configuration source.

This configuration does not allow null as key or value and will throw NullPointerException when trying to add or set properties with empty key or value.


Field Summary
 
Fields inherited from class com.netflix.config.ConcurrentMapConfiguration
DISABLE_DELIMITER_PARSING, map
 
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
 
Constructor Summary
DynamicWatchedConfiguration(WatchedConfigurationSource source)
          Simplified constructor with the following defaults:
ignoreDeletesFromSource = false
dynamicPropertyUpdater = new DynamicPropertyUpdater()
DynamicWatchedConfiguration(WatchedConfigurationSource source, boolean ignoreDeletesFromSource, DynamicPropertyUpdater updater)
          Create an instance of the WatchedConfigurationSource, add listeners, and wait for the update callbacks.
 
Method Summary
 WatchedConfigurationSource getSource()
           
 boolean isIgnoreDeletesFromSource()
           
 void updateConfiguration(WatchedUpdateResult result)
          Updates the configuration either incrementally or fully depending on the type of WatchedUpdateResult that is passed.
 
Methods inherited from class com.netflix.config.ConcurrentMapConfiguration
addConfigurationListener, addErrorListener, addProperty, addPropertyDirect, addPropertyImpl, clear, clearConfigurationListeners, clearErrorListeners, clearPropertyDirect, containsKey, copy, fireError, fireEvent, getConfigurationListeners, getErrorListeners, getKeys, getProperties, getProperty, isEmpty, loadProperties, removeConfigurationListener, removeErrorListener, setProperty, setPropertyImpl
 
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
 

Constructor Detail

DynamicWatchedConfiguration

public DynamicWatchedConfiguration(WatchedConfigurationSource source,
                                   boolean ignoreDeletesFromSource,
                                   DynamicPropertyUpdater updater)
Create an instance of the WatchedConfigurationSource, add listeners, and wait for the update callbacks.

Parameters:
source - PolledConfigurationSource to poll

DynamicWatchedConfiguration

public DynamicWatchedConfiguration(WatchedConfigurationSource source)
Simplified constructor with the following defaults:
ignoreDeletesFromSource = false
dynamicPropertyUpdater = new DynamicPropertyUpdater()

Parameters:
source - WatchedConfigurationSource
Method Detail

updateConfiguration

public void updateConfiguration(WatchedUpdateResult result)
Description copied from interface: WatchedUpdateListener
Updates the configuration either incrementally or fully depending on the type of WatchedUpdateResult that is passed.

Specified by:
updateConfiguration in interface WatchedUpdateListener

isIgnoreDeletesFromSource

public boolean isIgnoreDeletesFromSource()
Returns:
if the this configuration will ignore deletes from source

getSource

public WatchedConfigurationSource getSource()
Returns:
underlying WatchedConfigurationSource