You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thorbjørn Ravn Andersen (JIRA)" <ji...@apache.org> on 2007/08/06 16:54:00 UTC
[jira] Created: (CONFIGURATION-288) getConfigurationNames() does
not report names of nested configurations
getConfigurationNames() does not report names of nested configurations
----------------------------------------------------------------------
Key: CONFIGURATION-288
URL: https://issues.apache.org/jira/browse/CONFIGURATION-288
Project: Commons Configuration
Issue Type: Bug
Affects Versions: Nightly Builds
Environment: using trunk of august 6 2007
Reporter: Thorbjørn Ravn Andersen
Given a <configuration> A which includes a <configuration> B which in turn loads the <properties> C.
A and C has the config-name attribute. B does not.
Calling A.getConfigurationNames() does not return the name of C. From my initial reading of the code, it only returns names on the B level.
It also appears that the name for A does not appear either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CONFIGURATION-288) getConfigurationNames() does
not report names of nested configurations
Posted by "Thorbjørn Ravn Andersen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thorbjørn Ravn Andersen updated CONFIGURATION-288:
--------------------------------------------------
Attachment: A.xml
<configuration>
<system />
<configuration fileName="B.xml" config-optional="false" config-name="B"/>
</configuration>
> getConfigurationNames() does not report names of nested configurations
> ----------------------------------------------------------------------
>
> Key: CONFIGURATION-288
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-288
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: Nightly Builds
> Environment: using trunk of august 6 2007
> Reporter: Thorbjørn Ravn Andersen
> Attachments: A.xml, B.xml, C.properties, GetNestedConfigurationName.java, namedConfiguration.jar
>
>
> Given a <configuration> A which includes a <configuration> B which in turn loads the <properties> C.
> A and C has the config-name attribute. B does not.
> Calling A.getConfigurationNames() does not return the name of C. From my initial reading of the code, it only returns names on the B level.
> It also appears that the name for A does not appear either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CONFIGURATION-288) getConfigurationNames() does
not report names of nested configurations
Posted by "Thorbjørn Ravn Andersen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518128 ]
Thorbjørn Ravn Andersen commented on CONFIGURATION-288:
-------------------------------------------------------
I have now created an eclipse project with a sample demonstrating what I would like and what actually happens (can be uploaded if needed, I just uploaded the needed files).
Seen as a new user, this "named configuration" concept is very interesting, and I intuitively expected it to be able to get me a configuration "hidden" somewhere in the global configuration.
My goal with this is to let commons configuration maintain reloadable translations and log4j configuration files.
> getConfigurationNames() does not report names of nested configurations
> ----------------------------------------------------------------------
>
> Key: CONFIGURATION-288
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-288
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: Nightly Builds
> Environment: using trunk of august 6 2007
> Reporter: Thorbjørn Ravn Andersen
> Attachments: A.xml, B.xml, C.properties, GetNestedConfigurationName.java, namedConfiguration.jar
>
>
> Given a <configuration> A which includes a <configuration> B which in turn loads the <properties> C.
> A and C has the config-name attribute. B does not.
> Calling A.getConfigurationNames() does not return the name of C. From my initial reading of the code, it only returns names on the B level.
> It also appears that the name for A does not appear either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CONFIGURATION-288) getConfigurationNames() does
not report names of nested configurations
Posted by "Thorbjørn Ravn Andersen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thorbjørn Ravn Andersen updated CONFIGURATION-288:
--------------------------------------------------
Attachment: B.xml
<configuration>
<properties fileName="C.properties" config-optional="false" config-name="C"/>
</configuration>
> getConfigurationNames() does not report names of nested configurations
> ----------------------------------------------------------------------
>
> Key: CONFIGURATION-288
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-288
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: Nightly Builds
> Environment: using trunk of august 6 2007
> Reporter: Thorbjørn Ravn Andersen
> Attachments: A.xml, B.xml, C.properties, GetNestedConfigurationName.java, namedConfiguration.jar
>
>
> Given a <configuration> A which includes a <configuration> B which in turn loads the <properties> C.
> A and C has the config-name attribute. B does not.
> Calling A.getConfigurationNames() does not return the name of C. From my initial reading of the code, it only returns names on the B level.
> It also appears that the name for A does not appear either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CONFIGURATION-288) getConfigurationNames() does
not report names of nested configurations
Posted by "Thorbjørn Ravn Andersen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518126 ]
Thorbjørn Ravn Andersen commented on CONFIGURATION-288:
-------------------------------------------------------
Code snippet (GetNestedConfigurationName.java)
package x;
import org.apache.commons.configuration.CombinedConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.DefaultConfigurationBuilder;
import org.apache.log4j.BasicConfigurator;
public class GetNestedConfigurationName {
public static void main(String[] args) {
try {
main0(args);
} catch (Throwable e) {
e.printStackTrace();
}
}
public static void main0(String[] args) throws Exception {
BasicConfigurator.configure();
DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder("A.xml");
Configuration configuration = builder.getConfiguration();
System.out.println("C is loaded : c.property1=" + configuration.getString("c.property1"));
if (configuration instanceof CombinedConfiguration) {
CombinedConfiguration combined = (CombinedConfiguration) configuration;
Configuration c = combined.getConfiguration("C");
if (c == null) {
System.out.println("no configuration named C");
} else {
System.out.println("C by name : c.property1=" + c.getString("c.property1"));
}
}
}
}
output is
C is loaded : c.property1=value1
Combined configuration
no configuration named C
> getConfigurationNames() does not report names of nested configurations
> ----------------------------------------------------------------------
>
> Key: CONFIGURATION-288
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-288
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: Nightly Builds
> Environment: using trunk of august 6 2007
> Reporter: Thorbjørn Ravn Andersen
> Attachments: A.xml, B.xml, C.properties, GetNestedConfigurationName.java, namedConfiguration.jar
>
>
> Given a <configuration> A which includes a <configuration> B which in turn loads the <properties> C.
> A and C has the config-name attribute. B does not.
> Calling A.getConfigurationNames() does not return the name of C. From my initial reading of the code, it only returns names on the B level.
> It also appears that the name for A does not appear either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CONFIGURATION-288) getConfigurationNames() does
not report names of nested configurations
Posted by "Thorbjørn Ravn Andersen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thorbjørn Ravn Andersen updated CONFIGURATION-288:
--------------------------------------------------
Attachment: namedConfiguration.jar
jar with x.GetNestedCOnfigurationName, A.xml, B.xml and C.properties
> getConfigurationNames() does not report names of nested configurations
> ----------------------------------------------------------------------
>
> Key: CONFIGURATION-288
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-288
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: Nightly Builds
> Environment: using trunk of august 6 2007
> Reporter: Thorbjørn Ravn Andersen
> Attachments: namedConfiguration.jar
>
>
> Given a <configuration> A which includes a <configuration> B which in turn loads the <properties> C.
> A and C has the config-name attribute. B does not.
> Calling A.getConfigurationNames() does not return the name of C. From my initial reading of the code, it only returns names on the B level.
> It also appears that the name for A does not appear either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CONFIGURATION-288) getConfigurationNames() does
not report names of nested configurations
Posted by "Thorbjørn Ravn Andersen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thorbjørn Ravn Andersen updated CONFIGURATION-288:
--------------------------------------------------
Attachment: GetNestedConfigurationName.java
Source snippet demonstrating that C is not a known name
> getConfigurationNames() does not report names of nested configurations
> ----------------------------------------------------------------------
>
> Key: CONFIGURATION-288
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-288
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: Nightly Builds
> Environment: using trunk of august 6 2007
> Reporter: Thorbjørn Ravn Andersen
> Attachments: A.xml, B.xml, C.properties, GetNestedConfigurationName.java, namedConfiguration.jar
>
>
> Given a <configuration> A which includes a <configuration> B which in turn loads the <properties> C.
> A and C has the config-name attribute. B does not.
> Calling A.getConfigurationNames() does not return the name of C. From my initial reading of the code, it only returns names on the B level.
> It also appears that the name for A does not appear either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CONFIGURATION-288) getConfigurationNames() does
not report names of nested configurations
Posted by "Thorbjørn Ravn Andersen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thorbjørn Ravn Andersen updated CONFIGURATION-288:
--------------------------------------------------
Attachment: C.properties
c.property1=value1
c.property2=value2
> getConfigurationNames() does not report names of nested configurations
> ----------------------------------------------------------------------
>
> Key: CONFIGURATION-288
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-288
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: Nightly Builds
> Environment: using trunk of august 6 2007
> Reporter: Thorbjørn Ravn Andersen
> Attachments: A.xml, B.xml, C.properties, GetNestedConfigurationName.java, namedConfiguration.jar
>
>
> Given a <configuration> A which includes a <configuration> B which in turn loads the <properties> C.
> A and C has the config-name attribute. B does not.
> Calling A.getConfigurationNames() does not return the name of C. From my initial reading of the code, it only returns names on the B level.
> It also appears that the name for A does not appear either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CONFIGURATION-288) getConfigurationNames() does
not report names of nested configurations
Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oliver Heger updated CONFIGURATION-288:
---------------------------------------
Fix Version/s: 2.0
Priority: Minor (was: Major)
Issue Type: Improvement (was: Bug)
Affects Version/s: (was: Nightly Builds)
1.4
As I already pointed out, this is not a bug. CombinedConfiguration is designed and works the same way as, for instance, a map does: if you put a map into another map, its keys won't show up in the outer map either. This forms a hierarchical name space. If you force this name space to be flat, you will encounter problems with naming conflicts (what happens if there are sub configurations with the same name in different CombinedConfigurations?).
That said, I nevertheless think that an easy way of accessing (sub) configurations in a nested hierarchy is useful. I was thinking on something like an iterator or visitor mechanism allowing to iterate over a configuration's children. This will however probably involve some binary incompatible changes on some interfaces, so I am setting the fix version to the next major release.
> getConfigurationNames() does not report names of nested configurations
> ----------------------------------------------------------------------
>
> Key: CONFIGURATION-288
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-288
> Project: Commons Configuration
> Issue Type: Improvement
> Affects Versions: 1.4
> Environment: using trunk of august 6 2007
> Reporter: Thorbjørn Ravn Andersen
> Priority: Minor
> Fix For: 2.0
>
> Attachments: A.xml, B.xml, C.properties, GetNestedConfigurationName.java, namedConfiguration.jar
>
>
> Given a <configuration> A which includes a <configuration> B which in turn loads the <properties> C.
> A and C has the config-name attribute. B does not.
> Calling A.getConfigurationNames() does not return the name of C. From my initial reading of the code, it only returns names on the B level.
> It also appears that the name for A does not appear either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CONFIGURATION-288) getConfigurationNames() does
not report names of nested configurations
Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518005 ]
Oliver Heger commented on CONFIGURATION-288:
--------------------------------------------
Could you please provide an example configuration file and a short code fragment, so this issue can be easier reproduced? Thanks.
>From your description I am not convinced that this is a bug. It was intended that only the names of configurations directly added to a combined configuration are returned by getConfigurationNames(). A combined configuration is not aware of any nested combined configurations.
> getConfigurationNames() does not report names of nested configurations
> ----------------------------------------------------------------------
>
> Key: CONFIGURATION-288
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-288
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: Nightly Builds
> Environment: using trunk of august 6 2007
> Reporter: Thorbjørn Ravn Andersen
>
> Given a <configuration> A which includes a <configuration> B which in turn loads the <properties> C.
> A and C has the config-name attribute. B does not.
> Calling A.getConfigurationNames() does not return the name of C. From my initial reading of the code, it only returns names on the B level.
> It also appears that the name for A does not appear either.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.