I've looked some more at how we might use the existing WebMacro
ContextTool API for the objects that we place in the context.

After having looked more carefully at the WebMacro code for this, I
realised that we don't have to subclass WebContext or anything like
that. The 'init' method of ContextTool gets called when the tool first
gets used in the template, by which time we have already put the RunData
object in the context.

Also we shouldn't have to rename the existing classes. The object that
implements ContextTool acts as a factory for generating the actual
objects that get placed in the context - the 'init' method returns the
object.

So to switch to this method of stuffing the context all we need to do is
write a 'Tool' class for each of the WebMacro... objects that we put in
the context - I suggest they should live in util.webmacro (unless we
think they should have a separate package - util.webmacro.tools perhaps).

The only problem I can see with doing this is that if we follow usual
Java naming conventions we'll end up with, for example, a 'LinkTool'
class which will result in a context variable called '$Link' not
'$link'. I don't know if we can really break everyone's templates,
but the alternative - to call the class 'linkTool' - seems too
against the Java norm.

Thoughts? 




------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to