I made a StandaloneContext which contains a set of tools defined in the toolbox.xml format and I extended a couple of ViewTool classes for adding a property called singleton. The usage is: VelocityContext ctx = new StandaloneContext().
Uploading a patch to bugzilla is the proper way to propose contributions?
Nathan Bubna wrote:
On Thu, 09 Dec 2004 01:12:32 -0300, Edgar Poce <[EMAIL PROTECTED]> wrote:
I'm trying to make a standalone toolbox loader and I have a question.
is necessary in a standalone application to create a new instance of each Velocity Tool each time a Context is created?
it depends on the application and the tools.
is a good idea to add a "singleton" parameter to toolbox.xml and thus create instances only if necessary?
hmm. again, i'd say it probably depends. if you've looked at the ServletToolboxManager (which extends XMLToolboxManager), you'll see it extends the toolbox.xml format to support a "scope" element that allows you to put singleton-ish tools in the application scope and thus only be instantiated once.
if it suits your application's purposes, then adding a "singleton" parameter shouldn't be too hard and could be quite useful.
Regards Edgar
Mike Kienenberger wrote:
What's the best practice for adding a Velocity Tool to the context in a standalone app? is it manually with something like "context.put("tool", new *Tool())" or there's a configuration setting I'm missing?
Shinobu Kawai <[EMAIL PROTECTED]> wrote:
I guess that's the normal method. Or, you can use the toolbox strategy like VelocityViewServlet and DVSL. ## It's not built into Velocity, so you'll have to implement if yourself, though.
If you came up with a standalone toolbox loader using the same format as toolbox.xml and posted it, it might end up in the next version of velocity tools :)
XMLToolboxManager probably does most if not all of what you need already.
-Mike
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
