Claude,
I don't have the solution to your first question, just a few
thoughts about this.

Claude Brisson wrote:

> Would it be possible - and how - to pass some initialization parameters to the tools 
>?
> 
> Those parameters would be defined in toolbox.xml, like :
> 
> <toolbox>
>   <tool>
>      <key>toytool</key>
>      <class>ToyTool</class>
>      <tool-param>
>         <param-name>my param</param-name>
>         <param-value>my  value</param-value>
>      </tool-param>
>   </tool>
> </toolbox>


This could be done, but would mean that the parameter is the same
for the entire lifetime of the web application. This is probably
to limiting for most application cases. Furthermore, if your
parameter is static over the application's live time, you could
as well use a web application init parameter in web.xml. A view
tool has access to those init parameters through the ViewContext
interface. Anything that speaks against that approach?

Another approach is that you make available an initialization parameter
for a tool in the Velocity Context and let the tool fetch the
initialization parameter from the Velocity Context. This has the
advantage over the approach above that the parameter can vary for
every request or session if needed.

> We would need something like the ViewTool interface, but the  

> VelocityViewServlet considers implicitely that the init method of this
> interface is meant to receive the ViewContext.
> Maybe another interface ? Like ParametrizableTool ?


I see the need for parameterizable tools in some application scenarios.
But this goals is in conflict with the goals to automatically load,
initialize and (in the future) reuse tool instances. I am sure we can
do better than today but I don't yet see the right approach.

> 
> Another problem : when the parameter is to be a filename 

> (an initialization file needed by the tool), how can we ensure that the
> default path is the WEB-INF of the web-app ?


ServletContext provides several methods to access resources within the
context of a web application. Input to those methods is the context-relative
path to a resource (e.g. file).
See methods getResourceAsStream(), getResource(), getRealPath() of
Interface ServletContext in the Servlet API.

Hope this helps.

Gabe




> 
> Thanks for your help.
> 
> CloD
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> .
> 
> 


-- 
--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to