velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <>
Subject Re: Velocity vmlibs
Date Thu, 16 May 2002 09:57:15 GMT
On 5/15/02 10:25 PM, "Bill Boland" <> wrote:

> I'd be happy to contribute some that I write that are generic and
> reusable in many situations...I'm just not certain on the best way to
> contribute. 

Be sure the code is free of claim from others (like an employer), attach the
Apache Software License, format the code so we can stand it ;) and send to
the list.


> In terms of packaging, I think that in the realm of the ToolboxManager
> in the velocity-tools area. Another approach might be to have a Toolbox
> tool in the context  that you can use at the top of your template to
> "declare" the tool:
> #set ( $fmt = $toolbox.get( "/WEB-INF/vmlibs/FormatTool" ) )
> OR
> #set ( $fmt = $toolbox.get(
> "" ) )
> I'm just thinking off the cuff here so I have no idea what would be
> correct...but it would be a similar declaration. The toolbox would have
> access to the PageContext and the tools would require that they follow
> some interface or naming pattern for initialization.

I use this in another scripting environment I put together.  (Well, "$tool =
new(<whatever>);", and  control what <whatever> can be outside of the
script).  It's really useful and still allows the environment to keep
control of what is going on.

 > Now...I know that some may argue that these should be placed into
> context prior to the merge and not be done in the template. I would
> agree...and yet disagree. If I have a library of presentation tools at
> my disposal, it would be nice for me, as the page designer, to pick and
> choose the ones available to me. That way, I don't need ones placed into
> my context that I don't use.

Excactly - having a set that are deemed 'harmless' available at all times
makes life easy for everyone.

> Of course, if you don't want anyone to do this, you can keep the ToolBox
> tool out of the context.

Right - or have a configuration that limits what can be asked for.  Make it
throw and exception when someone asks for something verboten, and then noone
gets hurt - as the page won't render..

Geir Magnusson Jr.
Research & Development, Adeptra Inc.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message