You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Christine Keim <im...@ycn.com> on 2002/05/14 17:49:45 UTC

Pull Service

Hi there, 

i'm a newby and i got a problem at my hands.
I want to acomplish the following:
1) add a Class myToolkit to the Context of every Velocity page for the whole application
    this already works fine.
2) This myToolkit initialises a BEBroker, which i want to be used in actions and Screens too though.
Now i don't know how to get that instance of BEBroker that the Toolkit has in any of the actions.
The Toolkit-Class itself should only be used in velocity-templates. The BEBroker instead should be 
sort of a service. I thought maybe it is possible to add/register this BEBroker-class
as a service to the TurbineServices-Class or something similar, but honestly, i don't know how.
Another possible way would be to pool it as an object in the Poolservice, but i'd rather have it as a Service itself.
I did not find a howto to services, and after looking at some sourcecode i decided it may be faster if i asked this
here. Can anybody help me out here?

thanks in advance, Christine Keim

Re: Pull Service

Posted by Brian Lawler <bp...@pacbell.net>.
Christine-

If you have an instance of the context in your action you can just get
your PullTool out of that context directly with

MyToolkit tool = (MyToolkit) context.get("myToolkit");

Just substitue "myToolkit" with whatever you use in Velocity, ie if you
use $toolkit to get the pull tool in Velocity, use
context.get("toolkit") to get it in Java.

-Brian

On Tue, 2002-05-14 at 08:49, Christine Keim wrote:
> Hi there, 
> 
> i'm a newby and i got a problem at my hands.
> I want to acomplish the following:
> 1) add a Class myToolkit to the Context of every Velocity page for the whole application
>     this already works fine.
> 2) This myToolkit initialises a BEBroker, which i want to be used in actions and Screens too though.
> Now i don't know how to get that instance of BEBroker that the Toolkit has in any of the actions.
> The Toolkit-Class itself should only be used in velocity-templates. The BEBroker instead should be 
> sort of a service. I thought maybe it is possible to add/register this BEBroker-class
> as a service to the TurbineServices-Class or something similar, but honestly, i don't know how.
> Another possible way would be to pool it as an object in the Poolservice, but i'd rather have it as a Service itself.
> I did not find a howto to services, and after looking at some sourcecode i decided it may be faster if i asked this
> here. Can anybody help me out here?
> 
> thanks in advance, Christine Keim



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>