Stephane - Also - I don't think even with v.properties=velocity.properties that it'd be picked up from the <solr-home>/conf directory the way the code is loading it using SolrResourceLoader. The .properties file would need to be in your JAR file for your custom tool (or in the classpath somehow seen by the SolrResourceLoader). This is something that hasn't really been tried out (to my knowledge) so we might need to tinker a little to get custom tools to get injected smoothly the way it ideally should work.
Erik On Aug 12, 2011, at 14:17 , Stéphane Campinas wrote: > Hi, > > I am working with the velocity response writer, and I want to develop a > custom velocity tool. > To do so, I have written a JAVA class that looks like that: > > @DefaultKey("mytool") > public class MyCustomTool { > > public MyCustomTool() { > } > > public String doit(Object arg) { > // Do something > return "something"; > } > > } > > Then in order to register my custom tool, I create the property file: > > tools.toolbox = application > tools.application.mytool = org.my.custom.MyCustomTool > > By default, this file is named "velocity.properties" and is located within > the "conf" folder, > according to [1]. This is set by the velocity response writer in the > "v.properties" parameter. > > After copying the jar file into the "lib" folder of my solr application, I > use my custom tool in > my template by calling: > > $mytool.doit($var) > > However, this doesn't do anything: no exception, no processing of the $var > variable. It seems > that the custom tool is not loaded. > Would you know what I am doing wrong ? > > Thanks > > ps: By the way, I am using the 2.0-beta3 of the velocity tools. > > [1] > http://java.dzone.com/news/quick-look-%E2%80%93-solritas-and-gui?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%253A+javalobby%252Ffrontpage+%28Javalobby+%252F+Java+Zone%29 > > <http://java.dzone.com/news/quick-look-%E2%80%93-solritas-and-gui?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%253A+javalobby%252Ffrontpage+%28Javalobby+%252F+Java+Zone%29> > -- > Campinas Stéphane