Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration

[configuration] Provide support for declaring and creating objects


    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      Operating System: All
      Platform: All

    • Bugzilla Id:


      A useful enhancement for the configuration API could be a way to create and
      initialize objects whose class and initialization parameters are defined in a
      configuration file.

      The idea is that both the class name and initialization parameters for an object
      are defined in a standard format. A createObject(String key) method (which might
      fit best in DataConfiguration?) would extract the class name from the specified
      property, create the object using reflection and then populate properties via

      For the concrete format for declaring objects in a configuration file there are
      many possibilities. We have to define a format which is easy to use, but
      although suports complex initialization parameters. A possible object
      declaration could look as follows (here in XML flavour, but other configuration
      sources are of course possible, too):


      We could even go a step further and define an interface
      public interface Configurable
      void initialize(Configuration config);

      If the newly created object implements this interface, its initialize() method
      will be called and a sub configuration will be passed that contains the content
      of the <args> section. This would allow for arbitrary complex and also
      hierarchical initialization parameters. It's a bit similar to what IoC
      frameworks do.

      Side note: If we add more features to the configuration definition files
      processed by ConfigurationFactory (e.g locators or declarations for reloading
      strategies) and use a XMLConfiguration to load these files, the proposed object
      creation facility may come in handy.




            • Assignee:
              oliver.heger@t-online.de Oliver Heger
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: