Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-143

[configuration] Support event listeners for configurations

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.2
    • 1.4
    • None
    • None
    • Operating System: other
      Platform: Other

    • 38929

    Description

      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
      cleared:

      • 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?

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--events.diff
          18 kB
          Oliver Heger
        2. ASF.LICENSE.NOT.GRANTED--events.diff
          29 kB
          Oliver Heger
        3. ASF.LICENSE.NOT.GRANTED--events-tests.diff
          32 kB
          Oliver Heger

        Activity

          People

            Unassigned Unassigned
            oheger Oliver Heger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: