Affects Version/s: 1.2
Fix Version/s: 1.4
Operating System: other
I would like to suggest creating a ConfigurationEvent class and a
ConfigurationEventListener interface for monitoring changes on configurations.
AbstractConfiguration could act as an event source allowing listeners to
register itself at an instance. Whenever this instance is modified a
notification is sent out to all registered listeners.
The event class could contain
- a reference to the affected Configuration object
- an ID about the type of the event (e.g. property added, property removed,
configuration cleared etc.)
- the name of the affected property if applicable
- the value of the affected property if applicable
The listener interface could be quite simple and contain only a single method:
void configurationChanged(ConfigurationEvent event);
While an implementation should not be too complicated some details need to be
- ATM as AbstractConfiguration is implemented an operation could cause multiple
events. For instance setProperty() is implemented as calling clearProperty() and
then addProperty(). Should this be caught and treated as a single event?
- Should a reload of a file based configuration cause an event? Could this be
problematic if a called listener tries to access the configuration?