on Sun, 13 Oct 2002 06:42:53, James Thurley wrote :
>
> Using the Pull service, I have a request-scope tool which needs
> to call a method in another request-scope tool.  I try to do
> this with the following code in my init function:
>
>  Context c = TurbineVelocity.getContext((RunData)data);
>
> Where data is passed into my tools init function.  From what I've
> read in the docs and this mailing list, that call should get the
> existing context which I can then use to get my other request-scope
> tool.

this is also what i believed to be the case.  exposing the rundata, and
hence the context, to the request tool was one of the main /reasons/ for the
scope of the request tool.  unless of course, i'm misunderstanding where in
the request the request ApplicationTool is instantiated?

> Instead I think it must be trying to create a new context or
> something because it results in my init funciton being called
> again, which then goes into almost endless recursion of init
> -> getContext -> init -> getContext etc until I get a stack
> overflow.

this is the behaviour i experienced as well.

> Is there something silly I'm going here?  Is there another way I can get
> access to a tool being run by the Pull service?

here's what i do, to access Tool A from Tool B :

public class B implements ApplicationTool {

  public void init(Object data) {
    Log.info("B Request Tool init()");
    this.data = (RunData)data;

// doesn't work!  stack overflow?!?!
//   Context context = TurbineVelocity.getContext(this.data);

    aTool = new aTool();
    aTool.init(this.data);
}

although why i can't pull the Tool from the Context [or indeed why i can't
get the Context from the RunData, i have no idea.  perhaps someone can shed
light on this?

- brydon

--
Brydon Cheyney
Senior Analyst Programmer
2fluid_creative ltd
w: www.2fluid.co.uk

Reply via email to