hm,
let me try again...
This was the original situation:
root/A/config.xml
root/A/specificConfigForB.xml
root/A/log4jConfigForB.xml
I want to retrieve the URL of the log4jConfigForB.xml which is specified
relative to specificConfigForB.xml.
I know the URL for root/A/config.xml.
This file imports specificConfigForB.xml which specifies the name of the
log4j config file.
The URL to the log4j config file was constructed through new URL(
'root/A/config.xml', 'log4jConfigForB.xml'). The result is
root/A/log4jConfigForB.xml
However, when specificConfigForB.xml and log4jConfigForB.xml move to root/B
(or whereever) the result will still be root/A/log4jConfigForB.xml. Which is
clearly wrong.
I prefer not having to specify an absolute URL to log4jConfigForB.xml.
Adding the content of log4jConfigForB.xml to specificConfigForB.xml is also
no option.
My original idea was therefore that there might be a construct like a
special variable that is set by the parser when a file is being parsed. This
variable would then be filled with the URL to that particular file.
My question: is there such a construct ? Or can I determine somehow in which
file a configuration parameter is set ? Or is there another option ?
I hope this clearer ...
Thanks,
Michiel
On 6/8/06, Oliver Heger <[EMAIL PROTECTED]> wrote:
Michiel Kalkman wrote:
> Hi,
>
> I'd like to be able to do the following. I have the following directory
> structure:
>
> root/A/config.xml
> root/B/specificConfigForB.xml
> root/B/log4jConfigForB.xml
>
> root/A/config.xml looks like:
> <configuration>
> <xml fileName="../B/specificConfigForB.xml"/>
> </configuration>
>
> root/B/specificConfigForB.xml refers to the location of log4j like:
> <configuration>
>
<log4j-url>${some-predefined-variable-resolved-at-runtime}/log4j.xml</log4j-url>
>
> </configuration>
>
> The idea is that when I do something like config.getString( "log4j-url")
I
> want the location of the log4j.xml, like
> root/b/log4j.xml (and not root/a/log4j.xml).
>
> Is something like this possible ?
>
> If so, how ?
>
> Thanks and regards,
> Michiel
>
Hello,
I am not sure if I understand your question correctly. Do you want to
know if there is a mechanism of using variables in a configuration file
that can be replaced by current values? Then the answer is yes; have a
look at
http://jakarta.apache.org/commons/configuration/howto_properties.html#Variable%20Interpolation
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]