Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1845

Load configuration file without explicit mapping

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • None
    • None
    • Blueprint
    • None

    Description

      In Java, a properties file is, in essence, a map of key/value pairs. In Blueprint there does not appear to be a way to assign the values directly to a bean's map. This results in duplicated code and increases maintenance in some cases. For example, consider the following configuration items for an SMTP server:

          <bean class="EmailNotificationServerImpl" id="emailNotificationServerImpl">
              <property name="mailServerSettings">
                  <map>
                      <entry key="mail.smtp.auth" value="$(mail.smtp.auth)"/>
                      <entry key="mail.smtp.starttls.enable" value="$(mail.smtp.starttls.enable)"/>
                      <entry key="mail.smtp.host" value="$(mail.smtp.host)"/>
                      <entry key="mail.smtp.port" value="$(mail.smtp.port)"/>
                      <entry key="mail.smtp.timeout" value="$(mail.smtp.timeout)"/>
                      <entry key="mail.mime.allowutf8" value="$(mail.mime.allowutf8)"/>
                  </map>
              </property>
          </bean>
      

      The redundant nature of this approach is obvious: key/value pairs from a properties file can be mapped to a java.util.Map's key/value pairs automatically.

      If we wanted to configure more SMTP settings, we'd have to remember to update both the SMTP properties file and the Blueprint mapping, which is duplication of effort. It would be convenient if there was a way to simply load all properties into a map, directly. For example:

          <bean class="EmailNotificationServerImpl" id="emailNotificationServerImpl">
              <property name="mailServerSettings" source="notification.cfg" />
          </bean>
      

      In this way, new configuration items need only be added to notification.cfg.

      Attachments

        Activity

          People

            Unassigned Unassigned
            thangalin T X
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: