james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Serge Knystautas" <ser...@lokitech.com>
Subject Re: Getting mailet attributes from a Matcher
Date Wed, 28 Nov 2001 15:47:39 GMT
Rauno,

Mailet context is supposed to be server-wide, so that's not really what
you're looking for.  I think what you'd really want is for MatcherConfig to
have a getMailetConfig() parameter.  While this isn't too hard to do, it
ties our hands in terms of making the matchers more flexibly configured in
the conf file, i.e., how would getMailetConfig() work if you had something
like...

if (matcher1 && matcher2) {
   if (matcher3) {
     mailet1;
   } else {
     mailet2;
  }
}

Not that we have a clear vision for how this works or plan to implement this
anytime soon, but as we may want to move this way.

Is there a reason you need to abstract the SQL from your matcher?  I can
understand needing to abstract the jdbc conn definition, but that's easier
to address by using datasource that's defined elsewhere, and just passing
the datasource's name.

Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com/
----- Original Message -----
From: "Rauno Palosaari" <rauno@rauno.com>
To: <james-dev@jakarta.apache.org>
Sent: Tuesday, November 27, 2001 5:50 AM
Subject: Getting mailet attributes from a Matcher


Hi all.

Is it possible to get mailet-parameters from a Matcher, I wrote a matcher
and a mailet:
(assembly.xml)
<mailet match="IsCustomer" class="DoStuff">
     <connection>jdbc:mysql:///whatever</connection>
     <username>user</username>
     <password>something</password>
     <query>select domain from customer</query>
</mailet>

(What I want to do is to get the Matcher conditions from a db.)

DoStuff.java (mailet) has no problems getting connection, username, etc.
I want to access the parameters from my matcher as well.
getMatcherConfig().getMailetContext().getAttribute("connection"); doesn't do
the job unless somebody sets the attribute first, I guess.

Is there any way around this, i.e. other than passing the parameters in the
matcher condition part (well, it does the job but it's ugly):
<mailet match="IsCustomer=jdbc:mysql:///whatever,user,something,select
domain from customer" class="DoStuff">
</mailet>

Regards,
Rauno



--
To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


Mime
View raw message