Re: [logback-user] Special Joran substitution

Ceki Gulcu escribió:
Hello Diego,
The special syntax originates from Bash, at least that's where I saw it fist.
http://www.faqs.org/docs/abs/HTML/parameter-substitution.html http://tldp.org/LDP/abs/html/refcards.html#AEN20779 http://www.purinchu.net/wp/2005/06/11/advanced-parameter-substitution-with-b...
Thus, "${varnname:-word}" means, if varname exists and isn't null, return its value, otherwise return 'word'.
If my memory serves me correctly, the special substitution syntax is needed because, we would like to have the name of the parameter to vary with the circumstances. More precisely, while most database drivers take expect the name of the "url" parameter to be "url", some database drivers expect that the value be passed using a different variable name.
Does this help?
Diego Louzán wrote:
In chapter4 of the documentation the following example is shown:
<dataSource class="${dataSourceClass}"> <!-- Joran cannot substitute variables that are not attribute values. Therefore, we cannot declare the next parameter like the others. --> <param name="${url-key:-url}" value="${url_value}"/> <serverName>${serverName}</serverName> <databaseName>${databaseName}</databaseName> </dataSource>
I can't figure out that special syntax for Joran in "${url-key:-url}", can anybody explain it to me? Why is it needed in that example?
Regards. Diego.
I'm not much of a bash fan, so no wonder I had never heard about that syntax xD Thanks for clearing that up. Regards. Diego.
participants (1)
-
Diego Louzán