[ http://issues.apache.org/jira/browse/VELTOOLS-8?page=all ]

Nathan Bubna resolved VELTOOLS-8.

Resolution: Won't Fix

At this point, the XMLToolboxManager has advanced to the point where it is simple to use in a standalone situation where you are creating your own context:

XMLToolboxManager manager = new XMLToolboxManager();
manager.load(new FileInputStream(new File(path)));

Context ctx = new VelocityContext(manager.getToolbox(null));

The addition of support for defining tools as singletons is really only marginally useful. Object instantiation has gotten very cheap in recent VMs, and there are other ways to use tools as singletons, the easiest of which is probably to create the ToolInfo yourself and pass it to XMLToolboxManager.addData(ToolInfo). Then the toolbox manager will only create and reuse a single instance of the tool.

That said, i will take a clue from this patch and add a load(String filepath) method to XMLToolboxManager to simplify standalone usage even further.

Thanks for the contribution! Stay tuned for when we start working on VelocityTools 2.0 (hopefully this spring), as standalone usage will receive more consideration from the get-go.
Standalone Toolbox loader

URL: http://issues.apache.org/jira/browse/VELTOOLS-8
Project: VelocityTools
Issue Type: Improvement
Affects Versions: 1.1
Environment: Operating System: Windows XP
Platform: PC
Reporter: Edgar Poce
Priority: Minor
Fix For: 1.3

Attachments: patch.txt, Standalone Toolbox Loader Proposal Test.zip

A toolbox loader for standalone applications might be useful
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
postedNov 16, '06 at 6:08a
activeNov 16, '06 at 6:08a

1 user in discussion

Nathan Bubna (JIRA): 1 post



site design / logo © 2021 Grokbase