You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Oliver Heger <Ol...@t-online.de> on 2004/12/13 18:12:34 UTC

[configuration]XMLConfigurations

I have committed some changes for HierarchicalConfiguration and 
HierarchicalXMLConfiguration that allow HierarchicalXMLConfiguration to 
preserve the most features of the XML document from which it was loaded 
(including comments and processing instructions).

(Obviously my formatter settings in Eclipse are still suboptimal, so the 
resulting diff became quite large. So large that the cvs commit mail was 
rejected by the mailing list. Sorry about that.)

Back to the topic: The idea is that the Node objects in 
HierarchicalXMLConfiguration are now connected to the XML nodes they 
represent in the loaded document. This connection is established in the 
load() method. If later nodes are removed or their values are changed, 
these modifications are also applied to the associated XML nodes. 
Properties that are added to the configuration are added to the XML 
document before it is written.

With these enhancements HierarchicalXMLConfiguration supports now all 
features of XMLConfiguration plus the ability of storing properties in a 
hierarchical manner and keeping their structure. So I want to ask if we 
still need two separate XMLConfiguration classes. I suggest renaming 
HierarchicalXMLConfiguration to XMLConfiguration and to deprecate the 
original HierarchicalXMLConfiguration. In the configuration files for 
ConfigurationFactory the elements <xml> and <hierarchicalXML> could map 
to the same Configuration class (maybe the latter could log a warning 
that hierarchicalXML is deprecated).

If this is accepted, we can close the bugs related to XMLConfiguration 
messing up files on saving (31429, 32240). What do you think?

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration]XMLConfigurations

Posted by Emmanuel Bourg <sm...@lfjr.net>.
Oliver Heger wrote:

> I have not checked the tests for XMLConfiguration yet. I first wanted to 
> see if there is acceptance for this step at all. If this is the case, I 
> will have a look at the tests.

Yes this is a step in the right direction, I'd prefer only one class 
dealing with xml configurations. The only issue for me is the complexity 
of HierachicalConfiguration, but XMLConfiguration doesn't look that 
easier either ;) I think sooner or later we will promote the Node inner 
class to a top level class and use it for JNDIConfiguration, but that's 
another story.

Oops I forgot, Good work Oliver :)

Emmanuel Bourg

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration]XMLConfigurations

Posted by Oliver Heger <Ol...@t-online.de>.
Emmanuel Bourg wrote:

> Oliver Heger wrote:
>
>> If this is accepted, we can close the bugs related to 
>> XMLConfiguration messing up files on saving (31429, 32240). What do 
>> you think?
>
>
> The last time I pondered if HierarchicalXMLConfiguration could replace 
> XMLConfiguration there was something blocking but I can't remember 
> exactly what, maybe the lack of a save() implementation you fixed 
> earlier, I'll have to check. Do all tests for XMLConfiguration pass 
> with HierarchicalXMLConfiguration ?
>
> Emmanuel Bourg
>
I think the problem was the handling of comments or in general the fact 
that the source XML document was not kept. So some stuff could get lost. 
This should be fixed now.

I have not checked the tests for XMLConfiguration yet. I first wanted to 
see if there is acceptance for this step at all. If this is the case, I 
will have a look at the tests.

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration]XMLConfigurations

Posted by Emmanuel Bourg <sm...@lfjr.net>.
Oliver Heger wrote:

> I have now made HierarchicalXMLConfiguration fully compatible with 
> XMLConfiugration. All tests for XMLConfiguration now run also with 
> HierarchicalXMLConfiguration.

Well done !

> A thing that bothers me a bit is the fact that it is not too trivial to 
> implement all the features of file based configurations (e.g. auto save, 
> constructors) for HierarchicalXMLConfiguration because it cannot inherit 
> from AbstractFileConfiguration. Maybe someone comes up with a more 
> elegant solution?

Maybe we could make it extend AbstractFileConfiguration and have a 
helper class working with hierarchical configurations to walk the tree. 
That is how I implemented my TreeConfiguration prototype but I don't 
know if it would work well with HierarchicalConfiguration.


> If noone objects I will now go ahead and make 
> HierarchicalXMLConfiguration the one and only XMLConfiguration we have.

It's ok for me.

Emmanuel Bourg


Re: [configuration]XMLConfigurations

Posted by Oliver Heger <Ol...@t-online.de>.
Emmanuel Bourg wrote:

> Oliver Heger wrote:
>
>> If this is accepted, we can close the bugs related to 
>> XMLConfiguration messing up files on saving (31429, 32240). What do 
>> you think?
>
>
> The last time I pondered if HierarchicalXMLConfiguration could replace 
> XMLConfiguration there was something blocking but I can't remember 
> exactly what, maybe the lack of a save() implementation you fixed 
> earlier, I'll have to check. Do all tests for XMLConfiguration pass 
> with HierarchicalXMLConfiguration ?
>
> Emmanuel Bourg
>
I have now made HierarchicalXMLConfiguration fully compatible with 
XMLConfiugration. All tests for XMLConfiguration now run also with 
HierarchicalXMLConfiguration.

A thing that bothers me a bit is the fact that it is not too trivial to 
implement all the features of file based configurations (e.g. auto save, 
constructors) for HierarchicalXMLConfiguration because it cannot inherit 
from AbstractFileConfiguration. Maybe someone comes up with a more 
elegant solution?

If noone objects I will now go ahead and make 
HierarchicalXMLConfiguration the one and only XMLConfiguration we have.

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration]XMLConfigurations

Posted by Emmanuel Bourg <sm...@lfjr.net>.
Oliver Heger wrote:

> If this is accepted, we can close the bugs related to XMLConfiguration 
> messing up files on saving (31429, 32240). What do you think?

The last time I pondered if HierarchicalXMLConfiguration could replace 
XMLConfiguration there was something blocking but I can't remember 
exactly what, maybe the lack of a save() implementation you fixed 
earlier, I'll have to check. Do all tests for XMLConfiguration pass with 
HierarchicalXMLConfiguration ?

Emmanuel Bourg

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org