You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by jo...@parreco.com on 2003/08/06 21:12:00 UTC
ParameterParser
Howdy,
I am looking for some feedback on the attached classes I wrote to do ${...}
style parameter substitution. Please let me know if this whole thing is silly:
ParameterParser extracts the parameters and calls the lookup method of
MailParameterContext which matches the XX part of any getXX method of Mail
objects. Sample use:
<mailet match="All" class="SomeMailet">
<message>
This person ${sender} sent a message with the virus ${attribute.viruses}.
</message>
</mailet>
SomeMailet would contain:
ParameterParser p = new ParameterParser(new MailParameterParser(mail));
String message = p.parse(getInitParameter("message"));
This would invoke mail.getSender() for ${sender} and
mail.getAttribute("viruses") for ${attribute.viruses}
Thanks,
Josh
Re: ParameterParser
Posted by Josh Parreco <jo...@parreco.com>.
Noel, Serge,
Thank you for the feedback. I really want this functionality for my mailets
so I will take a closer look at using Jelly.
James Rocks!!!
Josh
----- Original Message -----
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <se...@james.apache.org>
Sent: Thursday, August 07, 2003 12:15 PM
Subject: RE: ParameterParser
> > I am looking for some feedback on the attached classes I wrote to do
> ${...}
> > style parameter substitution. Please let me know if this whole thing is
> silly
>
> Not silly, but did you look at the existing code and interface for doing
> parameterized string replacement? Seems to me that at least so far
creating
> either a Map or a Map adapter would do the same thing.
>
> If the code were going to be more complex, providing support somewhere in
> James' mailet implementation for a Java standard, such as EL might down
the
> road.
>
> --- Noel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
RE: ParameterParser
Posted by "Noel J. Bergman" <no...@devtech.com>.
> I am looking for some feedback on the attached classes I wrote to do
${...}
> style parameter substitution. Please let me know if this whole thing is
silly
Not silly, but did you look at the existing code and interface for doing
parameterized string replacement? Seems to me that at least so far creating
either a Map or a Map adapter would do the same thing.
If the code were going to be more complex, providing support somewhere in
James' mailet implementation for a Java standard, such as EL might down the
road.
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: ParameterParser
Posted by Serge Knystautas <se...@lokitech.com>.
josh@parreco.com wrote:
> Howdy,
>
> I am looking for some feedback on the attached classes I wrote to do ${...}
> style parameter substitution. Please let me know if this whole thing is silly:
Josh,
Looks interesting! I didn't review the code completely, but from first
blush (just from the size of the code), it doesn't look like you handle
multiple ".", e.g., "mail.myattribute.customproperty". Also, I'm not
sure how you're handle type coercion/primitives or if that's something
you think needs addressing.
I would think relying on Jelly or EL or something like that might be a
nice way to handle many of those issues without having to duplicate
effort or retrain people as the parameter passing feature gets more complex.
It is nice how you suggest offering it optionally. There has been talk
about doing something like this for the matcher argument themselves or
tying it into the spool processing, but those get more complicated.
Anyway, just some initial feedback. Hope it helps.
--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org