7 Replies Latest reply on Mar 18, 2005 3:13 AM by mikezzz

    MailListeners and Beanshells

    acoliver

      The beanshell or javascript thing will be one MailListener which may or may not route things to other maillisteners. You'll not be obligated to use it. I do however want some deployment semantics around it (meaning the abillity to deploy new mail beanshell/javascript scripts for routing/processing/eliminating mail).

      Selective matching of mail listeners. An example of this is the James matchers/selectors/etc. They are for conditionally applying workers in a chain of command pattern (Basically a mix of the reactor pattern and chain of command pattern). We may indeed implement something very like this but for the next several milestones, I intend to keep a single simple (easy to debug) chain rather than a branched chain. I'm also not 100% sold on a branched chain being implicitly supported rather than explicitly.

      Meaning I may opt for special MailListeners that take the chain of mail listeners and then apply conditions to the mail listeners that they contain rather than support matching/selecting in the core framework itself. (In fact I'm nearly positive that I'll do this) Basically a kind of combination of the chain of command and composite pattern in which the composite object happens to itself impelement a combination of the chain of command and reactor pattern (similar to the behavior in james).

      What we need to do right now is start enhancing Mail.java to provide more robust features for altering/reading/searching/matching headers. I'd also like to see some thoughts on how a MailListener which can perform operations on said Mail and other things like chain termination. Eventually it should provide imperative modes of maillistener chain aggregation.

      I have some inklings to use AOP for security and it might be possible to use AOP to implement the chain but I'm resistent to the idea as a generic construct. Thoughts (from code contributors/developers or active users only please)?

      -Andy

        • 1. Re: MailListeners and Beanshells

          "altering/reading/searching/matching headers":

          The message store does not currently provide indexing functionality. We can either add this functionality to the store using SQL queries, or maybe implement a Lucene index. Your thoughts Mike?

          • 2. Re: MailListeners and Beanshells
            acoliver

            Actually, it ought to be on the way IN so no index/search necessary. What may get interesting is the interaction of the bodies and matching on content (which we'll also need). It'd be good to delegate as much of this to the DB as possible but its probable we'll not be able to some/most of it.

            • 3. Re: MailListeners and Beanshells

              Mmmm, yes of course you're right, no index required.

              • 4. Re: MailListeners and Beanshells

                 

                I have some inklings to use AOP for security


                This is good news. I would like to use AOP for transaction management as the JBoss apects give the same coverage as EJBs.

                Mike.

                • 5. Re: MailListeners and Beanshells
                  acoliver

                  Yeah but doesn't using AOP for pluggable security in the mail server feel a bit naughty?

                  Now the naughtiest thing is that I have thoughts on how to implement almost exactly what we need so far as security goes with a combination of AOP and hibernate 3 filters... However whenver I think of it, I feel a bit like I'm standing in Times Square wearing leopard underwear while standing next to a red felt shays lounge and with two 19 year old models in bikinis in arm while smoking a cigar and drinking martinis. Maybe I should just go with it.

                  Anyhow, it makes total sense to me to ditch all stateless session beans and go to POJO+AOP for transactions. But not for M3. We need to knock that one out first. I'll stick some refactoring of MBeans and all in M4 as well.

                  • 6. Re: MailListeners and Beanshells

                    Sounds my last friday night....

                    Currently the store doesn't use EJBs it uses the Client Transaction explicitly, which really does make you feel dirty afterwards.

                    AOP transactions for the store will be M4.

                    Mike.

                    • 7. Re: MailListeners and Beanshells

                       

                      or maybe implement a Lucene index


                      This is not such a bad idea. Perhaps not to support the Mail API but to support protocols that require search. We could use lucene, or roll our own that will allow joins directly from the index to the message rows. I think this could be a POC task for M4. If it will be useful, implement in M5.