[ 
https://issues.apache.org/jira/browse/CONFIGURATION-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12642629#action_12642629
 ] 

Scott Wells commented on CONFIGURATION-342:
-------------------------------------------

Yeah, for my proof-of-concept against commons config, I decided to do the work 
outside of the library, but yes, it should be encapsulated within the 
DatabaseConfiguration class, not external to it.  And yes, this is only 
intended to help with multi-valued properties, not yet with true hierarchical 
structures.  It wouldn't be hard to imagine a similar flattening for full 
hierarchies that uses the XPath format for storing keys, though.

If this is something that interests you, I'd be happy to work with you on an 
implementation that addresses both issues.  I looked briefly at what it would 
take to perform a traversal of a HierarchicalConfiguration and didn't quite 
"get it" at first glance.  It'd be nice if there were a simple way to perform 
depth- and/or breadth-first traversals via a Visitor pattern or something.

What are your thoughts?  It looks at this point as if we're going to proceed 
with commons config for our next phase of the product, and my goals are the 
ability to store rich config data (including components with sub-components) in 
the DB but, with a line or two of code, enable import/export via XML.  I can do 
that now, but the richness of the data is limited because of the way that 
DatabaseConfiguration "loses" multi-valued properties and hierarchies.  I can 
imagine this same mechanism would be broadly useful.


> DatabaseConfiguration.copy() loses list/array values
> ----------------------------------------------------
>
>                 Key: CONFIGURATION-342
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-342
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Type conversion
>    Affects Versions: 1.5
>            Reporter: Scott Wells
>         Attachments: ConfigurationUtil.java
>
>
> I've found a bug where adding a list property to a BaseConfiguration, then 
> copying that full BaseConfiguration to a DatabaseConfiguration, the list is 
> lost and only the first element is copied to the destination 
> DatabaseConfiguration.  For example:
> BaseConfiguration bc = new BaseConfiguration();
> bc.addProperty("myList", Arrays.asList("1", "2", "3", "4");
> DatabaseConfiguration dc = new DatabaseConfiguration(...);
> dc.copy(bc);
> List list = dc.getList("myList");
> // At this point, you'll get a single element list containing only "1"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to