That's a very fair question. First i'll say that my solution was following Noel's idea of putting the reference on the MailetContext and then lazily obtaining the reference as needed.
However, back to your question: Why couple these decoupled objects (Matcher and a Mailet)? I'm working on a List Serv that is more extensible/customizable then the reference implementation provided with James. One of the features i've added, is the ability to plugin new commands to the list serv manager. This enables the list serv manager (a Generic Mailet) to delegate to listserv command handlers when handling new list commands like (info, faq, subscribe-confirm, etc...) I wanted to enable the matcher to not have to guess about the currently registered commands. But, the commands are currently registered with the list serv manager, and there wasn't an easy way that i could see to inform the matcher about the specific commands that the list serv manager understands. As a result, i centralized the command lookup mechanism is in the list serv manager, and i have the list serv matcher delegate to the list serv manager to see if the incoming mail has a valid command. Based on the lookup to the list serv manager, the matcher will return a true or false appropriately. This is my first project with james, so i'd wouldn't be at all surprised to find that there are more appropriate ways to pass configuration information on to a Matcher. Regards, --mark imel ----- Original Message ----- From: "Aaron Knauf" <[EMAIL PROTECTED]> To: "James Developers List" <[EMAIL PROTECTED]> Sent: Friday, February 14, 2003 1:29 PM Subject: Re: Obtaining a reference to a mailet > This thread worries me. Mailets and Matchers are completely decoupled, > at the moment. Giving a Matcher a reference to its Mailet (or vice > versa) will lead to the coupling of the two. We will end up with > Mailets that only work with a particuler Matcher. > > What is the benefit that you are after? Is it really worth making this > sacrifice for? Isn't there another way to achieve it? > > ADK > > Danny Angus wrote: > > >No, > >Although this whole area is the subject of change at the moment. > > > >d. > > > > > > > >>-----Original Message----- > >>From: Mark Imel [mailto:[EMAIL PROTECTED]] > >>Sent: 14 February 2003 00:29 > >>To: James Developers List > >>Subject: Re: Obtaining a reference to a mailet > >> > >> > >>You're correct my question is weird. I should have double checked. > >>I meant to say: Is there a way that my *matcher* can obtain a reference to > >>its coupled mailet? > >> > >>Sorry about the typo... > >> > >> > >>----- Original Message ----- > >>From: "Kenny Smith" <[EMAIL PROTECTED]> > >>To: "James Developers List" <[EMAIL PROTECTED]> > >>Sent: Thursday, February 13, 2003 1:51 PM > >>Subject: Re: Obtaining a reference to a mailet > >> > >> > >> > >> > >>>Hi Mark, > >>> > >>>The question seems weird... basic Java (all objects, not just mailets) > >>>gives you a 'this' reference which is a reference to your object from > >>>within... maybe you're asking a different question? > >>> > >>>Kenny Smith > >>> > >>> > >>>Mark Imel wrote: > >>> > >>> > >>> > >>>>When my custom mailet/matcher pair are instantiated and initialized, > >>>>is there a way for my mailet to obtain a reference to the mailet? > >>>> > >>>>And, if not at initialization time, can i obtain a reference at run > >>>> > >>>> > >>time? > >> > >> > >>>>Thanks, > >>>>--Mark Imel > >>>> > >>>> > >>>> > >>>--------------------------------------------------------------------- > >>>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>>For additional commands, e-mail: [EMAIL PROTECTED] > >>> > >>> > >>> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
