cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Hartmann <andr...@apache.org>
Subject Re: Introducing IOC for Java classes created in flowscript
Date Fri, 21 Nov 2003 12:43:23 GMT
Sylvain Wallez wrote:

[...]
> 
> So I added a new method to "cocoon" that sets up an object just as if it 
> were an Avalon component by honoring the various lifecycle interfaces.

[...]

> Example:
>  var foo = new Foo();
>  cocoon.setupObject(foo);
>  foo.doIt("blah");

This looks quite interesting and definitely useful.
But I've got a question:

When I obtain a component in a flowscript, I have to
release it before sendPage(). So, if my foo object uses
components, does it have to release them before a
sendPage() occurs in a script?

class Foo implements Serviceable {
     public void service(ServiceManager manager) {
         myComponent = (MyComponent)
             manager.lookup(MyComponent.ROLE);
     }
     ...
}

cocoon.summonObject(Packages.bar.Foo.class.getName());
foo.doIt("blah");
foo.releaseComponents();
cocoon.sendPageAndWait(...);

Is this correct?

Thank you in advance,
-- Andreas



Mime
View raw message