On Thu, 2003-08-14 at 12:37, Reinhard P�tz wrote:
> From: news [mailto:[EMAIL PROTECTED]
>
> > Reinhard P�tz wrote:
> >
> > >>The FOM does not provide access to input modules, does it?
> > So, what is
> > >>the recommended way to get an object from an Avalon component?
> > >
> > > var myComp = cocoon.getComponent("myComp.ROLE");
> > > var myObj = myComp.mymethod();
> >
> > Thanks for your fast answer!
> >
> > I guess the component is automatically released when the
> > script terminates?
>
>
> Sorry, forget this. Auto-release hasn't been implemented yet or more
> precicly Chris wrote some experimental stuff but it hasn't been
> integrated into CVS. Maybe we can add this to the scratchpad? What do
> you think Chris?
> Because of a lack of time I only had a brief look at it but couldn't
> test it more extensivly.
>
> So back to your question - for now you have to call
>
> cocoon.releaseComponent( myComp );
yep, and don't forget to use a try-finally, something like this:
var myObj;
var myComp = cocoon.getComponent(Packages.myComp.ROLE);
try {
myObj = myComp.mymethod();
} finally {
cocoon.releaseComponent( myComp );
}
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED] [EMAIL PROTECTED]