[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (ARIES-1845) Load configuration file without explicit mapping

T X created ARIES-1845:

             Summary: Load configuration file without explicit mapping
                 Key: ARIES-1845
             Project: Aries
          Issue Type: Improvement
          Components: Blueprint
            Reporter: T X

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, we have the following configuration items for an SMTP server:

        class="EmailNotificationServerImpl" id="emailNotificationServerImpl">
        <property name="mailServerSettings">
                <entry key="mail.smtp.auth" value="$(mail.smtp.auth)"/>
                <entry key="mail.smtp.starttls.enable" value="$(mail.smtp.starttls.enable)"/>
                <entry key="" value="$("/>
                <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)"/>

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

If we wanted to configure more SMTP settings, we'd have to remember to update both the SMTP configuration 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:

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

In this way, a new configuration item need only be added to {{notification.cfg}}.

This message was sent by Atlassian JIRA