Re: [Evolution-hackers] [Camel] How can I get a reference to the store class from another class?
- From: Jules Colding <colding omesc com>
- To: Not Zed <notzed ximian com>
- Cc: evolution-hackers gnome org
- Subject: Re: [Evolution-hackers] [Camel] How can I get a reference to the store class from another class?
- Date: Wed, 14 Sep 2005 09:57:21 +0200
On Tue, 2005-09-13 at 22:11 +0800, Not Zed wrote:
> On Tue, 2005-09-13 at 12:26 +0200, Jules Colding wrote:
> > On Tue, 2005-09-13 at 04:08 -0600, Susarla Parthasarathi wrote:
> > > On Tue, 2005-09-13 at 09:56 +0000, Jules Colding wrote:
> > > > Hi,
> > > >
> > > > There is a connect method in the transport class. I would like to use
> > > > the connect method that I implemented in the store class. How do I get a
> > > > reference to that one from a CamelService?
> > > If you want to use the same session, just implementing the send_to
> > > method should do.
> > > You could get the service object from CamelTransport and further get the
> > > pointer to the CamelStore. Getting a session from the store should be
> > > easy.
>
> I don't really follow what you're asking here ... since this discussion
> doesn't seem to match the original query.
I am confused too, but I wrote it off as a side effect of my tiny brain,
hopping it would dawn upon me further down the road...
> > Something like:
> >
> > CAMEL_SERVICE_CLASS(parent_class)->connect(service, ex);
> >
> > from within the transport connect() method?
>
> If you overrode the connect() method, that's how you'd call the parent
> class's one. Think Java super.connect() vs this.connect() (umm, i think
> that's java, it's been a while). And yes, you should always do this at
> the start of your connect method.
I should always call the parent class's connect method at the start of
my own connect() implementation???
Now I am really confused. I can't see any of the other Camel providers
calling the parent connect() in their own connect() implementation in
the store or transport classes.
> > But I gather that I don't need to do this as I can connect explicitly
> > from within the send_to() method in the transport instead?
>
> > Isn't it cleaner to connect in connect() and let the upper layers worry
> > about using send_to() without being connected?
> >
> > Should I ever call connect() in send_to() or is connect() called from
> > above before send_to() is invoked?
> >
> > Should I return an exception if I am not connected in send_to() or
> > should I connect myself?
>
> SendTo will only ever be called on a connected transport. If it isn't,
> then you must return a 'not connected' exception, yes. See
> camel-smtp-transport.c
OK, thanks.
> So yeah, connect will be called separately.
Thanks a lot,
jules
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]