You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "yair ogen (JIRA)" <ji...@apache.org> on 2009/11/08 15:52:32 UTC

[jira] Created: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

HierarchicalConfiguration does not support hierarchy  from property files
-------------------------------------------------------------------------

                 Key: CONFIGURATION-401
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
             Project: Commons Configuration
          Issue Type: Bug
         Environment: windows/Linux
            Reporter: yair ogen


If you have hierarchy like this:

persons.person.name=1
persons.person.surName=2
persons.person.phoneNum=3

persons.person.name=4
persons.person.surName=5
persons.person.phoneNum=6

persons.person.name=7
persons.person.surName=8
persons.person.phoneNum=9

If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).

The tree is not right.

I can do this:

hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()

but this returned empty iterator:

hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()

Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "yair ogen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12775344#action_12775344 ] 

yair ogen commented on CONFIGURATION-401:
-----------------------------------------

I see you point. However the list contains the values in the right order -
so this can be done.




> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "yair ogen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776335#action_12776335 ] 

yair ogen commented on CONFIGURATION-401:
-----------------------------------------

I see what you mean. It could be easily supported by:

persons.group.name=admins
persons. <http://persons.person.name/>group. <http://persons.group.name/>
person.name <http://persons.person.name/>=x
persons. <http://persons.person.name/>group. <http://persons.group.name/>
person.name <http://persons.person.name/>=y

persons.group.name=users
persons. <http://persons.person.name/>group. <http://persons.group.name/>
person.name <http://persons.person.name/>=z

then you have 2 groups under persons:

admins has 2 persons.

users has one.




> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "yair ogen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12775326#action_12775326 ] 

yair ogen commented on CONFIGURATION-401:
-----------------------------------------

I totally agree, but we are talking about the conversion to
HierarchicalConfiguration
and that is not property based. I think that converting from
properties to HierarchicalConfiguration
shuold support the above.




> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12775023#action_12775023 ] 

Joerg Schaible commented on CONFIGURATION-401:
----------------------------------------------

I don't think this is a valid enhancement request. The format of the property files are defined in the JDK as key value pairs and if you define the same key twice, you simply override the first one. This is what you get from Properties.load and I think we should not behave differently.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776026#action_12776026 ] 

Oliver Heger commented on CONFIGURATION-401:
--------------------------------------------

In your special example the {{PropertiesConfiguration}} contains 3 keys: _persons.person.name_, _persons.person.surName_, and _persons.person.phoneNum_. Each key is associated with a list of values. In this concrete case it is possible to convert this data into a hierarchical structure.

But as soon as the structure becomes slightly more complex, you are lost. Consider the example where persons are organized in groups, and you have properties like

{code}
persons.group.name=admins
persons.person.name=x
persons.person.name=y

persons.group.name=users
persons.person.name=z
{code}

Here you have two groups and three persons, but after the properties are read into a {{PropertiesConfiguration}} how do you know which persons belong to which group?

You try to extract structure from a format that is simply not provided.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776513#action_12776513 ] 

Ralph Goers commented on CONFIGURATION-401:
-------------------------------------------

If your customer mandates property files then I don't understand how 
persons.person.name=1
persons.person.surName=2
persons.person.phoneNum=3

persons.person.name=4
persons.person.surName=5
persons.person.phoneNum=6

persons.person.name=7
persons.person.surName=8
persons.person.phoneNum=9

would be acceptable. java.util.Properties files do not allow duplicate keys. Instead, you would have to do

persons.person.name=1,4,7
persons.person,surName=2,5,8
persons.persona.phoneNum=3,6,9

which, of course, is practically useless.

Also, I don't think I've actually seen a description of why you need to convert the properties into a hierarchical format. What is the use case you are trying to solve?

Yes, we could invent some new syntax that might work, but I don't think any of the committers are interested in doing that. I don't believe any of us are directly paid to work on Commons Configuration and we all have other things we would like to work on.

That said, although I understand you said you don't have the resources to do it, if you, or someone else, were to provide a patch we would definitely consider it.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12775130#action_12775130 ] 

Oliver Heger commented on CONFIGURATION-401:
--------------------------------------------

After scanning through the sources I think there is indeed a class that does what you want (or at least partly): {{HierarchicalConfigurationConverter}}. This class iterates over the keys of an arbitrary {{Configuration}} object and generates a series of start element and end element events that can be used to construct a corresponding hierarchical configuration. The tree structure generated this way should be close to the one you need.

There are however some problems:
* The class is somewhat experimental. It is not advertised in the documentation, and I am not sure whether it was used by anybody.
* It is an abstract class. There is one concrete subclass used internally by {{BaseConfigurationXMLReader}}. {{BaseConfigurationXMLReader}} allows a configuration object to be processed by an XML parser.

So I think you have the following options:
* You can create a concrete subclass of {{HierarchicalConfigurationConverter}} that creates {{ConfigurationNode}} objects corresponding to the start and end element notifications.
* You can try {{BaseConfigurationXMLReader}} and generate XML documents from a {{PropertiesConfiguration}}. These documents can then be parsed by a {{XMLConfiguration}}. If you follow this road, you might want to have a look at the unit tests for {{BaseConfigurationXMLReader}}.

Hope this helps.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Updated: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "yair ogen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

yair ogen updated CONFIGURATION-401:
------------------------------------

          Component/s: Expression engine
    Affects Version/s: 1.6

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "yair ogen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12774899#action_12774899 ] 

yair ogen commented on CONFIGURATION-401:
-----------------------------------------

I am not familiar with the commons configuration code enough to provide a
patch.

I am expecting that hierarchicalConfiguration.subset("persons(0)") will
return the name, surName and phoneNum of the first
group. hierarchicalConfiguration.subset("persons(1)") will return the name,
surName and phoneNum of the second group. and so on.

Can anyone address this - or is this a wild goose chase?




> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "yair ogen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776408#action_12776408 ] 

yair ogen commented on CONFIGURATION-401:
-----------------------------------------

my customer mandates property files.

the extension you are talking is exactly the challenge I am looking for
someone to pick up. I do not have the resources to do it myself.




> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12774884#action_12774884 ] 

Ralph Goers commented on CONFIGURATION-401:
-------------------------------------------

If you provide a patch we would definitely consider it.

That said, what should hierarchicalConfiguration.subset("persons(0)") or hierarchicalConfiguration.subset("persons(1)") return? It sounds like you somehow want the converter to understand that there are multiple person elements (and be able to group them) but not multiple people elements.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12775321#action_12775321 ] 

Oliver Heger commented on CONFIGURATION-401:
--------------------------------------------

Heaving slept a night over this problem I don't think that my last comment will help you. {{HierarchicalConfigurationConverter}} will produce the same results as {{ConfigurationUtils.convertToHierarchical()}}.

The problem is that {{PropertiesConfiguration}} when reading in the properties file already combines properties with the same key to a list. So the structure you are after and that is implicitly expressed in the order of the keys is already destroyed. I doubt that it can be reconstructed later.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776348#action_12776348 ] 

Ralph Goers commented on CONFIGURATION-401:
-------------------------------------------

At this point I find myself wondering why you wouldn't just use XML?  The above is just ugly. Especially when I can just do:

<persons>
  <group name="admin">
    <person name="x"/>
    <person name="y"/>
  </group>
  <group name="users">
    <person name="z"/>
  </group>
</persons>

and then have an XML Schema to enforce it to boot.

But if for some reason you have an aversion to XML than you could invent some new format that extends AbstractHierarchicalFileConfiguration.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776666#action_12776666 ] 

Joerg Schaible commented on CONFIGURATION-401:
----------------------------------------------

You could create different persons yourself introducing an id:

persons.person.0.name=1
persons.person.0.surName=2
persons.person.X.name=4
persons.person.X.surName=5

Simply use subset of person and iterate over the keys. If you tokenize them, you can use the first part as unique id to access the individual person entities.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "yair ogen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12774879#action_12774879 ] 

yair ogen commented on CONFIGURATION-401:
-----------------------------------------

I think this is a pretty strait forward case.

I am sure many would like this to be as I expect.

How else can I configure hierarchy by using properties only?




> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776651#action_12776651 ] 

Oliver Heger commented on CONFIGURATION-401:
--------------------------------------------

I agree with Ralph in most points. Your request seems very specific to me. Basically, you want Commons Configuration to support a proprietary properties format. I doubt that this might be useful for many other users.

So if anybody comes up with a patch, we will evaluate it. But I would be reluctant to adding such a feature unless the implementation is pretty generic so that it supports a broad range of conversions to hierarchical configurations.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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


[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12774826#action_12774826 ] 

Oliver Heger commented on CONFIGURATION-401:
--------------------------------------------

By converting the flat configuration to a hierarchical one a tree is constructed, but in this case it has a different structure than you expect. It looks like the following:

{noformat}
persons
    person
        name=1
        name=4
        name=7
        surName=2
        ...
{noformat}

The problem is that a flat configuration format like a properties file simply does not contain enough information about the internal structure of its properties. So the algorithm that creates a hierarchical configuration from this data has no information how it should combine certain properties (e.g. add multiple _person_ elements instead of adding all data to a single _person_ element).

I don't think there is much we can do about this. An algorithm smart enough to deal with this problem would really be complex - if it is feasable at all.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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