I like your idea about maintaining the commands in a Listserv registry.
And if i have unique commands, on a per/listserv basis, the registry can be
smart enough to lookup the commands associated with the appropriate
listserv.
Its coming along well. I'm putting it into 'production' on my site this
weekend, but it's not ready for submittal yet...
I haven't added the apache copyright headers, and i'll need to update my
coding style.
Hopefully next week i can submit it for early review.
One more thing, i making use of regular expressions in a couple of places,
but i'm doing so with the java 1.4 package. Is that a *bad* thing? I know
there is the Jakart ORO package (i'm not yet familiar with it), but that
would also require another external 3rd party lib...
Do you have any suggestions for these types of situations?
Thanks
----- Original Message -----
From: "Noel J. Bergman" <[EMAIL PROTECTED]>
To: "James Developers List" <[EMAIL PROTECTED]>
Sent: Friday, February 14, 2003 2:33 PM
Subject: RE: Obtaining a reference to a mailet
> Mark,
>
> In other words, each time you add a new command to the commandmap for the
> Listserv mailet, you want the matcher to understand it. They are coupled
by
> definition.
>
> You do accomplish this in several manners. Yes, you could use the
> MailetContext. But on the other hand, since these all need to be at least
> subclasses of a known Listserv class, you could maintain the registry in
the
> Listserv class. Perhaps something like:
>
> public static Collection getCommands(String listname);
>
> That supports both per-instance maps and a single map. If you just have a
> single command map, then you can ignore the listname parameter, e.g.,
>
> public static Set getCommands(String listname)
> {
> return Collections.unmodifiableSet(commandMap.keySet());
> }
>
> Thoughts?
>
> How is the list server coming? Are you close enough that you'd want to
> upload it, and let others help contribute?
>
> --- Noel
>
> -----Original Message-----
> From: Mark Imel [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 14, 2003 16:41
> To: James Developers List
> Subject: Re: Obtaining a reference to a mailet
>
>
> 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]