This class is a tool meant to be referenced in toolbox.xml
It can be used in any scope you want (application/session/request), depending on the behaviour you need for the refinement and ordering mechanisms (which will follow the same scope).
The initialization itself is very fast once all static initialization has been done, so there is no performance bottleneck when using request scope.
Since version 1.0rc1, you can have several instances of VelosurfTool, each with a distinct configuration file.
This can be useful to have one instance per schema, or one instance per database if dealing with several databases.
For this to work, you have to use the 1.3 version of velocity-tools (not yet released at the time I'm writing this,
so you need to grab it from the Velocity subversion repository) and give each instance the pathname of its configuration file
via the 'config' parameter in the toolbox.xml file, like this :
<!-- first instance -->
<tool>
<key>db1</key>
<scope>request</scope>
<class>velosurf.tools.VelosurfTool</scope>
<parameter name="config" value="WEB-INF/db1.xml" />
</tool>
<!-- second instance -->
<tool>
<key>db2</key>
<scope>request</scope>
<class>velosurf.tools.VelosurfTool</scope>
<parameter name="config" value="WEB-INF/db2.xml" />
</tool>
author: Claude Brisson |