Building the Velosurf archive
The last release is included in the /bin directory, but if you want to re-build the library, you need to have ant installed.
Configuring the toolbox
The following instructions detail how to use Velosurf as a Velocity tool using the VelocityViewServlet and the toolbox.xml mechanism.
First, you need to set up the Velocity toolbox in your Webapp. This involves:
Then, you can set up the Velosurf tools in /WEB-INF/toolbox.xml, like:
<?xml version="1.0"?> <toolbox> <!-- http query parameters tool: You can either use org.apache.velocity.tools.view.tools.ParameterParser or velosurf.tool.HttpQueryTool. If you are using the autofetch feature, the Velosurf version is mandatory. --> <tool> <key>query</key> <scope>request</scope> <class>org.apache.velocity.tools.view.tools.ParameterParser</class> </tool> <!-- database --> <tool> <key>db</key> <scope>request</scope> <class>velosurf.tools.VelosurfTool</class> </tool> </toolbox>
Velosurf will search for a default configuration file named '/WEB-INF/velosurf.xml'. Its goal is to gather all SQL code.
If you wish to change its name, you can set the appropriate context-param in your Webapp, with 'velosurf.config' as key and the target file as value.
By default, the database will be reverse enginered and each table becomes an entity, each column an attribute. But this file lets you fully customize entities and attributes.
You can start with the minimal configuration, that only specify the database connection parameters:
<?xml version="1.0"?> <database user='login' password='password' url='database_url'> </database>
You can then check your installation with a very simple template that checks that you can see your tables.