Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-2654

Reloadable Configurations via Apache Commons Configuration



    • Attachments:
    • Comments:
    • Documentation Status:
      Complete or Committed


      While there have been many talks of Dynamic Configurations, both in tickets (e.g. DS-1242) and Use Cases [1], it is possible to quickly correct some Configuration pain points by simply using Apache Commons Configuration instead of our "homegrown" Properties-based Configuration cache:


      Commons Configuration has several immediate advantages over our current implementation:

      • Configs can be stored in files (properties or XML/hierarchical), database, system properties, etc. Or in multiple sources at once, as needed
      • Configs can be reloaded (either automatically or on demand) without restarting a servlet container (Tomcat). For file-based configs, we could set them up to reload automatically whenever a file changes, or simply provide a "Reload Configs" button from the Admin UI.
      • Configs can be loaded in such a way that you can override values. So, we could potentially have an optional "local.cfg" whose values will override any defaults set in "dspace.cfg" (or module configs). This would allow users the ability to manage the configs they care about in a separate file, if they wanted.
      • Commons Configuration automatically performs variable interpolation based on other configs or even system properties (allowing us to more easily reuse settings in other configs): http://commons.apache.org/proper/commons-configuration/userguide_v1.10/howto_basicfeatures.html#Variable_Interpolation
      • Using Commons Configuration is much easier than maintaining our own custom storage/parsing of properties files

      I've been playing around with refactoring our ConfigurationService and DSpaceServiceManager in general to use Commons Configuration.

      I have a basic refactor which is "backwards compatible", passes all Unit Tests, and allows us to dynamically reload our config files (without restarting Tomcat). The refactor itself wasn't too complex, though it touches a lot of files in 'dspace-services'.

      Fair warning though, what I have is not fully functional as of yet (it only loads dspace.cfg, and not yet modules configs). But, I wanted to share this work early, for immediate feedback before moving it forward. PR will be posted shortly with more information.


          Issue Links



              tdonohue Tim Donohue
              tdonohue Tim Donohue
              0 Vote for this issue
              5 Start watching this issue