Leo Sutic wrote:
>
> > -----Original Message-----
> > From: Carsten Ziegeler [mailto:[EMAIL PROTECTED]
> > Sent: den 8 april 2004 16:24
> > To: [EMAIL PROTECTED]
> > Subject: RE: [Kernel22] How to develop a component?
> >
> >
> > >
> > > > From: Carsten Ziegeler [mailto:[EMAIL PROTECTED]
> > > >
> > > > How does the working code look like?
> > >
> > > The working code of what?
> > >
> > > The adapter / sandbox / compatibility layer?
> > >
> > The working code with some cocoon interfaces. I guess the component
> > interface for the stateful component is the same.
> > So, the different should be in the client.java code. Or am I wrong?
>
> The new code would be very similar.
Believe me, I'm really just curious. Would the new code be the same
or just similar? Of course the lookup is different as a different
method is used. From what I understood the code would look like
this:
StatefulComponent comp =
(StatefulComponent)wire.lookup(StatefulComponent.class, SOMEHINT);
try {
comp.login ();
// (1)
comp.doOperation ();
comp.logout ();
} finally {
wire.release (comp);
}
>
> The new "Block" code uses Wirings instead of a
> ComponentManager/ServiceManager, but they are *very* similar.
> You should also include a
> comp.ensureWired() call
> at the top, to test if the block whose components you are
> using hasn't been reloaded since you last checked. (This call
> will also reload the block if it is scheduled for reload, but
> not yet reloaded).
So, would I do a comp.ensureWired() before each call to the component?
>
> ***The biggest change however***, is that you have to be
> prepared for the event that a component that you have looked
> up may disappear due to block reloading.
>
> This simply did not happen with Avalon. So you may get an
> exception where you didn't get one before.
>
> Otherwise you should be fine.
>
So, if I understand you correctly, the only difference is that I
can get an exception that I wasn't prepared to get when using
Avalon. If that's try then I don't see any reason why this
wouldn't work with using the Avalon interfaces - I'm just
speaking of the interfaces not the implementation!
Carsten