Hello all,
I have been working on a registration application which is written entirely in
velocity and I want to specify some configurations for it such as should captchas
be required or should LiveValidation be enabled.
This is just an example and I'm sure there are and will be more velocity
applications which need to be configured.
The problem is that ConfigurationSource is unavailable to velocity applications
and a few possible solutions include:
Put the configuration in the XWiki.XWikiPreferences object and get it using
XWiki.Param
This is nice because preferences for applications which are in the database should
also be in the database IMO. However it negates the ConfigurationSource, making
configuration less portable and it also introduces the need for programming rights
to save the document.
Add a configuration class to get the parameters from ConfigurationSource and pass
them to the velocity application. Vincent has -1'd the idea of having a generic
configuration getter like XWiki.Param and writing a java class for each application
defeats the purpose of writing code as an XAR application.
Another idea is to put the configuration inside the (registration) application and
load the registration document in the relevant section of the administration
application. The best way to do this would be to define a class and the
administration app includes any document containing an object of that class.
This way any application which needed configuration could be configured from one
place and it wouldn't require a reference for each one.
I'd like to hear any other ideas anyone has,
Caleb
Show replies by date