Hi folks, Following a suggestion from Antoine I had a look at filterchains and thought about the degree to which the functionality of the PropertyFile task could be expressed in terms of filterchains, and whether that work would be fruitful, and would render the proprosed modification to PropertyFile redundant.
The difficulty I see with this approach is that properties files are not simply streams of text, so manipulation at that level doesn't seem appropriate. Up one level of abstraction is the TokenFilter stuff, which transforms the incoming stream into a sequence of tokens, and then filters these tokens. This is closer to what we want, but still requires that each token be expressed as a string. Actually the tokens we are interested in are comments, blank lines (arguably just the one type) and name-value pairs. The way to process this then is with a PropertyFileTokenizer which returns these sorts of tokens, but we could not apply existing filters to these tokens (because the existing filters operate on strings), so we would have to develop a new set. If the idea was to mimic the kind of functionality in the PropertyFile task (which is kind of where we started), that would supply requirements to an initial set (although there are still some that would need a bit of thought). This would, I suppose, provide an extensible way of modifying properties files, but its a far cry from the original task. It provides a conceptual overlap with the filterchain stuff, but not a whole lot more (not that the sharing of the concept isn't a good idea; it is). I haven't looked into the coding effort deeply here, instead just thinking about the suitability of the approach (I think there is some mismatch, but probably not unresolvable). However, this is the Friday of the week I had off work (well, between jobs), so I probably won't have the time to tackle this the right way that Antoine suggested. Apologies for letting anyone down with that admission. Still, if the group would like the quick fix just in the PropertyFile task, I can post it; if not, not harm no foul. PHiL --- Phil Hourihane <[EMAIL PROTECTED]> wrote: > Antoine, > > I'll certainly have a look at the filterchain stuff > and see how much overlap there is between the work I > did and that. The meterial that I prepared is only > in > passing a patch to PropertyFile, the main piece of > any > interest is a subclass of Properties which retains > the > format of the input stream from which properties > were > loaded, and which I thought to put in the public > domain. > > Anyway, since you have picqued my interest, I will > look at the filterchain stuff, which I am not > currently familiar with. > > PHiL > > > --- "Burgess, Benjamin" <[EMAIL PROTECTED]> > wrote: > > > +1 - excellent proposal > > > > -----Original Message----- > > From: Antoine Levy-Lambert [mailto:[EMAIL PROTECTED] > > > Sent: Friday, September 02, 2005 10:03 AM > > To: Ant Developers List > > Subject: Re: enhancement for PropertyFile, have a > > patch > > > > Hello Phil, > > I wonder whether, instead of patching > PropertyFile, > > you should not study > > how the <filterchain/> framework works and > implement > > the functionalitiy > > of propertyfile > > as a filter. Then it should be possible to change > > the implementation of > > propertyfile to make it use filters. > > To my opinion, all tasks which we have which are > > manipulating text files > > should be rewritten around filters. This would > avoid > > code duplication. > > And make the functionality of property file > > available on the fly. > > > > Cheers, > > > > Antoine > > > > Phil Hourihane wrote: > > > > >Hi folks, > > > > > >I hope I am getting the etiquette right for this; > I > > am > > >a new body on the list. > > > > > >The PropertyFile (optional) task allows a script > to > > >alter an existing properties file, but all > comments > > >and layout are lost. This doesn't get a mention > in > > >bugzilla. I have an enhancement which retains > > layout > > >and comments when writing a properties file, with > > >accompanying tests. > > > > > >I have a patch for the affected files, and there > > are a > > >few new files (util class, test class, and test > > data) > > >as well. > > > > > >Do the group want the enhancement? Or more detail > > from > > >me? Shall I post the patch and new files? Any > > feedback > > >is welcome. > > > > > >Philip Hourihane > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > ************************************************************** > > This message, including any attachments, contains > > confidential information intended for a specific > > individual and purpose, and is protected by law. > If > > you are not the intended recipient, please contact > > sender immediately by reply e-mail and destroy all > > copies. You are hereby notified that any > > disclosure, copying, or distribution of this > > message, or the taking of any action based on it, > is > > strictly prohibited. > > TIAA-CREF > > > ************************************************************** > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > > > ___________________________________________________________ > > Yahoo! Messenger - NEW crystal clear PC to PC > calling worldwide with voicemail > http://uk.messenger.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > ___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]