Hi,
I think this is a simple question ... although I could be having one of those
winter, late-afternoon brain-dead moments ...
Whereabouts exactly are tool class instances kept once they have been
initialized when using VelocityView and toolbox.xml? In other words, from where
and how does one obtain a reference to that tool instance (in another class,
not in a template)?
For example, if I have a custom directive and want to retrieve a previously
initialized instance of an application-scope tool, how would I do this?
Initially I thought that this would be achieved in the following way:
in the toolbox:
<tool>
<key>myTool</key>
<scope>application</scope>
<class>com.foo.MyReallyGroovyTool</class>
</tool>
in a directive:
public CustomDirective extends InputBase {
...
public void init(RuntimeServices rsvc, InternalContextAdapter context, Node
node) throws TemplateInitException {
MyReallGroovyTool tool = (MyReallyGroovyTool) context.get("myTool");
}
...
}
but now I'm thinking this is not correct (and trying this way fails) ...
Cheers,
Chris
********************************************************************************
DISCLAIMER: This e-mail is confidential and should not be used by anyone who is
not the original intended recipient. If you have received this e-mail in error
please inform the sender and delete it from your mailbox or any other storage
mechanism. Neither Macmillan Publishers Limited nor any of its agents accept
liability for any statements made which are clearly the sender's own and not
expressly made on behalf of Macmillan Publishers Limited or one of its agents.
Please note that neither Macmillan Publishers Limited nor any of its agents
accept any responsibility for viruses that may be contained in this e-mail or
its attachments and it is your responsibility to scan the e-mail and
attachments (if any). No contracts may be concluded on behalf of Macmillan
Publishers Limited or its agents by means of e-mail communication. Macmillan
Publishers Limited Registered in England and Wales with registered number
785998
Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS
********************************************************************************