You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Remy Maucherat <re...@apache.org> on 2003/10/20 17:13:02 UTC

[digester] Feature addition to digester

Hi,

I'd like to add a feature to the digester, allowing property 
replacement, similar to Ant. Basically, ${...} in an attribute value 
would get replaced by a property value.

The following elements would be added:

* PropertySource interface, containing a String getProperty(String key) 
method

* Digester.setPropertySources(PropertySource[] sources), which would:
   - enable property replacement (this would be disable otherwise, for 
100% compatibility)
   - use the sources in the given order until one returns a non null 
value; if all return null, no replacement occurs

The implementation is very simple, and the code is present in the Tomcat 
sources.

This would allow nice dynamic integration capabilities for files a 
container which XML files are parsed by the digester, and (more 
generally) will allow cool Ant-like properties management.

I can commit a patch if the feature is considered useful (the Tomcat 
community certainly did like it).

Comments ?

Remy



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


Re: [digester] Feature addition to digester

Posted by Simon Kitching <si...@ecnetwork.co.nz>.
On Tue, 2003-10-21 at 05:16, Craig R. McClanahan wrote:
> Remy Maucherat wrote:
> 
> > Hi,
> >
> > I'd like to add a feature to the digester, allowing property 
> > replacement, similar to Ant. Basically, ${...} in an attribute value 
> > would get replaced by a property value.

And +1 from me.

Could you please make the character that marks the start of the
"variable" configurable? eg allow:
 ${foo} or #{foo} or var{foo}

This is because I use the sequence "${xxx}" in attributes already in one
application.

And how about allowing variable evaluation in element bodies as well as
attributes?

I actually have implemented this functionality already for digester, but
not in a very nice way; I would certainly be interested in testing or
otherwise helping with this feature implementation.


Regards,

Simon




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


Re: [digester] Feature addition to digester

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Monday, October 20, 2003, at 05:16 PM, Craig R. McClanahan wrote:

> Remy Maucherat wrote:
>
>> Hi,
>>
>> I'd like to add a feature to the digester, allowing property replacement,
>>  similar to Ant. Basically, ${...} in an attribute value would get 
>> replaced by a property value.
>>
>> The following elements would be added:
>>
>> * PropertySource interface, containing a String getProperty(String key) 
>> method
>>
>> * Digester.setPropertySources(PropertySource[] sources), which would:
>>   - enable property replacement (this would be disable otherwise, for 
>> 100% compatibility)
>>   - use the sources in the given order until one returns a non null 
>> value; if all return null, no replacement occurs
>>
>> The implementation is very simple, and the code is present in the Tomcat 
>> sources.
>>
>> This would allow nice dynamic integration capabilities for files a 
>> container which XML files are parsed by the digester, and (more 
>> generally) will allow cool Ant-like properties management.
>>
>> I can commit a patch if the feature is considered useful (the Tomcat 
>> community certainly did like it).
>>
>> Comments ?
>>
> As I mentioned on TOMCAT-DEV, I'm +1 for this as long as the default 
> behavior is backwards compatible (as Remy proposes it to be).

+1 as long as the default behaviour is backwards compatible.

BTW remy - if you want to commit this yourself please remember to add 
yourself to the STATUS.html. (that way, your digester VOTEs will be 
binding in future.)

- robert


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


Re: [digester] Feature addition to digester

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Remy Maucherat wrote:

> Hi,
>
> I'd like to add a feature to the digester, allowing property 
> replacement, similar to Ant. Basically, ${...} in an attribute value 
> would get replaced by a property value.
>
> The following elements would be added:
>
> * PropertySource interface, containing a String getProperty(String 
> key) method
>
> * Digester.setPropertySources(PropertySource[] sources), which would:
>   - enable property replacement (this would be disable otherwise, for 
> 100% compatibility)
>   - use the sources in the given order until one returns a non null 
> value; if all return null, no replacement occurs
>
> The implementation is very simple, and the code is present in the 
> Tomcat sources.
>
> This would allow nice dynamic integration capabilities for files a 
> container which XML files are parsed by the digester, and (more 
> generally) will allow cool Ant-like properties management.
>
> I can commit a patch if the feature is considered useful (the Tomcat 
> community certainly did like it).
>
> Comments ?
>
As I mentioned on TOMCAT-DEV, I'm +1 for this as long as the default 
behavior is backwards compatible (as Remy proposes it to be).

> Remy
>

Craig



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


Re: [digester] Feature addition to digester

Posted by Scott Sanders <sc...@dotnot.org>.
I could see how it could be useful.  If you are willing to commit and 
support it, and the code is backwards-compatible (should be), then I am 
+1.  Go for it.

Scott

On Monday, October 20, 2003, at 08:13 AM, Remy Maucherat wrote:

> Hi,
>
> I'd like to add a feature to the digester, allowing property 
> replacement, similar to Ant. Basically, ${...} in an attribute value 
> would get replaced by a property value.
>
> The following elements would be added:
>
> * PropertySource interface, containing a String getProperty(String 
> key) method
>
> * Digester.setPropertySources(PropertySource[] sources), which would:
>   - enable property replacement (this would be disable otherwise, for 
> 100% compatibility)
>   - use the sources in the given order until one returns a non null 
> value; if all return null, no replacement occurs
>
> The implementation is very simple, and the code is present in the 
> Tomcat sources.
>
> This would allow nice dynamic integration capabilities for files a 
> container which XML files are parsed by the digester, and (more 
> generally) will allow cool Ant-like properties management.
>
> I can commit a patch if the feature is considered useful (the Tomcat 
> community certainly did like it).
>
> Comments ?


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