Oliver Heger wrote:
Simon Kitching wrote:
On Fri, 2005-05-20 at 19:00 +0200, Oliver Heger wrote:
Hi,
a while ago there was a discussion about adding support for variable
substitution/interpolation to lang. IIRC Simon Kitching proposed to
extract the interpolation engine of digester. I'd like to know the
current state of this project. Has there already been some work in
this direction?
Background is that I would need such a feature for [configuration]
where we plan to enhance our interpolation features. (ATM we have a
dependency on [digester], but this will probably be removed in the
future.)
It's committed to the Lang subversion, in the "text" package.
However I believe the Lang2.0 release which is currently at RC5 (and
therefore will hopefully be released any day now!) deliberately excludes
the "text" package as it is not regarded as "mature" yet.
The interpolation stuff, being very simple, quite possibly could be
released (my opinion) but:
* it needs unit tests (my fault, but there's been no hurry as the
text package was never expected to be in the next release), and
* there is other stuff in the text package that still needs work
before release.
It's a shame you didn't mention this just a little earlier! Anyway, my
suggestion would be to copy+paste the code from Lang into configuration
for the moment. If/when a later version of lang includes that code, you
could then switch to using it. And of course as one of the primary users
you would be able to influence the features if they aren't exactly what
you want right now!
Digester is essentially in the same situation; it doesn't currently use
Lang, so it has its own copy of the interpolation stuff (well, actually,
the original :-). In Digester's case, though, we expose the substitution
API to the user so they can customise the substitution; I don't know
whether you need to do this in configuration.
Cheers,
Simon
I had found the Interpolation class in lang's text package, but I
somehow hoped that digester's enhanced substitution features would
make it into lang (especially the stuff with VariableExpander). This
is very close to what I was looking for because we indeed would like
to let the users customize the mechanism. Would this be of interest
for lang or is it too, well, frameworkish?
In configuration there already exists an interpolation method, which
is quite powerful and even detects cyclic substitutions. Don't know
who the original author was. I think I will refactor this method out
into an own class and add something like a VariableExpander interface
(which will probably be slightly different from digester's original
because we support other types than String, too).
Regards,
Oliver
FYI, I have finished a first implementation of the interpolation
features I intend to integrate into commons configuration. The classes
can be found at the attachments of this bugzila ticket:
http://issues.apache.org/bugzilla/show_bug.cgi?id=35116
Comments are welcome!
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]