Hi,
--- Eric Dobbs <[EMAIL PROTECTED]> wrote:
> On Tuesday, April 2, 2002, at 08:16 AM, Chris Kimpton wrote:
>
> >> I would prefer to do
> >> this with an explicit configuration entry in
> >> TurbineResources.properties like this:
> >>
> >> component.fulcrum.property.webappRoot=${webappRoot}
> >> component.fulcrum.property.applicationRoot=${applicationRoot}
> >>
> >
Attached is the patch for this.
Note it is fairly similar to the previous patch - as I use
Configuration.subset to extract the component properties and then use
these as a "defaults" configuration for each component.
I've changed the signature of the public loadComponent method - not
sure how safe that is - do we want to provide backwards compatibility
on that method, its safe to pass in a null additional properties
configuration.
I added the Object based setters/getters (eg getBoolean(String
key,Boolean defaultValue) ) to the Configuration interface - as this
allows us to set the defaults object from a Configuration object
without casting it to a BaseConfiguration.
The BaseConfiguration now uses the defaults Configuration in the
interpolate method - the main point of this patch.
I have changed the getStringArray method to also call interpolate on
returned values. This is because the code for accessing log4j
properties call getStringArray (cos log4j uses commas in properties)
- but also could contain ${key} stuff - ie webappRoot.
I have also changed the subset method to interpolate its values too.
This is because when you use subset to get the properties for a
service, some of those may contain ${key} stuff - which should be
expanded, if possible.
Lastly and most controversially I changed interpolate to leave
unchanged any unmatched ${key} stuff. That is, the old behaviour for
a property ${foo}/blah would be to interpolate it into /blah if there
was no previous property with a key of "foo". It now leaves it as
${foo}/blah. We need this because when the logging service (a
primary service) gets its properties using getResources,
${webappRoot} is not defined at that point. The old behaviour would
lose this information. We can then add the webappRoot property
manually and let the interpolation work.
Regards,
Chris
=====
------------------------------------------
http://www.soccer2002.org.uk
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/
passthru2.diffu
Description: passthru2.diffu
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
