[
https://issues.apache.org/jira/browse/SLING-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ian Boston updated SLING-2625:
------------------------------
Affects Version/s: Commons OSGi 2.1.0
> Utility method to convert configuration value to map
> ----------------------------------------------------
>
> Key: SLING-2625
> URL: https://issues.apache.org/jira/browse/SLING-2625
> Project: Sling
> Issue Type: Improvement
> Components: Commons
> Affects Versions: Commons OSGi 2.1.0
> Reporter: Chetan Mehrotra
> Priority: Minor
> Fix For: Commons OSGi 2.1.2
>
> Attachments: SLING-2625.patch
>
>
> As per current form support for capturing configuration values its not
> possible to capture key=value pairs. To enable capturing of such pairs
> through configuration admin ui one has to use an array property consisting of
> key=value pairs
> @Property(value = {
> "poolSize=5",
> "timeout=50",
> })
> private static final String DATASOURCE_PROPS = "options";
> It would be helpful to have a method in
> org.apache.sling.commons.osgi.PropertiesUtil.toMap(Object value,String[]
> defaultValue). Which can parse such config and converts it to a map. Attached
> patch provides such an implementation which does the conversion using
> following rules
> 1. Entries are of the form key=value
> 2. Key is trimmed
> 3. Value is trimmed. If a trimmed value results in an empty string it is
> treated as null
> 4. Malformed entries like 'foo','foo=' are ignored
> 5. Map entries maintain the input order i.k linkedhashmap
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira