james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Noel J. Bergman" <n...@devtech.com>
Subject RE: Obtaining a reference to a mailet
Date Fri, 14 Feb 2003 22:33:24 GMT
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:james@imelshire.com]
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" <aknauf@xtra.co.nz>
To: "James Developers List" <james-dev@jakarta.apache.org>
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:james@imelshire.com]
> >>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" <jakarta-james@journalscape.com>
> >>To: "James Developers List" <james-dev@jakarta.apache.org>
> >>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: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Mime
View raw message