[xwiki-devs] [VOTE] Add a public API to retrieve a XWikiPreference with a fallback parameter on xwiki.cfg and a final default value
The signature would be : public String getXWikiPreference(String prefname, String fallback_param, String default_value); The underlaying method already exists in the non API XWiki.java (was added for http://jira.xwiki.org/jira/browse/XWIKI-2569). What this method exactly do is : "Obtain a preference value for the wiki, looking up first in the XWiki.XWikiPreferences document, then fallbacking on a config parameter when the first lookup gives an empty string, then returning the default value if the config parameter returned itself an empty string." My +1: +1 Jerome. PS: I've created a JIRA for it: http://jira.xwiki.org/jira/browse/XWIKI-3086
+0 (I'm not a big fan of it though since it's overloading even more our XWiki API) since we have it in XWiki.java but provided you fix the param names: * prefname --> preferenceName * fallback_param --> fallbackPropertyName Note: that what's even better is to use the new configuration module which supports this use case in a much nicer way. On Jan 8, 2009, at 2:24 PM, Jerome Velociter wrote:
The signature would be :
public String getXWikiPreference(String prefname, String fallback_param, String default_value);
The underlaying method already exists in the non API XWiki.java (was added for http://jira.xwiki.org/jira/browse/XWIKI-2569).
What this method exactly do is : "Obtain a preference value for the wiki, looking up first in the XWiki.XWikiPreferences document, then fallbacking on a config parameter when the first lookup gives an empty string, then returning the default value if the config parameter returned itself an empty string."
My +1:
+1
Jerome.
PS: I've created a JIRA for it: http://jira.xwiki.org/jira/browse/XWIKI-3086
Thanks -Vincent http://xwiki.com http://xwiki.org http://massol.net
Vincent Massol wrote:
+0 (I'm not a big fan of it though since it's overloading even more our XWiki API) since we have it in XWiki.java but provided you fix the param names:
* prefname --> preferenceName * fallback_param --> fallbackPropertyName
Note: that what's even better is to use the new configuration module which supports this use case in a much nicer way.
Yes but we don't have a velocity bridge to make it public, do we? Jerome.
On Jan 8, 2009, at 2:24 PM, Jerome Velociter wrote:
The signature would be :
public String getXWikiPreference(String prefname, String fallback_param, String default_value);
The underlaying method already exists in the non API XWiki.java (was added for http://jira.xwiki.org/jira/browse/XWIKI-2569).
What this method exactly do is : "Obtain a preference value for the wiki, looking up first in the XWiki.XWikiPreferences document, then fallbacking on a config parameter when the first lookup gives an empty string, then returning the default value if the config parameter returned itself an empty string."
My +1:
+1
Jerome.
PS: I've created a JIRA for it: http://jira.xwiki.org/jira/browse/XWIKI-3086
Thanks -Vincent http://xwiki.com http://xwiki.org http://massol.net
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Jan 8, 2009, at 2:39 PM, Jerome Velociter wrote:
Vincent Massol wrote:
+0 (I'm not a big fan of it though since it's overloading even more our XWiki API) since we have it in XWiki.java but provided you fix the param names:
* prefname --> preferenceName * fallback_param --> fallbackPropertyName
Note: that what's even better is to use the new configuration module which supports this use case in a much nicer way.
Yes but we don't have a velocity bridge to make it public, do we?
This is not a problem. The problem is that you need to move existing configuration data to the new xwiki.properties file and change the code that uses this data. Unless your use case is for new params in which case the only question is under what name you want your configuration component to be made visible for velocity. Technical detail: we have a VelocityContextInitializer interface for making components visible to velocity. We don't have the future velocity bridge but that shouldn't be a showstopper. -Vincent
Jerome.
On Jan 8, 2009, at 2:24 PM, Jerome Velociter wrote:
The signature would be :
public String getXWikiPreference(String prefname, String fallback_param, String default_value);
The underlaying method already exists in the non API XWiki.java (was added for http://jira.xwiki.org/jira/browse/XWIKI-2569).
What this method exactly do is : "Obtain a preference value for the wiki, looking up first in the XWiki.XWikiPreferences document, then fallbacking on a config parameter when the first lookup gives an empty string, then returning the default value if the config parameter returned itself an empty string."
My +1:
+1
Jerome.
PS: I've created a JIRA for it: http://jira.xwiki.org/jira/browse/XWIKI-3086
+1 with modifications suggested by Vincent On Thu, Jan 8, 2009 at 3:33 PM, Vincent Massol <[email protected]> wrote:
+0 (I'm not a big fan of it though since it's overloading even more our XWiki API) since we have it in XWiki.java but provided you fix the param names:
* prefname --> preferenceName * fallback_param --> fallbackPropertyName
Note: that what's even better is to use the new configuration module which supports this use case in a much nicer way.
On Jan 8, 2009, at 2:24 PM, Jerome Velociter wrote:
The signature would be :
public String getXWikiPreference(String prefname, String fallback_param, String default_value);
The underlaying method already exists in the non API XWiki.java (was added for http://jira.xwiki.org/jira/browse/XWIKI-2569).
What this method exactly do is : "Obtain a preference value for the wiki, looking up first in the XWiki.XWikiPreferences document, then fallbacking on a config parameter when the first lookup gives an empty string, then returning the default value if the config parameter returned itself an empty string."
My +1:
+1
Jerome.
PS: I've created a JIRA for it: http://jira.xwiki.org/jira/browse/XWIKI-3086
Thanks -Vincent http://xwiki.com http://xwiki.org http://massol.net
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
participants (3)
-
Jerome Velociter -
Thomas Mortagne -
Vincent Massol