com.tomgibara.pronto.config
Interface ConfigSource

All Known Implementing Classes:
CachingConfigSource, CompositeConfigSource, FileConfigSource, MapConfigSource, PreferencesConfigSource, StringConfigSource, SynchronizedConfigSource, SystemConfigSource, URLConfigSource

public interface ConfigSource

Implementations of this interface are supplied to configs to provide the raw properties for configuration. A config will externally synchronize calls to this interface. If a ConfigSource instance is supplied to more than one config then that instance must be safe for concurrent use.

Author:
Tom Gibara

Method Summary
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          A map of the configuration properties supplied by this source.
 long lastModified()
          Returns the time at which the properties were last known to have changed.
 

Method Detail

lastModified

long lastModified()
                  throws java.lang.RuntimeException
Returns the time at which the properties were last known to have changed. This method must be implemented and MAY NOT return rogue values if the time is unknown. The correct behaviour in such circumstances is to return the current system time. If calculation of the time fails, the implementation is free to throw a runtime exception of its choosing.

Returns:
the time at which the properties were last known to have changed, must be positive
Throws:
java.lang.RuntimeException - if the last modified timestamp could not be generated

getProperties

java.util.Map<java.lang.String,java.lang.String> getProperties()
                                                               throws java.lang.RuntimeException
A map of the configuration properties supplied by this source. The map returned by this method will not be modified by the config. The implementation is free to throw an unchecked exception of its choice if the properties cannot be supplied.

Returns:
the properties for this source, never null
Throws:
java.lang.RuntimeException - if the properties could not be supplied


Copyright © 2006-2007 Tom Gibara. All Rights Reserved.