Paulo Gaspar wrote:
>
> IMO, this is the closest to the correct solution.
>
> For me, the correct way to do it is to have a separate configuration
> mechanism. Just build an interface somewhere (Runtime?) to set configuration
> values (properties) and get whatever configurator that suits your needs.
That inverts the problem, at least the one I am thinking about. The
question is not to *make* a configurator, but to keep the properties
such that a Properties can be used to configure the Velocity runtime.
> For the sake of ease-of-use, Runtime should use a default configuration
> mechanism to initialize itself on first use - if no other initialization was
> performed before. This default mechanism could just be the Properties based
> one that is now used, so that the current behaviour is not changed.
Actually, it does have a default configuration, and even easier than
what you suggest - the default configuration is simply a call to init()
- Velocity will use a set of default properties included in the jar. No
muss, no fuss.
>
> If this default Properties configurator is loaded "by name", people that
> prefer XML-configurators or whatever-configurators don't even need to have
> the default configurator present.
The way it works now is you get to choose among :
- Runtime.init() : uses builtin defaults
- Runtime.init( filename ) : uses the built-in defaults, and overlays
them with any properties from the file
- Runtime.init( Properties ) : uses built-in defaultas, and overlays
them with any properties from the Properties.
Since we now have the handy-dandy Configuration class, we can add
- Runtime.init( Configuration ) : uses built-in defaults, and overlyas
them with any properties from the Configuration.
> This also allows for easier programatic onfiguration directly from Servlet
> code using some application specific stuff.
>
> So, as usual, I prefer having a default behaviour and the option to plug
> alternative ones.
Right. I think of it as conventional behavior and support for alternate
ones.
geir
--
Geir Magnusson Jr. [EMAIL PROTECTED]
Developing for the web? See http://jakarta.apache.org/velocity/