org.apache.james.transport.mailets
Class JDBCListserv

java.lang.Object
  |
  +--org.apache.mailet.GenericMailet
        |
        +--org.apache.james.transport.mailets.GenericListserv
              |
              +--org.apache.james.transport.mailets.JDBCListserv
All Implemented Interfaces:
Mailet, MailetConfig

public class JDBCListserv
extends GenericListserv

Rewrites recipient addresses based on a database table. The connection is configured by passing the URL to a conn definition. You need to set the table name to check (or view) along with the source and target columns to use. For example, <mailet match="All" class="JDBCAlias"> <data_source>maildb</datasource> <listserv_id>mylistserv</listserv_id> <listserv_table>source_email_address</listserv_table> <members_table>target_email_address</members_table> </mailet> This mailet will cache the settings available when first initialized. If you wish it to reload for each message, add the init parameter <cache_settings>false</cache_settings>

Author:
Serge Knystautas

Field Summary
protected  boolean attachmentsAllowed
           
protected  boolean cacheSettings
           
protected  org.apache.avalon.excalibur.datasource.DataSourceComponent datasource
           
protected  MailAddress listservAddress
           
protected  java.lang.String listservID
           
protected  java.lang.String listservQuery
           
protected  java.lang.String listservTable
           
protected  java.util.Collection members
           
protected  boolean membersOnly
           
protected  java.lang.String membersQuery
           
protected  java.lang.String membersTable
           
protected  boolean replyToList
           
protected  java.lang.String subjectPrefix
           
 
Constructor Summary
JDBCListserv()
           
 
Method Summary
 MailAddress getListservAddress()
          The email address that this listserv processes on.
 java.lang.String getMailetInfo()
          Returns information about the mailet, such as author, version, and copyright.
 java.util.Collection getMembers()
          Returns a Collection of MailAddress objects of members to receive this email
 java.lang.String getSubjectPrefix()
          An optional subject prefix which will be surrounded by [].
 void init()
          A convenience method which can be overridden so that there's no need to call super.init(config).
 boolean isAttachmentsAllowed()
          Returns whether this listserv allow attachments
 boolean isMembersOnly()
          Returns whether this list should restrict to senders only
 boolean isReplyToList()
          Returns whether listserv should add reply-to header
protected  void loadSettings()
           
 
Methods inherited from class org.apache.james.transport.mailets.GenericListserv
service
 
Methods inherited from class org.apache.mailet.GenericMailet
destroy, getInitParameter, getInitParameterNames, getMailetConfig, getMailetContext, getMailetName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

datasource

protected org.apache.avalon.excalibur.datasource.DataSourceComponent datasource

listservID

protected java.lang.String listservID

listservTable

protected java.lang.String listservTable

membersTable

protected java.lang.String membersTable

cacheSettings

protected boolean cacheSettings

members

protected java.util.Collection members

membersOnly

protected boolean membersOnly

attachmentsAllowed

protected boolean attachmentsAllowed

replyToList

protected boolean replyToList

listservAddress

protected MailAddress listservAddress

subjectPrefix

protected java.lang.String subjectPrefix

listservQuery

protected java.lang.String listservQuery

membersQuery

protected java.lang.String membersQuery
Constructor Detail

JDBCListserv

public JDBCListserv()
Method Detail

init

public void init()
          throws javax.mail.MessagingException
Description copied from class: GenericMailet
A convenience method which can be overridden so that there's no need to call super.init(config). Instead of overriding init(MailetConfig), simply override this method and it will be called by GenericMailet.init(MailetConfig config). The MailetConfig object can still be retrieved via getMailetConfig().
Overrides:
init in class GenericMailet
Following copied from class: org.apache.mailet.GenericMailet
Throws:
javax.mail.MessagingException - if an exception occurs that interrupts the mailet's normal operation

getMembers

public java.util.Collection getMembers()
                                throws javax.mail.MessagingException
Returns a Collection of MailAddress objects of members to receive this email
Overrides:
getMembers in class GenericListserv

isMembersOnly

public boolean isMembersOnly()
                      throws javax.mail.MessagingException
Returns whether this list should restrict to senders only
Overrides:
isMembersOnly in class GenericListserv

isAttachmentsAllowed

public boolean isAttachmentsAllowed()
                             throws javax.mail.MessagingException
Returns whether this listserv allow attachments
Overrides:
isAttachmentsAllowed in class GenericListserv

isReplyToList

public boolean isReplyToList()
                      throws javax.mail.MessagingException
Returns whether listserv should add reply-to header
Overrides:
isReplyToList in class GenericListserv

getListservAddress

public MailAddress getListservAddress()
                               throws javax.mail.MessagingException
The email address that this listserv processes on. If returns null, will use the recipient of the message, which hopefully will be the correct email address assuming the matcher was properly specified.
Overrides:
getListservAddress in class GenericListserv

getSubjectPrefix

public java.lang.String getSubjectPrefix()
                                  throws javax.mail.MessagingException
An optional subject prefix which will be surrounded by [].
Overrides:
getSubjectPrefix in class GenericListserv

loadSettings

protected void loadSettings()
                     throws javax.mail.MessagingException

getMailetInfo

public java.lang.String getMailetInfo()
Description copied from class: GenericMailet
Returns information about the mailet, such as author, version, and copyright. By default, this method returns an empty string. Override this method to have it return a meaningful value.
Overrides:
getMailetInfo in class GenericMailet
Following copied from class: org.apache.mailet.GenericMailet
Returns:
String information about this mailet, by default an empty string


"Copyright © 2001 Apache Jakarta Project. All Rights Reserved."